Use project's kotlin compiler version and repo for the samples
This commit is contained in:
committed by
Stanislav Erokhin
parent
f3a0debaf8
commit
4638988c2f
@@ -8,8 +8,9 @@ import java.io.File
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A task that copies samples and replaces direct repository URLs with ones provided by the cache-redirector service.
|
* A task that copies samples and replaces direct repository URLs with ones provided by the cache-redirector service.
|
||||||
|
* This task also adds kotlin compiler repository from the project's gradle.properties file.
|
||||||
*/
|
*/
|
||||||
open class CopySamples: Copy() {
|
open class CopySamples : Copy() {
|
||||||
@InputDirectory
|
@InputDirectory
|
||||||
var samplesDir: File = project.file("samples")
|
var samplesDir: File = project.file("samples")
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ open class CopySamples: Copy() {
|
|||||||
from(samplesDir) {
|
from(samplesDir) {
|
||||||
it.exclude("**/*.gradle.kts")
|
it.exclude("**/*.gradle.kts")
|
||||||
it.exclude("**/*.gradle")
|
it.exclude("**/*.gradle")
|
||||||
|
it.exclude("**/gradle.properties")
|
||||||
}
|
}
|
||||||
from(samplesDir) {
|
from(samplesDir) {
|
||||||
it.include("**/*.gradle")
|
it.include("**/*.gradle")
|
||||||
@@ -34,6 +36,23 @@ open class CopySamples: Copy() {
|
|||||||
replacements[repo]?.let { r -> line.replace(repo, r) } ?: line
|
replacements[repo]?.let { r -> line.replace(repo, r) } ?: line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
from(samplesDir) {
|
||||||
|
it.include("**/gradle.properties")
|
||||||
|
|
||||||
|
val kotlinVersion = project.property("kotlinVersion") as? String
|
||||||
|
?: throw IllegalArgumentException("Property kotlinVersion should be specified in the root project")
|
||||||
|
val kotlinCompilerRepo = project.property("kotlinCompilerRepo") as? String
|
||||||
|
?: throw IllegalArgumentException("Property kotlinCompilerRepo should be specified in the root project")
|
||||||
|
|
||||||
|
it.filter { line ->
|
||||||
|
when {
|
||||||
|
line.startsWith("kotlin_version") -> "kotlin_version=$kotlinVersion"
|
||||||
|
line.startsWith("#kotlinCompilerRepo") || line.startsWith("kotlinCompilerRepo") ->
|
||||||
|
"kotlinCompilerRepo=$kotlinCompilerRepo"
|
||||||
|
else -> line
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun configure(closure: Closure<Any>): Task {
|
override fun configure(closure: Closure<Any>): Task {
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://dl.bintray.com/kotlin/kotlin-dev")
|
maven("https://dl.bintray.com/kotlin/kotlin-dev")
|
||||||
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
||||||
|
|
||||||
|
val kotlinCompilerRepo: String? by rootProject
|
||||||
|
kotlinCompilerRepo?.let { maven(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
val kotlin_version: String by rootProject
|
val kotlin_version: String by rootProject
|
||||||
@@ -16,6 +19,9 @@ allprojects {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://dl.bintray.com/kotlin/kotlin-dev")
|
maven("https://dl.bintray.com/kotlin/kotlin-dev")
|
||||||
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
||||||
|
|
||||||
|
val kotlinCompilerRepo: String? by rootProject
|
||||||
|
kotlinCompilerRepo?.let { maven(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ org.gradle.workers.max=4
|
|||||||
# CHANGE_VERSION_WITH_RELEASE
|
# CHANGE_VERSION_WITH_RELEASE
|
||||||
kotlin_version=1.4.10
|
kotlin_version=1.4.10
|
||||||
|
|
||||||
|
# Sets maven path for the kotlin version other than release
|
||||||
|
#kotlinCompilerRepo=
|
||||||
|
|
||||||
# Use custom Kotlin/Native home:
|
# Use custom Kotlin/Native home:
|
||||||
kotlin.native.home=../../dist
|
kotlin.native.home=../../dist
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user