Skip to content

Commit 262e220

Browse files
authored
Build script tweaks (#3485)
* Use simpler syntax to apply Kotlin compiler options * Set property values with lazy property assignment = operator * Limit scope of UnstableApiUsage suppressions * Remove unnecessary suppressions * Prioritise Maven Central ahead of Gradle Plugin Portal
1 parent 5503b93 commit 262e220

File tree

23 files changed

+35
-51
lines changed

23 files changed

+35
-51
lines changed

build-logic/settings.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ rootProject.name = "build-logic"
66

77
pluginManagement {
88
repositories {
9-
gradlePluginPortal()
109
mavenCentral()
10+
gradlePluginPortal()
1111
}
1212
includeBuild("../build-settings-logic")
1313
}
1414

15-
@Suppress("UnstableApiUsage")
1615
dependencyResolutionManagement {
16+
@Suppress("UnstableApiUsage")
1717
repositories {
1818
mavenCentral()
1919
google()

build-logic/src/main/kotlin/dokkabuild.gradle-plugin.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ plugins {
1717
// because `kotlin-dsl plugin` declares them on task level, and so top-level config is overridden
1818
tasks.withType<KotlinCompile>().configureEach {
1919
compilerOptions {
20-
languageVersion.set(dokkaBuild.kotlinLanguageLevel)
21-
apiVersion.set(dokkaBuild.kotlinLanguageLevel)
20+
languageVersion = dokkaBuild.kotlinLanguageLevel
21+
apiVersion = dokkaBuild.kotlinLanguageLevel
2222

2323
freeCompilerArgs.addAll(
2424
// need 1.4 support, otherwise there might be problems
@@ -31,5 +31,5 @@ tasks.withType<KotlinCompile>().configureEach {
3131
}
3232

3333
tasks.validatePlugins {
34-
enableStricterValidation.set(true)
34+
enableStricterValidation = true
3535
}

build-logic/src/main/kotlin/dokkabuild.java.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ plugins {
1313

1414
java {
1515
toolchain {
16-
languageVersion.set(dokkaBuild.mainJavaVersion)
16+
languageVersion = dokkaBuild.mainJavaVersion
1717
}
1818
}
1919

@@ -26,9 +26,9 @@ tasks.withType<Test>().configureEach {
2626
(Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
2727
}
2828

29-
javaLauncher.set(javaToolchains.launcherFor {
30-
languageVersion.set(dokkaBuild.testJavaLauncherVersion)
31-
})
29+
javaLauncher = javaToolchains.launcherFor {
30+
languageVersion = dokkaBuild.testJavaLauncherVersion
31+
}
3232
}
3333

3434
dependencies {

build-logic/src/main/kotlin/dokkabuild.kotlin-jvm.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ val rootProjectsWithoutDependencyOnDokkaCore = listOf("dokka-integration-tests")
1212
kotlin {
1313
explicitApi()
1414
compilerOptions {
15-
allWarningsAsErrors.set(true)
16-
languageVersion.set(dokkaBuild.kotlinLanguageLevel)
17-
apiVersion.set(dokkaBuild.kotlinLanguageLevel)
15+
allWarningsAsErrors = true
16+
languageVersion = dokkaBuild.kotlinLanguageLevel
17+
apiVersion = dokkaBuild.kotlinLanguageLevel
1818

1919
// These projects know nothing about the `@InternalDokkaApi` annotation, so the Kotlin compiler
2020
// will complain about an unresolved opt-in requirement marker and fail the build if it's not excluded.

build-logic/src/main/kotlin/dokkabuild.publish-gradle-plugin.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ plugins {
1111

1212
@Suppress("UnstableApiUsage")
1313
gradlePlugin {
14-
website.set("https://kotl.in/dokka")
15-
vcsUrl.set("https://github.com/kotlin/dokka.git")
14+
website = "https://kotl.in/dokka"
15+
vcsUrl = "https://github.com/kotlin/dokka.git"
1616
}
1717

1818
// com.gradle.plugin-publish configures publication in afterEvaluate block

build-logic/src/main/kotlin/dokkabuild.publish-shadow.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ java {
1717

1818
tasks.shadowJar {
1919
// separate directory because otherwise Gradle complains about multiple tasks writing into the same file
20-
destinationDirectory.set(project.layout.buildDirectory.dir("shadowLibs"))
20+
destinationDirectory = project.layout.buildDirectory.dir("shadowLibs")
2121
// removes the `-all` classifier from the artifact name
22-
archiveClassifier.set("")
22+
archiveClassifier = ""
2323
}
2424

2525
publishing.publications.register<MavenPublication>(PublicationName.JVM) {

build-settings-logic/settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pluginManagement {
1515

1616
@Suppress("UnstableApiUsage")
1717
dependencyResolutionManagement {
18-
repositoriesMode.set(PREFER_SETTINGS)
18+
repositoriesMode = PREFER_SETTINGS
1919
repositories {
2020
mavenCentral()
2121
gradlePluginPortal()

dokka-integration-tests/gradle/projects/it-android-0/settings.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
@file:Suppress("LocalVariableName", "UnstableApiUsage")
6-
75
apply(from = "template.settings.gradle.kts")
86
rootProject.name = "it-android-0"

dokka-integration-tests/gradle/projects/it-basic-groovy/settings.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
@file:Suppress("LocalVariableName", "UnstableApiUsage")
6-
75
apply(from = "template.settings.gradle.kts")
86
rootProject.name = "it-basic-groovy"

dokka-integration-tests/gradle/projects/it-basic/settings.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
@file:Suppress("LocalVariableName", "UnstableApiUsage")
6-
75
apply(from = "template.settings.gradle.kts")
86
rootProject.name = "it-basic"

dokka-integration-tests/gradle/projects/it-js-ir-0/settings.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
@file:Suppress("LocalVariableName", "UnstableApiUsage")
6-
75
apply(from = "template.settings.gradle.kts")
86
rootProject.name = "it-js-ir-0"

dokka-integration-tests/gradle/projects/it-sequential-tasks-execution-stress/settings.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
@file:Suppress("LocalVariableName", "UnstableApiUsage")
6-
75
apply(from = "template.settings.gradle.kts")
86
rootProject.name = "it-sequential-tasks-execution-stress"

dokka-integration-tests/gradle/projects/template.settings.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
@file:Suppress("LocalVariableName", "UnstableApiUsage")
6-
75
pluginManagement {
86
val dokka_it_kotlin_version: String by settings
97
val dokka_it_dokka_version: String by settings

dokka-integration-tests/settings.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
@file:Suppress("UnstableApiUsage")
6-
75
rootProject.name = "dokka-integration-tests"
86

97
pluginManagement {
@@ -22,6 +20,7 @@ plugins {
2220
}
2321

2422
dependencyResolutionManagement {
23+
@Suppress("UnstableApiUsage")
2524
repositories {
2625
maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide")
2726
maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide-plugin-dependencies")

dokka-runners/runner-cli/settings.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
@file:Suppress("UnstableApiUsage")
6-
75
rootProject.name = "runner-cli"
86

97
pluginManagement {
@@ -22,6 +20,7 @@ plugins {
2220
}
2321

2422
dependencyResolutionManagement {
23+
@Suppress("UnstableApiUsage")
2524
repositories {
2625
mavenCentral()
2726
google()

dokka-runners/runner-gradle-plugin-classic/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ dependencies {
2828
testImplementation("org.jetbrains.dokka:dokka-test-api:$version")
2929
}
3030

31-
@Suppress("UnstableApiUsage")
3231
gradlePlugin {
3332
plugins {
3433
create("dokka") {
@@ -37,6 +36,7 @@ gradlePlugin {
3736

3837
displayName = "Dokka plugin"
3938
description = "Dokka is an API documentation engine for Kotlin"
39+
@Suppress("UnstableApiUsage")
4040
tags.addAll("dokka", "kotlin", "kdoc", "android", "documentation", "api")
4141
}
4242
}

dokka-runners/runner-gradle-plugin-classic/settings.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
@file:Suppress("UnstableApiUsage")
6-
75
rootProject.name = "runner-gradle-plugin-classic"
86

97
pluginManagement {
@@ -22,6 +20,7 @@ plugins {
2220
}
2321

2422
dependencyResolutionManagement {
23+
@Suppress("UnstableApiUsage")
2524
repositories {
2625
mavenCentral()
2726
google()

dokka-runners/runner-maven-plugin/settings.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
@file:Suppress("UnstableApiUsage")
6-
75
rootProject.name = "runner-maven-plugin"
86

97
pluginManagement {
@@ -22,6 +20,7 @@ plugins {
2220
}
2321

2422
dependencyResolutionManagement {
23+
@Suppress("UnstableApiUsage")
2524
repositories {
2625
mavenCentral()
2726
}

dokka-subprojects/analysis-kotlin-descriptors/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ val shadowDependenciesJar by tasks.registering(ShadowJar::class) {
6363
group = "shadow"
6464
description = "Create a shadow jar from dependencies without fastutil"
6565

66-
archiveClassifier.set("dependencies")
67-
destinationDirectory.set(project.layout.buildDirectory.dir("shadowDependenciesLibs"))
66+
archiveClassifier = "dependencies"
67+
destinationDirectory = project.layout.buildDirectory.dir("shadowDependenciesLibs")
6868

6969
// we need to create JAR with dependencies, but without fastutil,
7070
// so we include `runtimeClasspath` configuration (the same configuration which is used by default `shadowJar` task)

dokka-subprojects/analysis-kotlin-symbols/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ val shadowDependenciesJar by tasks.registering(ShadowJar::class) {
125125
group = "shadow"
126126
description = "Create a shadow jar from dependencies without fastutil"
127127

128-
archiveClassifier.set("dependencies")
129-
destinationDirectory.set(project.layout.buildDirectory.dir("shadowDependenciesLibs"))
128+
archiveClassifier = "dependencies"
129+
destinationDirectory = project.layout.buildDirectory.dir("shadowDependenciesLibs")
130130

131131
// we need to create JAR with dependencies, but without fastutil,
132132
// so we include `runtimeClasspath` configuration (the same configuration which is used by default `shadowJar` task)

dokka-subprojects/plugin-base-frontend/build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ plugins {
1212
}
1313

1414
node {
15-
version.set(libs.versions.node)
15+
version = libs.versions.node
1616

1717
// https://github.com/node-gradle/gradle-node-plugin/blob/3.5.1/docs/faq.md#is-this-plugin-compatible-with-centralized-repositories-declaration
18-
download.set(true)
19-
distBaseUrl.set(null as String?) // Strange cast to avoid overload ambiguity
18+
download = true
19+
distBaseUrl = null as String? // Strange cast to avoid overload ambiguity
2020

2121
// Stop Gradle from monitoring node_modules dir; it will be managed by NPM. This helps performance and task-avoidance.
2222
fastNpmInstall = true
@@ -27,7 +27,7 @@ val distributionDirectory = layout.projectDirectory.dir("dist")
2727
val npmRunBuild by tasks.registering(NpmTask::class) {
2828
dependsOn(tasks.npmInstall)
2929

30-
npmCommand.set(parseSpaceSeparatedArgs("run build"))
30+
npmCommand = parseSpaceSeparatedArgs("run build")
3131

3232
inputs.dir("src/main")
3333
.withPropertyName("mainSources")

examples/plugin/hide-internal-api/build.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ dependencies {
3131
testImplementation("org.jetbrains.dokka:dokka-base-test-utils:$dokkaVersion")
3232
}
3333

34+
kotlin {
35+
compilerOptions.jvmTarget.set(JvmTarget.JVM_1_8)
36+
}
37+
3438
val dokkaOutputDir = "$buildDir/dokka"
3539

3640
tasks {
37-
withType<KotlinCompile>().configureEach {
38-
compilerOptions.jvmTarget.set(JvmTarget.JVM_1_8)
39-
}
4041
dokkaHtml {
4142
outputDirectory.set(file(dokkaOutputDir))
4243
}

settings.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
@file:Suppress("UnstableApiUsage")
6-
75
rootProject.name = "dokka"
86

97
pluginManagement {
@@ -17,6 +15,7 @@ pluginManagement {
1715
}
1816

1917
dependencyResolutionManagement {
18+
@Suppress("UnstableApiUsage")
2019
repositories {
2120
maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide")
2221
maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide-plugin-dependencies")

0 commit comments

Comments
 (0)