Skip to content

Commit 76eebcc

Browse files
authored
Gradle improvements (#258)
Co-authored-by: hfhbd <hfhbd@users.noreply.github.com>
1 parent 6c926dd commit 76eebcc

File tree

3 files changed

+27
-51
lines changed

3 files changed

+27
-51
lines changed

build.gradle.kts

Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import Build_gradle.MavenPomFile
2-
import kotlinx.html.js.packageJson
31
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
42
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
53

@@ -11,19 +9,12 @@ plugins {
119
kotlin("multiplatform") version "1.9.22"
1210
id("maven-publish")
1311
id("signing")
12+
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2"
1413
}
1514

1615
group = "org.jetbrains.kotlinx"
1716
version = "0.11.0"
1817

19-
buildscript {
20-
dependencies {
21-
classpath("org.jetbrains.kotlinx:binary-compatibility-validator:0.13.2")
22-
}
23-
}
24-
25-
apply(plugin = "binary-compatibility-validator")
26-
2718
/**
2819
* If "release" profile is used the "-SNAPSHOT" suffix of the version is removed.
2920
*/
@@ -85,7 +76,7 @@ kotlin {
8576
jvm {
8677
mavenPublication {
8778
groupId = group as String
88-
pom { name by "${project.name}-jvm" }
79+
pom { name = "${project.name}-jvm" }
8980

9081
artifact(emptyJar) {
9182
classifier = "javadoc"
@@ -104,7 +95,7 @@ kotlin {
10495

10596
mavenPublication {
10697
groupId = group as String
107-
pom { name by "${project.name}-js" }
98+
pom { name = "${project.name}-js" }
10899
}
109100
}
110101
@OptIn(ExperimentalWasmDsl::class)
@@ -114,7 +105,7 @@ kotlin {
114105

115106
mavenPublication {
116107
groupId = group as String
117-
pom { name by "${project.name}-wasm-js" }
108+
pom { name = "${project.name}-wasm-js" }
118109
}
119110
}
120111

@@ -151,7 +142,7 @@ kotlin {
151142
groupId = group as String
152143
artifactId = "${project.name}-common"
153144
pom {
154-
name by "${project.name}-common"
145+
name = "${project.name}-common"
155146
}
156147
}
157148
}
@@ -161,22 +152,15 @@ kotlin {
161152
jvmToolchain(8)
162153

163154
sourceSets {
164-
commonMain {
165-
dependencies {
166-
implementation(kotlin("stdlib"))
167-
}
168-
}
169-
170155
commonTest {
171156
dependencies {
172157
implementation(kotlin("test"))
173158
}
174159
}
175-
176160
}
177161
}
178162

179-
tasks.withType<Jar> {
163+
tasks.withType<Jar>().configureEach {
180164
manifest {
181165
attributes += sortedMapOf(
182166
"Built-By" to System.getProperty("user.name"),
@@ -221,46 +205,42 @@ typealias MavenPomFile = MavenPom
221205
fun MavenPomFile.config(config: MavenPomFile.() -> Unit = {}) {
222206
config()
223207

224-
url by "https://github.com/Kotlin/kotlinx.html"
225-
name by "kotlinx.html"
226-
description by "A kotlinx.html library provides DSL to build HTML to Writer/Appendable or DOM at JVM and browser (or other JavaScript engine) for better Kotlin programming for Web."
208+
url = "https://github.com/Kotlin/kotlinx.html"
209+
name = "kotlinx.html"
210+
description = "A kotlinx.html library provides DSL to build HTML to Writer/Appendable or DOM at JVM and browser (or other JavaScript engine) for better Kotlin programming for Web."
227211

228212
licenses {
229213
license {
230-
name by "The Apache License, Version 2.0"
231-
url by "https://www.apache.org/licenses/LICENSE-2.0.txt"
214+
name = "The Apache License, Version 2.0"
215+
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
232216
}
233217
}
234218

235219
scm {
236-
connection by "scm:git:git@github.com:Kotlin/kotlinx.html.git"
237-
url by "https://github.com/Kotlin/kotlinx.html"
238-
tag by "HEAD"
220+
connection = "scm:git:git@github.com:Kotlin/kotlinx.html.git"
221+
url = "https://github.com/Kotlin/kotlinx.html"
222+
tag = "HEAD"
239223
}
240224

241225
developers {
242226
developer {
243-
name by "Sergey Mashkov"
244-
organization by "JetBrains s.r.o."
227+
name = "Sergey Mashkov"
228+
organization = "JetBrains s.r.o."
245229
roles to "developer"
246230
}
247231

248232
developer {
249-
name by "Anton Dmitriev"
250-
organization by "JetBrains s.r.o."
233+
name = "Anton Dmitriev"
234+
organization = "JetBrains s.r.o."
251235
roles to "developer"
252236
}
253237
}
254238
}
255239

256-
tasks.withType<GenerateModuleMetadata> {
240+
tasks.withType<GenerateModuleMetadata>().configureEach {
257241
enabled = true
258242
}
259243

260-
infix fun <T> Property<T>.by(value: T) {
261-
set(value)
262-
}
263-
264244
val signingKey = System.getenv("SIGN_KEY_ID")
265245
val signingKeyPassphrase = System.getenv("SIGN_KEY_PASSPHRASE")
266246

@@ -274,14 +254,13 @@ if (!signingKey.isNullOrBlank()) {
274254
}
275255
}
276256

277-
rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin> {
278-
val nodeM1Version = "16.13.1"
279-
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().nodeVersion = nodeM1Version
280-
}
281-
282257
rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin::class.java) {
283258
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension>().ignoreScripts = false
284259
}
285260

286-
tasks.getByName("jsBrowserTest").dependsOn("wasmJsTestTestDevelopmentExecutableCompileSync")
287-
tasks.getByName("wasmJsBrowserTest").dependsOn("jsTestTestDevelopmentExecutableCompileSync")
261+
tasks.named("jsBrowserTest") {
262+
dependsOn("wasmJsTestTestDevelopmentExecutableCompileSync")
263+
}
264+
tasks.named("wasmJsBrowserTest") {
265+
dependsOn("jsTestTestDevelopmentExecutableCompileSync")
266+
}

buildSrc/build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
plugins {
2-
kotlin("jvm") version "1.9.21"
2+
`kotlin-dsl`
33
}
44

55
repositories {
66
mavenCentral()
77
}
88

99
dependencies {
10-
implementation(kotlin("stdlib"))
1110
implementation("com.sun.xsom:xsom:20140925")
1211
implementation("com.squareup:kotlinpoet:1.15.3")
13-
}
12+
}

gradle.properties

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# The following property is required to mitigate issue https://github.com/gradle/gradle/issues/11412.
2-
systemProp.org.gradle.internal.publish.checksums.insecure=true
31
kotlin.code.style=official
42
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
53

0 commit comments

Comments
 (0)