Use "sourcesJar" task builder for kotlin-reflect sources
This commit is contained in:
@@ -74,13 +74,15 @@ fun<T: Jar> Project.runtimeJar(task: T, body: T.() -> Unit = {}): T {
|
|||||||
|
|
||||||
fun Project.runtimeJar(taskName: String = "jar", body: Jar.() -> Unit = {}): Jar = runtimeJar(getOrCreateTask(taskName, body))
|
fun Project.runtimeJar(taskName: String = "jar", body: Jar.() -> Unit = {}): Jar = runtimeJar(getOrCreateTask(taskName, body))
|
||||||
|
|
||||||
fun Project.sourcesJar(body: Jar.() -> Unit = {}): Jar =
|
fun Project.sourcesJar(sourceSet: String? = "main", body: Jar.() -> Unit = {}): Jar =
|
||||||
getOrCreateTask("sourcesJar") {
|
getOrCreateTask("sourcesJar") {
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
classifier = "sources"
|
classifier = "sources"
|
||||||
try {
|
try {
|
||||||
project.pluginManager.withPlugin("java-base") {
|
if (sourceSet != null) {
|
||||||
from(project.the<JavaPluginConvention>().sourceSets["main"].allSource)
|
project.pluginManager.withPlugin("java-base") {
|
||||||
|
from(project.the<JavaPluginConvention>().sourceSets[sourceSet].allSource)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e: UnknownDomainObjectException) {
|
} catch (e: UnknownDomainObjectException) {
|
||||||
// skip default sources location
|
// skip default sources location
|
||||||
|
|||||||
@@ -198,9 +198,8 @@ val relocateCoreSources by task<Copy> {
|
|||||||
|
|
||||||
tasks.getByName("jar").enabled = false
|
tasks.getByName("jar").enabled = false
|
||||||
|
|
||||||
val relocatedSourcesJar by task<Jar> {
|
val sourcesJar = sourcesJar(sourceSet = null) {
|
||||||
dependsOn(relocateCoreSources)
|
dependsOn(relocateCoreSources)
|
||||||
classifier = "sources"
|
|
||||||
from(relocatedCoreSrc)
|
from(relocatedCoreSrc)
|
||||||
from("$core/reflection.jvm/src")
|
from("$core/reflection.jvm/src")
|
||||||
}
|
}
|
||||||
@@ -224,11 +223,10 @@ artifacts {
|
|||||||
add(mainJar.name, artifactJar)
|
add(mainJar.name, artifactJar)
|
||||||
add("runtime", artifactJar)
|
add("runtime", artifactJar)
|
||||||
add("archives", artifactJar)
|
add("archives", artifactJar)
|
||||||
add("archives", relocatedSourcesJar)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
javadocJar()
|
javadocJar()
|
||||||
|
|
||||||
dist(fromTask = result) {
|
dist(fromTask = result) {
|
||||||
from(relocatedSourcesJar)
|
from(sourcesJar)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user