Skip to content

Commit f9ae712

Browse files
authored
Simple property assignments and dropping Property by extension (#371)
Adhering to guidelines https://blog.gradle.org/simpler-kotlin-dsl-property-assignment
1 parent d7b0533 commit f9ae712

File tree

4 files changed

+22
-27
lines changed

4 files changed

+22
-27
lines changed

benchmarks/build.gradle.kts

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

1616
kotlin {
1717
jvmToolchain {
18-
languageVersion.set(JavaLanguageVersion.of(libs.versions.java.get()))
18+
languageVersion = JavaLanguageVersion.of(libs.versions.java.get())
1919
}
2020

2121
jvm()

build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-dokka.gradle.kts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ tasks.withType<DokkaTaskPartial>().configureEach {
1515
includes.from("Module.md")
1616

1717
sourceLink {
18-
localDirectory.set(rootDir)
19-
remoteUrl.set(URL("https://github.com/kotlin/kotlinx-io/tree/master"))
20-
remoteLineSuffix.set("#L")
18+
localDirectory = rootDir
19+
remoteUrl = URL("https://github.com/kotlin/kotlinx-io/tree/master")
20+
remoteLineSuffix = "#L"
2121
}
2222

2323
// we don't want to advertise `unsafe` APIs in documentation
2424
perPackageOption {
25-
suppress.set(true)
26-
matchingRegex.set(".*unsafe.*")
25+
suppress = true
26+
matchingRegex = ".*unsafe.*"
2727
}
2828

2929
// as in kotlinx-io-multiplatform.gradle.kts:configureSourceSet

build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ plugins {
1717
kotlin {
1818
@OptIn(ExperimentalKotlinGradlePluginApi::class)
1919
compilerOptions {
20-
allWarningsAsErrors.set(true)
20+
allWarningsAsErrors = true
2121
freeCompilerArgs.add("-Xexpect-actual-classes")
2222
}
2323

2424
val versionCatalog: VersionCatalog = extensions.getByType<VersionCatalogsExtension>().named("libs")
2525
jvmToolchain {
2626
val javaVersion = versionCatalog.findVersion("java").getOrNull()?.requiredVersion
2727
?: throw GradleException("Version 'java' is not specified in the version catalog")
28-
languageVersion.set(JavaLanguageVersion.of(javaVersion))
28+
languageVersion = JavaLanguageVersion.of(javaVersion)
2929
}
3030

3131
jvm {

build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-publish.gradle.kts

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,45 +28,40 @@ publishing {
2828
}
2929
}
3030

31-
// Pom configuration
32-
infix fun <T> Property<T>.by(value: T) {
33-
set(value)
34-
}
35-
3631
fun MavenPom.configureMavenCentralMetadata(project: Project) {
37-
name by project.name
38-
description by "IO support for Kotlin"
39-
url by "https://github.com/Kotlin/kotlinx-io"
32+
name = project.name
33+
description = "IO support for Kotlin"
34+
url = "https://github.com/Kotlin/kotlinx-io"
4035

4136
licenses {
4237
license {
43-
name by "The Apache Software License, Version 2.0"
44-
url by "https://www.apache.org/licenses/LICENSE-2.0.txt"
45-
distribution by "repo"
38+
name = "The Apache Software License, Version 2.0"
39+
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
40+
distribution = "repo"
4641
}
4742
}
4843

4944
developers {
5045
developer {
51-
id by "JetBrains"
52-
name by "JetBrains Team"
53-
organization by "JetBrains"
54-
organizationUrl by "https://www.jetbrains.com"
46+
id = "JetBrains"
47+
name = "JetBrains Team"
48+
organization = "JetBrains"
49+
organizationUrl = "https://www.jetbrains.com"
5550
}
5651
}
5752

5853
scm {
59-
url by "https://github.com/Kotlin/kotlinx-io"
54+
url = "https://github.com/Kotlin/kotlinx-io"
6055
}
6156
}
6257

6358
fun MavenPublication.mavenCentralArtifacts(project: Project, sources: SourceDirectorySet) {
6459
val sourcesJar by project.tasks.creating(Jar::class) {
65-
archiveClassifier.set("sources")
60+
archiveClassifier = "sources"
6661
from(sources)
6762
}
6863
val javadocJar by project.tasks.creating(Jar::class) {
69-
archiveClassifier.set("javadoc")
64+
archiveClassifier = "javadoc"
7065
// contents are deliberately left empty
7166
}
7267
artifact(sourcesJar)
@@ -100,7 +95,7 @@ fun RepositoryHandler.configureMavenPublication( project: Project) {
10095

10196
fun Project.configureEmptyJavadocArtifact(): Jar {
10297
val javadocJar by project.tasks.creating(Jar::class) {
103-
archiveClassifier.set("javadoc")
98+
archiveClassifier = "javadoc"
10499
// contents are deliberately left empty
105100
}
106101
return javadocJar

0 commit comments

Comments
 (0)