Migrate to Gradle KTS, step 2: fix syntax
This commit is contained in:
committed by
Space Team
parent
63eaf3f86f
commit
65dbc1c98a
@@ -1,60 +1,59 @@
|
|||||||
import org.jetbrains.dokka.Platform
|
import org.jetbrains.dokka.Platform
|
||||||
import org.jetbrains.dokka.DokkaConfiguration
|
import org.jetbrains.dokka.DokkaConfiguration
|
||||||
import org.jetbrains.dokka.gradle.DokkaTask
|
import org.jetbrains.dokka.gradle.DokkaTask
|
||||||
|
import java.net.URL
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "base"
|
base
|
||||||
id "org.jetbrains.dokka"
|
id("org.jetbrains.dokka")
|
||||||
}
|
}
|
||||||
|
|
||||||
evaluationDependsOnChildren()
|
evaluationDependsOnChildren()
|
||||||
|
|
||||||
def pKotlinBig() { return project('kotlin_big').extensions }
|
fun pKotlinBig() = project("kotlin_big").ext
|
||||||
|
|
||||||
ext.outputDir = "$buildDir/doc"
|
val outputDir = file("$buildDir/doc")
|
||||||
ext.outputDirLatest = "$outputDir/latest"
|
val outputDirLatest = file("$outputDir/latest")
|
||||||
ext.outputDirPrevious = "$outputDir/previous"
|
val outputDirPrevious = file("$outputDir/previous")
|
||||||
ext.kotlin_root = pKotlinBig().kotlin_root
|
val kotlin_root: String by pKotlinBig()
|
||||||
ext.kotlin_libs = pKotlinBig().kotlin_libs
|
val kotlin_libs: String by pKotlinBig()
|
||||||
ext.kotlin_native_root = file("$kotlin_root/kotlin-native").absolutePath
|
val kotlin_native_root = file("$kotlin_root/kotlin-native").absolutePath
|
||||||
ext.github_revision = pKotlinBig().github_revision
|
val github_revision: String by pKotlinBig()
|
||||||
ext.localRoot = kotlin_root
|
val localRoot = kotlin_root
|
||||||
ext.baseUrl = new URL("https://github.com/JetBrains/kotlin/tree/$github_revision")
|
val baseUrl = URL("https://github.com/JetBrains/kotlin/tree/$github_revision")
|
||||||
ext.templatesDir = "$projectDir/templates".replace('\\', '/')
|
val templatesDir = file("$projectDir/templates").invariantSeparatorsPath
|
||||||
|
|
||||||
task cleanDocs(type: Delete) {
|
val cleanDocs by tasks.registering(Delete::class) {
|
||||||
delete(outputDir)
|
delete(outputDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
task prepare() {
|
val prepare by tasks.registering {
|
||||||
dependsOn(':kotlin_big:extractLibs')
|
dependsOn(":kotlin_big:extractLibs")
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven {
|
maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev")
|
||||||
url 'https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
final String dokka_version = findProperty("dokka_version")
|
val dokka_version: String by project
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
dokkaPlugin project(":plugins:dokka-samples-transformer-plugin")
|
dokkaPlugin(project(":plugins:dokka-samples-transformer-plugin"))
|
||||||
dokkaPlugin project(":plugins:dokka-stdlib-configuration-plugin")
|
dokkaPlugin(project(":plugins:dokka-stdlib-configuration-plugin"))
|
||||||
dokkaPlugin project(":plugins:dokka-version-filter-plugin")
|
dokkaPlugin(project(":plugins:dokka-version-filter-plugin"))
|
||||||
dokkaPlugin "org.jetbrains.dokka:versioning-plugin:$dokka_version"
|
dokkaPlugin("org.jetbrains.dokka:versioning-plugin:$dokka_version")
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskProvider<DokkaTask> createStdLibVersionedDocTask(String version, Boolean isLatest) {
|
fun createStdLibVersionedDocTask(version: String, isLatest: Boolean) =
|
||||||
return tasks.register("kotlin-stdlib_" + version + (isLatest ? "_latest" : ""), DokkaTask) {
|
tasks.register<DokkaTask>("kotlin-stdlib_" + version + (if (isLatest) "_latest" else "")) {
|
||||||
dependsOn(prepare)
|
dependsOn(prepare)
|
||||||
|
|
||||||
def kotlin_stdlib_dir = "$kotlin_root/libraries/stdlib"
|
val kotlin_stdlib_dir = file("$kotlin_root/libraries/stdlib")
|
||||||
|
|
||||||
def stdlibIncludeMd = "$kotlin_root/libraries/stdlib/src/Module.md"
|
val stdlibIncludeMd = file("$kotlin_root/libraries/stdlib/src/Module.md")
|
||||||
def stdlibSamples = "$kotlin_root/libraries/stdlib/samples/test"
|
val stdlibSamples = file("$kotlin_root/libraries/stdlib/samples/test")
|
||||||
|
|
||||||
def suppressedPackages = [
|
val suppressedPackages = listOf(
|
||||||
"kotlin.internal",
|
"kotlin.internal",
|
||||||
"kotlin.jvm.internal",
|
"kotlin.jvm.internal",
|
||||||
"kotlin.js.internal",
|
"kotlin.js.internal",
|
||||||
@@ -62,26 +61,30 @@ TaskProvider<DokkaTask> createStdLibVersionedDocTask(String version, Boolean isL
|
|||||||
"kotlin.jvm.functions",
|
"kotlin.jvm.functions",
|
||||||
"kotlin.coroutines.jvm.internal",
|
"kotlin.coroutines.jvm.internal",
|
||||||
"kotlin.reflect.jvm.internal"
|
"kotlin.reflect.jvm.internal"
|
||||||
]
|
)
|
||||||
|
|
||||||
def kotlinLanguageVersion = version
|
var kotlinLanguageVersion = version
|
||||||
if (version == "1.0")
|
if (version == "1.0")
|
||||||
kotlinLanguageVersion = "1.1"
|
kotlinLanguageVersion = "1.1"
|
||||||
|
|
||||||
|
|
||||||
moduleName.set("kotlin-stdlib")
|
moduleName.set("kotlin-stdlib")
|
||||||
def moduleDirName = "kotlin-stdlib"
|
val moduleDirName = "kotlin-stdlib"
|
||||||
if (isLatest) {
|
if (isLatest) {
|
||||||
outputDirectory.set(new File(outputDirLatest, moduleDirName))
|
outputDirectory.set(outputDirLatest.resolve(moduleDirName))
|
||||||
pluginsMapConfiguration.set(["org.jetbrains.dokka.base.DokkaBase" : """{ "mergeImplicitExpectActualDeclarations": "true", "templatesDir": "$templatesDir" }""",
|
with(pluginsMapConfiguration) {
|
||||||
"org.jetbrains.dokka.kotlinlang.StdLibConfigurationPlugin": """{ "ignoreCommonBuiltIns": "true" }""",
|
put("org.jetbrains.dokka.base.DokkaBase" , """{ "mergeImplicitExpectActualDeclarations": "true", "templatesDir": "$templatesDir" }""")
|
||||||
"org.jetbrains.dokka.versioning.VersioningPlugin" : """{ "version": "$version", "olderVersionsDir": "${outputDirPrevious.toString().replace('\\', '/')}/$moduleDirName" }"""])
|
put("org.jetbrains.dokka.kotlinlang.StdLibConfigurationPlugin", """{ "ignoreCommonBuiltIns": "true" }""")
|
||||||
|
put("org.jetbrains.dokka.versioning.VersioningPlugin" , """{ "version": "$version", "olderVersionsDir": "${outputDirPrevious.resolve(moduleDirName).invariantSeparatorsPath}" }""")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
outputDirectory.set(new File(new File(outputDirPrevious, moduleDirName), version))
|
outputDirectory.set(outputDirPrevious.resolve(moduleDirName).resolve(version))
|
||||||
pluginsMapConfiguration.set(["org.jetbrains.dokka.base.DokkaBase" : """{ "mergeImplicitExpectActualDeclarations": "true", "templatesDir": "$templatesDir" }""",
|
with(pluginsMapConfiguration) {
|
||||||
"org.jetbrains.dokka.kotlinlang.StdLibConfigurationPlugin": """{ "ignoreCommonBuiltIns": "true" }""",
|
put("org.jetbrains.dokka.base.DokkaBase" , """{ "mergeImplicitExpectActualDeclarations": "true", "templatesDir": "$templatesDir" }""")
|
||||||
"org.jetbrains.dokka.kotlinlang.VersionFilterPlugin" : """{ "targetVersion": "$version" }""",
|
put("org.jetbrains.dokka.kotlinlang.StdLibConfigurationPlugin", """{ "ignoreCommonBuiltIns": "true" }""")
|
||||||
"org.jetbrains.dokka.versioning.VersioningPlugin" : """{ "version": "$version" }"""])
|
put("org.jetbrains.dokka.kotlinlang.VersionFilterPlugin" , """{ "targetVersion": "$version" }""")
|
||||||
|
put("org.jetbrains.dokka.versioning.VersioningPlugin" , """{ "version": "$version" }""")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dokkaSourceSets {
|
dokkaSourceSets {
|
||||||
if (version != "1.0" && version != "1.1") { // Common platform since Kotlin 1.2
|
if (version != "1.0" && version != "1.1") { // Common platform since Kotlin 1.2
|
||||||
@@ -204,9 +207,9 @@ TaskProvider<DokkaTask> createStdLibVersionedDocTask(String version, Boolean isL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
configureEach {
|
configureEach {
|
||||||
documentedVisibilities.set([DokkaConfiguration.Visibility.PUBLIC, DokkaConfiguration.Visibility.PROTECTED])
|
documentedVisibilities.set(setOf(DokkaConfiguration.Visibility.PUBLIC, DokkaConfiguration.Visibility.PROTECTED))
|
||||||
skipDeprecated.set(false)
|
skipDeprecated.set(false)
|
||||||
includes.from(stdlibIncludeMd.toString())
|
includes.from(stdlibIncludeMd)
|
||||||
noStdlibLink.set(true)
|
noStdlibLink.set(true)
|
||||||
languageVersion.set(kotlinLanguageVersion)
|
languageVersion.set(kotlinLanguageVersion)
|
||||||
samples.from(stdlibSamples.toString())
|
samples.from(stdlibSamples.toString())
|
||||||
@@ -224,37 +227,39 @@ TaskProvider<DokkaTask> createStdLibVersionedDocTask(String version, Boolean isL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TaskProvider<DokkaTask> createKotlinTestVersionedDocTask(String version, Boolean isLatest, TaskProvider<DokkaTask> stdlibDocTask) {
|
fun createKotlinTestVersionedDocTask(version: String, isLatest: Boolean, stdlibDocTask: TaskProvider<DokkaTask>) =
|
||||||
return tasks.register("kotlin-test_" + version + (isLatest ? "_latest" : ""), DokkaTask) {
|
tasks.register<DokkaTask>("kotlin-test_" + version + (if (isLatest) "_latest" else "")) {
|
||||||
dependsOn(prepare, stdlibDocTask)
|
dependsOn(prepare, stdlibDocTask)
|
||||||
|
|
||||||
def kotlinTestIncludeMd = "$kotlin_root/libraries/kotlin.test/Module.md"
|
val kotlinTestIncludeMd = file("$kotlin_root/libraries/kotlin.test/Module.md")
|
||||||
|
|
||||||
def kotlinTestCommonClasspath = fileTree("$kotlin_libs/kotlin-test-common")
|
val kotlinTestCommonClasspath = fileTree("$kotlin_libs/kotlin-test-common")
|
||||||
def kotlinTestJunitClasspath = fileTree("$kotlin_libs/kotlin-test-junit")
|
val kotlinTestJunitClasspath = fileTree("$kotlin_libs/kotlin-test-junit")
|
||||||
def kotlinTestJunit5Classpath = fileTree("$kotlin_libs/kotlin-test-junit5")
|
val kotlinTestJunit5Classpath = fileTree("$kotlin_libs/kotlin-test-junit5")
|
||||||
def kotlinTestTestngClasspath = fileTree("$kotlin_libs/kotlin-test-testng")
|
val kotlinTestTestngClasspath = fileTree("$kotlin_libs/kotlin-test-testng")
|
||||||
def kotlinTestJsClasspath = fileTree("$kotlin_libs/kotlin-test-js")
|
val kotlinTestJsClasspath = fileTree("$kotlin_libs/kotlin-test-js")
|
||||||
def kotlinTestJvmClasspath = fileTree("$kotlin_libs/kotlin-test")
|
val kotlinTestJvmClasspath = fileTree("$kotlin_libs/kotlin-test")
|
||||||
|
|
||||||
def stdlibPackageList = new URL("file:///${stdlibDocTask.get().outputDirectory.get()}/kotlin-stdlib/package-list".toString())
|
val stdlibPackageList = URL("file:///${stdlibDocTask.get().outputDirectory.get()}/kotlin-stdlib/package-list")
|
||||||
def junit5PackageList = new URL("https://junit.org/junit5/docs/current/api/element-list".toString())
|
val kotlinLanguageVersion = version
|
||||||
def kotlinLanguageVersion = version
|
|
||||||
|
|
||||||
moduleName.set("kotlin-test")
|
moduleName.set("kotlin-test")
|
||||||
|
|
||||||
def moduleDirName = "kotlin-test"
|
val moduleDirName = "kotlin-test"
|
||||||
if (isLatest) {
|
if (isLatest) {
|
||||||
outputDirectory.set(new File(outputDirLatest, moduleDirName))
|
outputDirectory.set(outputDirLatest.resolve(moduleDirName))
|
||||||
pluginsMapConfiguration.set(["org.jetbrains.dokka.base.DokkaBase" : """{ "mergeImplicitExpectActualDeclarations": "true", "templatesDir": "$templatesDir" }""",
|
with(pluginsMapConfiguration) {
|
||||||
"org.jetbrains.dokka.versioning.VersioningPlugin": """{ "version": "$version", "olderVersionsDir": "${outputDirPrevious.toString().replace('\\', '/')}/$moduleDirName" }"""])
|
put("org.jetbrains.dokka.base.DokkaBase" , """{ "mergeImplicitExpectActualDeclarations": "true", "templatesDir": "$templatesDir" }""")
|
||||||
|
put("org.jetbrains.dokka.versioning.VersioningPlugin" , """{ "version": "$version", "olderVersionsDir": "${outputDirPrevious.resolve(moduleDirName).invariantSeparatorsPath}" }""")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
outputDirectory.set(new File(new File(outputDirPrevious, moduleDirName), version))
|
outputDirectory.set(outputDirPrevious.resolve(moduleDirName).resolve(version))
|
||||||
pluginsMapConfiguration.set(["org.jetbrains.dokka.base.DokkaBase" : """{ "mergeImplicitExpectActualDeclarations": "true", "templatesDir": "$templatesDir" }""",
|
with(pluginsMapConfiguration) {
|
||||||
"org.jetbrains.dokka.kotlinlang.VersionFilterPlugin": """{ "targetVersion": "$version" }""",
|
put("org.jetbrains.dokka.base.DokkaBase" , """{ "mergeImplicitExpectActualDeclarations": "true", "templatesDir": "$templatesDir" }""")
|
||||||
"org.jetbrains.dokka.versioning.VersioningPlugin" : """{ "version": "$version" }"""])
|
put("org.jetbrains.dokka.kotlinlang.VersionFilterPlugin" , """{ "targetVersion": "$version" }""")
|
||||||
|
put("org.jetbrains.dokka.versioning.VersioningPlugin" , """{ "version": "$version" }""")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dokkaSourceSets {
|
dokkaSourceSets {
|
||||||
@@ -298,8 +303,8 @@ TaskProvider<DokkaTask> createKotlinTestVersionedDocTask(String version, Boolean
|
|||||||
sourceRoots.from("$kotlin_root/libraries/kotlin.test/junit/src/main/kotlin")
|
sourceRoots.from("$kotlin_root/libraries/kotlin.test/junit/src/main/kotlin")
|
||||||
|
|
||||||
externalDocumentationLink {
|
externalDocumentationLink {
|
||||||
url.set(new URL("http://junit.org/junit4/javadoc/latest/"))
|
url.set(URL("http://junit.org/junit4/javadoc/latest/"))
|
||||||
packageListUrl.set(new URL("http://junit.org/junit4/javadoc/latest/package-list"))
|
packageListUrl.set(URL("http://junit.org/junit4/javadoc/latest/package-list"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,8 +320,8 @@ TaskProvider<DokkaTask> createKotlinTestVersionedDocTask(String version, Boolean
|
|||||||
sourceRoots.from("$kotlin_root/libraries/kotlin.test/junit5/src/main/kotlin")
|
sourceRoots.from("$kotlin_root/libraries/kotlin.test/junit5/src/main/kotlin")
|
||||||
|
|
||||||
externalDocumentationLink {
|
externalDocumentationLink {
|
||||||
url.set(new URL("https://junit.org/junit5/docs/current/api/"))
|
url.set(URL("https://junit.org/junit5/docs/current/api/"))
|
||||||
packageListUrl.set(junit5PackageList)
|
packageListUrl.set(URL("https://junit.org/junit5/docs/current/api/element-list"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,7 +369,7 @@ TaskProvider<DokkaTask> createKotlinTestVersionedDocTask(String version, Boolean
|
|||||||
}
|
}
|
||||||
configureEach {
|
configureEach {
|
||||||
skipDeprecated.set(false)
|
skipDeprecated.set(false)
|
||||||
includes.from(kotlinTestIncludeMd.toString())
|
includes.from(kotlinTestIncludeMd)
|
||||||
languageVersion.set(kotlinLanguageVersion)
|
languageVersion.set(kotlinLanguageVersion)
|
||||||
noStdlibLink.set(true)
|
noStdlibLink.set(true)
|
||||||
sourceLink {
|
sourceLink {
|
||||||
@@ -373,34 +378,34 @@ TaskProvider<DokkaTask> createKotlinTestVersionedDocTask(String version, Boolean
|
|||||||
remoteLineSuffix.set("#L")
|
remoteLineSuffix.set("#L")
|
||||||
}
|
}
|
||||||
externalDocumentationLink {
|
externalDocumentationLink {
|
||||||
url.set(new URL("https://kotlinlang.org/api/latest/jvm/stdlib/"))
|
url.set(URL("https://kotlinlang.org/api/latest/jvm/stdlib/"))
|
||||||
packageListUrl.set(stdlibPackageList)
|
packageListUrl.set(stdlibPackageList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
gradle.projectsEvaluated {
|
gradle.projectsEvaluated {
|
||||||
def versions = ["1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8"]
|
val versions = listOf("1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8")
|
||||||
String latestVersion = versions.last()
|
val latestVersion = versions.last()
|
||||||
|
|
||||||
// builds this version/all versions as historical for the next versions builds
|
// builds this version/all versions as historical for the next versions builds
|
||||||
tasks.register('buildAllVersions')
|
val buildAllVersions by tasks.registering
|
||||||
// builds the latest version incorporating all previous historical versions docs
|
// builds the latest version incorporating all previous historical versions docs
|
||||||
tasks.register('buildLatestVersion')
|
val buildLatestVersion by tasks.registering
|
||||||
|
|
||||||
def latestStdlib = createStdLibVersionedDocTask(latestVersion, true)
|
val latestStdlib = createStdLibVersionedDocTask(latestVersion, true)
|
||||||
def latestTest = createKotlinTestVersionedDocTask(latestVersion, true, latestStdlib)
|
val latestTest = createKotlinTestVersionedDocTask(latestVersion, true, latestStdlib)
|
||||||
|
|
||||||
buildLatestVersion.configure { dependsOn(latestStdlib, latestTest) }
|
buildLatestVersion.configure { dependsOn(latestStdlib, latestTest) }
|
||||||
|
|
||||||
versions.forEach { version ->
|
versions.forEach { version ->
|
||||||
def versionStdlib = createStdLibVersionedDocTask(version, false)
|
val versionStdlib = createStdLibVersionedDocTask(version, false)
|
||||||
def versionTest = createKotlinTestVersionedDocTask(version, false, versionStdlib)
|
val versionTest = createKotlinTestVersionedDocTask(version, false, versionStdlib)
|
||||||
if (version != latestVersion) {
|
if (version != latestVersion) {
|
||||||
latestStdlib.configure { dependsOn versionStdlib }
|
latestStdlib.configure { dependsOn(versionStdlib) }
|
||||||
latestTest.configure { dependsOn versionTest }
|
latestTest.configure { dependsOn(versionTest) }
|
||||||
}
|
}
|
||||||
buildAllVersions.configure { dependsOn(versionStdlib, versionTest) }
|
buildAllVersions.configure { dependsOn(versionStdlib, versionTest) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,67 +1,69 @@
|
|||||||
apply plugin: 'base'
|
plugins {
|
||||||
|
base
|
||||||
|
}
|
||||||
|
|
||||||
final boolean isTeamcityBuild = project.hasProperty("teamcity.version")
|
val isTeamcityBuild = project.hasProperty("teamcity.version")
|
||||||
|
|
||||||
// kotlin/libraries/tools/kotlin-stdlib-docs -> kotlin
|
// kotlin/libraries/tools/kotlin-stdlib-docs -> kotlin
|
||||||
final String kotlinRootDir = rootProject.file("../../../").absolutePath.replace('\\', '/')
|
val kotlinRootDir = rootProject.file("../../../").absoluteFile.invariantSeparatorsPath
|
||||||
final String kotlinLibsDir = "$buildDir/libs"
|
val kotlinLibsDir = "$buildDir/libs"
|
||||||
|
|
||||||
final String githubRevision = isTeamcityBuild ? project.property("githubRevision") : "master"
|
val githubRevision = if (isTeamcityBuild) project.property("githubRevision") else "master"
|
||||||
final String kotlinVersion = isTeamcityBuild ? project.property("deployVersion") : "1.9.255-SNAPSHOT"
|
val kotlinVersion = if (isTeamcityBuild) project.property("deployVersion") as String else "1.9.255-SNAPSHOT"
|
||||||
final String repo = isTeamcityBuild ? project.property("kotlinLibsRepo") : "$kotlinRootDir/build/repo"
|
val repo = if (isTeamcityBuild) project.property("kotlinLibsRepo") as String else "$kotlinRootDir/build/repo"
|
||||||
|
|
||||||
println("# Extracting info:")
|
println("# Parameters summary:")
|
||||||
println(" isTeamcityBuild: $isTeamcityBuild")
|
println(" isTeamcityBuild: $isTeamcityBuild")
|
||||||
println(" githubRevision: $githubRevision")
|
println(" githubRevision: $githubRevision")
|
||||||
println(" kotlinVersion: $kotlinVersion")
|
println(" kotlinVersion: $kotlinVersion")
|
||||||
|
println(" dokkaVersion: ${property("dokka_version")}")
|
||||||
println(" repo: $repo")
|
println(" repo: $repo")
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url = repo }
|
maven(url = repo)
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<String> modules = [
|
val modules = listOf(
|
||||||
"kotlin-stdlib",
|
"kotlin-stdlib",
|
||||||
"kotlin-stdlib-common",
|
"kotlin-stdlib-common",
|
||||||
"kotlin-stdlib-jdk7",
|
"kotlin-stdlib-jdk7",
|
||||||
"kotlin-stdlib-jdk8",
|
"kotlin-stdlib-jdk8",
|
||||||
"kotlin-stdlib-js",
|
"kotlin-stdlib-js",
|
||||||
"kotlin-test",
|
"kotlin-test",
|
||||||
"kotlin-test-js",
|
"kotlin-test-js",
|
||||||
"kotlin-test-junit5",
|
"kotlin-test-junit5",
|
||||||
"kotlin-test-junit",
|
"kotlin-test-junit",
|
||||||
"kotlin-test-testng",
|
"kotlin-test-testng",
|
||||||
"kotlin-test-common",
|
"kotlin-test-common",
|
||||||
]
|
)
|
||||||
|
|
||||||
|
|
||||||
task extractLibs() { }
|
val extractLibs by tasks.registering(Task::class)
|
||||||
|
|
||||||
|
|
||||||
modules.forEach { module ->
|
modules.forEach { module ->
|
||||||
final String lib = "kotlin_lib_$module"
|
|
||||||
|
|
||||||
final Configuration lib_src = configurations.create(lib)
|
val library = configurations.create("kotlin_lib_$module")
|
||||||
|
|
||||||
if (module == "kotlin-test-js") {
|
if (module == "kotlin-test-js") {
|
||||||
lib_src.attributes {attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, "kotlin-runtime")) }
|
library.attributes { attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage::class, "kotlin-runtime")) }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
"$lib"(group: 'org.jetbrains.kotlin', name: module, version: kotlinVersion)
|
library(group = "org.jetbrains.kotlin", name = module, version = kotlinVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
final Task libsTask = tasks.create("extract_lib_$module", Sync) {
|
val libsTask = tasks.register<Sync>("extract_lib_$module") {
|
||||||
dependsOn lib_src
|
dependsOn(library)
|
||||||
|
|
||||||
from { lib_src }
|
from({ library })
|
||||||
into "$kotlinLibsDir/$module"
|
into("$kotlinLibsDir/$module")
|
||||||
}
|
}
|
||||||
|
|
||||||
extractLibs.dependsOn libsTask
|
extractLibs.configure { dependsOn(libsTask) }
|
||||||
}
|
}
|
||||||
|
|
||||||
project.extensions.github_revision = githubRevision
|
project.ext["github_revision"] = githubRevision
|
||||||
project.extensions.kotlin_root = kotlinRootDir
|
project.ext["kotlin_root"] = kotlinRootDir
|
||||||
project.extensions.kotlin_libs = kotlinLibsDir
|
project.ext["kotlin_libs"] = kotlinLibsDir
|
||||||
|
|||||||
Reference in New Issue
Block a user