CIDR: New way of building CLion and AppCode plugins
- Move `prepare/cidr-plugin`, `prepare/clion-plugin` and `prepare/appcode-plugin` modules from `kotlin` to `kotlin-ultimate` project - Move `versions.clion.*` and `versions.appcode.*` properties from `kotlin` to `kotlin-ultimate` project - Drop `cidr183` bunch in `kotlin` project - Drop useless `cidrPluginDir`, `clionPluginDir`, `clionSandboxDir`, `appcodePluginDir`, `appcodeSandboxDir` Gradle properties in `kotlin` project - Drop `cidrPlugin` Gradle task in `kotlin` project - Total: Add ability to build `kotlin-ultimate` both as part of multi-project build with `kotlin` project, and as a standalone build
This commit is contained in:
+9
-90
@@ -29,6 +29,11 @@ buildscript {
|
||||
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
|
||||
classpath("net.sf.proguard:proguard-gradle:6.0.3")
|
||||
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
|
||||
|
||||
// a workaround to add another one buildSrc with Cidr-specific tools to Gradle classpath
|
||||
if (findProperty("cidrPluginsEnabled")?.toString()?.toBoolean() == true) {
|
||||
classpath("org.jetbrains.kotlin.ultimate:buildSrc:1.0")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,21 +78,8 @@ allprojects {
|
||||
|
||||
extra["kotlin_root"] = rootDir
|
||||
|
||||
val cidrKotlinPlugin by configurations.creating
|
||||
val appcodeKotlinPlugin by configurations.creating
|
||||
val clionKotlinPlugin by configurations.creating
|
||||
|
||||
val includeCidr by extra(project.getBooleanProperty("cidrPluginsEnabled") ?: false)
|
||||
val jpsBootstrap by configurations.creating
|
||||
|
||||
dependencies {
|
||||
if (includeCidr) {
|
||||
cidrKotlinPlugin(project(":prepare:cidr-plugin", "runtimeJar"))
|
||||
appcodeKotlinPlugin(project(":prepare:appcode-plugin", "runtimeJar"))
|
||||
clionKotlinPlugin(project(":prepare:clion-plugin", "runtimeJar"))
|
||||
}
|
||||
}
|
||||
|
||||
val commonBuildDir = File(rootDir, "build")
|
||||
val distDir by extra("$rootDir/dist")
|
||||
val distKotlinHomeDir by extra("$distDir/kotlinc")
|
||||
@@ -95,13 +87,9 @@ val distLibDir = "$distKotlinHomeDir/lib"
|
||||
val commonLocalDataDir = "$rootDir/local"
|
||||
val ideaSandboxDir = "$commonLocalDataDir/ideaSandbox"
|
||||
val ideaUltimateSandboxDir = "$commonLocalDataDir/ideaUltimateSandbox"
|
||||
val clionSandboxDir = "$commonLocalDataDir/clionSandbox"
|
||||
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/Kotlin"
|
||||
val clionPluginDir = "$distDir/artifacts/clionPlugin/Kotlin"
|
||||
val artifactsDir = "$distDir/artifacts"
|
||||
val ideaPluginDir = "$artifactsDir/ideaPlugin/Kotlin"
|
||||
val ideaUltimatePluginDir = "$artifactsDir/ideaUltimatePlugin/Kotlin"
|
||||
|
||||
// TODO: use "by extra()" syntax where possible
|
||||
extra["distLibDir"] = project.file(distLibDir)
|
||||
@@ -109,13 +97,8 @@ extra["libsDir"] = project.file(distLibDir)
|
||||
extra["commonLocalDataDir"] = project.file(commonLocalDataDir)
|
||||
extra["ideaSandboxDir"] = project.file(ideaSandboxDir)
|
||||
extra["ideaUltimateSandboxDir"] = project.file(ideaUltimateSandboxDir)
|
||||
extra["clionSandboxDir"] = project.file(ideaSandboxDir)
|
||||
extra["appcodeSandboxDir"] = project.file(ideaSandboxDir)
|
||||
extra["ideaPluginDir"] = project.file(ideaPluginDir)
|
||||
extra["ideaUltimatePluginDir"] = project.file(ideaUltimatePluginDir)
|
||||
extra["cidrPluginDir"] = project.file(cidrPluginDir)
|
||||
extra["appcodePluginDir"] = project.file(appcodePluginDir)
|
||||
extra["clionPluginDir"] = project.file(clionPluginDir)
|
||||
extra["isSonatypeRelease"] = false
|
||||
|
||||
// Work-around necessary to avoid setting null javaHome. Will be removed after support of lazy task configuration
|
||||
@@ -448,11 +431,7 @@ tasks {
|
||||
|
||||
create("cleanupArtifacts") {
|
||||
doLast {
|
||||
delete(ideaPluginDir)
|
||||
delete(ideaUltimatePluginDir)
|
||||
delete(cidrPluginDir)
|
||||
delete(appcodePluginDir)
|
||||
delete(clionPluginDir)
|
||||
delete(artifactsDir)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -664,66 +643,6 @@ val zipPlugin by task<Zip> {
|
||||
}
|
||||
}
|
||||
|
||||
fun cidrPlugin(product: String, pluginDir: String) = tasks.creating(Copy::class.java) {
|
||||
if (!includeCidr) {
|
||||
throw GradleException("CIDR plugins require 'cidrPluginsEnabled' property turned on")
|
||||
}
|
||||
val prepareCidrPlugin = getTasksByName("cidrPlugin", true)
|
||||
val prepareCurrentPlugin = (getTasksByName(product.toLowerCase() + "Plugin", true) - this)
|
||||
prepareCurrentPlugin.forEach { it.mustRunAfter(prepareCidrPlugin) }
|
||||
|
||||
dependsOn(ideaPlugin)
|
||||
dependsOn(prepareCidrPlugin)
|
||||
dependsOn(prepareCurrentPlugin)
|
||||
|
||||
into(pluginDir)
|
||||
from(ideaPluginDir) {
|
||||
exclude("lib/kotlin-plugin.jar")
|
||||
|
||||
exclude("lib/android-lint.jar")
|
||||
exclude("lib/android-ide.jar")
|
||||
exclude("lib/android-output-parser-ide.jar")
|
||||
exclude("lib/android-extensions-ide.jar")
|
||||
exclude("lib/android-extensions-compiler.jar")
|
||||
exclude("lib/kapt3-idea.jar")
|
||||
exclude("lib/jps-ide.jar")
|
||||
exclude("lib/jps/**")
|
||||
exclude("kotlinc/**")
|
||||
exclude("lib/maven-ide.jar")
|
||||
}
|
||||
from(cidrKotlinPlugin) { into("lib") }
|
||||
from(configurations[product.toLowerCase() + "KotlinPlugin"]) { into("lib") }
|
||||
}
|
||||
|
||||
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/kotlin-plugin-$kotlinVersion-$product-$cidrPluginVersion-$productVersion.zip"
|
||||
val destFile = File(destPath)
|
||||
|
||||
destinationDir = destFile.parentFile
|
||||
archiveName = destFile.name
|
||||
|
||||
from(tasks[product.toLowerCase() + "Plugin"])
|
||||
into("Kotlin")
|
||||
setExecutablePermissions()
|
||||
|
||||
doLast {
|
||||
logger.lifecycle("Plugin artifacts packed to $archivePath")
|
||||
}
|
||||
}
|
||||
|
||||
if (includeCidr) {
|
||||
val appcodePlugin by cidrPlugin("AppCode", appcodePluginDir)
|
||||
val appcodeVersion = extra["versions.appcode"] as String
|
||||
val zipAppCodePlugin by zipCidrPlugin("AppCode", appcodeVersion)
|
||||
|
||||
val clionPlugin by cidrPlugin("CLion", clionPluginDir)
|
||||
val clionVersion = extra["versions.clion"] as String
|
||||
val zipCLionPlugin by zipCidrPlugin("CLion", clionVersion)
|
||||
}
|
||||
|
||||
configure<IdeaModel> {
|
||||
module {
|
||||
excludeDirs = files(
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.cidr
|
||||
|
||||
import org.gradle.api.tasks.Copy
|
||||
import org.gradle.api.tasks.bundling.Zip
|
||||
import java.util.regex.Pattern
|
||||
|
||||
fun Zip.includePatched(fileToMarkers: Map<String, List<String>>) {
|
||||
val notDone = mutableSetOf<Pair<String, String>>()
|
||||
fileToMarkers.forEach { (path, markers) ->
|
||||
for (marker in markers) {
|
||||
notDone += path to marker
|
||||
}
|
||||
}
|
||||
|
||||
eachFile {
|
||||
val markers = fileToMarkers[this.sourcePath] ?: return@eachFile
|
||||
this.filter {
|
||||
var data = it
|
||||
for (marker in markers) {
|
||||
val newData = data.replace(("^(.*" + Pattern.quote(marker) + ".*)$").toRegex(), "<!-- $1 -->")
|
||||
data = newData
|
||||
notDone -= path to marker
|
||||
}
|
||||
data
|
||||
}
|
||||
}
|
||||
doLast {
|
||||
check(notDone.size == 0) {
|
||||
"Filtering failed for: " +
|
||||
notDone.joinToString(separator = "\n") { (file, marker) -> "file=$file, marker=`$marker`" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Zip.includePatchedJavaXmls() {
|
||||
val javaPsiXmlPath = "META-INF/JavaPsiPlugin.xml"
|
||||
val javaPluginXmlPath = "META-INF/JavaPlugin.xml"
|
||||
|
||||
includePatched(
|
||||
mapOf(
|
||||
javaPsiXmlPath to listOf("implementation=\"org.jetbrains.uast.java.JavaUastLanguagePlugin\""),
|
||||
javaPluginXmlPath to listOf("implementation=\"com.intellij.spi.SPIFileTypeFactory\"")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fun Copy.applyCidrVersionRestrictions(
|
||||
productVersion: String,
|
||||
strictProductVersionLimitation: Boolean,
|
||||
pluginVersion: String
|
||||
) {
|
||||
val dotsCount = productVersion.count { it == '.' }
|
||||
check(dotsCount in 1..2) {
|
||||
"Wrong CIDR product version format: $productVersion"
|
||||
}
|
||||
|
||||
// private product versions don't have two dots
|
||||
val privateProductVersion = dotsCount == 1
|
||||
|
||||
val applyStrictProductVersionLimitation = if (privateProductVersion && strictProductVersionLimitation) {
|
||||
// it does not make sense for private versions to apply strict version limitation
|
||||
logger.warn("Non-public CIDR product version [$productVersion] has been specified. The corresponding `versions.<product>.strict` property will be ignored.")
|
||||
false
|
||||
} else strictProductVersionLimitation
|
||||
|
||||
val sinceBuild = if (privateProductVersion)
|
||||
productVersion
|
||||
else
|
||||
productVersion.substringBeforeLast('.')
|
||||
|
||||
val untilBuild = if (applyStrictProductVersionLimitation)
|
||||
// if `strict` then restrict plugin to the same single version of CLion or AppCode
|
||||
"$sinceBuild.*"
|
||||
else
|
||||
productVersion.substringBefore('.') + ".*"
|
||||
|
||||
filter {
|
||||
it
|
||||
.replace("<!--idea_version_placeholder-->",
|
||||
"<idea-version since-build=\"$sinceBuild\" until-build=\"$untilBuild\"/>")
|
||||
.replace("<!--version_placeholder-->",
|
||||
"<version>$pluginVersion</version>")
|
||||
}
|
||||
}
|
||||
@@ -10,3 +10,5 @@ kotlin.compiler.newInferenceEnabled=true
|
||||
#signingRequired=true
|
||||
|
||||
#jpsBuild=true
|
||||
|
||||
#cidrPluginsEnabled=true
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m -Dfile.encoding=UTF-8
|
||||
|
||||
cacheRedirectorEnabled=true
|
||||
|
||||
kotlin.compiler.effectSystemEnabled=true
|
||||
kotlin.compiler.newInferenceEnabled=true
|
||||
#maven.repository.mirror=http://repository.jetbrains.com/remote-repos/
|
||||
#bootstrap.kotlin.repo=https://dl.bintray.com/kotlin/kotlin-dev
|
||||
#bootstrap.kotlin.version=1.1.50-dev-1451
|
||||
#signingRequired=true
|
||||
|
||||
cidrPluginsEnabled=true
|
||||
@@ -1,22 +0,0 @@
|
||||
versions.intellijSdk=183.5153.4
|
||||
versions.androidBuildTools=r23.0.1
|
||||
versions.idea.NodeJS=181.3494.12
|
||||
# TODO: select appropriate 183 base build for AppCode
|
||||
versions.appcode=191.5488
|
||||
versions.appcode.strict=false
|
||||
versions.appcode.repo=ijplatform_master_CIDR_AppCode_Installers
|
||||
versions.clion=183.5153.40
|
||||
versions.clion.strict=false
|
||||
versions.clion.repo=ijplatform_IjPlatform183_Cidr_CLion_PublicInstallers
|
||||
versions.jar.guava=25.1-jre
|
||||
versions.jar.groovy-all=2.4.15
|
||||
versions.jar.lombok-ast=0.2.3
|
||||
versions.jar.swingx-core=1.6.2-2
|
||||
versions.jar.kxml2=2.3.0
|
||||
versions.jar.streamex=0.6.7
|
||||
versions.jar.gson=2.8.5
|
||||
versions.jar.oro=2.0.8
|
||||
versions.jar.picocontainer=1.2
|
||||
versions.jar.asm-all=7.0
|
||||
ignore.jar.snappy-in-java=true
|
||||
versions.gradle-api=4.5.1
|
||||
@@ -17,10 +17,6 @@ dependencies {
|
||||
|
||||
val ideaPluginDir: File by rootProject.extra
|
||||
val ideaSandboxDir: File by rootProject.extra
|
||||
val clionPluginDir: File by rootProject.extra
|
||||
val clionSandboxDir: File by rootProject.extra
|
||||
val appcodePluginDir: File by rootProject.extra
|
||||
val appcodeSandboxDir: File by rootProject.extra
|
||||
|
||||
runIdeTask("runIde", ideaPluginDir, ideaSandboxDir) {
|
||||
dependsOn(":dist", ":ideaPlugin")
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import com.github.jk1.tcdeps.KotlinScriptDslAdapter.teamcityServer
|
||||
import com.github.jk1.tcdeps.KotlinScriptDslAdapter.tc
|
||||
import org.gradle.kotlin.dsl.support.zipTo
|
||||
import org.jetbrains.kotlin.cidr.includePatchedJavaXmls
|
||||
import org.jetbrains.kotlin.cidr.applyCidrVersionRestrictions
|
||||
|
||||
apply {
|
||||
plugin("kotlin")
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("com.github.jk1.tcdeps") version "0.17"
|
||||
}
|
||||
|
||||
repositories {
|
||||
teamcityServer {
|
||||
setUrl("http://buildserver.labs.intellij.net")
|
||||
credentials {
|
||||
username = "guest"
|
||||
password = "guest"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val kotlinVersion = rootProject.extra["kotlinVersion"] as String
|
||||
|
||||
val cidrPluginDir: File by rootProject.extra
|
||||
val appcodePluginDir: File by rootProject.extra
|
||||
val appcodeVersion = rootProject.extra["versions.appcode"] as String
|
||||
val appcodeVersionStrict = (rootProject.extra["versions.appcode.strict"] as String).toBoolean()
|
||||
val appcodeVersionRepo = rootProject.extra["versions.appcode.repo"] as String
|
||||
|
||||
val cidrPlugin by configurations.creating
|
||||
val platformDepsZip by configurations.creating
|
||||
|
||||
val pluginXmlPath = "META-INF/plugin.xml"
|
||||
|
||||
val platformDepsJarName = "kotlinNative-platformDeps.jar"
|
||||
val pluginXmlLocation = File(buildDir, "pluginXml")
|
||||
|
||||
// Do not rename, used in pill importer
|
||||
val projectsToShadow by extra(listOf(
|
||||
":kotlin-ultimate:cidr-native",
|
||||
":kotlin-ultimate:appcode-native"))
|
||||
|
||||
|
||||
dependencies {
|
||||
cidrPlugin(project(":prepare:cidr-plugin"))
|
||||
platformDepsZip(tc("$appcodeVersionRepo:$appcodeVersion:OC-plugins/kotlinNative-platformDeps-$appcodeVersion.zip"))
|
||||
}
|
||||
|
||||
val kotlinPluginXml by tasks.creating {
|
||||
inputs.files(cidrPlugin)
|
||||
outputs.files(fileFrom(buildDir, name, "META-INF/KotlinPlugin.xml"))
|
||||
|
||||
doFirst {
|
||||
val pluginXmlText = zipTree(inputs.files.singleFile)
|
||||
.matching { include(pluginXmlPath) }
|
||||
.singleFile
|
||||
.readText()
|
||||
outputs.files.singleFile.writeText(pluginXmlText)
|
||||
}
|
||||
}
|
||||
|
||||
val preparePluginXml by task<Copy> {
|
||||
dependsOn(":kotlin-ultimate:appcode-native:assemble")
|
||||
|
||||
val cidrPluginVersion = project.findProperty("cidrPluginVersion") as String? ?: "beta-1"
|
||||
val appcodePluginVersion = "$kotlinVersion-AppCode-$cidrPluginVersion-$appcodeVersion"
|
||||
|
||||
inputs.property("appcodePluginVersion", appcodePluginVersion)
|
||||
outputs.files(pluginXmlLocation)
|
||||
|
||||
from(project(":kotlin-ultimate:appcode-native").mainSourceSet.output.resourcesDir) { include(pluginXmlPath) }
|
||||
into(pluginXmlLocation)
|
||||
|
||||
applyCidrVersionRestrictions(appcodeVersion, appcodeVersionStrict, appcodePluginVersion)
|
||||
}
|
||||
|
||||
val jar = runtimeJar {
|
||||
archiveName = "kotlin-plugin.jar"
|
||||
dependsOn(cidrPlugin)
|
||||
dependsOn(preparePluginXml)
|
||||
from(kotlinPluginXml) { into("META-INF") }
|
||||
|
||||
from {
|
||||
zipTree(cidrPlugin.singleFile).matching {
|
||||
exclude(pluginXmlPath)
|
||||
}
|
||||
}
|
||||
|
||||
for (p in projectsToShadow) {
|
||||
dependsOn("$p:classes")
|
||||
from(getSourceSetsFrom(p)["main"].output) {
|
||||
exclude(pluginXmlPath)
|
||||
}
|
||||
}
|
||||
from(pluginXmlLocation) { include(pluginXmlPath) }
|
||||
}
|
||||
|
||||
val platformDepsJar by task<Zip> {
|
||||
archiveName = platformDepsJarName
|
||||
val platformDepsJar = zipTree(platformDepsZip.singleFile).matching { include("**/$platformDepsJarName") }.singleFile
|
||||
from(zipTree(platformDepsJar)) {
|
||||
exclude(pluginXmlPath)
|
||||
includePatchedJavaXmls()
|
||||
}
|
||||
}
|
||||
|
||||
task<Copy>("appcodePlugin") {
|
||||
into(appcodePluginDir)
|
||||
from(cidrPluginDir) { exclude("lib/kotlin-plugin.jar") }
|
||||
into("lib") {
|
||||
from(jar)
|
||||
from(platformDepsJar)
|
||||
from(zipTree(platformDepsZip.singleFile).files) {
|
||||
exclude("**/$platformDepsJarName")
|
||||
}
|
||||
}
|
||||
into("templates") {
|
||||
from(File(project(":kotlin-ultimate:appcode-native").projectDir, "templates"))
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import groovy.lang.Closure
|
||||
import java.io.FilterReader
|
||||
|
||||
description = "Kotlin AppCode & CLion plugin"
|
||||
|
||||
apply {
|
||||
plugin("kotlin")
|
||||
}
|
||||
|
||||
val ideaPluginDir: File by rootProject.extra
|
||||
val cidrPluginDir: File by rootProject.extra
|
||||
|
||||
val kotlinPlugin by configurations.creating
|
||||
|
||||
val pluginXmlPath = "META-INF/plugin.xml"
|
||||
|
||||
dependencies {
|
||||
kotlinPlugin(project(":prepare:idea-plugin", configuration = "runtimeJar"))
|
||||
}
|
||||
|
||||
val pluginXml by tasks.creating {
|
||||
inputs.files(kotlinPlugin)
|
||||
outputs.files(fileFrom(buildDir, name, pluginXmlPath))
|
||||
|
||||
doFirst {
|
||||
val placeholderRegex = Regex(
|
||||
"""<!-- CIDR-PLUGIN-PLACEHOLDER-START -->(.*)<!-- CIDR-PLUGIN-PLACEHOLDER-END -->""",
|
||||
RegexOption.DOT_MATCHES_ALL)
|
||||
|
||||
val excludeRegex = Regex(
|
||||
"""<!-- CIDR-PLUGIN-EXCLUDE-START -->(.*?)<!-- CIDR-PLUGIN-EXCLUDE-END -->""",
|
||||
RegexOption.DOT_MATCHES_ALL)
|
||||
|
||||
val ideaVersionRegex = Regex("""<idea-version[^/>]+/>""".trimMargin())
|
||||
|
||||
val versionRegex = Regex("""<version>([^<]+)</version>""")
|
||||
|
||||
zipTree(inputs.files.singleFile)
|
||||
.matching { include(pluginXmlPath) }
|
||||
.singleFile
|
||||
.readText()
|
||||
.replace(placeholderRegex, "<depends>com.intellij.modules.cidr.lang</depends>")
|
||||
.replace(excludeRegex, "")
|
||||
.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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val jar = runtimeJar {
|
||||
archiveName = "kotlin-plugin.jar"
|
||||
dependsOn(kotlinPlugin)
|
||||
from {
|
||||
zipTree(kotlinPlugin.singleFile).matching {
|
||||
exclude(pluginXmlPath)
|
||||
}
|
||||
}
|
||||
from(pluginXml) { into("META-INF") }
|
||||
}
|
||||
|
||||
task<Copy>("cidrPlugin") {
|
||||
into(cidrPluginDir)
|
||||
from(jar) { into("lib") }
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
import com.github.jk1.tcdeps.KotlinScriptDslAdapter.teamcityServer
|
||||
import com.github.jk1.tcdeps.KotlinScriptDslAdapter.tc
|
||||
import org.jetbrains.kotlin.cidr.includePatchedJavaXmls
|
||||
import org.jetbrains.kotlin.cidr.applyCidrVersionRestrictions
|
||||
|
||||
apply {
|
||||
plugin("kotlin")
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("com.github.jk1.tcdeps") version "0.17"
|
||||
}
|
||||
|
||||
repositories {
|
||||
teamcityServer {
|
||||
setUrl("http://buildserver.labs.intellij.net")
|
||||
credentials {
|
||||
username = "guest"
|
||||
password = "guest"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
val clionVersionStrict = (rootProject.extra["versions.clion.strict"] as String).toBoolean()
|
||||
val clionVersionRepo = rootProject.extra["versions.clion.repo"] as String
|
||||
|
||||
val cidrPlugin by configurations.creating
|
||||
val platformDepsZip by configurations.creating
|
||||
|
||||
val pluginXmlPath = "META-INF/plugin.xml"
|
||||
|
||||
val platformDepsJarName = "kotlinNative-platformDeps.jar"
|
||||
val pluginXmlLocation = File(buildDir, "pluginXml")
|
||||
|
||||
// Do not rename, used in pill importer
|
||||
val projectsToShadow by extra(listOf(
|
||||
":kotlin-ultimate:cidr-native",
|
||||
":kotlin-ultimate:clion-native"))
|
||||
|
||||
|
||||
dependencies {
|
||||
cidrPlugin(project(":prepare:cidr-plugin"))
|
||||
platformDepsZip(tc("$clionVersionRepo:$clionVersion:CL-plugins/kotlinNative-platformDeps-$clionVersion.zip"))
|
||||
}
|
||||
|
||||
val kotlinPluginXml by tasks.creating {
|
||||
inputs.files(cidrPlugin)
|
||||
outputs.files(fileFrom(buildDir, name, "META-INF/KotlinPlugin.xml"))
|
||||
|
||||
doFirst {
|
||||
val pluginXmlText = zipTree(inputs.files.singleFile)
|
||||
.matching { include(pluginXmlPath) }
|
||||
.singleFile
|
||||
.readText()
|
||||
outputs.files.singleFile.writeText(pluginXmlText)
|
||||
}
|
||||
}
|
||||
|
||||
val preparePluginXml by task<Copy> {
|
||||
dependsOn(":kotlin-ultimate:clion-native:assemble")
|
||||
|
||||
val cidrPluginVersion = project.findProperty("cidrPluginVersion") as String? ?: "beta-1"
|
||||
val clionPluginVersion = "$kotlinVersion-CLion-$cidrPluginVersion-$clionVersion"
|
||||
|
||||
inputs.property("clionPluginVersion", clionPluginVersion)
|
||||
outputs.files(pluginXmlLocation)
|
||||
|
||||
from(project(":kotlin-ultimate:clion-native").mainSourceSet.output.resourcesDir) { include(pluginXmlPath) }
|
||||
into(pluginXmlLocation)
|
||||
|
||||
applyCidrVersionRestrictions(clionVersion, clionVersionStrict, clionPluginVersion)
|
||||
}
|
||||
|
||||
val jar = runtimeJar {
|
||||
archiveName = "kotlin-plugin.jar"
|
||||
dependsOn(cidrPlugin)
|
||||
dependsOn(preparePluginXml)
|
||||
from(kotlinPluginXml) { into("META-INF") }
|
||||
|
||||
from {
|
||||
zipTree(cidrPlugin.singleFile).matching {
|
||||
exclude(pluginXmlPath)
|
||||
}
|
||||
}
|
||||
|
||||
for (p in projectsToShadow) {
|
||||
dependsOn("$p:classes")
|
||||
from(getSourceSetsFrom(p)["main"].output) {
|
||||
exclude(pluginXmlPath)
|
||||
}
|
||||
}
|
||||
from(pluginXmlLocation) { include(pluginXmlPath) }
|
||||
}
|
||||
|
||||
val platformDepsJar by task<Zip> {
|
||||
archiveName = platformDepsJarName
|
||||
val platformDepsJar = zipTree(platformDepsZip.singleFile).matching { include("**/$platformDepsJarName") }.singleFile
|
||||
from(zipTree(platformDepsJar)) {
|
||||
exclude(pluginXmlPath)
|
||||
includePatchedJavaXmls()
|
||||
}
|
||||
}
|
||||
|
||||
task<Copy>("clionPlugin") {
|
||||
into(clionPluginDir)
|
||||
from(cidrPluginDir) { exclude("lib/kotlin-plugin.jar") }
|
||||
from(jar) { into("lib") }
|
||||
from(platformDepsJar) { into("lib") }
|
||||
from(zipTree(platformDepsZip.singleFile).files) {
|
||||
exclude("**/$platformDepsJarName")
|
||||
into("lib")
|
||||
}
|
||||
from(File(project(":kotlin-ultimate:clion-native").projectDir, "templates")) { into("templates") }
|
||||
}
|
||||
+6
-5
@@ -128,7 +128,6 @@ include ":kotlin-build-common",
|
||||
":prepare:formatter",
|
||||
":prepare:ide-lazy-resolver",
|
||||
":prepare:idea-plugin",
|
||||
":prepare:cidr-plugin",
|
||||
":android-lint",
|
||||
":kotlin-compiler",
|
||||
":kotlin-compiler-embeddable",
|
||||
@@ -199,12 +198,14 @@ include ":kotlin-build-common",
|
||||
|
||||
def includeCidr = hasProperty("cidrPluginsEnabled") && cidrPluginsEnabled != 'false'
|
||||
if (includeCidr) {
|
||||
include ":kotlin-ultimate:cidr-native",
|
||||
includeBuild "kotlin-ultimate/buildSrc"
|
||||
include ":kotlin-ultimate:prepare-deps:platform-deps",
|
||||
":kotlin-ultimate:cidr-native",
|
||||
":kotlin-ultimate:appcode-native",
|
||||
":kotlin-ultimate:clion-native",
|
||||
":prepare:cidr-plugin",
|
||||
":prepare:appcode-plugin",
|
||||
":prepare:clion-plugin"
|
||||
":kotlin-ultimate:prepare:cidr-plugin",
|
||||
":kotlin-ultimate:prepare:appcode-plugin",
|
||||
":kotlin-ultimate:prepare:clion-plugin"
|
||||
}
|
||||
|
||||
def isTeamcityBuild = hasProperty("teamcity") || System.getenv("TEAMCITY_VERSION") != null
|
||||
|
||||
Reference in New Issue
Block a user