Skip to content

Commit 896dd28

Browse files
committed
chore: Gradle 8.3-rc1 update and misc refactorings
1 parent ed00cac commit 896dd28

File tree

12 files changed

+74
-67
lines changed

12 files changed

+74
-67
lines changed

build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ plugins {
55
}
66

77
// Multi module single coverage report
8-
// tasks.dokkaHtmlMultiModule { moduleName = project.name }
98
dependencies { project.subprojects.forEach { kover(it) } }
9+
10+
tasks.dokkaHtmlMultiModule { moduleName = "Kotlin Multiplatform Playground!" }

common/src/commonMain/kotlin/dev/suresh/Greeting.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Greeting {
3434

3535
private fun kotlinxTests(): String {
3636
val ba = "Kotlinx".encodeToByteArray()
37-
val bs1 = ByteString(ba)
37+
val bs1 = ByteString(data = ba)
3838
val bs2 = "IO".encodeToByteString()
3939

4040
val bs = buildByteString {

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ org.gradle.parallel=true
33
org.gradle.caching=true
44
org.gradle.daemon=false
55
org.gradle.configureondemand=true
6+
org.gradle.configuration-cache=false
67
org.gradle.jvmargs=-Xmx2048m
78
org.gradle.kotlin.dsl.allWarningsAsErrors=true
89
# org.gradle.welcome=never

gradle/build-logic/common-plugins/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
@file:Suppress("UnstableApiUsage")
2+
13
import org.jetbrains.kotlin.gradle.dsl.*
24
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
35

46
plugins {
57
`kotlin-dsl`
8+
embeddedKotlin("plugin.serialization")
69
alias(libs.plugins.jte)
710
alias(libs.plugins.bestpractices)
811
// alias(libs.plugins.kotlin.dsl)

gradle/build-logic/common-plugins/src/main/kotlin/common/KotlinExtns.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ fun JavaToolchainSpec.configureJvmToolchain() {
9595

9696
context(Project)
9797
fun JavaCompile.configureJavac() {
98+
modularity.inferModulePath = true
9899
options.apply {
99100
encoding = "UTF-8"
100101
release = javaRelease

gradle/build-logic/common-plugins/src/main/kotlin/plugins/common.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ tasks {
101101
description = "Generate template classes"
102102
group = LifecycleBasePlugin.BUILD_TASK_NAME
103103

104-
// GitHub actions workaround
105-
val props = project.properties.toMutableMap()
104+
// val props = project.properties.toMutableMap()
105+
val props = mutableMapOf<String, Any?>()
106106
props["git_branch"] = project.findProperty("branch_name")
107107
props["git_tag"] = project.findProperty("base_tag")
108108

@@ -130,7 +130,7 @@ tasks {
130130

131131
filteringCharset = "UTF-8"
132132
from(project.projectDir.resolve("src/main/templates"))
133-
into(project.buildDir.resolve("generated-sources/templates/kotlin/main"))
133+
into(project.layout.buildDirectory.dir("generated-sources/templates/kotlin/main"))
134134
exclude { it.name.startsWith("jte") }
135135
expand(props)
136136

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package plugins
22

3-
import common.kotlinJvmTarget
43
import common.libs
54
import java.net.URI
5+
import org.jetbrains.dokka.DokkaConfiguration.Visibility
66
import org.jetbrains.dokka.gradle.DokkaTaskPartial
77

88
plugins {
@@ -14,53 +14,45 @@ tasks {
1414
withType<DokkaTaskPartial>().configureEach {
1515
dokkaSourceSets.configureEach {
1616
moduleName = project.name
17-
jdkVersion = kotlinJvmTarget.map { it.target.toInt() }
17+
jdkVersion = 20
18+
// jdkVersion = kotlinJvmTarget.map { it.target.toInt() }
1819
noStdlibLink = false
1920
noJdkLink = false
2021
reportUndocumented = false
2122
skipDeprecated = true
2223
includes.from("README.md")
2324

24-
pluginsMapConfiguration =
25-
mapOf(
26-
"org.jetbrains.dokka.base.DokkaBase" to
27-
"""{
28-
"footerMessage": "Copyright &copy; 2023 Suresh"
29-
}""")
25+
documentedVisibilities = setOf(Visibility.PUBLIC, Visibility.PROTECTED)
3026

3127
sourceLink {
32-
sourceLink {
33-
remoteUrl = libs.versions.publish.scm.url.map { URI("$it/tree/main/src").toURL() }
34-
remoteLineSuffix = "#L"
35-
}
36-
37-
externalDocumentationLink {
38-
url = URI("https://kotlin.github.io/kotlinx.coroutines/package-list").toURL()
39-
}
40-
41-
externalDocumentationLink {
42-
url = URI("https://kotlinlang.org/api/kotlinx.serialization/package-list").toURL()
43-
}
28+
localDirectory = rootProject.projectDir
29+
remoteUrl = libs.versions.publish.scm.url.map { URI("$it/tree/main").toURL() }
30+
remoteLineSuffix = "#L"
31+
}
4432

45-
perPackageOption {
46-
matchingRegex = "kotlin($|\\.).*"
47-
skipDeprecated = false
48-
reportUndocumented = true // Emit warnings about not documented members
49-
includeNonPublic = false
50-
}
33+
externalDocumentationLink {
34+
url = URI("https://kotlin.github.io/kotlinx.coroutines/package-list").toURL()
5135
}
5236

53-
// val rootPath = rootProject.rootDir.toPath()
54-
// val logoCss = rootPath.resolve("docs/css/logo-styles.css").toString().replace('\\', '/')
55-
// val paletteSvg =
56-
// rootPath.resolve("docs/img/wordmark_small_dark.svg").toString().replace('\\', '/')
57-
// pluginsMapConfiguration = mapOf(
58-
// "org.jetbrains.dokka.base.DokkaBase" to """{
59-
// "customStyleSheets": ["$logoCss"],
60-
// "customAssets": ["$paletteSvg"],
61-
// "footerMessage": "Copyright &copy; 2021 AJ Alt"
62-
// }"""
63-
// )
37+
externalDocumentationLink {
38+
url = URI("https://kotlinlang.org/api/kotlinx.serialization/package-list").toURL()
39+
}
6440
}
41+
42+
pluginsMapConfiguration =
43+
mapOf(
44+
"org.jetbrains.dokka.base.DokkaBase" to
45+
"""{ "footerMessage": "Copyright &copy; 2023 Suresh"}""")
46+
47+
// val rootPath = rootProject.rootDir.toPath()
48+
// val logoCss = rootPath.resolve("docs/css/logo-styles.css").toString().replace('\\', '/')
49+
// val paletteSvg = rootPath.resolve("docs/img/img.svg").toString().replace('\\', '/')
50+
// pluginsMapConfiguration = mapOf(
51+
// "org.jetbrains.dokka.base.DokkaBase" to """{
52+
// "customStyleSheets": ["$logoCss"],
53+
// "customAssets": ["$paletteSvg"],
54+
// "footerMessage": "Copyright &copy; 2021 AJ Alt"
55+
// }"""
56+
// )
6557
}
6658
}

gradle/build-logic/common-plugins/src/main/kotlin/plugins/kotlin.mpp.gradle.kts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ kotlinMultiplatform.apply {
5151

5252
// val test by testRuns.existing
5353
testRuns.configureEach { executionTask.configure { configureKotlinTest() } }
54+
// Attribute to distinguish JVM target
5455
attributes.attribute(mppTargetAttr, "jvm")
5556
}
5657

@@ -60,18 +61,19 @@ kotlinMultiplatform.apply {
6061
compilerOptions.configure { configureKotlinJvm() }
6162
}
6263
testRuns.configureEach { executionTask.configure { configureKotlinTest() } }
64+
// Attribute to distinguish Desktop target
6365
attributes.attribute(mppTargetAttr, "desktop")
6466
}
6567

66-
js(IR) {
68+
js {
6769
useEsModules()
6870
binaries.executable()
6971

7072
browser {
7173
commonWebpackConfig(
7274
Action {
7375
// outputFileName = "app.js"
74-
cssSupport { enabled.set(true) }
76+
cssSupport { enabled = true }
7577
})
7678

7779
testTask(
@@ -84,6 +86,8 @@ kotlinMultiplatform.apply {
8486
// distribution { outputDirectory = file("$projectDir/docs") }
8587
}
8688

89+
compilations.configureEach { kotlinOptions { configureKotlinJs() } }
90+
8791
testRuns.configureEach { executionTask.configure { configureTestReport() } }
8892
}
8993

@@ -235,6 +239,8 @@ tasks {
235239
named<Copy>("jvmProcessResources") {
236240
val jsBrowserDist = named("jsBrowserDistribution")
237241
from(jsBrowserDist)
242+
// filePermissions {}
243+
// dirPermissions {}
238244
}
239245

240246
// Application run should use the jvmJar as classpath
@@ -264,7 +270,7 @@ if (!isNodeJSConfigured.toBoolean()) {
264270
rootProject.extensions.configure<NodeJsRootExtension> {
265271
download = true
266272
isNodeJSConfigured = "true"
267-
// nodeVersion = "20.0.0-v8-canaryxxxx"
273+
nodeVersion = libs.versions.node.version.get()
268274
// nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
269275
}
270276
}

gradle/build-logic/common-plugins/src/main/kotlin/plugins/publishing.gradle.kts

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@ if (project == rootProject) {
1616

1717
group = libs.versions.group.get()
1818

19-
tasks {
20-
cyclonedxBom {
21-
includeConfigs = listOf("runtimeClasspath")
22-
skipConfigs = listOf("compileClasspath", "testCompileClasspath")
23-
destination = project.layout.buildDirectory.dir("sbom").map { it.asFile }
24-
outputFormat = "json"
25-
includeLicenseText = true
26-
}
19+
val sonatypeUsername: String? by project
20+
val sonatypePassword: String? by project
21+
val signingKey: String? by project
22+
val signingPassword: String? by project
23+
24+
signing {
25+
isRequired = sonatypeUsername.isNullOrBlank().not() && sonatypePassword.isNullOrBlank().not()
26+
// isPublish = gradle.taskGraph.allTasks.any { it.name.startsWith("publish") }
27+
useInMemoryPgpKeys(signingKey, signingPassword)
28+
// useGpgCmd()
29+
sign(publishing.publications)
2730
}
2831

2932
publishing {
@@ -105,17 +108,15 @@ publishing {
105108
}
106109
}
107110

108-
// signing {
109-
// setRequired {
110-
// gradle.taskGraph.allTasks.any {
111-
// it.name.startsWith("publish")
112-
// }
113-
// }
114-
// publishing.publications.configureEach {
115-
// sign(this)
116-
// }
117-
// useGpgCmd()
118-
// }
111+
tasks {
112+
cyclonedxBom {
113+
includeConfigs = listOf("runtimeClasspath")
114+
skipConfigs = listOf("compileClasspath", "testCompileClasspath")
115+
destination = project.layout.buildDirectory.dir("sbom").map { it.asFile }
116+
outputFormat = "json"
117+
includeLicenseText = true
118+
}
119+
}
119120

120121
fun MavenPublication.configurePom() {
121122
val githubUrl = libs.versions.publish.scm.url

gradle/build-logic/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ org.gradle.parallel=true
22
org.gradle.caching=true
33
org.gradle.daemon=false
44
org.gradle.configureondemand=true
5+
org.gradle.configuration-cache=true
56
org.gradle.jvmargs=-Xmx2048m
67
org.gradle.kotlin.dsl.allWarningsAsErrors=true
78

0 commit comments

Comments
 (0)