diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5347757 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,21 @@ +name: Gradle build + +on: + push: + branches: [ dev, master ] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 40 + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2.5.0 + with: + java-version: 11 + distribution: liberica + - uses: gradle/gradle-build-action@v2 + with: + arguments: build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 74a385e..6e3e21d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,14 +8,17 @@ on: jobs: build: runs-on: ubuntu-latest + timeout-minutes: 40 steps: - uses: actions/checkout@v2 - - - name: Run a one-line script - run: echo Hello, world! - - - name: Run a multi-line script - run: | - echo Add other actions to build, - echo test, and deploy your project. + - uses: actions/setup-java@v2.5.0 + with: + java-version: 11 + distribution: liberica + - uses: gradle/gradle-build-action@v2 + with: + arguments: | + publishAllPublicationsToSpaceRepository + -Ppublishing.space.user=${{ secrets.SPACE_APP_ID }} + -Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b97937..8c45f7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- Coroutine tests as default dependency for tests +- Context receiver flag ### Changed - Separate release tasks for each target +- Kotlin 1.6.20 +- Context receivers enabled +- Ktor 2.0 ### Deprecated diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..7fc6f1f --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +kotlin.code.style=official diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e54f996..98a51c7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,22 +1,22 @@ [versions] -tools = "0.11.2-kotlin-1.6.10" -kotlin = "1.6.10" +tools = "0.11.3-kotlin-1.6.20" +kotlin = "1.6.20" atomicfu = "0.17.1" binary-compatibility-validator = "0.8.0" changelog = "1.3.1" dokka = "1.6.10" -kotlin-jupyter = "0.11.0-62" +kotlin-jupyter = "0.11.0-71" kotlinx-benchmark = "0.4.2" kotlinx-cli = "0.3.4" kotlinx-collections-immutable = "0.3.5" -kotlinx-coroutines = "1.6.0" +kotlinx-coroutines = "1.6.1" kotlinx-datetime = "0.3.2" kotlinx-html = "0.7.3" kotlinx-knit = "0.3.0" kotlinx-nodejs = "0.0.7" kotlinx-serialization = "1.3.2" -ktor = "1.6.7" -xmlutil = "0.84.0" +ktor = "2.0.0" +xmlutil = "0.84.1" yamlkt = "0.10.2" jsBom = "0.0.1-pre.313-kotlin-1.6.10" junit = "5.8.2" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 41dfb87..00e33ed 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt index f48f6d0..22f7ec6 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt @@ -166,39 +166,9 @@ public open class KScienceProjectPlugin : Plugin { } } - tasks.withType { - dependsOn(generateReadme) - } - } - - val releaseAll by tasks.creating { - group = RELEASE_GROUP - description = "Publish development or production release based on version suffix" - } - - allprojects { - afterEvaluate { - ksciencePublish.repositoryNames.forEach { repositoryName -> - val repositoryNameCapitalized = repositoryName.capitalize() - - tasks.withType() - .filter { it.name.startsWith("publish") && it.name.endsWith("To${repositoryNameCapitalized}Repository") } - .forEach { - val theName = "release${ - it.name.removePrefix("publish").removeSuffix("To${repositoryNameCapitalized}Repository") - }" - - val targetReleaseTask = tasks.findByName(theName) ?: tasks.create(theName) { - group = RELEASE_GROUP - description = "Publish platform release artifact" - } - - releaseAll.dependsOn(targetReleaseTask) - - targetReleaseTask.dependsOn(it) - } - } - } +// tasks.withType { +// dependsOn(generateReadme) +// } } val generateReadme by tasks.creating { @@ -264,6 +234,39 @@ public open class KScienceProjectPlugin : Plugin { dependsOn(generateReadme) } + + val releaseAll by tasks.creating { + group = RELEASE_GROUP + description = "Publish development or production release based on version suffix" + dependsOn(generateReadme) + } + + allprojects { + afterEvaluate { + ksciencePublish.repositoryNames.forEach { repositoryName -> + val repositoryNameCapitalized = repositoryName.capitalize() + + val pattern = "publish(?.*)PublicationTo${repositoryNameCapitalized}Repository" + .toRegex() + + tasks.withType().toList().forEach forEachPublication@ { + val matchResult = pattern.matchEntire(it.name) ?: return@forEachPublication + val publicationName = matchResult.groups["publication"]!!.value.capitalize() + val releaseTaskName = "release$publicationName" + + val targetReleaseTask = rootProject.tasks.findByName(releaseTaskName) ?: rootProject.tasks.create(releaseTaskName) { + group = RELEASE_GROUP + description = "Publish platform release artifact for $publicationName to all repositories" + } + + releaseAll.dependsOn(targetReleaseTask) + + targetReleaseTask.dependsOn(it) + } + } + } + } + // Disable API validation for snapshots if (isSnapshot()) { extensions.findByType()?.apply { diff --git a/src/main/kotlin/ru/mipt/npm/gradle/commonConfigurations.kt b/src/main/kotlin/ru/mipt/npm/gradle/commonConfigurations.kt index de1b304..433e462 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/commonConfigurations.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/commonConfigurations.kt @@ -15,7 +15,7 @@ import ru.mipt.npm.gradle.internal.applySettings import ru.mipt.npm.gradle.internal.fromJsDependencies -private val defaultJvmArgs: List = listOf("-Xjvm-default=all", "-Xlambdas=indy") +private val defaultJvmArgs: List = listOf("-Xjvm-default=all", "-Xlambdas=indy", "-Xcontext-receivers") public fun Project.configureKScience( kotlinVersion: KotlinVersion @@ -38,6 +38,7 @@ public fun Project.configureKScience( dependencies { implementation(kotlin("test-junit5")) implementation("org.junit.jupiter:junit-jupiter:${KScienceVersions.junit}") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${KScienceVersions.coroutinesVersion}") } } } @@ -83,6 +84,7 @@ public fun Project.configureKScience( sourceSets["test"].apply { dependencies { implementation(kotlin("test-js")) + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${KScienceVersions.coroutinesVersion}") } } } @@ -124,6 +126,7 @@ public fun Project.configureKScience( dependencies { implementation(kotlin("test-common")) implementation(kotlin("test-annotations-common")) + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${KScienceVersions.coroutinesVersion}") } } val jvmMain by getting