Fix dependencies to the cross-project tasks
This commit is contained in:
committed by
Vyacheslav Gerasimov
parent
434bbafe58
commit
555e9674b2
+1
-2
@@ -355,14 +355,13 @@ task<Copy>("dist") {
|
||||
}
|
||||
|
||||
val compilerCopyTask = task<Copy>("idea-plugin-copy-compiler") {
|
||||
dependsOnTaskIfExistsRec("dist")
|
||||
shouldRunAfter(":dist")
|
||||
into(ideaPluginDir)
|
||||
from(distDir) { include("kotlinc/**") }
|
||||
}
|
||||
|
||||
task<Copy>("ideaPlugin") {
|
||||
dependsOn(compilerCopyTask)
|
||||
dependsOnTaskIfExistsRec("idea-plugin")
|
||||
shouldRunAfter(":prepare:idea-plugin:idea-plugin")
|
||||
into("$ideaPluginDir/lib")
|
||||
}
|
||||
|
||||
@@ -20,26 +20,6 @@ fun Project.callGroovy(name: String, vararg args: Any?): Any? {
|
||||
return (property(name) as Closure<*>).call(*args)
|
||||
}
|
||||
|
||||
fun AbstractTask.dependsOnTaskIfExists(task: String, project: Project?, parentProject: Project?) {
|
||||
val thisTask = this
|
||||
val p = project ?: this.project
|
||||
p.afterEvaluate {
|
||||
p.tasks.firstOrNull { it.name == task }?.also {
|
||||
if (parentProject != null) {
|
||||
parentProject.evaluationDependsOn(p.path)
|
||||
}
|
||||
thisTask.dependsOn(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun AbstractTask.dependsOnTaskIfExistsRec(task: String, project: Project? = null, parentProject: Project? = null) {
|
||||
dependsOnTaskIfExists(task, project, parentProject)
|
||||
(project ?: this.project).subprojects.forEach {
|
||||
dependsOnTaskIfExistsRec(task, it, this.project)
|
||||
}
|
||||
}
|
||||
|
||||
inline fun<T: Any> Project.withJavaPlugin(crossinline body: () -> T?): T? {
|
||||
var res: T? = null
|
||||
pluginManager.withPlugin("java") {
|
||||
|
||||
@@ -24,7 +24,7 @@ sourceSets {
|
||||
testsJar {}
|
||||
|
||||
projectTest {
|
||||
dependsOnTaskIfExistsRec("dist", project = rootProject)
|
||||
shouldRunAfter(":dist")
|
||||
dependsOn(":prepare:mock-runtime-for-test:dist")
|
||||
workingDir = rootDir
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ tasks.withType<KotlinCompile> {
|
||||
|
||||
projectTest {
|
||||
executable = "${rootProject.extra["JDK_18"]!!}/bin/java"
|
||||
dependsOnTaskIfExistsRec("dist", project = rootProject)
|
||||
shouldRunAfter(":dist")
|
||||
dependsOn(":prepare:mock-runtime-for-test:dist")
|
||||
workingDir = rootDir
|
||||
systemProperty("kotlin.test.script.classpath", the<JavaPluginConvention>().sourceSets.getByName("test").output.classesDirs.joinToString(File.pathSeparator))
|
||||
|
||||
@@ -17,6 +17,6 @@ sourceSets {
|
||||
}
|
||||
|
||||
projectTest {
|
||||
dependsOnTaskIfExistsRec("dist", project = rootProject)
|
||||
shouldRunAfter(":dist")
|
||||
workingDir = rootDir
|
||||
}
|
||||
|
||||
@@ -17,5 +17,5 @@ val ideaSandboxDir: File by rootProject.extra
|
||||
|
||||
runIdeTask("runIde", ideaPluginDir, ideaSandboxDir) {
|
||||
|
||||
dependsOn(":dist", ":prepare:idea-plugin:idea-plugin", ":ideaPlugin")
|
||||
shouldRunAfter(":ideaPlugin")
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ sourceSets {
|
||||
}
|
||||
|
||||
projectTest {
|
||||
dependsOnTaskIfExistsRec("dist", project = rootProject)
|
||||
shouldRunAfter(":dist")
|
||||
workingDir = rootDir
|
||||
doFirst {
|
||||
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
|
||||
|
||||
@@ -47,7 +47,7 @@ sourceSets {
|
||||
}
|
||||
|
||||
projectTest {
|
||||
dependsOnTaskIfExistsRec("dist", project = rootProject)
|
||||
shouldRunAfter(":dist")
|
||||
workingDir = rootDir
|
||||
doFirst {
|
||||
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
|
||||
|
||||
@@ -52,7 +52,7 @@ evaluationDependsOn(":kotlin-android-extensions-runtime")
|
||||
|
||||
projectTest {
|
||||
environment("ANDROID_EXTENSIONS_RUNTIME_CLASSES", getSourceSetsFrom(":kotlin-android-extensions-runtime")["main"].output.classesDirs.asPath)
|
||||
dependsOnTaskIfExistsRec("dist", project = rootProject)
|
||||
shouldRunAfter(":dist")
|
||||
workingDir = rootDir
|
||||
doFirst {
|
||||
val androidPluginPath = File(intellijRootDir(), "plugins/android").canonicalPath
|
||||
|
||||
@@ -37,7 +37,7 @@ testsJar {}
|
||||
|
||||
projectTest {
|
||||
workingDir = rootDir
|
||||
dependsOnTaskIfExistsRec("dist", project = rootProject)
|
||||
shouldRunAfter(":dist")
|
||||
}
|
||||
|
||||
runtimeJar()
|
||||
|
||||
@@ -177,7 +177,7 @@ val ideaUltimatePluginDir: File by rootProject.extra
|
||||
|
||||
task<Copy>("ideaUltimatePlugin") {
|
||||
dependsOn("$communityPluginProject:ideaPlugin")
|
||||
dependsOnTaskIfExistsRec("ideaPlugin", rootProject)
|
||||
shouldRunAfter(":ideaPlugin")
|
||||
into(ideaUltimatePluginDir)
|
||||
from(ideaPluginDir) { exclude("lib/kotlin-plugin.jar") }
|
||||
from(jar, { into("lib") })
|
||||
|
||||
@@ -19,6 +19,6 @@ val ideaUltimateSandboxDir: File by rootProject.extra
|
||||
if (intellijUltimateEnabled) {
|
||||
|
||||
runIdeTask("runUltimate", ideaUltimatePluginDir, ideaUltimateSandboxDir) {
|
||||
dependsOn(":dist", ":prepare:idea-plugin:idea-plugin", ":ideaPlugin", ":ultimate:idea-ultimate-plugin")
|
||||
shouldRunAfter(":ultimate:ideaUltimatePlugin")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user