add cleanup dependencies tasks for buildSrc
change embedded kotlin version to bootstrap for buildSrc
This commit is contained in:
+3
-3
@@ -5,10 +5,10 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|||||||
import proguard.gradle.ProGuardTask
|
import proguard.gradle.ProGuardTask
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
extra["defaultSnapshotVersion"] = "1.4-SNAPSHOT"
|
|
||||||
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
|
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
|
||||||
|
|
||||||
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap("1.4.0-dev-1075", cacheRedirectorEnabled))
|
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
bootstrapKotlinRepo?.let(::maven)
|
bootstrapKotlinRepo?.let(::maven)
|
||||||
@@ -28,7 +28,7 @@ buildscript {
|
|||||||
dependencies {
|
dependencies {
|
||||||
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
|
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
|
||||||
|
|
||||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.12")
|
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.13")
|
||||||
classpath("com.gradle.publish:plugin-publish-plugin:0.9.7")
|
classpath("com.gradle.publish:plugin-publish-plugin:0.9.7")
|
||||||
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
|
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
|
||||||
classpath("net.sf.proguard:proguard-gradle:6.1.0")
|
classpath("net.sf.proguard:proguard-gradle:6.1.0")
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
extra["versions.native-platform"] = "0.14"
|
extra["versions.native-platform"] = "0.14"
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
|
|
||||||
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
|
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
|
||||||
|
|
||||||
val buildSrcKotlinVersion: String by extra(findProperty("buildSrc.kotlin.version")?.toString() ?: embeddedKotlinVersion)
|
extra["defaultSnapshotVersion"] = kotlinBuildProperties.defaultSnapshotVersion
|
||||||
val buildSrcKotlinRepo: String? by extra(findProperty("buildSrc.kotlin.repo") as String?)
|
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap(kotlinBuildProperties.kotlinBootstrapVersion!!, cacheRedirectorEnabled))
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
if (cacheRedirectorEnabled) {
|
if (cacheRedirectorEnabled) {
|
||||||
@@ -15,21 +16,21 @@ buildscript {
|
|||||||
maven("https://kotlin.bintray.com/kotlin-dependencies")
|
maven("https://kotlin.bintray.com/kotlin-dependencies")
|
||||||
}
|
}
|
||||||
|
|
||||||
buildSrcKotlinRepo?.let {
|
project.bootstrapKotlinRepo?.let {
|
||||||
maven(url = it)
|
maven(url = it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.12")
|
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.13")
|
||||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$buildSrcKotlinVersion")
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
|
||||||
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:$buildSrcKotlinVersion")
|
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${project.bootstrapKotlinVersion}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
|
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
|
||||||
|
|
||||||
logger.info("buildSrcKotlinVersion: " + extra["buildSrcKotlinVersion"])
|
logger.info("buildSrcKotlinVersion: " + extra["bootstrapKotlinVersion"])
|
||||||
logger.info("buildSrc kotlin compiler version: " + org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION)
|
logger.info("buildSrc kotlin compiler version: " + org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION)
|
||||||
logger.info("buildSrc stdlib version: " + KotlinVersion.CURRENT)
|
logger.info("buildSrc stdlib version: " + KotlinVersion.CURRENT)
|
||||||
|
|
||||||
@@ -83,14 +84,14 @@ repositories {
|
|||||||
maven("https://kotlin.bintray.com/kotlin-dependencies")
|
maven("https://kotlin.bintray.com/kotlin-dependencies")
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
|
|
||||||
extra["buildSrcKotlinRepo"]?.let {
|
extra["bootstrapKotlinRepo"]?.let {
|
||||||
maven(url = it)
|
maven(url = it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("stdlib", embeddedKotlinVersion))
|
implementation(kotlin("stdlib", embeddedKotlinVersion))
|
||||||
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.12")
|
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.13")
|
||||||
|
|
||||||
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
|
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
|
||||||
implementation("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
|
implementation("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import java.text.SimpleDateFormat
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.xml.stream.XMLOutputFactory
|
import javax.xml.stream.XMLOutputFactory
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.internal.CleanableStore
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.CleanDataTask
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
base
|
base
|
||||||
}
|
}
|
||||||
@@ -105,7 +108,8 @@ val nodeJSPlugin by configurations.creating
|
|||||||
val intellijRuntimeAnnotations = "intellij-runtime-annotations"
|
val intellijRuntimeAnnotations = "intellij-runtime-annotations"
|
||||||
|
|
||||||
val dependenciesDir = (findProperty("kotlin.build.dependencies.dir") as String?)?.let(::File)
|
val dependenciesDir = (findProperty("kotlin.build.dependencies.dir") as String?)?.let(::File)
|
||||||
?: rootProject.rootDir.parentFile.resolve("dependencies")
|
?: (findProperty("agent.persistent.cache") as String?)?.let(::File)
|
||||||
|
?: rootProject.gradle.gradleUserHomeDir.resolve("kotlin-build-dependencies")
|
||||||
|
|
||||||
val customDepsRepoDir = dependenciesDir.resolve("repo")
|
val customDepsRepoDir = dependenciesDir.resolve("repo")
|
||||||
|
|
||||||
@@ -142,14 +146,29 @@ dependencies {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val makeIntellijCore = buildIvyRepositoryTask(intellijCore, customDepsOrg, customDepsRepoDir)
|
|
||||||
|
val cleanupIntellijCore = tasks.register<CleanDataTask>("cleanupIntellijCore") {
|
||||||
|
cleanableStoreProvider = provider { CleanableStore[repoDir.resolve("intellij-core").absolutePath] }
|
||||||
|
}
|
||||||
|
|
||||||
|
val cleanupIntellijAnnotation = tasks.register<CleanDataTask>("cleanupIntellijAnnotation") {
|
||||||
|
cleanableStoreProvider = provider { CleanableStore[repoDir.resolve(intellijRuntimeAnnotations).absolutePath] }
|
||||||
|
}
|
||||||
|
|
||||||
|
val cleanupDependencies = tasks.register("cleanupDependencies") {
|
||||||
|
dependsOn(cleanupIntellijCore)
|
||||||
|
dependsOn(cleanupIntellijAnnotation)
|
||||||
|
}
|
||||||
|
|
||||||
|
val makeIntellijCore = buildIvyRepositoryTaskAndRegisterCleanupTask(intellijCore, customDepsOrg, customDepsRepoDir)
|
||||||
|
|
||||||
val makeIntellijAnnotations by tasks.registering(Copy::class) {
|
val makeIntellijAnnotations by tasks.registering(Copy::class) {
|
||||||
dependsOn(makeIntellijCore)
|
dependsOn(makeIntellijCore)
|
||||||
|
|
||||||
from(repoDir.resolve("intellij-core/$intellijVersion/artifacts/annotations.jar"))
|
val intellijCoreRepo = CleanableStore[repoDir.resolve("intellij-core").absolutePath][intellijVersion].use()
|
||||||
|
from(intellijCoreRepo.resolve("artifacts/annotations.jar"))
|
||||||
|
|
||||||
val targetDir = File(repoDir, "$intellijRuntimeAnnotations/$intellijVersion")
|
val targetDir = CleanableStore[repoDir.resolve(intellijRuntimeAnnotations).absolutePath][intellijVersion].use()
|
||||||
into(targetDir)
|
into(targetDir)
|
||||||
|
|
||||||
val ivyFile = File(targetDir, "$intellijRuntimeAnnotations.ivy.xml")
|
val ivyFile = File(targetDir, "$intellijRuntimeAnnotations.ivy.xml")
|
||||||
@@ -181,7 +200,7 @@ val mergeSources by tasks.creating(Jar::class.java) {
|
|||||||
val sourcesFile = mergeSources.outputs.files.singleFile
|
val sourcesFile = mergeSources.outputs.files.singleFile
|
||||||
|
|
||||||
val makeIde = if (androidStudioBuild != null) {
|
val makeIde = if (androidStudioBuild != null) {
|
||||||
buildIvyRepositoryTask(
|
buildIvyRepositoryTaskAndRegisterCleanupTask(
|
||||||
androidStudio,
|
androidStudio,
|
||||||
customDepsOrg,
|
customDepsOrg,
|
||||||
customDepsRepoDir,
|
customDepsRepoDir,
|
||||||
@@ -192,9 +211,9 @@ val makeIde = if (androidStudioBuild != null) {
|
|||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
val task = if (installIntellijUltimate) {
|
val task = if (installIntellijUltimate) {
|
||||||
buildIvyRepositoryTask(intellijUltimate, customDepsOrg, customDepsRepoDir, null, sourcesFile)
|
buildIvyRepositoryTaskAndRegisterCleanupTask(intellijUltimate, customDepsOrg, customDepsRepoDir, null, sourcesFile)
|
||||||
} else {
|
} else {
|
||||||
buildIvyRepositoryTask(intellij, customDepsOrg, customDepsRepoDir, null, sourcesFile)
|
buildIvyRepositoryTaskAndRegisterCleanupTask(intellij, customDepsOrg, customDepsRepoDir, null, sourcesFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
task.configure {
|
task.configure {
|
||||||
@@ -204,8 +223,7 @@ val makeIde = if (androidStudioBuild != null) {
|
|||||||
task
|
task
|
||||||
}
|
}
|
||||||
|
|
||||||
val buildJpsStandalone = buildIvyRepositoryTask(jpsStandalone, customDepsOrg, customDepsRepoDir, null, sourcesFile)
|
val buildJpsStandalone = buildIvyRepositoryTaskAndRegisterCleanupTask(jpsStandalone, customDepsOrg, customDepsRepoDir, null, sourcesFile)
|
||||||
val buildNodeJsPlugin = buildIvyRepositoryTask(nodeJSPlugin, customDepsOrg, customDepsRepoDir, ::skipToplevelDirectory, sourcesFile)
|
|
||||||
|
|
||||||
tasks.named("build") {
|
tasks.named("build") {
|
||||||
dependsOn(
|
dependsOn(
|
||||||
@@ -215,11 +233,16 @@ tasks.named("build") {
|
|||||||
makeIntellijAnnotations
|
makeIntellijAnnotations
|
||||||
)
|
)
|
||||||
|
|
||||||
if (installIntellijUltimate) {
|
|
||||||
dependsOn(buildNodeJsPlugin)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (installIntellijUltimate) {
|
||||||
|
val buildNodeJsPlugin =
|
||||||
|
buildIvyRepositoryTaskAndRegisterCleanupTask(nodeJSPlugin, customDepsOrg, customDepsRepoDir, ::skipToplevelDirectory, sourcesFile)
|
||||||
|
tasks.named("build") { dependsOn(buildNodeJsPlugin) }
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("build") { dependsOn(cleanupDependencies) }
|
||||||
|
|
||||||
// Task to delete legacy repo locations
|
// Task to delete legacy repo locations
|
||||||
tasks.register<Delete>("cleanLegacy") {
|
tasks.register<Delete>("cleanLegacy") {
|
||||||
delete("$projectDir/android-dx")
|
delete("$projectDir/android-dx")
|
||||||
@@ -227,93 +250,114 @@ tasks.register<Delete>("cleanLegacy") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.named<Delete>("clean") {
|
tasks.named<Delete>("clean") {
|
||||||
|
//TODO specify repos to clean? Use CleanDataTask
|
||||||
delete(customDepsRepoDir)
|
delete(customDepsRepoDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun buildIvyRepositoryTask(
|
fun buildIvyRepositoryTaskAndRegisterCleanupTask(
|
||||||
configuration: Configuration,
|
configuration: Configuration,
|
||||||
organization: String,
|
organization: String,
|
||||||
repoDirectory: File,
|
repoDirectory: File,
|
||||||
pathRemap: ((String) -> String)? = null,
|
pathRemap: ((String) -> String)? = null,
|
||||||
sources: File? = null
|
sources: File? = null
|
||||||
) = tasks.register("buildIvyRepositoryFor${configuration.name.capitalize()}") {
|
): TaskProvider<Task> {
|
||||||
|
fun ResolvedArtifact.storeDirectory(): CleanableStore =
|
||||||
|
CleanableStore[repoDirectory.resolve("$organization/${moduleVersion.id.name}").absolutePath]
|
||||||
|
|
||||||
fun ResolvedArtifact.moduleDirectory(): File =
|
fun ResolvedArtifact.moduleDirectory(): File =
|
||||||
File(repoDirectory, "$organization/${moduleVersion.id.name}/${moduleVersion.id.version}")
|
storeDirectory()[moduleVersion.id.version].use()
|
||||||
|
|
||||||
dependsOn(configuration)
|
val buildIvyRepositoryTask = tasks.register("buildIvyRepositoryFor${configuration.name.capitalize()}") {
|
||||||
inputs.files(configuration)
|
dependsOn(configuration)
|
||||||
|
inputs.files(configuration)
|
||||||
|
|
||||||
if (verifyDependencyOutput) {
|
if (verifyDependencyOutput) {
|
||||||
outputs.dir(provider {
|
outputs.dir(
|
||||||
configuration.resolvedConfiguration.resolvedArtifacts.single().moduleDirectory()
|
provider {
|
||||||
})
|
configuration.resolvedConfiguration.resolvedArtifacts.single().moduleDirectory()
|
||||||
} else {
|
|
||||||
outputs.upToDateWhen {
|
|
||||||
configuration.resolvedConfiguration.resolvedArtifacts.single()
|
|
||||||
.moduleDirectory()
|
|
||||||
.exists()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
doFirst {
|
|
||||||
configuration.resolvedConfiguration.resolvedArtifacts.single().run {
|
|
||||||
val moduleDirectory = moduleDirectory()
|
|
||||||
val artifactsDirectory = File(moduleDirectory(), "artifacts")
|
|
||||||
|
|
||||||
logger.info("Unpacking ${file.name} into ${artifactsDirectory.absolutePath}")
|
|
||||||
copy {
|
|
||||||
val fileTree = when (extension) {
|
|
||||||
"tar.gz" -> tarTree(file)
|
|
||||||
"zip" -> zipTree(file)
|
|
||||||
else -> error("Unsupported artifact extension: $extension")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
from(fileTree.matching {
|
|
||||||
exclude("**/plugins/Kotlin/**")
|
|
||||||
})
|
|
||||||
|
|
||||||
into(artifactsDirectory)
|
|
||||||
|
|
||||||
if (pathRemap != null) {
|
|
||||||
eachFile {
|
|
||||||
path = pathRemap(path)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
includeEmptyDirs = false
|
|
||||||
}
|
|
||||||
|
|
||||||
writeIvyXml(
|
|
||||||
organization,
|
|
||||||
moduleVersion.id.name,
|
|
||||||
moduleVersion.id.version,
|
|
||||||
moduleVersion.id.name,
|
|
||||||
File(artifactsDirectory, "lib"),
|
|
||||||
File(artifactsDirectory, "lib"),
|
|
||||||
File(moduleDirectory, "ivy"),
|
|
||||||
*listOfNotNull(sources).toTypedArray()
|
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
outputs.upToDateWhen {
|
||||||
|
configuration.resolvedConfiguration.resolvedArtifacts.single()
|
||||||
|
.moduleDirectory()
|
||||||
|
.exists()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val pluginsDirectory = File(artifactsDirectory, "plugins")
|
doFirst {
|
||||||
if (pluginsDirectory.exists()) {
|
configuration.resolvedConfiguration.resolvedArtifacts.single().run {
|
||||||
file(File(artifactsDirectory, "plugins"))
|
val moduleDirectory = moduleDirectory()
|
||||||
.listFiles { file: File -> file.isDirectory }
|
val artifactsDirectory = File(moduleDirectory(), "artifacts")
|
||||||
.forEach {
|
|
||||||
writeIvyXml(
|
logger.info("Unpacking ${file.name} into ${artifactsDirectory.absolutePath}")
|
||||||
organization,
|
copy {
|
||||||
it.name,
|
val fileTree = when (extension) {
|
||||||
moduleVersion.id.version,
|
"tar.gz" -> tarTree(file)
|
||||||
it.name,
|
"zip" -> zipTree(file)
|
||||||
File(it, "lib"),
|
else -> error("Unsupported artifact extension: $extension")
|
||||||
File(it, "lib"),
|
|
||||||
File(moduleDirectory, "ivy"),
|
|
||||||
*listOfNotNull(sources).toTypedArray()
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
from(
|
||||||
|
fileTree.matching {
|
||||||
|
exclude("**/plugins/Kotlin/**")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
into(artifactsDirectory)
|
||||||
|
|
||||||
|
if (pathRemap != null) {
|
||||||
|
eachFile {
|
||||||
|
path = pathRemap(path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
includeEmptyDirs = false
|
||||||
|
}
|
||||||
|
|
||||||
|
writeIvyXml(
|
||||||
|
organization,
|
||||||
|
moduleVersion.id.name,
|
||||||
|
moduleVersion.id.version,
|
||||||
|
moduleVersion.id.name,
|
||||||
|
File(artifactsDirectory, "lib"),
|
||||||
|
File(artifactsDirectory, "lib"),
|
||||||
|
File(moduleDirectory, "ivy"),
|
||||||
|
*listOfNotNull(sources).toTypedArray()
|
||||||
|
)
|
||||||
|
|
||||||
|
val pluginsDirectory = File(artifactsDirectory, "plugins")
|
||||||
|
if (pluginsDirectory.exists()) {
|
||||||
|
file(File(artifactsDirectory, "plugins"))
|
||||||
|
.listFiles { file: File -> file.isDirectory }
|
||||||
|
.forEach {
|
||||||
|
writeIvyXml(
|
||||||
|
organization,
|
||||||
|
it.name,
|
||||||
|
moduleVersion.id.version,
|
||||||
|
it.name,
|
||||||
|
File(it, "lib"),
|
||||||
|
File(it, "lib"),
|
||||||
|
File(moduleDirectory, "ivy"),
|
||||||
|
*listOfNotNull(sources).toTypedArray()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val cleanupIvyRepositoryTask = tasks.register<CleanDataTask>("cleanupIvyRepositoryFor${configuration.name.capitalize()}") {
|
||||||
|
cleanableStoreProvider = provider {
|
||||||
|
configuration.resolvedConfiguration.resolvedArtifacts.single().storeDirectory()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanupDependencies {
|
||||||
|
dependsOn(cleanupIvyRepositoryTask)
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildIvyRepositoryTask
|
||||||
}
|
}
|
||||||
|
|
||||||
fun writeIvyXml(
|
fun writeIvyXml(
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.12")
|
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.13")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,12 @@
|
|||||||
|
|
||||||
// usages in build scripts are not tracked properly
|
// usages in build scripts are not tracked properly
|
||||||
|
|
||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|
||||||
import org.gradle.api.GradleException
|
import org.gradle.api.GradleException
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.artifacts.ProjectDependency
|
import org.gradle.api.artifacts.ProjectDependency
|
||||||
import org.gradle.api.artifacts.dsl.DependencyHandler
|
import org.gradle.api.artifacts.dsl.DependencyHandler
|
||||||
import org.gradle.api.file.ConfigurableFileCollection
|
import org.gradle.api.file.ConfigurableFileCollection
|
||||||
import org.gradle.api.file.FileCollection
|
import org.gradle.api.file.FileCollection
|
||||||
import org.gradle.api.tasks.AbstractCopyTask
|
|
||||||
import org.gradle.kotlin.dsl.extra
|
import org.gradle.kotlin.dsl.extra
|
||||||
import org.gradle.kotlin.dsl.project
|
import org.gradle.kotlin.dsl.project
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "org.jetbrains.kotlin"
|
group = "org.jetbrains.kotlin"
|
||||||
version = "0.0.12"
|
version = "0.0.13"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
Vendored
+18
-18
@@ -1,20 +1,20 @@
|
|||||||
@file:Suppress("unused") // usages in build scripts are not tracked properly
|
/*
|
||||||
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.*
|
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
|
|
||||||
|
|
||||||
var Project.bootstrapKotlinVersion: String
|
var Project.bootstrapKotlinVersion: String
|
||||||
get() = this.property("bootstrapKotlinVersion") as String
|
get() = property("bootstrapKotlinVersion") as String
|
||||||
private set(value) {
|
private set(value) {
|
||||||
this.extra["bootstrapKotlinVersion"] = value
|
extensions.extraProperties.set("bootstrapKotlinVersion", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
var Project.bootstrapKotlinRepo: String?
|
var Project.bootstrapKotlinRepo: String?
|
||||||
get() = this.property("bootstrapKotlinRepo") as String?
|
get() = property("bootstrapKotlinRepo") as String?
|
||||||
private set(value) {
|
private set(value) {
|
||||||
this.extra["bootstrapKotlinRepo"] = value
|
extensions.extraProperties.set("bootstrapKotlinRepo", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
val Project.internalKotlinRepo: String?
|
val Project.internalKotlinRepo: String?
|
||||||
@@ -22,16 +22,16 @@ val Project.internalKotlinRepo: String?
|
|||||||
"branch:default:any/artifacts/content/internal/repo"
|
"branch:default:any/artifacts/content/internal/repo"
|
||||||
|
|
||||||
fun Project.kotlinBootstrapFrom(defaultSource: BootstrapOption) {
|
fun Project.kotlinBootstrapFrom(defaultSource: BootstrapOption) {
|
||||||
val customVersion = project.findProperty("bootstrap.kotlin.version") as String?
|
val customVersion = findProperty("bootstrap.custom.kotlin.version") as String?
|
||||||
val customRepo = project.findProperty("bootstrap.kotlin.repo") as String?
|
val customRepo = findProperty("bootstrap.custom.kotlin.repo") as String?
|
||||||
val teamCityVersion = project.findProperty("bootstrap.teamcity.kotlin.version") as String?
|
val teamCityVersion = findProperty("bootstrap.teamcity.kotlin.version") as String?
|
||||||
val teamCityBuild = project.findProperty("bootstrap.teamcity.build.number") as String?
|
val teamCityBuild = findProperty("bootstrap.teamcity.build.number") as String?
|
||||||
val teamCityProject = project.findProperty("bootstrap.teamcity.project") as String?
|
val teamCityProject = findProperty("bootstrap.teamcity.project") as String?
|
||||||
|
|
||||||
val bootstrapSource = when {
|
val bootstrapSource = when {
|
||||||
project.hasProperty("bootstrap.local") -> BootstrapOption.Local(
|
hasProperty("bootstrap.local") -> BootstrapOption.Local(
|
||||||
project.findProperty("bootstrap.local.version") as String?,
|
findProperty("bootstrap.local.version") as String?,
|
||||||
project.findProperty("bootstrap.local.path") as String?
|
findProperty("bootstrap.local.path") as String?
|
||||||
)
|
)
|
||||||
teamCityVersion != null -> BootstrapOption.TeamCity(
|
teamCityVersion != null -> BootstrapOption.TeamCity(
|
||||||
teamCityVersion,
|
teamCityVersion,
|
||||||
@@ -43,8 +43,8 @@ fun Project.kotlinBootstrapFrom(defaultSource: BootstrapOption) {
|
|||||||
else -> defaultSource
|
else -> defaultSource
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstrapSource.applyToProject(project)
|
bootstrapSource.applyToProject(this)
|
||||||
project.logger.lifecycle("Using kotlin bootstrap version $bootstrapKotlinVersion from repo $bootstrapKotlinRepo")
|
logger.lifecycle("Using kotlin bootstrap version $bootstrapKotlinVersion from repo $bootstrapKotlinRepo")
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class BootstrapOption {
|
sealed class BootstrapOption {
|
||||||
@@ -19,16 +19,24 @@ class KotlinBuildProperties(
|
|||||||
private val propertiesProvider: PropertiesProvider
|
private val propertiesProvider: PropertiesProvider
|
||||||
) {
|
) {
|
||||||
private val localProperties: Properties = Properties()
|
private val localProperties: Properties = Properties()
|
||||||
|
private val rootProperties: Properties = Properties()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val localPropertiesFile = propertiesProvider.rootProjectDir.resolve("local.properties")
|
loadPropertyFile("local.properties", localProperties)
|
||||||
if (localPropertiesFile.isFile) {
|
loadPropertyFile("gradle.properties", rootProperties)
|
||||||
localPropertiesFile.reader().use(localProperties::load)
|
}
|
||||||
|
|
||||||
|
private fun loadPropertyFile(fileName: String, propertiesDestination: Properties) {
|
||||||
|
val propertiesFile = propertiesProvider.rootProjectDir.resolve(fileName)
|
||||||
|
if (propertiesFile.isFile) {
|
||||||
|
propertiesFile.reader().use(propertiesDestination::load)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private operator fun get(key: String): Any? = localProperties.getProperty(key) ?: propertiesProvider.getProperty(key)
|
private operator fun get(key: String): Any? = localProperties.getProperty(key) ?: propertiesProvider.getProperty(key)
|
||||||
|
|
||||||
|
private fun getLocalOrRoot(key: String): Any? = get(key) ?: rootProperties.getProperty(key)
|
||||||
|
|
||||||
private fun getBoolean(key: String, default: Boolean = false): Boolean =
|
private fun getBoolean(key: String, default: Boolean = false): Boolean =
|
||||||
this[key]?.toString()?.trim()?.toBoolean() ?: default
|
this[key]?.toString()?.trim()?.toBoolean() ?: default
|
||||||
|
|
||||||
@@ -96,6 +104,10 @@ class KotlinBuildProperties(
|
|||||||
val buildCacheUser: String? = get("kotlin.build.cache.user") as String?
|
val buildCacheUser: String? = get("kotlin.build.cache.user") as String?
|
||||||
|
|
||||||
val buildCachePassword: String? = get("kotlin.build.cache.password") as String?
|
val buildCachePassword: String? = get("kotlin.build.cache.password") as String?
|
||||||
|
|
||||||
|
val kotlinBootstrapVersion: String? = getLocalOrRoot("bootstrap.kotlin.version") as String?
|
||||||
|
|
||||||
|
val defaultSnapshotVersion: String? = getLocalOrRoot("defaultSnapshotVersion") as String?
|
||||||
}
|
}
|
||||||
|
|
||||||
private const val extensionName = "kotlinBuildProperties"
|
private const val extensionName = "kotlinBuildProperties"
|
||||||
|
|||||||
+6
-2
@@ -1,13 +1,17 @@
|
|||||||
org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m -Dfile.encoding=UTF-8
|
org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m -Dfile.encoding=UTF-8
|
||||||
|
|
||||||
cacheRedirectorEnabled=true
|
cacheRedirectorEnabled=true
|
||||||
|
defaultSnapshotVersion=1.4-SNAPSHOT
|
||||||
|
|
||||||
kotlin.compiler.effectSystemEnabled=true
|
kotlin.compiler.effectSystemEnabled=true
|
||||||
kotlin.compiler.newInferenceEnabled=true
|
kotlin.compiler.newInferenceEnabled=true
|
||||||
#maven.repository.mirror=http://repository.jetbrains.com/remote-repos/
|
#maven.repository.mirror=http://repository.jetbrains.com/remote-repos/
|
||||||
#bootstrap.kotlin.repo=https://dl.bintray.com/kotlin/kotlin-dev
|
#bootstrap.custom.kotlin.repo=https://dl.bintray.com/kotlin/kotlin-dev
|
||||||
#bootstrap.kotlin.version=1.1.50-dev-1451
|
#bootstrap.custom.kotlin.version=1.1.50-dev-1451
|
||||||
|
bootstrap.kotlin.version=1.4.0-dev-1148
|
||||||
|
|
||||||
#signingRequired=true
|
#signingRequired=true
|
||||||
|
#org.gradle.debug=true
|
||||||
|
|
||||||
## The following properties can be added to your local.properties file to customize the build:
|
## The following properties can be added to your local.properties file to customize the build:
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +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
|
|
||||||
|
|
||||||
intellijUltimateEnabled=false
|
|
||||||
intellijEnforceCommunitySdk=true
|
|
||||||
|
|
||||||
## The following properties can be added to your local.properties file to customize the build:
|
|
||||||
|
|
||||||
#jpsBuild=true
|
|
||||||
#cidrPluginsEnabled=true
|
|
||||||
|
|
||||||
## Used for compare gradle and jps build
|
|
||||||
|
|
||||||
#kotlin.build.postprocessing=false
|
|
||||||
#kotlin.build.java9=false
|
|
||||||
#kotlin.build.useBootstrapStdlib=true
|
|
||||||
@@ -1,24 +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
|
|
||||||
|
|
||||||
intellijUltimateEnabled=false
|
|
||||||
intellijEnforceCommunitySdk=true
|
|
||||||
|
|
||||||
## The following properties can be added to your local.properties file to customize the build:
|
|
||||||
|
|
||||||
#jpsBuild=true
|
|
||||||
#cidrPluginsEnabled=true
|
|
||||||
|
|
||||||
## Used for compare gradle and jps build
|
|
||||||
|
|
||||||
#kotlin.build.postprocessing=false
|
|
||||||
#kotlin.build.java9=false
|
|
||||||
#kotlin.build.useBootstrapStdlib=true
|
|
||||||
@@ -1,24 +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
|
|
||||||
|
|
||||||
intellijUltimateEnabled=false
|
|
||||||
intellijEnforceCommunitySdk=true
|
|
||||||
|
|
||||||
## The following properties can be added to your local.properties file to customize the build:
|
|
||||||
|
|
||||||
#jpsBuild=true
|
|
||||||
#cidrPluginsEnabled=true
|
|
||||||
|
|
||||||
## Used for compare gradle and jps build
|
|
||||||
|
|
||||||
#kotlin.build.postprocessing=false
|
|
||||||
#kotlin.build.java9=false
|
|
||||||
#kotlin.build.useBootstrapStdlib=true
|
|
||||||
+1
-1
@@ -27,7 +27,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.12")
|
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.13")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user