Merge pull request #42 from mipt-npm/dev

0.11.3
This commit is contained in:
Alexander Nozik 2022-04-12 10:52:59 +03:00 committed by GitHub
commit 3d843210ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 85 additions and 49 deletions

21
.github/workflows/build.yml vendored Normal file
View File

@ -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

View File

@ -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 }}

View File

@ -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

1
gradle.properties Normal file
View File

@ -0,0 +1 @@
kotlin.code.style=official

View File

@ -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"

View File

@ -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

View File

@ -166,39 +166,9 @@ public open class KScienceProjectPlugin : Plugin<Project> {
}
}
tasks.withType<AbstractDokkaTask> {
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<PublishToMavenRepository>()
.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<AbstractDokkaTask> {
// dependsOn(generateReadme)
// }
}
val generateReadme by tasks.creating {
@ -264,6 +234,39 @@ public open class KScienceProjectPlugin : Plugin<Project> {
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(?<publication>.*)PublicationTo${repositoryNameCapitalized}Repository"
.toRegex()
tasks.withType<PublishToMavenRepository>().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<ApiValidationExtension>()?.apply {

View File

@ -15,7 +15,7 @@ import ru.mipt.npm.gradle.internal.applySettings
import ru.mipt.npm.gradle.internal.fromJsDependencies
private val defaultJvmArgs: List<String> = listOf("-Xjvm-default=all", "-Xlambdas=indy")
private val defaultJvmArgs: List<String> = 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