-
Notifications
You must be signed in to change notification settings - Fork 624
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrated build scripts to kts (#2654)
Actions: - Translate subprojects buildscripts to KTS - Upgrade Gradle to 8.7 - Move common login into convention precompiled plugins - Added support of version catalog - Use Kotlin version from version catalog - Removed usage of extra extension and rootProject - Removed buildscript block and grouped root scripts - Removed background native tests
- Loading branch information
Showing
55 changed files
with
1,723 additions
and
1,592 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import org.jetbrains.kotlin.gradle.dsl.* | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
/* | ||
* Copyright 2017-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
plugins { | ||
java | ||
idea | ||
kotlin("jvm") | ||
alias(libs.plugins.serialization) | ||
alias(libs.plugins.shadow) | ||
alias(libs.plugins.jmh) | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
jmh { | ||
jmhVersion.set("1.35") | ||
} | ||
|
||
tasks.processJmhResources { | ||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
} | ||
|
||
tasks.jmhJar { | ||
archiveBaseName.set("benchmarks") | ||
archiveVersion.set("") | ||
destinationDirectory.set(file("$rootDir")) | ||
} | ||
|
||
// to include benchmark-module jmh source set compilation during build to verify that it is also compiled succesfully | ||
tasks.assemble { | ||
dependsOn(tasks.jmhClasses) | ||
} | ||
|
||
tasks.withType<KotlinCompile>().configureEach { | ||
compilerOptions { | ||
jvmTarget = JvmTarget.JVM_1_8 | ||
} | ||
|
||
kotlinOptions { | ||
if (overriddenLanguageVersion != null) { | ||
languageVersion = overriddenLanguageVersion | ||
freeCompilerArgs += "-Xsuppress-version-warnings" | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(libs.jmhCore) | ||
implementation(libs.guava) | ||
implementation(libs.jackson.databind) | ||
implementation(libs.jackson.module.kotlin) | ||
implementation(libs.okio) | ||
implementation(project(":kotlinx-serialization-core")) | ||
implementation(project(":kotlinx-serialization-json")) | ||
implementation(project(":kotlinx-serialization-json-okio")) | ||
implementation(project(":kotlinx-serialization-protobuf")) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication | ||
|
||
plugins { | ||
`java-platform` | ||
} | ||
|
||
val name = project.name | ||
|
||
dependencies { | ||
constraints { | ||
rootProject.subprojects.forEach { | ||
if (it.name == name) return@forEach | ||
if (!it.plugins.hasPlugin("maven-publish")) return@forEach | ||
evaluationDependsOn(it.path) | ||
it.publishing.publications.all { | ||
this as MavenPublication | ||
if (artifactId.endsWith("-kotlinMultiplatform")) return@all | ||
if (artifactId.endsWith("-metadata")) return@all | ||
// Skip platform artifacts (like *-linuxx64, *-macosx64) | ||
// It leads to inconsistent bom when publishing from different platforms | ||
// (e.g. on linux it will include only linuxx64 artifacts and no macosx64) | ||
// It shouldn't be a problem as usually consumers need to use generic *-native artifact | ||
// Gradle will choose correct variant by using metadata attributes | ||
if (artifacts.any { it.extension == "klib" }) return@all | ||
this@constraints.api(mapOf("group" to groupId, "name" to artifactId, "version" to version)) | ||
} | ||
} | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
val mavenBom by creating(MavenPublication::class) { | ||
from(components["javaPlatform"]) | ||
} | ||
// Disable metadata publication | ||
forEach { pub -> | ||
pub as DefaultMavenPublication | ||
pub.unsetModuleDescriptorGenerator() | ||
tasks.matching { it.name == "generateMetadataFileFor${pub.name.capitalize()}Publication" }.all { | ||
onlyIf { false } | ||
} | ||
} | ||
} | ||
} | ||
|
||
fun DefaultMavenPublication.unsetModuleDescriptorGenerator() { | ||
@Suppress("NULL_FOR_NONNULL_TYPE") | ||
val generator: TaskProvider<Task?> = null | ||
setModuleDescriptorGenerator(generator) | ||
} |
Oops, something went wrong.