Convert all compiler modules to intellij plugin

This commit is contained in:
Ilya Chernikov
2017-11-02 12:39:49 +01:00
committed by Vyacheslav Gerasimov
parent 6614695616
commit 74411d9b9c
10 changed files with 102 additions and 22 deletions
+9 -1
View File
@@ -3,6 +3,8 @@ description = "Kotlin Build Common"
apply { plugin("kotlin") } apply { plugin("kotlin") }
configureIntellijPlugin()
dependencies { dependencies {
compileOnly(project(":core:util.runtime")) compileOnly(project(":core:util.runtime"))
compileOnly(project(":compiler:util")) compileOnly(project(":compiler:util"))
@@ -11,7 +13,6 @@ dependencies {
compileOnly(project(":js:js.serializer")) compileOnly(project(":js:js.serializer"))
compileOnly(project(":js:js.frontend")) compileOnly(project(":js:js.frontend"))
compileOnly(project(":kotlin-reflect-api")) compileOnly(project(":kotlin-reflect-api"))
compileOnly(ideaSdkDeps("util"))
testCompileOnly(project(":compiler:cli-common")) testCompileOnly(project(":compiler:cli-common"))
testCompile(projectTests(":compiler:tests-common")) testCompile(projectTests(":compiler:tests-common"))
testCompile(commonDep("junit:junit")) testCompile(commonDep("junit:junit"))
@@ -21,6 +22,13 @@ dependencies {
testRuntime(projectDist(":kotlin-reflect")) testRuntime(projectDist(":kotlin-reflect"))
} }
afterEvaluate {
dependencies {
compileOnly(intellij { include("util.jar") })
testCompileOnly(intellij { include("openapi.jar") })
}
}
sourceSets { sourceSets {
"main" { projectDefault() } "main" { projectDefault() }
"test" { projectDefault() } "test" { projectDefault() }
+1 -1
View File
@@ -26,7 +26,7 @@ dependencies {
afterEvaluate { afterEvaluate {
dependencies { dependencies {
compile(intellij { include("openapi.jar") }) compile(intellij { include("openapi.jar") })
testCompile(intellij { include("idea.jar", "idea-rt.jar", "groovy-all.jar", "jps-builders.jar") }) testCompile(intellij { include("idea.jar", "idea_rt.jar", "groovy-all-*.jar", "jps-builders.jar") })
testCompile(intellijExtra("jps-standalone") { include("jps-model.jar") }) testCompile(intellijExtra("jps-standalone") { include("jps-model.jar") })
testCompile(intellijExtra("jps-build-test")) testCompile(intellijExtra("jps-build-test"))
} }
+11 -1
View File
@@ -3,6 +3,10 @@ apply { plugin("kotlin") }
jvmTarget = "1.8" jvmTarget = "1.8"
configureIntellijPlugin {
setExtraDependencies("intellij-core")
}
dependencies { dependencies {
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:cli-common")) compile(project(":compiler:cli-common"))
@@ -17,7 +21,6 @@ dependencies {
compile(project(":js:js.translator")) compile(project(":js:js.translator"))
compile(project(":js:js.serializer")) compile(project(":js:js.serializer"))
compile(project(":js:js.dce")) compile(project(":js:js.dce"))
compile(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
compile(commonDep("org.fusesource.jansi", "jansi")) compile(commonDep("org.fusesource.jansi", "jansi"))
compile(commonDep("org.jline", "jline")) compile(commonDep("org.jline", "jline"))
compile(files("${System.getProperty("java.home")}/../lib/tools.jar")) compile(files("${System.getProperty("java.home")}/../lib/tools.jar"))
@@ -29,6 +32,13 @@ dependencies {
testCompile(commonDep("junit:junit")) testCompile(commonDep("junit:junit"))
} }
afterEvaluate {
dependencies {
compile(intellijCoreJar())
compile(intellijCoreJarDependencies())
}
}
sourceSets { sourceSets {
"main" { "main" {
projectDefault() projectDefault()
+11 -1
View File
@@ -3,13 +3,23 @@ apply { plugin("kotlin") }
jvmTarget = "1.6" jvmTarget = "1.6"
configureIntellijPlugin {
setExtraDependencies("intellij-core")
}
dependencies { dependencies {
compile(project(":core:util.runtime")) compile(project(":core:util.runtime"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java")) compile(project(":compiler:frontend.java"))
compile(project(":compiler:frontend.script")) compile(project(":compiler:frontend.script"))
compileOnly(project(":kotlin-reflect-api")) compileOnly(project(":kotlin-reflect-api"))
compile(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>))) }
afterEvaluate {
dependencies {
compile(intellijCoreJar())
compile(intellijCoreJarDependencies())
}
} }
sourceSets { sourceSets {
+11 -1
View File
@@ -3,17 +3,27 @@ apply { plugin("kotlin") }
jvmTarget = "1.6" jvmTarget = "1.6"
configureIntellijPlugin {
setExtraDependencies("intellij-core")
}
dependencies { dependencies {
val compile by configurations val compile by configurations
compile(project(":compiler:cli")) compile(project(":compiler:cli"))
compile(project(":compiler:daemon-common")) compile(project(":compiler:daemon-common"))
compile(project(":compiler:incremental-compilation-impl")) compile(project(":compiler:incremental-compilation-impl"))
compile(project(":kotlin-build-common")) compile(project(":kotlin-build-common"))
compile(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
compile(commonDep("org.fusesource.jansi", "jansi")) compile(commonDep("org.fusesource.jansi", "jansi"))
compile(commonDep("org.jline", "jline")) compile(commonDep("org.jline", "jline"))
} }
afterEvaluate {
dependencies {
compile(intellijCoreJar())
compile(intellijCoreJarDependencies())
}
}
sourceSets { sourceSets {
"main" { projectDefault() } "main" { projectDefault() }
"test" {} "test" {}
+11 -1
View File
@@ -3,15 +3,25 @@ apply { plugin("kotlin") }
jvmTarget = "1.6" jvmTarget = "1.6"
configureIntellijPlugin {
setExtraDependencies("intellij-core")
}
dependencies { dependencies {
compile(project(":core:descriptors")) compile(project(":core:descriptors"))
compile(project(":core:descriptors.jvm")) compile(project(":core:descriptors.jvm"))
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:cli-common")) compile(project(":compiler:cli-common"))
compile(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
compile(project(":kotlin-stdlib")) compile(project(":kotlin-stdlib"))
} }
afterEvaluate {
dependencies {
compile(intellijCoreJar())
compile(intellijCoreJarDependencies())
}
}
sourceSets { sourceSets {
"main" { projectDefault() } "main" { projectDefault() }
"test" {} "test" {}
+10 -2
View File
@@ -3,14 +3,22 @@ apply { plugin("kotlin") }
jvmTarget = "1.6" jvmTarget = "1.6"
configureIntellijPlugin {
setExtraDependencies("intellij-core")
}
dependencies { dependencies {
compile(ideaSdkCoreDeps("intellij-core"))
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
} }
afterEvaluate {
dependencies {
compile(intellijCoreJar())
}
}
sourceSets { sourceSets {
"main" { projectDefault() } "main" { projectDefault() }
"test" {} "test" {}
} }
+6 -2
View File
@@ -5,8 +5,12 @@ apply { plugin("kotlin") }
jvmTarget = "1.6" jvmTarget = "1.6"
dependencies { configureIntellijPlugin()
compile(ideaSdkDeps("asm-all"))
afterEvaluate {
dependencies {
compile(intellij { include("asm-all.jar") })
}
} }
sourceSets { sourceSets {
+11 -2
View File
@@ -1,6 +1,10 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
configureIntellijPlugin {
setExtraDependencies("intellij-core")
}
dependencies { dependencies {
testCompile(project(":core:descriptors")) testCompile(project(":core:descriptors"))
testCompile(project(":core:descriptors.jvm")) testCompile(project(":core:descriptors.jvm"))
@@ -25,11 +29,16 @@ dependencies {
testCompile(projectTests(":compiler:tests-common-jvm6")) testCompile(projectTests(":compiler:tests-common-jvm6"))
testCompileOnly(project(":kotlin-reflect-api")) testCompileOnly(project(":kotlin-reflect-api"))
testCompile(commonDep("junit:junit")) testCompile(commonDep("junit:junit"))
testCompile(ideaSdkCoreDeps("intellij-core"))
testCompile(ideaSdkDeps("openapi", "idea", "idea_rt"))
testCompile(preloadedDeps("dx", subdir = "android-5.0/lib")) testCompile(preloadedDeps("dx", subdir = "android-5.0/lib"))
} }
afterEvaluate {
dependencies {
testCompile(intellijCoreJar())
testCompile(intellij { include("openapi.jar", "idea.jar", "idea_rt.jar") })
}
}
sourceSets { sourceSets {
"main" { } "main" { }
"test" { projectDefault() } "test" { projectDefault() }
+21 -10
View File
@@ -30,6 +30,8 @@ val compilerManifestClassPath =
"kotlin-stdlib.jar kotlin-reflect.jar kotlin-script-runtime.jar" "kotlin-stdlib.jar kotlin-reflect.jar kotlin-script-runtime.jar"
val fatJarContents by configurations.creating val fatJarContents by configurations.creating
val fatJarContentsStripMetadata by configurations.creating
val fatJarContentsStripServices by configurations.creating
val fatSourcesJarContents by configurations.creating val fatSourcesJarContents by configurations.creating
val proguardLibraryJars by configurations.creating val proguardLibraryJars by configurations.creating
val fatJar by configurations.creating val fatJar by configurations.creating
@@ -43,15 +45,16 @@ val outputJar = File(buildDir, "libs", "$compilerBaseName.jar")
val compilerModules: Array<String> by rootProject.extra val compilerModules: Array<String> by rootProject.extra
val ideaCoreSdkJars: Array<String> by rootProject.extra
val coreSdkJarsSimple = ideaCoreSdkJars.filterNot { it == "jdom" || it == "log4j" }.toTypedArray()
compilerModules.forEach { evaluationDependsOn(it) } compilerModules.forEach { evaluationDependsOn(it) }
val compiledModulesSources = compilerModules.map { val compiledModulesSources = compilerModules.map {
project(it).the<JavaPluginConvention>().sourceSets.getByName("main").allSource project(it).the<JavaPluginConvention>().sourceSets.getByName("main").allSource
} }
configureIntellijPlugin {
setExtraDependencies("intellij-core", "jps-standalone")
}
dependencies { dependencies {
compilerModules.forEach { compilerModules.forEach {
fatJarContents(project(it)) { isTransitive = false } fatJarContents(project(it)) { isTransitive = false }
@@ -61,8 +64,6 @@ dependencies {
} }
fatJarContents(project(":core:builtins", configuration = "builtins")) fatJarContents(project(":core:builtins", configuration = "builtins"))
fatJarContents(ideaSdkCoreDeps(*coreSdkJarsSimple))
fatJarContents(ideaSdkDeps("jna-platform"))
fatJarContents(commonDep("javax.inject")) fatJarContents(commonDep("javax.inject"))
fatJarContents(commonDep("org.jline", "jline")) fatJarContents(commonDep("org.jline", "jline"))
fatJarContents(commonDep("org.fusesource.jansi", "jansi")) fatJarContents(commonDep("org.fusesource.jansi", "jansi"))
@@ -83,6 +84,17 @@ dependencies {
compile(project(":kotlin-reflect")) compile(project(":kotlin-reflect"))
} }
afterEvaluate {
dependencies {
fatJarContents(intellijCoreJar())
fatJarContents(intellijCoreJarDependencies { exclude("jdom.jar", "log4j.jar") })
fatJarContents(intellij { include("jna-platform.jar") })
fatJarContentsStripServices(intellijExtra("jps-standalone") { include("jps-model.jar") })
fatJarContentsStripMetadata(intellij { include("oromatcher.jar", "jdom.jar", "log4j.jar") })
}
}
val packCompiler by task<ShadowJar> { val packCompiler by task<ShadowJar> {
configurations = listOf(fatJar) configurations = listOf(fatJar)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE duplicatesStrategy = DuplicatesStrategy.EXCLUDE
@@ -91,9 +103,10 @@ val packCompiler by task<ShadowJar> {
setupPublicJar("before-proguard") setupPublicJar("before-proguard")
from(fatJarContents) from(fatJarContents)
ideaSdkDeps("jps-model.jar", subdir = "jps").forEach { from(zipTree(it)) { exclude("META-INF/services/**") } } afterEvaluate {
ideaSdkDeps("oromatcher").forEach { from(zipTree(it)) { exclude("META-INF/jb/** META-INF/LICENSE") } } fatJarContentsStripServices.files.forEach { from(zipTree(it)) { exclude("META-INF/services/**") } }
ideaSdkCoreDeps("jdom", "log4j").forEach { from(zipTree(it)) { exclude("META-INF/jb/** META-INF/LICENSE") } } fatJarContentsStripMetadata.files.forEach { from(zipTree(it)) { exclude("META-INF/jb/** META-INF/LICENSE") } }
}
manifest.attributes.put("Class-Path", compilerManifestClassPath) manifest.attributes.put("Class-Path", compilerManifestClassPath)
manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler") manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler")
@@ -120,8 +133,6 @@ val proguard by task<ProGuardTask> {
noDefaultJar() noDefaultJar()
cleanArtifacts()
val pack = if (shrink) proguard else packCompiler val pack = if (shrink) proguard else packCompiler
dist(targetName = compilerBaseName + ".jar", dist(targetName = compilerBaseName + ".jar",