Build: Add additional configuration lambda to the publish helper
This commit is contained in:
@@ -205,7 +205,7 @@ fun Project.standardPublicJars() {
|
|||||||
javadocJar()
|
javadocJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Project.publish(moduleMetadata: Boolean = false) {
|
fun Project.publish(moduleMetadata: Boolean = false, configure: MavenPublication.() -> Unit = { }) {
|
||||||
apply<MavenPublishPlugin>()
|
apply<MavenPublishPlugin>()
|
||||||
apply<SigningPlugin>()
|
apply<SigningPlugin>()
|
||||||
|
|
||||||
@@ -245,8 +245,6 @@ fun Project.publish(moduleMetadata: Boolean = false) {
|
|||||||
create<MavenPublication>("Main") {
|
create<MavenPublication>("Main") {
|
||||||
if (javaComponent != null) {
|
if (javaComponent != null) {
|
||||||
from(javaComponent)
|
from(javaComponent)
|
||||||
} else {
|
|
||||||
artifact(tasks["jar"])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pom {
|
pom {
|
||||||
@@ -272,6 +270,8 @@ fun Project.publish(moduleMetadata: Boolean = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configure()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,10 +80,11 @@ artifacts {
|
|||||||
archives libraryJarWithIr
|
archives libraryJarWithIr
|
||||||
distLibrary libraryJarWithIr
|
distLibrary libraryJarWithIr
|
||||||
archives sourcesJar
|
archives sourcesJar
|
||||||
sources sourcesJar
|
|
||||||
distJs(file(compileKotlin2Js.kotlinOptions.outputFile)) {
|
distJs(file(compileKotlin2Js.kotlinOptions.outputFile)) {
|
||||||
builtBy(compileKotlin2Js)
|
builtBy(compileKotlin2Js)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configureSourcesJar()
|
||||||
|
|
||||||
configureJavadocJar()
|
configureJavadocJar()
|
||||||
|
|||||||
@@ -2,9 +2,13 @@ description = 'Kotlin Test'
|
|||||||
|
|
||||||
apply plugin: 'kotlin-platform-jvm'
|
apply plugin: 'kotlin-platform-jvm'
|
||||||
|
|
||||||
|
archivesBaseName = 'kotlin-test'
|
||||||
|
|
||||||
configureJvm6Project(project)
|
configureJvm6Project(project)
|
||||||
// TODO: Migrate to maven-publish publishing
|
|
||||||
configureLegacyPublishing(project)
|
configurePublishing(project) {
|
||||||
|
artifactId = archivesBaseName
|
||||||
|
}
|
||||||
|
|
||||||
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
||||||
|
|
||||||
@@ -21,8 +25,6 @@ dependencies {
|
|||||||
testCompile('junit:junit:4.12')
|
testCompile('junit:junit:4.12')
|
||||||
}
|
}
|
||||||
|
|
||||||
archivesBaseName = 'kotlin-test'
|
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifestAttributes(manifest, project, 'Test', true)
|
manifestAttributes(manifest, project, 'Test', true)
|
||||||
if (includeJava9) {
|
if (includeJava9) {
|
||||||
@@ -30,19 +32,14 @@ jar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task modularJar(type: Jar) {
|
configureModularJar {
|
||||||
dependsOn(jar)
|
dependsOn(jar)
|
||||||
manifestAttributes(manifest, project, 'Test', true)
|
manifestAttributes(manifest, project, 'Test', true)
|
||||||
classifier = 'modular'
|
|
||||||
|
|
||||||
from zipTree(jar.outputs.files.singleFile)
|
from zipTree(jar.outputs.files.singleFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
configureSourcesJar()
|
||||||
archives sourcesJar
|
|
||||||
sources sourcesJar
|
|
||||||
archives modularJar
|
|
||||||
}
|
|
||||||
|
|
||||||
configureJavadocJar()
|
configureJavadocJar()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user