diff --git a/build.gradle.kts b/build.gradle.kts index ec6676beb13..e2e7b1dc407 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -101,8 +101,8 @@ val appcodeSandboxDir = "$commonLocalDataDir/appcodeSandbox" val ideaPluginDir = "$distDir/artifacts/ideaPlugin/Kotlin" val ideaUltimatePluginDir = "$distDir/artifacts/ideaUltimatePlugin/Kotlin" val cidrPluginDir = "$distDir/artifacts/cidrPlugin/Kotlin" -val appcodePluginDir = "$distDir/artifacts/appcodePlugin/kotlinNative-appcode" -val clionPluginDir = "$distDir/artifacts/clionPlugin/kotlinNative-clion" +val appcodePluginDir = "$distDir/artifacts/appcodePlugin/Kotlin" +val clionPluginDir = "$distDir/artifacts/clionPlugin/Kotlin" // TODO: use "by extra()" syntax where possible extra["distLibDir"] = project.file(distLibDir) @@ -682,9 +682,11 @@ fun cidrPlugin(product: String, pluginDir: String) = tasks.creating(Copy::class. from(configurations[product.toLowerCase() + "KotlinPlugin"]) { into("lib") } } -fun zipCidrPlugin(product: String) = tasks.creating(Zip::class.java) { +fun zipCidrPlugin(product: String, productVersion: String) = tasks.creating(Zip::class.java) { + // Note: "cidrPluginVersion" has different format and semantics from "pluginVersion" used in IJ and AS plugins. + val cidrPluginVersion = project.findProperty("cidrPluginVersion") as String? ?: "beta-1" val destPath = project.findProperty("pluginZipPath") as String? - ?: "$distDir/artifacts/kotlinNative-plugin-$kotlinVersion-$product.zip" + ?: "$distDir/artifacts/kotlin-plugin-$kotlinVersion-$product-$cidrPluginVersion-$productVersion.zip" val destFile = File(destPath) destinationDir = destFile.parentFile @@ -701,10 +703,12 @@ fun zipCidrPlugin(product: String) = tasks.creating(Zip::class.java) { if (includeCidr) { val appcodePlugin by cidrPlugin("AppCode", appcodePluginDir) - val zipAppCodePlugin by zipCidrPlugin("AppCode") + val appcodeVersion = extra["versions.appcode"] as String + val zipAppCodePlugin by zipCidrPlugin("AppCode", appcodeVersion) val clionPlugin by cidrPlugin("CLion", clionPluginDir) - val zipCLionPlugin by zipCidrPlugin("CLion") + val clionVersion = extra["versions.clion"] as String + val zipCLionPlugin by zipCidrPlugin("CLion", clionVersion) } configure { diff --git a/prepare/cidr-plugin/build.gradle.kts b/prepare/cidr-plugin/build.gradle.kts index c0e49da42b2..f23ed76d8b1 100644 --- a/prepare/cidr-plugin/build.gradle.kts +++ b/prepare/cidr-plugin/build.gradle.kts @@ -20,11 +20,6 @@ dependencies { } val pluginXml by tasks.creating { - val kotlinVersion: String by rootProject.extra - val pluginFullVersionNumber = findProperty("pluginVersion") as? String - ?: "$kotlinVersion-CIDR" - - inputs.property("pluginFullVersionNumber", pluginFullVersionNumber) inputs.files(kotlinPlugin) outputs.files(fileFrom(buildDir, name, pluginXmlPath)) @@ -37,6 +32,8 @@ val pluginXml by tasks.creating { """(.*?)""", RegexOption.DOT_MATCHES_ALL) + val ideaVersionRegex = Regex("""]+/>""".trimMargin()) + val versionRegex = Regex("""([^<]+)""") zipTree(inputs.files.singleFile) @@ -45,7 +42,8 @@ val pluginXml by tasks.creating { .readText() .replace(placeholderRegex, "com.intellij.modules.cidr.lang") .replace(excludeRegex, "") - .replace(versionRegex, "$pluginFullVersionNumber") + .replace(ideaVersionRegex, "") // IDEA version to be specified in CLion or AppCode plugin.xml file. + .replace(versionRegex, "") // Version to be specified in CLion or AppCode plugin.xml file. .also { pluginXmlText -> outputs.files.singleFile.writeText(pluginXmlText) } diff --git a/prepare/clion-plugin/build.gradle.kts b/prepare/clion-plugin/build.gradle.kts index 0469e68818d..31ea5d0911c 100644 --- a/prepare/clion-plugin/build.gradle.kts +++ b/prepare/clion-plugin/build.gradle.kts @@ -20,6 +20,8 @@ repositories { } } +val kotlinVersion = rootProject.extra["kotlinVersion"] as String + val cidrPluginDir: File by rootProject.extra val clionPluginDir: File by rootProject.extra val clionVersion = rootProject.extra["versions.clion"] as String @@ -61,7 +63,12 @@ val kotlinPluginXml by tasks.creating { val preparePluginXml by task { dependsOn(":kotlin-ultimate:clion-native:assemble") - inputs.property("versions.clion", clionVersion) + + val cidrPluginVersion = project.findProperty("cidrPluginVersion") as String? ?: "beta-1" + val clionPluginVersion = "$kotlinVersion-CLion-$cidrPluginVersion-$clionVersion" + + inputs.property("clionPluginVersion", clionPluginVersion) + from(project(":kotlin-ultimate:clion-native").mainSourceSet.output.resourcesDir) { include(pluginXmlPath) } into(pluginXmlLocation) @@ -70,8 +77,11 @@ val preparePluginXml by task { val untilBuild = clionVersion.substring(0, clionVersion.lastIndexOf('.')) + ".*" filter { - it.replace("", - "") + it + .replace("", + "") + .replace("", + "$clionPluginVersion") } }