diff --git a/build.gradle.kts b/build.gradle.kts index f18dfb25422..fb9a9ae6ddc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -81,8 +81,12 @@ repositories { } } +val cidrKotlinPlugin by configurations.creating + dependencies { bootstrapCompileCfg(kotlinDep("compiler-embeddable", bootstrapKotlinVersion)) + + cidrKotlinPlugin(project(":prepare:cidr-plugin", "runtimeJar")) } val commonBuildDir = File(rootDir, "build") @@ -356,7 +360,7 @@ allprojects { } } -val distTask = task("dist") { +val dist by task { val childDistTasks = getTasksByName("dist", true) - this@task dependsOn(childDistTasks) @@ -365,17 +369,16 @@ val distTask = task("dist") { from(files("license")) { into("kotlinc/license") } } -val compilerCopyTask = task("idea-plugin-copy-compiler") { - dependsOn(distTask) +val copyCompilerToIdeaPlugin by task { + dependsOn(dist) into(ideaPluginDir) from(distDir) { include("kotlinc/**") } } -task("ideaPlugin") { - dependsOn(compilerCopyTask) +val ideaPlugin by task { + dependsOn(copyCompilerToIdeaPlugin) val childIdeaPluginTasks = getTasksByName("ideaPlugin", true) - this@task dependsOn(childIdeaPluginTasks) - into("$ideaPluginDir/lib") } tasks { @@ -391,6 +394,7 @@ tasks { doLast { delete(ideaPluginDir) delete(ideaUltimatePluginDir) + delete(cidrPluginDir) } } @@ -519,18 +523,20 @@ tasks { "check" { dependsOn("test") } } -fun CopySpec.compilerScriptPermissionsSpec() { - filesMatching("bin/*") { mode = 0b111101101 } - filesMatching("bin/*.bat") { mode = 0b110100100 } +fun CopySpec.setExecutablePermissions() { + filesMatching("**/bin/*") { mode = 0b111101101 } + filesMatching("**/bin/*.bat") { mode = 0b110100100 } } val zipCompiler by task { + dependsOn(dist) destinationDir = file(distDir) archiveName = "kotlin-compiler-$kotlinVersion.zip" - from(distKotlinHomeDir) { - into("kotlinc") - compilerScriptPermissionsSpec() - } + + from(distKotlinHomeDir) + into("kotlinc") + setExecutablePermissions() + doLast { logger.lifecycle("Compiler artifacts packed to $archivePath") } @@ -561,15 +567,35 @@ val zipPlugin by task { doFirst { if (destPath == null) throw GradleException("Specify target zip path with 'pluginZipPath' property") } - into("Kotlin") { - from("$src/kotlinc") { - into("kotlinc") - compilerScriptPermissionsSpec() - } - from(src) { - exclude("kotlinc") - } + + from(src) + into("Kotlin") + setExecutablePermissions() + + doLast { + logger.lifecycle("Plugin artifacts packed to $archivePath") } +} + +val cidrPlugin by task { + dependsOn(ideaPlugin) + into(cidrPluginDir) + from(ideaPluginDir) { exclude("lib/kotlin-plugin.jar") } + from(cidrKotlinPlugin) { into("lib") } +} + +val zipCidrPlugin by task { + val destPath = project.findProperty("pluginZipPath") as String? + ?: "$distDir/artifacts/kotlin-plugin-$kotlinVersion-CIDR" + val destFile = File(destPath) + + destinationDir = destFile.parentFile + archiveName = destFile.name + + from(cidrPlugin) + into("Kotlin") + setExecutablePermissions() + doLast { logger.lifecycle("Plugin artifacts packed to $archivePath") }