Add Idea Ultimate plugin build
This commit is contained in:
@@ -40,10 +40,21 @@ fun Project.preloadedDeps(vararg artifactBaseNames: String, baseDir: File = File
|
||||
fun Project.ideaSdkDeps(vararg artifactBaseNames: String, subdir: String = "lib"): ConfigurableFileCollection =
|
||||
preloadedDeps(*artifactBaseNames, baseDir = File(rootDir, "ideaSDK"), subdir = subdir)
|
||||
|
||||
fun Project.ideaUltimateSdkDeps(vararg artifactBaseNames: String, subdir: String = "lib"): ConfigurableFileCollection {
|
||||
val ultimateSdkDir = File(rootDir, "ultimate", "ideaSDK")
|
||||
return if (ultimateSdkDir.isDirectory) preloadedDeps(*artifactBaseNames, baseDir = ultimateSdkDir, subdir = subdir)
|
||||
else files()
|
||||
}
|
||||
|
||||
fun Project.ideaSdkCoreDeps(vararg artifactBaseNames: String): ConfigurableFileCollection = ideaSdkDeps(*artifactBaseNames, subdir = "core")
|
||||
|
||||
fun Project.ideaUltimateSdkCoreDeps(vararg artifactBaseNames: String): ConfigurableFileCollection = ideaUltimateSdkDeps(*artifactBaseNames, subdir = "core")
|
||||
|
||||
fun Project.ideaPluginDeps(vararg artifactBaseNames: String, plugin: String, subdir: String = "lib"): ConfigurableFileCollection =
|
||||
preloadedDeps(*artifactBaseNames, baseDir = File(rootDir, "ideaSDK"), subdir = "plugins/$plugin/$subdir")
|
||||
ideaSdkDeps(*artifactBaseNames, subdir = "plugins/$plugin/$subdir")
|
||||
|
||||
fun Project.ideaUltimatePluginDeps(vararg artifactBaseNames: String, plugin: String, subdir: String = "lib"): ConfigurableFileCollection =
|
||||
ideaUltimateSdkDeps(*artifactBaseNames, subdir = "plugins/$plugin/$subdir")
|
||||
|
||||
fun Project.kotlinDep(artifactBaseName: String, version: String? = null): String = "org.jetbrains.kotlin:kotlin-$artifactBaseName:${version ?: bootstrapKotlinVersion}"
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ dependencies {
|
||||
testRuntime(ideaPluginDeps("*.jar", plugin = "copyright"))
|
||||
testRuntime(ideaPluginDeps("*.jar", plugin = "properties"))
|
||||
testRuntime(ideaPluginDeps("*.jar", plugin = "java-i18n"))
|
||||
testRuntime(ideaPluginDeps("*.jar", plugin = "coverage"))
|
||||
testRuntime(ideaPluginDeps("*.jar", plugin = "java-decompiler"))
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -124,7 +124,8 @@ include ":kotlin-build-common",
|
||||
":kotlin-annotation-processing",
|
||||
":kotlin-annotation-processing-gradle",
|
||||
":examples:kotlin-jsr223-local-example",
|
||||
":examples:kotlin-jsr223-daemon-local-eval-example"
|
||||
":examples:kotlin-jsr223-daemon-local-eval-example",
|
||||
":ultimate"
|
||||
|
||||
rootProject.name = "kotlin"
|
||||
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
|
||||
description = "Kotlin IDEA Ultimate plugin"
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("com.github.jengelman.gradle.plugins:shadow:1.2.3")
|
||||
}
|
||||
}
|
||||
|
||||
apply { plugin("kotlin") }
|
||||
|
||||
val ideaCommunityPlugin by configurations.creating
|
||||
|
||||
val ideaProjectClasses = project(":idea").the<JavaPluginConvention>().sourceSets["main"].output.classesDirs
|
||||
val ideaProjectResources = project(":idea").the<JavaPluginConvention>().sourceSets["main"].output.resourcesDir
|
||||
|
||||
dependencies {
|
||||
val compile by configurations
|
||||
val compileOnly by configurations
|
||||
val testCompile by configurations
|
||||
val testCompileOnly by configurations
|
||||
val testRuntime by configurations
|
||||
compile(projectDist(":kotlin-reflect"))
|
||||
compile(projectDist(":kotlin-stdlib"))
|
||||
compile(project(":core")) { isTransitive = false }
|
||||
compile(project(":core:util.runtime")) { isTransitive = false }
|
||||
compile(project(":compiler:light-classes")) { isTransitive = false }
|
||||
compile(project(":compiler:frontend")) { isTransitive = false }
|
||||
compile(project(":compiler:frontend.java")) { isTransitive = false }
|
||||
compile(ideaProjectClasses)
|
||||
compile(project(":idea:idea-core")) { isTransitive = false }
|
||||
compile(project(":idea:ide-common")) { isTransitive = false }
|
||||
compile(project(":idea:idea-gradle")) { isTransitive = false }
|
||||
|
||||
compile(ideaUltimateSdkCoreDeps("annotations", "trove4j", "intellij-core"))
|
||||
compile(ideaUltimateSdkDeps("openapi", "idea", "util"))
|
||||
// compile(ideaUltimatePluginDeps("gradle-tooling-api", plugin = "gradle"))
|
||||
compile(ideaUltimatePluginDeps("*.jar", plugin = "CSS"))
|
||||
compile(ideaUltimatePluginDeps("*.jar", plugin = "DatabaseTools"))
|
||||
compile(ideaUltimatePluginDeps("*.jar", plugin = "JavaEE"))
|
||||
compile(ideaUltimatePluginDeps("*.jar", plugin = "jsp"))
|
||||
compile(ideaUltimatePluginDeps("*.jar", plugin = "PersistenceSupport"))
|
||||
compile(ideaUltimatePluginDeps("*.jar", plugin = "Spring"))
|
||||
compile(ideaUltimatePluginDeps("*.jar", plugin = "properties"))
|
||||
compile(ideaUltimatePluginDeps("*.jar", plugin = "java-i18n"))
|
||||
compile(ideaUltimatePluginDeps("*.jar", plugin = "gradle"))
|
||||
compile(ideaUltimatePluginDeps("*.jar", plugin = "Groovy"))
|
||||
compile(ideaUltimatePluginDeps("*.jar", plugin = "junit"))
|
||||
compile(ideaUltimatePluginDeps("*.jar", plugin = "uml"))
|
||||
|
||||
testCompile(projectDist(":kotlin-test:kotlin-test-jvm"))
|
||||
testCompile(project(":compiler.tests-common")) { isTransitive = false }
|
||||
testCompile(project(":idea:idea-test-framework")) { isTransitive = false }
|
||||
testCompile(project(":plugins:lint")) { isTransitive = false }
|
||||
testCompile(project(":idea:idea-jvm")) { isTransitive = false }
|
||||
testCompile(project(":generators")) { isTransitive = false }
|
||||
testCompile(projectTests(":idea"))
|
||||
// testCompileOnly(projectTests(":idea:idea-gradle"))
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testCompile(ideaUltimateSdkDeps("gson"))
|
||||
testCompile(preloadedDeps("kotlinx-coroutines-core"))
|
||||
|
||||
testRuntime(projectDist(":kotlin-compiler"))
|
||||
testRuntime(project(":plugins:android-extensions-idea")) { isTransitive = false }
|
||||
testRuntime(project(":android-extensions-compiler")) { isTransitive = false }
|
||||
testRuntime(project(":plugins:annotation-based-compiler-plugins-ide-support")) { isTransitive = false }
|
||||
testRuntime(project(":idea:idea-android")) { isTransitive = false }
|
||||
testRuntime(project(":idea:idea-maven")) { isTransitive = false }
|
||||
testRuntime(project(":idea:idea-jps-common")) { isTransitive = false }
|
||||
testRuntime(project(":idea:formatter")) { isTransitive = false }
|
||||
testRuntime(project(":sam-with-receiver-ide-plugin")) { isTransitive = false }
|
||||
testRuntime(project(":kotlin-sam-with-receiver-compiler-plugin")) { isTransitive = false }
|
||||
testRuntime(project(":noarg-ide-plugin")) { isTransitive = false }
|
||||
testRuntime(project(":kotlin-noarg-compiler-plugin")) { isTransitive = false }
|
||||
testRuntime(project(":allopen-ide-plugin")) { isTransitive = false }
|
||||
testRuntime(project(":kotlin-allopen-compiler-plugin")) { isTransitive = false }
|
||||
testRuntime(ideaUltimateSdkDeps("*.jar"))
|
||||
testRuntime(ideaUltimatePluginDeps("*.jar", plugin = "properties"))
|
||||
testRuntime(ideaUltimatePluginDeps("*.jar", plugin = "coverage"))
|
||||
testRuntime(ideaUltimatePluginDeps("*.jar", plugin = "maven"))
|
||||
testRuntime(ideaUltimatePluginDeps("*.jar", plugin = "android"))
|
||||
testRuntime(ideaUltimatePluginDeps("*.jar", plugin = "testng"))
|
||||
testRuntime(ideaUltimatePluginDeps("*.jar", plugin = "IntelliLang"))
|
||||
testRuntime(ideaUltimatePluginDeps("*.jar", plugin = "testng"))
|
||||
testRuntime(ideaUltimatePluginDeps("*.jar", plugin = "copyright"))
|
||||
testRuntime(ideaUltimatePluginDeps("*.jar", plugin = "java-decompiler"))
|
||||
testRuntime(files("${System.getProperty("java.home")}/../lib/tools.jar"))
|
||||
|
||||
ideaCommunityPlugin(projectRuntimeJar(":prepare:kotlin-plugin"))
|
||||
}
|
||||
|
||||
val preparedResources = File(buildDir, "prepResources")
|
||||
|
||||
sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {
|
||||
projectDefault()
|
||||
resources.srcDir(preparedResources)
|
||||
}
|
||||
}
|
||||
|
||||
val ultimatePluginXmlContent: String by lazy {
|
||||
val sectRex = Regex("""^\s*</?idea-plugin>\s*$""")
|
||||
File(projectDir, "resources/META-INF/ultimate-plugin.xml")
|
||||
.readLines()
|
||||
.filterNot { it.matches(sectRex) }
|
||||
.joinToString("\n")
|
||||
}
|
||||
|
||||
val prepareResources by task<Copy> {
|
||||
dependsOn(":idea:assemble")
|
||||
from(ideaProjectResources, { exclude("META-INF/plugin.xml") })
|
||||
into(preparedResources)
|
||||
}
|
||||
|
||||
val preparePluginXml by task<Copy> {
|
||||
dependsOn(":idea:assemble")
|
||||
from(ideaProjectResources, { include("META-INF/plugin.xml") })
|
||||
into(preparedResources)
|
||||
filter {
|
||||
it?.replace("<!-- ULTIMATE-PLUGIN-PLACEHOLDER -->", ultimatePluginXmlContent)
|
||||
}
|
||||
}
|
||||
|
||||
val jar = runtimeJar(task<ShadowJar>("shadowJar")) {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
dependsOn(preparePluginXml)
|
||||
project(":prepare:kotlin-plugin").afterEvaluate {
|
||||
ideaCommunityPlugin.files.forEach {
|
||||
from(zipTree(it), { exclude("META-INF/plugin.xml") })
|
||||
}
|
||||
}
|
||||
from(preparedResources, { include("META-INF/plugin.xml") })
|
||||
from(the<JavaPluginConvention>().sourceSets.getByName("main").output)
|
||||
archiveName = "kotlin-plugin.jar"
|
||||
}
|
||||
|
||||
val ideaPluginDir: File by rootProject.extra
|
||||
val ideaUltimatePluginDir: File by rootProject.extra
|
||||
|
||||
task<Copy>("idea-ultimate-plugin") {
|
||||
dependsOnTaskIfExistsRec("idea-plugin", rootProject)
|
||||
into(ideaUltimatePluginDir)
|
||||
from(ideaPluginDir) { exclude("lib/kotlin-plugin.jar") }
|
||||
from(jar, { into("lib") })
|
||||
}
|
||||
|
||||
projectTest {
|
||||
dependsOn(prepareResources)
|
||||
dependsOn(preparePluginXml)
|
||||
workingDir = rootDir
|
||||
}
|
||||
Reference in New Issue
Block a user