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")