Introduce jps-compatible-base plugin to create necessary configurations

To avoid generating static accessors (via kotlinDslAccessorsSnapshot),
we need to create all necessary configurations during 'plugins'
block evaluation.
This commit is contained in:
Alexey Tsvetkov
2018-03-24 22:12:37 +03:00
parent 8a82c1618c
commit b420671a1d
8 changed files with 13 additions and 15 deletions
+4
View File
@@ -33,6 +33,10 @@ plugins {
gradlePlugin {
(plugins) {
"jps-compatible-base" {
id = "jps-compatible-base"
implementationClass = "org.jetbrains.kotlin.pill.JpsCompatibleBasePlugin"
}
"jps-compatible" {
id = "jps-compatible"
implementationClass = "org.jetbrains.kotlin.pill.JpsCompatiblePlugin"
-4
View File
@@ -107,10 +107,6 @@ object EmbeddedComponents {
val CONFIGURATION_NAME = "embeddedComponents"
}
fun Project.containsEmbeddedComponents() {
configurations.create(EmbeddedComponents.CONFIGURATION_NAME)
}
fun AbstractCopyTask.fromEmbeddedComponents() {
val embeddedComponents = project.configurations.getByName(EmbeddedComponents.CONFIGURATION_NAME)
if (this is ShadowJar) {
+7
View File
@@ -10,6 +10,12 @@ import shadow.org.jdom2.output.Format
import shadow.org.jdom2.output.XMLOutputter
import java.io.File
class JpsCompatibleBasePlugin : Plugin<Project> {
override fun apply(project: Project) {
project.configurations.create(EmbeddedComponents.CONFIGURATION_NAME)
}
}
class JpsCompatiblePlugin : Plugin<Project> {
companion object {
private const val JPS_LIBRARY_PATH = "jpsLibraryPath"
@@ -64,6 +70,7 @@ class JpsCompatiblePlugin : Plugin<Project> {
}
override fun apply(project: Project) {
project.plugins.apply(JpsCompatibleBasePlugin::class.java)
// 'jpsTest' does not require the 'tests-jar' artifact
project.configurations.create("jpsTest")
@@ -11,8 +11,6 @@ jvmTarget = "1.6"
val nativePlatformVariants: List<String> by rootProject.extra
containsEmbeddedComponents()
dependencies {
compileOnly(project(":compiler:util"))
compileOnly(project(":compiler:cli-common"))
@@ -8,8 +8,6 @@ plugins {
val robolectricClasspath by configurations.creating
containsEmbeddedComponents()
dependencies {
testCompile(intellijCoreDep()) { includeJars("intellij-core") }
@@ -6,8 +6,6 @@ plugins {
id("jps-compatible")
}
containsEmbeddedComponents()
dependencies {
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntime(intellijDep())
+1 -2
View File
@@ -3,6 +3,7 @@ description = "Kotlin Android Lint"
plugins {
`java-base`
id("jps-compatible-base")
}
val projectsToShadow = listOf(
@@ -15,8 +16,6 @@ sourceSets {
"test" {}
}
containsEmbeddedComponents()
dependencies {
projectsToShadow.forEach { p ->
embeddedComponents(project(p)) { isTransitive = false }
+1 -3
View File
@@ -4,6 +4,7 @@ description = "Kotlin JPS plugin"
plugins {
`java-base`
id("jps-compatible-base")
}
val projectsToShadow = listOf(
@@ -20,9 +21,6 @@ val projectsToShadow = listOf(
":core:util.runtime",
":plugins:android-extensions-jps")
containsEmbeddedComponents()
dependencies {
projectsToShadow.forEach {
embeddedComponents(project(it)) { isTransitive = false }