docs build: move parameter initialization to the parent project
in order to avoid evaluationDependsOn dependency
This commit is contained in:
committed by
Space Team
parent
e627356aea
commit
93650dcada
@@ -8,19 +8,34 @@ plugins {
|
||||
id("org.jetbrains.dokka")
|
||||
}
|
||||
|
||||
evaluationDependsOnChildren()
|
||||
val isTeamcityBuild = project.hasProperty("teamcity.version")
|
||||
|
||||
// kotlin/libraries/tools/kotlin-stdlib-docs -> kotlin
|
||||
val kotlin_root = rootProject.file("../../../").absoluteFile.invariantSeparatorsPath
|
||||
val kotlin_libs by extra("$buildDir/libs")
|
||||
|
||||
val rootProperties = java.util.Properties().apply {
|
||||
file(kotlin_root).resolve("gradle.properties").inputStream().use { stream -> load(stream) }
|
||||
}
|
||||
val defaultSnapshotVersion: String by rootProperties
|
||||
|
||||
val githubRevision = if (isTeamcityBuild) project.property("githubRevision") else "master"
|
||||
val artifactsVersion by extra(if (isTeamcityBuild) project.property("deployVersion") as String else defaultSnapshotVersion)
|
||||
val artifactsRepo by extra(if (isTeamcityBuild) project.property("kotlinLibsRepo") as String else "$kotlin_root/build/repo")
|
||||
val dokka_version: String by project
|
||||
|
||||
println("# Parameters summary:")
|
||||
println(" isTeamcityBuild: $isTeamcityBuild")
|
||||
println(" dokka version: $dokka_version")
|
||||
println(" githubRevision: $githubRevision")
|
||||
println(" artifacts version: $artifactsVersion")
|
||||
println(" artifacts repo: $artifactsRepo")
|
||||
|
||||
fun pKotlinBig() = project("kotlin_big").ext
|
||||
|
||||
val outputDir = file(findProperty("docsBuildDir") as String? ?: "$buildDir/doc")
|
||||
val inputDirPrevious = file(findProperty("docsPreviousVersionsDir") as String? ?: "$outputDir/previous")
|
||||
val outputDirPartial = outputDir.resolve("partial")
|
||||
val kotlin_root: String by pKotlinBig()
|
||||
val kotlin_libs: String by pKotlinBig()
|
||||
val kotlin_native_root = file("$kotlin_root/kotlin-native").absolutePath
|
||||
val github_revision: String by pKotlinBig()
|
||||
val localRoot = kotlin_root
|
||||
val baseUrl = URL("https://github.com/JetBrains/kotlin/tree/$github_revision")
|
||||
val templatesDir = file(findProperty("templatesDir") as String? ?: "$projectDir/templates").invariantSeparatorsPath
|
||||
|
||||
val cleanDocs by tasks.registering(Delete::class) {
|
||||
@@ -39,7 +54,6 @@ repositories {
|
||||
mavenCentral()
|
||||
maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/dokka/dev")
|
||||
}
|
||||
val dokka_version: String by project
|
||||
|
||||
dependencies {
|
||||
dokkaPlugin(project(":plugins:dokka-samples-transformer-plugin"))
|
||||
@@ -371,13 +385,13 @@ fun GradleDokkaSourceSetBuilder.perPackageOption(packageNamePrefix: String, acti
|
||||
|
||||
fun GradleDokkaSourceSetBuilder.sourceLinksFromRoot() {
|
||||
sourceLink {
|
||||
localDirectory.set(file(localRoot))
|
||||
remoteUrl.set(baseUrl)
|
||||
localDirectory.set(file(kotlin_root))
|
||||
remoteUrl.set(URL("https://github.com/JetBrains/kotlin/tree/$githubRevision"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
}
|
||||
|
||||
gradle.projectsEvaluated {
|
||||
run {
|
||||
val versions = listOf(/*"1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7",*/ "1.8")
|
||||
val latestVersion = versions.last()
|
||||
|
||||
|
||||
@@ -2,29 +2,12 @@ plugins {
|
||||
base
|
||||
}
|
||||
|
||||
val isTeamcityBuild = project.hasProperty("teamcity.version")
|
||||
|
||||
// kotlin/libraries/tools/kotlin-stdlib-docs -> kotlin
|
||||
val kotlinRootDir = rootProject.file("../../../").absoluteFile.invariantSeparatorsPath
|
||||
val kotlinLibsDir = "$buildDir/libs"
|
||||
|
||||
val githubRevision = if (isTeamcityBuild) project.property("githubRevision") else "master"
|
||||
val kotlinVersion = if (isTeamcityBuild) project.property("deployVersion") as String else defaultSnapshotVersion()
|
||||
val repo = if (isTeamcityBuild) project.property("kotlinLibsRepo") as String else "$kotlinRootDir/build/repo"
|
||||
|
||||
fun defaultSnapshotVersion(): String = file(kotlinRootDir).resolve("gradle.properties").inputStream().use { stream ->
|
||||
java.util.Properties().apply { load(stream) }["defaultSnapshotVersion"] as String
|
||||
}
|
||||
|
||||
println("# Parameters summary:")
|
||||
println(" isTeamcityBuild: $isTeamcityBuild")
|
||||
println(" githubRevision: $githubRevision")
|
||||
println(" kotlinVersion: $kotlinVersion")
|
||||
println(" dokkaVersion: ${property("dokka_version")}")
|
||||
println(" repo: $repo")
|
||||
val artifactsVersion: String by project
|
||||
val artifactsRepo: String by project
|
||||
val kotlin_libs: String by project
|
||||
|
||||
repositories {
|
||||
maven(url = repo)
|
||||
maven(url = artifactsRepo)
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
@@ -56,19 +39,16 @@ modules.forEach { module ->
|
||||
}
|
||||
|
||||
dependencies {
|
||||
library(group = "org.jetbrains.kotlin", name = module, version = kotlinVersion)
|
||||
library(group = "org.jetbrains.kotlin", name = module, version = artifactsVersion)
|
||||
}
|
||||
|
||||
val libsTask = tasks.register<Sync>("extract_lib_$module") {
|
||||
dependsOn(library)
|
||||
|
||||
from({ library })
|
||||
into("$kotlinLibsDir/$module")
|
||||
into("$kotlin_libs/$module")
|
||||
}
|
||||
|
||||
extractLibs.configure { dependsOn(libsTask) }
|
||||
}
|
||||
|
||||
project.ext["github_revision"] = githubRevision
|
||||
project.ext["kotlin_root"] = kotlinRootDir
|
||||
project.ext["kotlin_libs"] = kotlinLibsDir
|
||||
|
||||
Reference in New Issue
Block a user