Build: Extract build cache setup to kotlin-build-gradle-plugin
This commit is contained in:
@@ -22,7 +22,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.4")
|
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.5")
|
||||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$buildSrcKotlinVersion")
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$buildSrcKotlinVersion")
|
||||||
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:$buildSrcKotlinVersion")
|
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:$buildSrcKotlinVersion")
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("stdlib", embeddedKotlinVersion))
|
implementation(kotlin("stdlib", embeddedKotlinVersion))
|
||||||
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.4")
|
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.5")
|
||||||
|
|
||||||
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")}")
|
||||||
|
|||||||
@@ -20,27 +20,13 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.4")
|
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.5")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def buildProperties = BuildPropertiesKt.getKotlinBuildPropertiesForSettings(settings)
|
def buildProperties = BuildPropertiesKt.getKotlinBuildPropertiesForSettings(settings)
|
||||||
|
|
||||||
logger.info("buildCacheUrl=${buildProperties.buildCacheUrl}")
|
BuildCacheKt.setupBuildCache(settings)
|
||||||
logger.info("pushToBuildCache=${buildProperties.pushToBuildCache}")
|
|
||||||
|
|
||||||
buildCache {
|
|
||||||
local {
|
|
||||||
enabled = buildProperties.localBuildCacheEnabled
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buildProperties.buildCacheUrl != null) {
|
|
||||||
remote(HttpBuildCache) {
|
|
||||||
url = buildProperties.buildCacheUrl
|
|
||||||
push = buildProperties.pushToBuildCache
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
include "prepare-deps"
|
include "prepare-deps"
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "org.jetbrains.kotlin"
|
group = "org.jetbrains.kotlin"
|
||||||
version = "0.0.4"
|
version = "0.0.5"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2019 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.initialization.Settings
|
||||||
|
import org.gradle.caching.http.HttpBuildCache
|
||||||
|
import java.net.URI
|
||||||
|
|
||||||
|
|
||||||
|
fun Settings.setupBuildCache() {
|
||||||
|
buildCache.local.isEnabled = kotlinBuildProperties.localBuildCacheEnabled
|
||||||
|
kotlinBuildProperties.buildCacheUrl?.let { remoteCacheUrl ->
|
||||||
|
buildCache.remote(HttpBuildCache::class.java) { remoteCache ->
|
||||||
|
remoteCache.url = URI(remoteCacheUrl)
|
||||||
|
remoteCache.isPush = kotlinBuildProperties.pushToBuildCache
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-16
@@ -31,7 +31,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.4")
|
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.5")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,21 +48,7 @@ gradleEnterprise {
|
|||||||
|
|
||||||
def buildProperties = BuildPropertiesKt.getKotlinBuildPropertiesForSettings(settings)
|
def buildProperties = BuildPropertiesKt.getKotlinBuildPropertiesForSettings(settings)
|
||||||
|
|
||||||
logger.info("buildCacheUrl=${buildProperties.buildCacheUrl}")
|
BuildCacheKt.setupBuildCache(settings)
|
||||||
logger.info("pushToBuildCache=${buildProperties.pushToBuildCache}")
|
|
||||||
|
|
||||||
buildCache {
|
|
||||||
local {
|
|
||||||
enabled = buildProperties.localBuildCacheEnabled
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buildProperties.buildCacheUrl != null) {
|
|
||||||
remote(HttpBuildCache) {
|
|
||||||
url = buildProperties.buildCacheUrl
|
|
||||||
push = buildProperties.pushToBuildCache
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// modules
|
// modules
|
||||||
include ":kotlin-build-common",
|
include ":kotlin-build-common",
|
||||||
|
|||||||
Reference in New Issue
Block a user