Pill: Merge two "root" and "non-root" Pill plugins

This commit is contained in:
Yan Zhulanow
2018-02-22 00:18:42 +03:00
parent 3da479c1d5
commit b24d87f7ed
3 changed files with 9 additions and 19 deletions
-1
View File
@@ -250,7 +250,6 @@ apply {
} }
apply { plugin("jps-compatible") } apply { plugin("jps-compatible") }
apply { plugin("jps-compatible-root") }
fun Project.allprojectsRecursive(body: Project.() -> Unit) { fun Project.allprojectsRecursive(body: Project.() -> Unit) {
this.body() this.body()
+9 -17
View File
@@ -9,13 +9,6 @@ import shadow.org.jdom2.output.XMLOutputter
import java.io.File import java.io.File
class JpsCompatiblePlugin : Plugin<Project> { class JpsCompatiblePlugin : Plugin<Project> {
override fun apply(project: Project) {
// 'jpsTest' does not require the 'tests-jar' artifact
project.configurations.create("jpsTest")
}
}
class JpsCompatibleRootPlugin : Plugin<Project> {
companion object { companion object {
private fun mapper(module: String, vararg configurations: String): DependencyMapper { private fun mapper(module: String, vararg configurations: String): DependencyMapper {
return DependencyMapper("org.jetbrains.kotlin", module, *configurations) { MappedDependency(PDependency.Library(module)) } return DependencyMapper("org.jetbrains.kotlin", module, *configurations) { MappedDependency(PDependency.Library(module)) }
@@ -82,24 +75,23 @@ class JpsCompatibleRootPlugin : Plugin<Project> {
) )
) )
} }
} }
override fun apply(project: Project) { override fun apply(project: Project) {
if (project != project.rootProject) { // 'jpsTest' does not require the 'tests-jar' artifact
error("JpsCompatible root plugin can be applied only to the root project") project.configurations.create("jpsTest")
}
project.tasks.create("pill") { if (project == project.rootProject) {
doLast { pill(project) } project.tasks.create("pill") {
} doLast { pill(project) }
}
project.tasks.create("unpill") { project.tasks.create("unpill") {
doLast { unpill(project) } doLast { unpill(project) }
}
} }
} }
private lateinit var projectDir: File private lateinit var projectDir: File
private lateinit var platformVersion: String private lateinit var platformVersion: String
private lateinit var platformBaseNumber: String private lateinit var platformBaseNumber: String
@@ -1 +0,0 @@
implementation-class=org.jetbrains.kotlin.pill.JpsCompatibleRootPlugin