Migrate to new package and Kotlin 1.7.20-Beta

This commit is contained in:
Alexander Nozik 2022-07-29 14:46:22 +03:00
parent 1c80eeb2c7
commit f6e27eebdd
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
21 changed files with 89 additions and 73 deletions

View File

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Kotlin 1.7.10 - Kotlin 1.7.10
- Versions update - Versions update
- Project group changed to `space.kscience`
### Deprecated ### Deprecated

View File

@ -1,28 +1,28 @@
[![Maven Central](https://img.shields.io/maven-central/v/ru.mipt.npm.gradle.project/ru.mipt.npm.gradle.project.gradle.plugin.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22ru.mipt.npm.gradle.project%22%20AND%20a:%22ru.mipt.npm.gradle.project.gradle.plugin%22) [![Maven Central](https://img.shields.io/maven-central/v/space.kscience.gradle.project/space.kscience.gradle.project.gradle.plugin.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22space.kscience.gradle.project%22%20AND%20a:%22space.kscience.gradle.project.gradle.plugin%22)
# KScience build tools # KScience build tools
A collection of gradle plugins for building and publish in *kscience* and *dataforge* projects. A collection of gradle plugins for building and publish in *kscience* and *dataforge* projects.
## ru.mipt.npm.gradle.common ## space.kscience.gradle.common
A primary plugin. When used with kotlin-jvm, kotlin-js or kotlin-mulitplatform configures the project for appropriate target. A primary plugin. When used with kotlin-jvm, kotlin-js or kotlin-mulitplatform configures the project for appropriate target.
## ru.mipt.npm.gradle.project ## space.kscience.gradle.project
Root project tool including JetBrains changelog plugin an kotlin binary compatibility validator tool. Root project tool including JetBrains changelog plugin an kotlin binary compatibility validator tool.
## ru.mipt.npm.gradle.mpp ## space.kscience.gradle.mpp
`= kotlin("multiplatform") + ru.mipt.npm.gradle.common` `= kotlin("multiplatform") + space.kscience.gradle.common`
Includes JVM-IR and JS-IR-Browser targets. Includes JVM-IR and JS-IR-Browser targets.
## ru.mipt.npm.gradle.jvm ## space.kscience.gradle.jvm
`= kotlin("jvm") + ru.mipt.npm.gradle.common` `= kotlin("jvm") + space.kscience.gradle.common`
## ru.mipt.npm.gradle.js ## space.kscience.gradle.js
`= kotlin("js") + ru.mipt.npm.gradle.common` `= kotlin("js") + space.kscience.gradle.common`
## ru.mipt.npm.gradle.native ## space.kscience.gradle.native
add default native targets to `ru.mipt.npm.gradle.mpp` add default native targets to `space.kscience.gradle.mpp`
## ru.mipt.npm.gradle.node ## space.kscience.gradle.node
add node target to `ru.mipt.npm.gradle.mpp` add node target to `space.kscience.gradle.mpp`

View File

@ -9,10 +9,10 @@ plugins {
`version-catalog` `version-catalog`
} }
group = "ru.mipt.npm" group = "space.kscience"
version = libs.versions.tools.get() version = libs.versions.tools.get()
description = "Build tools for DataForge and kscience projects" description = "Build tools for kotlin for science projects"
changelog.version.set(project.version.toString()) changelog.version.set(project.version.toString())
@ -52,50 +52,51 @@ tasks.test {
gradlePlugin { gradlePlugin {
plugins { plugins {
create("common") { create("common") {
id = "ru.mipt.npm.gradle.common" id = "space.kscience.gradle.common"
description = "The generalized kscience plugin that works in conjunction with any kotlin plugin" description = "The generalized kscience plugin that works in conjunction with any kotlin plugin"
implementationClass = "ru.mipt.npm.gradle.KScienceCommonPlugin" implementationClass = "space.kscience.gradle.KScienceCommonPlugin"
} }
create("project") { create("project") {
id = "ru.mipt.npm.gradle.project" id = "space.kscience.gradle.project"
description = "The root plugin for multi-module project infrastructure" description = "The root plugin for multi-module project infrastructure"
implementationClass = "ru.mipt.npm.gradle.KScienceProjectPlugin" implementationClass = "space.kscience.gradle.KScienceProjectPlugin"
} }
create("mpp") { create("mpp") {
id = "ru.mipt.npm.gradle.mpp" id = "space.kscience.gradle.mpp"
description = "Pre-configured multiplatform project" description = "Pre-configured multiplatform project"
implementationClass = "ru.mipt.npm.gradle.KScienceMPPlugin" implementationClass = "space.kscience.gradle.KScienceMPPlugin"
} }
create("jvm") { create("jvm") {
id = "ru.mipt.npm.gradle.jvm" id = "space.kscience.gradle.jvm"
description = "Pre-configured JVM project" description = "Pre-configured JVM project"
implementationClass = "ru.mipt.npm.gradle.KScienceJVMPlugin" implementationClass = "space.kscience.gradle.KScienceJVMPlugin"
} }
create("js") { create("js") {
id = "ru.mipt.npm.gradle.js" id = "space.kscience.gradle.js"
description = "Pre-configured JS project" description = "Pre-configured JS project"
implementationClass = "ru.mipt.npm.gradle.KScienceJSPlugin" implementationClass = "space.kscience.gradle.KScienceJSPlugin"
} }
create("native") { create("native") {
id = "ru.mipt.npm.gradle.native" id = "space.kscience.gradle.native"
description = "Additional native targets to be use alongside mpp" description = "Additional native targets to be use alongside mpp"
implementationClass = "ru.mipt.npm.gradle.KScienceNativePlugin" implementationClass = "space.kscience.gradle.KScienceNativePlugin"
} }
create("node") { create("node") {
id = "ru.mipt.npm.gradle.node" id = "space.kscience.gradle.node"
description = "Additional nodejs target to be use alongside mpp" description = "Additional nodejs target to be use alongside mpp"
implementationClass = "ru.mipt.npm.gradle.KScienceNodePlugin" implementationClass = "space.kscience.gradle.KScienceNodePlugin"
} }
} }
} }
tasks.create("version") { tasks.create("version") {
group = "publishing"
val versionFile = project.buildDir.resolve("project-version.txt") val versionFile = project.buildDir.resolve("project-version.txt")
outputs.file(versionFile) outputs.file(versionFile)
doLast { doLast {
@ -174,7 +175,7 @@ afterEvaluate {
} }
} }
val spaceRepo = "https://maven.pkg.jetbrains.space/mipt-npm/p/mipt-npm/maven" val spaceRepo = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven"
val spaceUser: String? = project.findProperty("publishing.space.user") as? String val spaceUser: String? = project.findProperty("publishing.space.user") as? String
val spaceToken: String? = project.findProperty("publishing.space.token") as? String val spaceToken: String? = project.findProperty("publishing.space.token") as? String

View File

@ -1,6 +1,6 @@
[versions] [versions]
tools = "0.11.8-kotlin-1.7.10" tools = "0.12.0-kotlin-1.7.20-Beta"
kotlin = "1.7.10" kotlin = "1.7.20-Beta"
atomicfu = "0.18.2" atomicfu = "0.18.2"
binary-compatibility-validator = "0.10.1" binary-compatibility-validator = "0.10.1"
changelog = "1.3.1" changelog = "1.3.1"
@ -82,13 +82,13 @@ changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
gradle-common = { id = "ru.mipt.npm.gradle.common", version.ref = "tools" } gradle-common = { id = "space.kscience.gradle.common", version.ref = "tools" }
gradle-project = { id = "ru.mipt.npm.gradle.project", version.ref = "tools" } gradle-project = { id = "space.kscience.gradle.project", version.ref = "tools" }
gradle-mpp = { id = "ru.mipt.npm.gradle.mpp", version.ref = "tools" } gradle-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" }
gradle-jvm = { id = "ru.mipt.npm.gradle.jvm", version.ref = "tools" } gradle-jvm = { id = "space.kscience.gradle.jvm", version.ref = "tools" }
gradle-js = { id = "ru.mipt.npm.gradle.js", version.ref = "tools" } gradle-js = { id = "space.kscience.gradle.js", version.ref = "tools" }
gradle-native = { id = "ru.mipt.npm.gradle.native", version.ref = "tools" } gradle-native = { id = "space.kscience.gradle.native", version.ref = "tools" }
gradle-node = { id = "ru.mipt.npm.gradle.node", version.ref = "tools" } gradle-node = { id = "space.kscience.gradle.node", version.ref = "tools" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" } kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" }

View File

@ -1,4 +1,4 @@
package ru.mipt.npm.gradle package space.kscience.gradle
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project

View File

@ -1,4 +1,4 @@
package ru.mipt.npm.gradle package space.kscience.gradle
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.plugins.ApplicationPlugin import org.gradle.api.plugins.ApplicationPlugin
@ -11,9 +11,9 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlinx.jupyter.api.plugin.tasks.JupyterApiResourcesTask import org.jetbrains.kotlinx.jupyter.api.plugin.tasks.JupyterApiResourcesTask
import ru.mipt.npm.gradle.internal.defaultPlatform import space.kscience.gradle.internal.defaultPlatform
import ru.mipt.npm.gradle.internal.useCommonDependency import space.kscience.gradle.internal.useCommonDependency
import ru.mipt.npm.gradle.internal.useFx import space.kscience.gradle.internal.useFx
public enum class FXModule(public val artifact: String, public vararg val dependencies: FXModule) { public enum class FXModule(public val artifact: String, public vararg val dependencies: FXModule) {
BASE("javafx-base"), BASE("javafx-base"),

View File

@ -1,4 +1,4 @@
package ru.mipt.npm.gradle package space.kscience.gradle
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project

View File

@ -1,4 +1,4 @@
package ru.mipt.npm.gradle package space.kscience.gradle
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project

View File

@ -1,4 +1,4 @@
package ru.mipt.npm.gradle package space.kscience.gradle
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project

View File

@ -1,4 +1,4 @@
package ru.mipt.npm.gradle package space.kscience.gradle
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project

View File

@ -1,4 +1,4 @@
package ru.mipt.npm.gradle package space.kscience.gradle
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project

View File

@ -1,4 +1,4 @@
package ru.mipt.npm.gradle package space.kscience.gradle
import kotlinx.validation.ApiValidationExtension import kotlinx.validation.ApiValidationExtension
import kotlinx.validation.BinaryCompatibilityValidatorPlugin import kotlinx.validation.BinaryCompatibilityValidatorPlugin
@ -10,7 +10,7 @@ import org.jetbrains.changelog.ChangelogPlugin
import org.jetbrains.changelog.ChangelogPluginExtension import org.jetbrains.changelog.ChangelogPluginExtension
import org.jetbrains.dokka.gradle.AbstractDokkaTask import org.jetbrains.dokka.gradle.AbstractDokkaTask
import org.jetbrains.dokka.gradle.DokkaPlugin import org.jetbrains.dokka.gradle.DokkaPlugin
import ru.mipt.npm.gradle.internal.* import space.kscience.gradle.internal.*
/** /**
* Simplifies adding repositories for Maven publishing, responds for releasing tasks for projects. * Simplifies adding repositories for Maven publishing, responds for releasing tasks for projects.
@ -241,6 +241,17 @@ public open class KScienceProjectPlugin : Plugin<Project> {
dependsOn(generateReadme) dependsOn(generateReadme)
} }
tasks.create("version") {
group = "publishing"
val versionFile = project.buildDir.resolve("project-version.txt")
outputs.file(versionFile)
doLast {
versionFile.createNewFile()
versionFile.writeText(project.version.toString())
println(project.version)
}
}
allprojects { allprojects {
afterEvaluate { afterEvaluate {
ksciencePublish.repositoryNames.forEach { repositoryName -> ksciencePublish.repositoryNames.forEach { repositoryName ->

View File

@ -1,4 +1,4 @@
package ru.mipt.npm.gradle package space.kscience.gradle
import freemarker.cache.StringTemplateLoader import freemarker.cache.StringTemplateLoader
import freemarker.template.Configuration import freemarker.template.Configuration

View File

@ -1,4 +1,4 @@
package ru.mipt.npm.gradle package space.kscience.gradle
import org.gradle.api.JavaVersion import org.gradle.api.JavaVersion

View File

@ -1,7 +1,7 @@
package ru.mipt.npm.gradle package space.kscience.gradle
import org.gradle.api.Project import org.gradle.api.Project
import ru.mipt.npm.gradle.internal.useCommonDependency import space.kscience.gradle.internal.useCommonDependency
public class SerializationTargets( public class SerializationTargets(
public val sourceSet: DependencySourceSet, public val sourceSet: DependencySourceSet,

View File

@ -1,4 +1,4 @@
package ru.mipt.npm.gradle package space.kscience.gradle
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension import org.gradle.api.plugins.JavaPluginExtension
@ -10,9 +10,9 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import ru.mipt.npm.gradle.internal.applyRepos import space.kscience.gradle.internal.applyRepos
import ru.mipt.npm.gradle.internal.applySettings import space.kscience.gradle.internal.applySettings
import ru.mipt.npm.gradle.internal.fromJsDependencies import space.kscience.gradle.internal.fromJsDependencies
private val defaultJvmArgs: List<String> = listOf("-Xjvm-default=all", "-Xlambdas=indy", "-Xjdk-release=${KScienceVersions.JVM_TARGET}") private val defaultJvmArgs: List<String> = listOf("-Xjvm-default=all", "-Xlambdas=indy", "-Xjdk-release=${KScienceVersions.JVM_TARGET}")
@ -63,7 +63,9 @@ public fun Project.configureKScience(
js(IR) { js(IR) {
browser { browser {
commonWebpackConfig { commonWebpackConfig {
cssSupport.enabled = true cssSupport{
enabled = true
}
} }
} }
} }
@ -107,7 +109,9 @@ public fun Project.configureKScience(
js(IR) { js(IR) {
browser { browser {
commonWebpackConfig { commonWebpackConfig {
cssSupport.enabled = true cssSupport{
enabled = true
}
} }
} }
} }

View File

@ -1,4 +1,4 @@
package ru.mipt.npm.gradle.internal package space.kscience.gradle.internal
import org.gradle.api.artifacts.ProjectDependency import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.dsl.RepositoryHandler import org.gradle.api.artifacts.dsl.RepositoryHandler

View File

@ -1,4 +1,4 @@
package ru.mipt.npm.gradle.internal package space.kscience.gradle.internal
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.configure
@ -6,8 +6,8 @@ import org.gradle.kotlin.dsl.invoke
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import ru.mipt.npm.gradle.DependencyConfiguration import space.kscience.gradle.DependencyConfiguration
import ru.mipt.npm.gradle.DependencySourceSet import space.kscience.gradle.DependencySourceSet
internal fun Project.useDependency( internal fun Project.useDependency(
vararg pairs: Pair<String, String>, vararg pairs: Pair<String, String>,

View File

@ -1,4 +1,4 @@
package ru.mipt.npm.gradle.internal package space.kscience.gradle.internal
import org.apache.tools.ant.taskdefs.condition.Os import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.api.Project import org.gradle.api.Project
@ -6,9 +6,9 @@ import org.gradle.kotlin.dsl.findByType
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import ru.mipt.npm.gradle.DependencyConfiguration import space.kscience.gradle.DependencyConfiguration
import ru.mipt.npm.gradle.FXModule import space.kscience.gradle.FXModule
import ru.mipt.npm.gradle.FXPlatform import space.kscience.gradle.FXPlatform
internal val defaultPlatform: FXPlatform = when { internal val defaultPlatform: FXPlatform = when {
Os.isFamily(Os.FAMILY_WINDOWS) -> FXPlatform.WINDOWS Os.isFamily(Os.FAMILY_WINDOWS) -> FXPlatform.WINDOWS

View File

@ -1,4 +1,4 @@
package ru.mipt.npm.gradle.internal package space.kscience.gradle.internal
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension import org.gradle.api.publish.PublishingExtension
@ -10,7 +10,7 @@ import org.gradle.plugins.signing.SigningExtension
import org.gradle.plugins.signing.SigningPlugin import org.gradle.plugins.signing.SigningPlugin
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.targets import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.targets
internal fun Project.requestPropertyOrNull(propertyName: String): String? = findProperty(propertyName) as? String internal fun Project.requestPropertyOrNull(propertyName: String): String? = findProperty(propertyName) as? String
?: System.getenv(propertyName) ?: System.getenv(propertyName)

View File

@ -1,6 +1,5 @@
package ru.mipt.npm.gradle
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import space.kscience.gradle.KScienceVersions
class TestPlugins { class TestPlugins {
@Test @Test