Build: Add zipCidrPlugin task which builds plugin for CLion & AppCode
This commit is contained in:
+47
-21
@@ -81,8 +81,12 @@ repositories {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val cidrKotlinPlugin by configurations.creating
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
bootstrapCompileCfg(kotlinDep("compiler-embeddable", bootstrapKotlinVersion))
|
bootstrapCompileCfg(kotlinDep("compiler-embeddable", bootstrapKotlinVersion))
|
||||||
|
|
||||||
|
cidrKotlinPlugin(project(":prepare:cidr-plugin", "runtimeJar"))
|
||||||
}
|
}
|
||||||
|
|
||||||
val commonBuildDir = File(rootDir, "build")
|
val commonBuildDir = File(rootDir, "build")
|
||||||
@@ -356,7 +360,7 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val distTask = task<Copy>("dist") {
|
val dist by task<Copy> {
|
||||||
val childDistTasks = getTasksByName("dist", true) - this@task
|
val childDistTasks = getTasksByName("dist", true) - this@task
|
||||||
dependsOn(childDistTasks)
|
dependsOn(childDistTasks)
|
||||||
|
|
||||||
@@ -365,17 +369,16 @@ val distTask = task<Copy>("dist") {
|
|||||||
from(files("license")) { into("kotlinc/license") }
|
from(files("license")) { into("kotlinc/license") }
|
||||||
}
|
}
|
||||||
|
|
||||||
val compilerCopyTask = task<Copy>("idea-plugin-copy-compiler") {
|
val copyCompilerToIdeaPlugin by task<Copy> {
|
||||||
dependsOn(distTask)
|
dependsOn(dist)
|
||||||
into(ideaPluginDir)
|
into(ideaPluginDir)
|
||||||
from(distDir) { include("kotlinc/**") }
|
from(distDir) { include("kotlinc/**") }
|
||||||
}
|
}
|
||||||
|
|
||||||
task<Copy>("ideaPlugin") {
|
val ideaPlugin by task<Task> {
|
||||||
dependsOn(compilerCopyTask)
|
dependsOn(copyCompilerToIdeaPlugin)
|
||||||
val childIdeaPluginTasks = getTasksByName("ideaPlugin", true) - this@task
|
val childIdeaPluginTasks = getTasksByName("ideaPlugin", true) - this@task
|
||||||
dependsOn(childIdeaPluginTasks)
|
dependsOn(childIdeaPluginTasks)
|
||||||
into("$ideaPluginDir/lib")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
@@ -391,6 +394,7 @@ tasks {
|
|||||||
doLast {
|
doLast {
|
||||||
delete(ideaPluginDir)
|
delete(ideaPluginDir)
|
||||||
delete(ideaUltimatePluginDir)
|
delete(ideaUltimatePluginDir)
|
||||||
|
delete(cidrPluginDir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,18 +523,20 @@ tasks {
|
|||||||
"check" { dependsOn("test") }
|
"check" { dependsOn("test") }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun CopySpec.compilerScriptPermissionsSpec() {
|
fun CopySpec.setExecutablePermissions() {
|
||||||
filesMatching("bin/*") { mode = 0b111101101 }
|
filesMatching("**/bin/*") { mode = 0b111101101 }
|
||||||
filesMatching("bin/*.bat") { mode = 0b110100100 }
|
filesMatching("**/bin/*.bat") { mode = 0b110100100 }
|
||||||
}
|
}
|
||||||
|
|
||||||
val zipCompiler by task<Zip> {
|
val zipCompiler by task<Zip> {
|
||||||
|
dependsOn(dist)
|
||||||
destinationDir = file(distDir)
|
destinationDir = file(distDir)
|
||||||
archiveName = "kotlin-compiler-$kotlinVersion.zip"
|
archiveName = "kotlin-compiler-$kotlinVersion.zip"
|
||||||
from(distKotlinHomeDir) {
|
|
||||||
into("kotlinc")
|
from(distKotlinHomeDir)
|
||||||
compilerScriptPermissionsSpec()
|
into("kotlinc")
|
||||||
}
|
setExecutablePermissions()
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
logger.lifecycle("Compiler artifacts packed to $archivePath")
|
logger.lifecycle("Compiler artifacts packed to $archivePath")
|
||||||
}
|
}
|
||||||
@@ -561,15 +567,35 @@ val zipPlugin by task<Zip> {
|
|||||||
doFirst {
|
doFirst {
|
||||||
if (destPath == null) throw GradleException("Specify target zip path with 'pluginZipPath' property")
|
if (destPath == null) throw GradleException("Specify target zip path with 'pluginZipPath' property")
|
||||||
}
|
}
|
||||||
into("Kotlin") {
|
|
||||||
from("$src/kotlinc") {
|
from(src)
|
||||||
into("kotlinc")
|
into("Kotlin")
|
||||||
compilerScriptPermissionsSpec()
|
setExecutablePermissions()
|
||||||
}
|
|
||||||
from(src) {
|
doLast {
|
||||||
exclude("kotlinc")
|
logger.lifecycle("Plugin artifacts packed to $archivePath")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val cidrPlugin by task<Copy> {
|
||||||
|
dependsOn(ideaPlugin)
|
||||||
|
into(cidrPluginDir)
|
||||||
|
from(ideaPluginDir) { exclude("lib/kotlin-plugin.jar") }
|
||||||
|
from(cidrKotlinPlugin) { into("lib") }
|
||||||
|
}
|
||||||
|
|
||||||
|
val zipCidrPlugin by task<Zip> {
|
||||||
|
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 {
|
doLast {
|
||||||
logger.lifecycle("Plugin artifacts packed to $archivePath")
|
logger.lifecycle("Plugin artifacts packed to $archivePath")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user