diff --git a/TeamCityBuild.xml b/TeamCityBuild.xml
index 1241f998ccb..eb9ba42dd99 100644
--- a/TeamCityBuild.xml
+++ b/TeamCityBuild.xml
@@ -41,6 +41,7 @@
+
+
@@ -63,11 +65,11 @@
-
+
-
+
@@ -75,17 +77,11 @@
-
+
-
-
-
-
-
-
-
+
@@ -118,42 +114,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/build.gradle.kts b/build.gradle.kts
index 1d3c225b5f4..405e584ef6d 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -507,83 +507,59 @@ tasks {
"check" { dependsOn("test") }
}
-// TODO: copied from build.xml (used on TC), reconsider location and dependencies after complete migration
-val `zip-compiler` by task {
+fun CopySpec.compilerScriptPermissionsSpec() {
+ filesMatching("bin/*") { mode = 0b111101101 }
+ filesMatching("bin/*.bat") { mode = 0b110100100 }
+}
+
+val zipCompiler by task {
destinationDir = file(distDir)
archiveName = "kotlin-compiler-$kotlinVersion.zip"
from(distKotlinHomeDir) {
- exclude("bin/**")
into("kotlinc")
+ compilerScriptPermissionsSpec()
}
- from("$distKotlinHomeDir/bin") {
- include("*.bat")
- into("kotlinc/bin")
- fileMode = 0b110100100
- }
- from("$distKotlinHomeDir/bin") {
- exclude("*.bat")
- into("kotlinc/bin")
- fileMode = 0b111101101
+ doLast {
+ logger.lifecycle("Compiler artifacts packed to $archivePath")
}
}
-// TODO: copied from build.xml (used on TC), reconsider location and dependencies after complete migration
-val `zip-test-data` by task {
+val zipTestData by task {
destinationDir = file(distDir)
archiveName = "kotlin-test-data.zip"
from("compiler/testData") { into("compiler") }
from("idea/testData") { into("ide") }
from("idea/idea-completion/testData") { into("ide/completion") }
+ doLast {
+ logger.lifecycle("Test data packed to $archivePath")
+ }
}
-// TODO: copied from TeamCityBuild.xml (excluding some parts), consider implementing patching in the appropriate projects
-
-val pluginXmlDir = "$rootDir/idea/src/META-INF"
-val pluginXmlPath = "$pluginXmlDir/plugin.xml"
-val pluginXmlBackupDir = "$buildDir/plugin_xml_backup"
-val pluginXmlBackupPath = "$pluginXmlBackupDir/plugin.xml"
-
-val backupTemplateFile by task {
- from(pluginXmlPath)
- into(pluginXmlBackupDir)
-}
-
-val writePluginVersionToTemplateFile by task {
- dependsOn(backupTemplateFile)
- from(pluginXmlBackupPath)
- into(pluginXmlDir)
- filter { it.replace("@snapshot@", "$buildNumber") }
-}
-
-val restoreTemplateFile by task {
- from(pluginXmlBackupPath)
- into(pluginXmlDir)
-}
-
-val revertTemplateFiles by task {
- dependsOn(restoreTemplateFile)
- delete(pluginXmlBackupDir)
-}
-
-// TODO: copied from build.xml (used on TC), reconsider location, logic and dependencies after complete migration
-val zipArtifacts by task {
- val dest = File(System.getProperty("plugin.zip") ?: "$distDir/artifacts/kotlin-plugin-$buildNumber.zip")
- val src = System.getProperty("pluginArtifactDir") ?: ideaPluginDir
+val zipPlugin by task {
+ val src = when (project.findProperty("pluginArtifactDir") as String?) {
+ "Kotlin" -> ideaPluginDir
+ "KotlinUltimate" -> ideaUltimatePluginDir
+ null -> if (project.hasProperty("ultimate")) ideaUltimatePluginDir else ideaPluginDir
+ else -> error("Unsupported plugin artifact dir")
+ }
+ val destPath = project.findProperty("pluginZipPath") as String?
+ val dest = File(destPath ?: "$buildDir/kotlin-plugin.zip")
destinationDir = dest.parentFile
archiveName = dest.name
- from(src) {
- exclude("kotlinc/bin/**")
- into("Kotlin")
+ doFirst {
+ if (destPath == null) throw GradleException("Specify target zip path with 'pluginZipPath' property")
}
- from("$src/kotlinc/bin") {
- include("*.bat")
- into("Kotlin/kotlinc/bin")
- fileMode = 0b110100100
+ into("Kotlin") {
+ from("$src/kotlinc") {
+ into("kotlinc")
+ compilerScriptPermissionsSpec()
+ }
+ from(src) {
+ exclude("kotlinc")
+ }
}
- from("$src/kotlinc/bin") {
- exclude("*.bat")
- into("Kotlin/kotlinc/bin")
- fileMode = 0b111101101
+ doLast {
+ logger.lifecycle("Plugin artifacts packed to $archivePath")
}
}
diff --git a/prepare/build.version/build.gradle.kts b/prepare/build.version/build.gradle.kts
index d283d96e858..4d90c2a3d7b 100644
--- a/prepare/build.version/build.gradle.kts
+++ b/prepare/build.version/build.gradle.kts
@@ -52,6 +52,20 @@ val writeCompilerVersion by tasks.creating {
}
}
+val writePluginVersion by tasks.creating {
+ val versionFile = project(":idea").projectDir.resolve("src/META-INF/plugin.xml")
+ val pluginVersion = rootProject.findProperty("pluginVersion") as String?
+ inputs.property("version", pluginVersion)
+ outputs.file(versionFile)
+ doLast {
+ requireNotNull(pluginVersion) { "Specify 'pluginVersion' property" }
+ replaceVersion(versionFile, """([^<]+)""") {
+ logger.lifecycle("Writing new plugin version: $pluginVersion")
+ pluginVersion!!
+ }
+ }
+}
+
val writeVersions by tasks.creating {
dependsOn(writeBuildNumber, writeStdlibVersion, writeCompilerVersion)
}