Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies and clean up build scripts #423

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/.idea/*
!/.idea/copyright
.gradle
.kotlin
*.iml
target
build
/local.properties
local.properties
benchmarks.jar
37 changes: 17 additions & 20 deletions benchmarks/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
/*
* Copyright 2019-2023 JetBrains s.r.o. and contributors.
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
*/
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
id("kotlin")
id("me.champeau.jmh")
with(libs.plugins) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer not using with to keep things as simple as possible in plugins.

alias(kotlin.jvm)
alias(jmh)
}
}


val mainJavaToolchainVersion by ext(project.property("java.mainToolchainVersion"))
val modularJavaToolchainVersion by ext(project.property("java.modularToolchainVersion"))

sourceSets {
dependencies {
implementation(project(":kotlinx-datetime"))
implementation("org.openjdk.jmh:jmh-core:1.35")
implementation(libs.jmh)
}
}

// Publish benchmarks to the root for the easier 'java -jar benchmarks.jar`
// publish benchmarks to the repository root for easier `java -jar benchmarks.jar`
tasks.named<Jar>("jmhJar") {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tasks.named<Jar>("jmhJar") {
tasks.jmhJar {

val nullString: String? = null
archiveBaseName.set("benchmarks")
archiveClassifier.set(nullString)
archiveVersion.set(nullString)
archiveVersion.convention(nullString)
destinationDirectory.set(file("$rootDir"))
archiveBaseName = "benchmarks"
archiveClassifier = null
archiveVersion.convention(null as String?)
archiveVersion = null
destinationDirectory = file("$rootDir")
}

repositories {
mavenCentral()
// compile all Kotlin code from the module during full-repository builds
tasks.named("assemble") {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tasks.named("assemble") {
tasks.assemble {

tasks.withType<KotlinCompilationTask<*>>().forEach { compileKotlinTask ->
dependsOn(compileKotlinTask)
Comment on lines +28 to +29
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tasks.withType<KotlinCompilationTask<*>>().forEach { compileKotlinTask ->
dependsOn(compileKotlinTask)
dependsOn(tasks.withType<KotlinCompilationTask<*>>())

}
}
86 changes: 54 additions & 32 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile

plugins {
id("kotlinx.team.infra") version "0.4.0-dev-81"
kotlin("multiplatform") apply false
id("org.jetbrains.kotlinx.kover") version "0.8.0-Beta2"
with(libs.plugins) {
alias(kotlinx.infra)
alias(kover)

alias(kotlin.multiplatform) apply false
}
}

fun javaLanguageVersionProperty(propertyName: String) = JavaLanguageVersion.of(property(propertyName) as String)
val mainJavaToolchainVersion by extra(javaLanguageVersionProperty("java.mainToolchainVersion"))
val modularJavaToolchainVersion by extra(javaLanguageVersionProperty("java.modularToolchainVersion"))

infra {
teamcity {
}
publishing {
include(":kotlinx-datetime")
libraryRepoUrl = "https://github.com/Kotlin/kotlinx-datetime"
Expand All @@ -16,37 +26,11 @@ infra {
}
}

val mainJavaToolchainVersion by ext(project.property("java.mainToolchainVersion"))
val modularJavaToolchainVersion by ext(project.property("java.modularToolchainVersion"))

allprojects {
repositories {
addTrainRepositories(project)
mavenCentral()
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
// outputs the compiler version to logs so we can check whether the train configuration applied
kotlinOptions.freeCompilerArgs += "-version"
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile>().configureEach {
compilerOptions { freeCompilerArgs.add("-Xpartial-linkage-loglevel=ERROR") }
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile>().configureEach {
compilerOptions { freeCompilerArgs.add("-Xpartial-linkage-loglevel=ERROR") }
}
}

// Disable NPM to NodeJS nightly compatibility check.
// Drop this when NodeJs version that supports latest Wasm become stable
tasks.withType<org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask>().configureEach {
args.add("--ignore-engines")
}

kover {
reports {
verify {
rule {
// requirement for a minimum lines coverage of 85%
// requirement for a minimum line coverage of 85%
minBound(85)
}
}
Expand All @@ -57,3 +41,41 @@ dependencies {
kover(project(":kotlinx-datetime"))
kover(project(":kotlinx-datetime-serialization"))
}

// !! infrastructure for builds as a Kotlin user project
// (although some of these settings are just enabled by default because they're not very invasive anyway)
subprojects {
tasks.withType<KotlinCompilationTask<*>>().configureEach {
compilerOptions {
// output kotlin.git-searchable names of reported diagnostics
freeCompilerArgs.add("-Xrender-internal-diagnostic-names")
// output reported warnings even in the presence of reported errors
freeCompilerArgs.add("-Xreport-all-warnings")

with(providers) {
gradleProperty("kotlin_language_version").orNull?.let { optionalOverridingKotlinLanguageVersion ->
languageVersion = KotlinVersion.fromVersion(optionalOverridingKotlinLanguageVersion)
logger.info(
"[ktDT-as-KUP] Overrode the Kotlin language version with $optionalOverridingKotlinLanguageVersion for '$path'"
)
}
gradleProperty("kotlin_api_version").orNull?.let { optionalOverridingKotlinApiVersion ->
apiVersion = KotlinVersion.fromVersion(optionalOverridingKotlinApiVersion)
logger.info(
"[ktDT-as-KUP] Overrode the Kotlin API version with $optionalOverridingKotlinApiVersion for '$path'"
)
}
}
}
}
tasks.withType<KotlinNativeCompile>().configureEach {
compilerOptions {
freeCompilerArgs.add("-Xpartial-linkage-loglevel=error")
}
}
tasks.withType<Kotlin2JsCompile>().configureEach {
compilerOptions {
freeCompilerArgs.add("-Xpartial-linkage-loglevel=error")
}
}
}
42 changes: 0 additions & 42 deletions buildSrc/build.gradle.kts

This file was deleted.

50 changes: 0 additions & 50 deletions buildSrc/src/main/kotlin/CommunityProjectsBuild.kt

This file was deleted.

Loading