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

Gradle 7.4.2, Kotlin 1.6.21 and other plugin updates #3281

Merged
merged 1 commit into from May 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -12,3 +12,4 @@ build
out
target
local.properties
/kotlin-js-store
9 changes: 6 additions & 3 deletions benchmarks/build.gradle.kts
Expand Up @@ -8,7 +8,6 @@ import me.champeau.gradle.*
import org.jetbrains.kotlin.gradle.tasks.*

plugins {
id("net.ltgt.apt")
id("com.github.johnrengelman.shadow")
id("me.champeau.gradle.jmh") apply false
}
Expand All @@ -31,8 +30,6 @@ tasks.named<KotlinCompile>("compileJmhKotlin") {
}
}



// It is better to use the following to run benchmarks, otherwise you may get unexpected errors:
// ./gradlew --no-daemon cleanJmhJar jmh -Pjmh="MyBenchmark"
extensions.configure<JMHPluginExtension>("jmh") {
Expand All @@ -54,6 +51,12 @@ val jmhJarTask = tasks.named<Jar>("jmhJar") {
}

tasks {
// For some reason the DuplicatesStrategy from jmh is not enough
// and errors with duplicates appear unless I force it to WARN only:
withType<Copy> {
duplicatesStrategy = DuplicatesStrategy.WARN
}

build {
dependsOn(jmhJarTask)
}
Expand Down
13 changes: 7 additions & 6 deletions build.gradle
Expand Up @@ -54,13 +54,13 @@ buildscript {
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
classpath "org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicfu_version"
classpath "org.jetbrains.kotlinx:kotlinx-knit:$knit_version"
classpath "com.moowork.gradle:gradle-node-plugin:$gradle_node_version"
classpath "com.github.node-gradle:gradle-node-plugin:$gradle_node_version"
classpath "org.jetbrains.kotlinx:binary-compatibility-validator:$binary_compatibility_validator_version"
classpath "ru.vyarus:gradle-animalsniffer-plugin:1.5.3" // Android API check
classpath "ru.vyarus:gradle-animalsniffer-plugin:1.5.4" // Android API check
classpath "org.jetbrains.kotlinx:kover:$kover_version"

// JMH plugins
classpath "com.github.jengelman.gradle.plugins:shadow:5.1.0"
classpath "gradle.plugin.com.github.johnrengelman:shadow:7.1.2"
}

CacheRedirector.configureBuildScript(buildscript, rootProject)
Expand Down Expand Up @@ -130,6 +130,9 @@ allprojects {
}
}

// needs to be before evaluationDependsOn due to weird Gradle ordering
apply plugin: "animalsniffer-conventions"

// Add dependency to core source sets. Core is configured in kx-core/build.gradle
configure(subprojects.findAll { !sourceless.contains(it.name) && it.name != coreModule }) {
evaluationDependsOn(":$coreModule")
Expand Down Expand Up @@ -232,7 +235,7 @@ def core_docs_url = "https://kotlin.github.io/kotlinx.coroutines/$coreModule/"
def core_docs_file = "$projectDir/kotlinx-coroutines-core/build/dokka/htmlPartial/package-list"
apply plugin: "org.jetbrains.dokka"

configure(subprojects.findAll { !unpublished.contains(it.name) }) {
configure(subprojects.findAll { !unpublished.contains(it.name) && it.name != coreModule }) {
if (it.name != 'kotlinx-coroutines-bom') {
apply from: rootProject.file('gradle/dokka.gradle.kts')
}
Expand Down Expand Up @@ -303,8 +306,6 @@ def publishTasks = getTasksByName("publish", true) + getTasksByName("publishNpm"

task deploy(dependsOn: publishTasks)

apply plugin: "animalsniffer-conventions"

clean.dependsOn gradle.includedBuilds.collect { it.task(':clean') }

// --------------- Knit configuration ---------------
Expand Down
6 changes: 6 additions & 0 deletions buildSrc/src/main/kotlin/Publishing.kt
Expand Up @@ -7,6 +7,7 @@
import org.gradle.api.Project
import org.gradle.api.artifacts.dsl.*
import org.gradle.api.publish.maven.*
import org.gradle.kotlin.dsl.*
import org.gradle.plugins.signing.*
import java.net.*

Expand Down Expand Up @@ -56,6 +57,11 @@ fun configureMavenPublication(rh: RepositoryHandler, project: Project) {
password = project.getSensitiveProperty("libs.sonatype.password")
}
}

// Something that's easy to "clean" for development, not mavenLocal
Copy link
Member

Choose a reason for hiding this comment

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

👍

rh.maven("${project.rootProject.buildDir}/repo") {
name = "buildRepo"
}
}

fun signPublicationIfKeyPresent(project: Project, publication: MavenPublication) {
Expand Down
20 changes: 11 additions & 9 deletions buildSrc/src/main/kotlin/animalsniffer-conventions.gradle.kts
Expand Up @@ -4,17 +4,19 @@

import ru.vyarus.gradle.plugin.animalsniffer.*

subprojects {
configure(subprojects) {
// Skip JDK 8 projects or unpublished ones
if (!shouldSniff()) return@subprojects
if (!shouldSniff()) return@configure
apply(plugin = "ru.vyarus.animalsniffer")
configure<AnimalSnifferExtension> {
sourceSets = listOf((project.extensions.getByName("sourceSets") as SourceSetContainer).getByName("main"))
}
val signature: Configuration by configurations
dependencies {
signature("net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature")
signature("org.codehaus.mojo.signature:java17:1.0@signature")
project.plugins.withType(JavaPlugin::class.java) {
configure<AnimalSnifferExtension> {
sourceSets = listOf((project.extensions.getByName("sourceSets") as SourceSetContainer).getByName("main"))
}
val signature: Configuration by configurations
dependencies {
signature("net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature")
signature("org.codehaus.mojo.signature:java17:1.0@signature")
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Expand Up @@ -5,7 +5,7 @@
# Kotlin
version=1.6.1-SNAPSHOT
group=org.jetbrains.kotlinx
kotlin_version=1.6.20
kotlin_version=1.6.21

# Dependencies
junit_version=4.12
Expand Down Expand Up @@ -35,7 +35,7 @@ baksmali_version=2.2.7

# JS
kotlin.js.compiler=both
gradle_node_version=1.2.0
gradle_node_version=3.1.1
node_version=10.0.0
npm_version=5.7.1
mocha_version=6.2.2
Expand Down
2 changes: 1 addition & 1 deletion gradle/compile-js-multiplatform.gradle
Expand Up @@ -60,7 +60,7 @@ compileTestJsLegacy.configure {
task populateNodeModules(type: Copy, dependsOn: compileTestJsLegacy) {
// we must copy output that is transformed by atomicfu
from(kotlin.js().compilations.main.output.allOutputs)
into "$node.nodeModulesDir/node_modules"
into node.nodeProjectDir.dir("node_modules")

def configuration = configurations.hasProperty("jsLegacyTestRuntimeClasspath")
? configurations.jsLegacyTestRuntimeClasspath
Expand Down
4 changes: 0 additions & 4 deletions gradle/dokka.gradle.kts
Expand Up @@ -39,10 +39,6 @@ tasks.withType(DokkaTaskPartial::class).configureEach {

if (!project.isMultiplatform) {
dependsOn(project.configurations["compileClasspath"])
doFirst {
// resolve classpath only during execution
classpath.from(project.configurations["compileClasspath"].files)// + project.sourceSets.main.output.files)
}
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions gradle/node-js.gradle
Expand Up @@ -2,13 +2,13 @@
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

apply plugin: 'com.moowork.node'
apply plugin: 'com.github.node-gradle.node'

node {
version = "$node_version"
npmVersion = "$npm_version"
download = true
nodeModulesDir = file(buildDir)
nodeProjectDir = file(buildDir)
}

// Configures testing for JS modules
Expand All @@ -25,7 +25,7 @@ task prepareNodePackage(type: Copy) {
from("npm") {
exclude 'package.json'
}
into "$node.nodeModulesDir"
into node.nodeProjectDir
}

npmInstall.dependsOn prepareNodePackage
Expand Down
5 changes: 3 additions & 2 deletions gradle/publish.gradle
Expand Up @@ -6,7 +6,6 @@ import org.gradle.util.VersionNumber

// Configures publishing of Maven artifacts to Maven Central

apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'

Expand All @@ -16,7 +15,9 @@ def isMultiplatform = project.name == "kotlinx-coroutines-core" || project.name
def isBom = project.name == "kotlinx-coroutines-bom"

if (!isBom) {
apply plugin: "com.github.johnrengelman.shadow"
if (project.name == "kotlinx-coroutines-debug") {
apply plugin: "com.github.johnrengelman.shadow"
}

// empty xxx-javadoc.jar
task javadocJar(type: Jar) {
Expand Down
35 changes: 18 additions & 17 deletions gradle/test-mocha-js.gradle
Expand Up @@ -9,7 +9,7 @@ task installDependenciesMochaNode(type: NpmTask, dependsOn: [npmInstall]) {
"mocha@$mocha_version",
"source-map-support@$source_map_support_version",
'--no-save']
if (project.hasProperty("teamcity")) args += ["mocha-teamcity-reporter@$mocha_teamcity_reporter_version"]
if (project.hasProperty("teamcity")) args.addAll(["mocha-teamcity-reporter@$mocha_teamcity_reporter_version"])
}

def compileJsLegacy = tasks.hasProperty("compileKotlinJsLegacy")
Expand All @@ -22,9 +22,9 @@ def compileTestJsLegacy = tasks.hasProperty("compileTestKotlinJsLegacy")

// todo: use atomicfu-transformed test files here (not critical)
task testMochaNode(type: NodeTask, dependsOn: [compileTestJsLegacy, installDependenciesMochaNode]) {
script = file("$node.nodeModulesDir/node_modules/mocha/bin/mocha")
args = [compileTestJsLegacy.outputFile, '--require', 'source-map-support/register']
if (project.hasProperty("teamcity")) args += ['--reporter', 'mocha-teamcity-reporter']
script = file("${node.nodeProjectDir.getAsFile().get()}/node_modules/mocha/bin/mocha")
args = [compileTestJsLegacy.outputFile.path, '--require', 'source-map-support/register']
if (project.hasProperty("teamcity")) args.addAll(['--reporter', 'mocha-teamcity-reporter'])
}

def jsLegacyTestTask = project.tasks.findByName('jsLegacyTest') ? jsLegacyTest : jsTest
Expand All @@ -40,8 +40,8 @@ task installDependenciesMochaChrome(type: NpmTask, dependsOn: [npmInstall]) {
"kotlin@$kotlin_version",
"kotlin-test@$kotlin_version",
'--no-save']
if (project.hasProperty("teamcity")) args += [
"mocha-teamcity-reporter@$mocha_teamcity_reporter_version"]
if (project.hasProperty("teamcity")) args.addAll([
"mocha-teamcity-reporter@$mocha_teamcity_reporter_version"])
}

def mochaChromeTestPage = file("$buildDir/test-page.html")
Expand All @@ -51,19 +51,20 @@ task prepareMochaChrome(dependsOn: [compileTestJsLegacy, installDependenciesMoch
}

prepareMochaChrome.doLast {
def nodeProjDir = node.nodeProjectDir.getAsFile().get()
mochaChromeTestPage.text = """<!DOCTYPE html>
<html>
<head>
<title>Mocha Tests</title>
<meta charset="utf-8">
<link rel="stylesheet" href="$node.nodeModulesDir/node_modules/mocha/mocha.css">
<link rel="stylesheet" href="$nodeProjDir/node_modules/mocha/mocha.css">
</head>
<body>
<div id="mocha"></div>
<script src="$node.nodeModulesDir/node_modules/mocha/mocha.js"></script>
<script src="$nodeProjDir/node_modules/mocha/mocha.js"></script>
<script>mocha.setup('bdd');</script>
<script src="$node.nodeModulesDir/node_modules/kotlin/kotlin.js"></script>
<script src="$node.nodeModulesDir/node_modules/kotlin-test/kotlin-test.js"></script>
<script src="$nodeProjDir/node_modules/kotlin/kotlin.js"></script>
<script src="$nodeProjDir/node_modules/kotlin-test/kotlin-test.js"></script>
<script src="$compileJsLegacy.outputFile"></script>
<script src="$compileTestJsLegacy.outputFile"></script>
<script>mocha.run();</script>
Expand All @@ -73,9 +74,9 @@ prepareMochaChrome.doLast {
}

task testMochaChrome(type: NodeTask, dependsOn: prepareMochaChrome) {
script = file("$node.nodeModulesDir/node_modules/mocha-headless-chrome/bin/start")
args = [compileTestJsLegacy.outputFile, '--file', mochaChromeTestPage]
if (project.hasProperty("teamcity")) args += ['--reporter', 'mocha-teamcity-reporter']
script = file("${node.nodeProjectDir.getAsFile().get()}/node_modules/mocha-headless-chrome/bin/start")
args = [compileTestJsLegacy.outputFile.path, '--file', mochaChromeTestPage]
if (project.hasProperty("teamcity")) args.addAll(['--reporter', 'mocha-teamcity-reporter'])
}

// todo: Commented out because mocha-headless-chrome does not work on TeamCity
Expand All @@ -90,13 +91,13 @@ task installDependenciesMochaJsdom(type: NpmTask, dependsOn: [npmInstall]) {
"jsdom-global@$jsdom_global_version",
"source-map-support@$source_map_support_version",
'--no-save']
if (project.hasProperty("teamcity")) args += ["mocha-teamcity-reporter@$mocha_teamcity_reporter_version"]
if (project.hasProperty("teamcity")) args.addAll(["mocha-teamcity-reporter@$mocha_teamcity_reporter_version"])
}

task testMochaJsdom(type: NodeTask, dependsOn: [compileTestJsLegacy, installDependenciesMochaJsdom]) {
script = file("$node.nodeModulesDir/node_modules/mocha/bin/mocha")
args = [compileTestJsLegacy.outputFile, '--require', 'source-map-support/register', '--require', 'jsdom-global/register']
if (project.hasProperty("teamcity")) args += ['--reporter', 'mocha-teamcity-reporter']
script = file("${node.nodeProjectDir.getAsFile().get()}/node_modules/mocha/bin/mocha")
args = [compileTestJsLegacy.outputFile.path, '--require', 'source-map-support/register', '--require', 'jsdom-global/register']
if (project.hasProperty("teamcity")) args.addAll(['--reporter', 'mocha-teamcity-reporter'])
}

jsLegacyTestTask.dependsOn testMochaJsdom
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Expand Up @@ -4,6 +4,6 @@

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 3 additions & 3 deletions integration-testing/build.gradle
Expand Up @@ -98,9 +98,9 @@ dependencies {
testImplementation 'junit:junit:4.12'
npmTestImplementation 'org.apache.commons:commons-compress:1.18'
npmTestImplementation 'com.google.code.gson:gson:2.8.5'
debugAgentTestCompile project(':kotlinx-coroutines-core')
debugAgentTestCompile project(':kotlinx-coroutines-debug')
coreAgentTestCompile project(':kotlinx-coroutines-core')
debugAgentTestImplementation project(':kotlinx-coroutines-core')
debugAgentTestImplementation project(':kotlinx-coroutines-debug')
coreAgentTestImplementation project(':kotlinx-coroutines-core')
}

compileTestKotlin {
Expand Down
2 changes: 1 addition & 1 deletion integration/kotlinx-coroutines-guava/build.gradle.kts
Expand Up @@ -5,7 +5,7 @@
val guavaVersion = "31.0.1-jre"

dependencies {
compile("com.google.guava:guava:$guavaVersion")
api("com.google.guava:guava:$guavaVersion")
}

java {
Expand Down
2 changes: 2 additions & 0 deletions kotlinx-coroutines-core/build.gradle
Expand Up @@ -14,6 +14,8 @@ if (rootProject.ext.native_targets_enabled) {
apply from: rootProject.file("gradle/compile-js-multiplatform.gradle")
apply from: rootProject.file('gradle/publish-npm-js.gradle')

apply from: rootProject.file('gradle/dokka.gradle.kts')
apply from: rootProject.file('gradle/publish.gradle')
/* ==========================================================================
Configure source sets structure for kotlinx-coroutines-core:
Expand Down
4 changes: 2 additions & 2 deletions kotlinx-coroutines-debug/build.gradle
Expand Up @@ -21,8 +21,8 @@ configurations {
dependencies {
compileOnly "junit:junit:$junit_version"
compileOnly "org.junit.jupiter:junit-jupiter-api:$junit5_version"
testCompile "org.junit.jupiter:junit-jupiter-engine:$junit5_version"
testCompile "org.junit.platform:junit-platform-testkit:1.7.0"
testImplementation "org.junit.jupiter:junit-jupiter-engine:$junit5_version"
testImplementation "org.junit.platform:junit-platform-testkit:1.7.0"
shadowDeps "net.bytebuddy:byte-buddy:$byte_buddy_version"
shadowDeps "net.bytebuddy:byte-buddy-agent:$byte_buddy_version"
compileOnly "io.projectreactor.tools:blockhound:$blockhound_version"
Expand Down
4 changes: 2 additions & 2 deletions reactive/kotlinx-coroutines-reactive/build.gradle.kts
Expand Up @@ -5,8 +5,8 @@
val reactiveStreamsVersion = property("reactive_streams_version")

dependencies {
compile("org.reactivestreams:reactive-streams:$reactiveStreamsVersion")
testCompile("org.reactivestreams:reactive-streams-tck:$reactiveStreamsVersion")
api("org.reactivestreams:reactive-streams:$reactiveStreamsVersion")
testImplementation("org.reactivestreams:reactive-streams-tck:$reactiveStreamsVersion")
}

val testNG by tasks.registering(Test::class) {
Expand Down
4 changes: 2 additions & 2 deletions reactive/kotlinx-coroutines-reactor/build.gradle.kts
Expand Up @@ -5,8 +5,8 @@
val reactorVersion = version("reactor")

dependencies {
compile("io.projectreactor:reactor-core:$reactorVersion")
compile(project(":kotlinx-coroutines-reactive"))
api("io.projectreactor:reactor-core:$reactorVersion")
api(project(":kotlinx-coroutines-reactive"))
}

java {
Expand Down
1 change: 0 additions & 1 deletion settings.gradle
Expand Up @@ -18,7 +18,6 @@ pluginManagement {
}

rootProject.name = 'kotlinx.coroutines'
enableFeaturePreview('GRADLE_METADATA')

def module(String path) {
int i = path.lastIndexOf('/')
Expand Down
2 changes: 1 addition & 1 deletion ui/kotlinx-coroutines-swing/build.gradle.kts
Expand Up @@ -3,5 +3,5 @@
*/

dependencies {
testCompile(project(":kotlinx-coroutines-jdk8"))
testImplementation(project(":kotlinx-coroutines-jdk8"))
}