[gradle-plugin] Rename javadoc/sources jars and tasks
This commit is contained in:
+14
-17
@@ -184,31 +184,28 @@ class KotlinNativePlugin @Inject constructor(val attributesFactory: ImmutableAtt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val KotlinNativeSourceSetImpl.sourceSetSuffix: String
|
private fun KotlinNativeSourceSetImpl.createJarTask(taskName: String, configure: (Jar) -> Unit): Jar {
|
||||||
get() = name.let { if (it == MAIN_SOURCE_SET_NAME) "" else it }
|
|
||||||
|
|
||||||
private fun KotlinNativeSourceSetImpl.createSourcesJarTask(target: KonanTarget): Jar {
|
|
||||||
val sources = getAllSources(target)
|
|
||||||
val taskName = "sourcesJar${sourceSetSuffix}${target.name}"
|
|
||||||
val task = project.tasks.findByName(taskName)
|
val task = project.tasks.findByName(taskName)
|
||||||
|
|
||||||
return if (task != null) {
|
return if (task != null) {
|
||||||
task as Jar
|
task as Jar
|
||||||
} else {
|
} else {
|
||||||
project.tasks.create(taskName, Jar::class.java) {
|
project.tasks.create(taskName, Jar::class.java, configure)
|
||||||
it.baseName = name
|
|
||||||
it.appendix = target.name
|
|
||||||
it.classifier = "sources"
|
|
||||||
it.from(sources)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun KotlinNativeSourceSetImpl.createSourcesJarTask(target: KonanTarget): Jar =
|
||||||
|
createJarTask("sourcesJar${name.capitalize()}${target.name.capitalize()}") {
|
||||||
|
it.appendix = "$name-${target.name}"
|
||||||
|
it.classifier = "sources"
|
||||||
|
it.from(getAllSources(target))
|
||||||
|
}
|
||||||
|
|
||||||
private fun KotlinNativeSourceSetImpl.createEmptyJarTask(namePrefix: String, classifier: String): Jar =
|
private fun KotlinNativeSourceSetImpl.createEmptyJarTask(namePrefix: String, classifier: String): Jar =
|
||||||
project.tasks.maybeCreate("$namePrefix$sourceSetSuffix", Jar::class.java).apply {
|
createJarTask("$namePrefix${name.capitalize()}") {
|
||||||
baseName = name
|
it.appendix = name
|
||||||
this.classifier = classifier
|
it.classifier = classifier
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun Project.setUpMavenPublish() = pluginManager.withPlugin("maven-publish") { _ ->
|
private fun Project.setUpMavenPublish() = pluginManager.withPlugin("maven-publish") { _ ->
|
||||||
val publishingExtension = project.extensions.getByType(PublishingExtension::class.java)
|
val publishingExtension = project.extensions.getByType(PublishingExtension::class.java)
|
||||||
|
|||||||
Reference in New Issue
Block a user