Compare commits

...

2 Commits

Author SHA1 Message Date
d93b0a578f 0.15.4-2.0.0 2024-06-04 12:52:49 +03:00
43dcf509fb 0.15.4-2.0.0 2024-06-04 12:49:18 +03:00
5 changed files with 45 additions and 29 deletions

View File

@ -9,7 +9,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
### Changed ### Changed
- Use ES6 modules by default in JS
### Deprecated ### Deprecated
@ -19,6 +18,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security ### Security
## 0.15.4-kotlin-2.0.0 - 2024-06-04
### Added
- Pass `compose` extension to the kscience extension so compose dependencies could be called directly from kscience block
### Changed
- Use ES6 modules by default in JS
- Kotlin 2.0
## 0.15.2-kotlin-1.9.22 - 2024-02-09 ## 0.15.2-kotlin-1.9.22 - 2024-02-09
### Added ### Added

View File

@ -1,12 +1,13 @@
[versions] [versions]
atomicfu = "0.24.0" atomicfu = "0.24.0"
changelog = "2.2.0" changelog = "2.2.0"
compose = "1.6.10" compose = "1.6.11"
dokka = "1.9.20" dokka = "1.9.20"
jsBom = "1.0.0-pre.751" jsBom = "1.0.0-pre.754"
junit = "5.10.2"
# @pin # @pin
kotlin = "2.0.0" kotlin = "2.0.0"
kotlin-jupyter = "0.12.0-227" kotlin-jupyter = "0.12.0-230"
kotlinx-benchmark = "0.4.10" kotlinx-benchmark = "0.4.10"
kotlinx-cli = "0.3.6" kotlinx-cli = "0.3.6"
kotlinx-coroutines = "1.8.1" kotlinx-coroutines = "1.8.1"
@ -15,24 +16,24 @@ kotlinx-html = "0.11.0"
kotlinx-knit = "0.5.0" kotlinx-knit = "0.5.0"
kotlinx-nodejs = "0.0.7" kotlinx-nodejs = "0.0.7"
kotlinx-serialization = "1.6.3" kotlinx-serialization = "1.6.3"
kover = "0.8.0"
ktor = "2.3.11" ktor = "2.3.11"
logback = "1.5.6" logback = "1.5.6"
slf4j = "2.0.13" slf4j = "2.0.13"
# @pin # @pin
tools = "0.15.3-kotlin-2.0.0" tools = "0.15.4-kotlin-2.0.0"
xmlutil = "0.86.3" xmlutil = "0.86.3"
yamlkt = "0.13.0" yamlkt = "0.13.0"
kover = "0.8.0"
junit = "5.10.2"
[plugins] [plugins]
com-github-ben-manes-versions = "com.github.ben-manes.versions:0.51.0" com-github-ben-manes-versions = "com.github.ben-manes.versions:0.51.0"
compose-jb = { id = "org.jetbrains.compose", version.ref = "compose" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kscience-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" } compose-jb = { id = "org.jetbrains.compose", version.ref = "compose" }
kscience-project = { id = "space.kscience.gradle.project", version.ref = "tools" } jetbrains-changelog = "org.jetbrains.changelog:2.2.0"
jetbrains-dokka = "org.jetbrains.dokka:1.9.20"
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" }
kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:4.4.0"
kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" } kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" }
kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" } kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
@ -48,13 +49,11 @@ kotlin-plugin-scripting = { id = "org.jetbrains.kotlin.plugin.scripting", versio
kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kotlin-plugin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" } kotlin-plugin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark" } kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark" }
kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
kscience-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" }
kscience-project = { id = "space.kscience.gradle.project", version.ref = "tools" }
ktor = { id = "io.ktor.plugin", version.ref = "ktor" } ktor = { id = "io.ktor.plugin", version.ref = "ktor" }
version-catalog-update = "nl.littlerobots.version-catalog-update:0.8.4" version-catalog-update = "nl.littlerobots.version-catalog-update:0.8.4"
kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:4.4.0"
jetbrains-changelog = "org.jetbrains.changelog:2.2.0"
jetbrains-dokka = "org.jetbrains.dokka:1.9.20"
kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
[libraries] [libraries]
atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" } atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" }
@ -65,7 +64,7 @@ dokka-base = { module = "org.jetbrains.dokka:dokka-base", version.ref = "dokka"
dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
dokka-gradle-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } dokka-gradle-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
foojay-resolver = "org.gradle.toolchains:foojay-resolver:0.8.0" foojay-resolver = "org.gradle.toolchains:foojay-resolver:0.8.0"
freemarker = "org.freemarker:freemarker:2.3.32" freemarker = "org.freemarker:freemarker:2.3.33"
gradle-changelog-plugin = { module = "org.jetbrains.intellij.plugins:gradle-changelog-plugin", version.ref = "changelog" } gradle-changelog-plugin = { module = "org.jetbrains.intellij.plugins:gradle-changelog-plugin", version.ref = "changelog" }
kotlin-assignment-compiler-plugin-embeddable = { module = "org.jetbrains.kotlin:kotlin-assignment-compiler-plugin-embeddable", version.ref = "kotlin" } kotlin-assignment-compiler-plugin-embeddable = { module = "org.jetbrains.kotlin:kotlin-assignment-compiler-plugin-embeddable", version.ref = "kotlin" }
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }

View File

@ -3,6 +3,7 @@ package space.kscience.gradle
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.plugins.ApplicationPlugin import org.gradle.api.plugins.ApplicationPlugin
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.provider.Property import org.gradle.api.provider.Property
import org.gradle.api.tasks.Copy import org.gradle.api.tasks.Copy
import org.gradle.api.tasks.testing.Test import org.gradle.api.tasks.testing.Test
@ -28,6 +29,7 @@ import space.kscience.gradle.internal.defaultKotlinJvmArgs
import space.kscience.gradle.internal.fromJsDependencies import space.kscience.gradle.internal.fromJsDependencies
import space.kscience.gradle.internal.requestPropertyOrNull import space.kscience.gradle.internal.requestPropertyOrNull
import space.kscience.gradle.internal.useCommonDependency import space.kscience.gradle.internal.useCommonDependency
import javax.inject.Inject
public enum class DependencyConfiguration { public enum class DependencyConfiguration {
API, API,
@ -52,7 +54,7 @@ public val Project.isInDevelopment: Boolean
private const val defaultJdkVersion = 11 private const val defaultJdkVersion = 11
public open class KScienceExtension(public val project: Project) { public abstract class KScienceExtension @Inject constructor(public val project: Project): ExtensionAware {
public val jdkVersionProperty: Property<Int> = project.objects.property<Int>().apply { public val jdkVersionProperty: Property<Int> = project.objects.property<Int>().apply {
set(defaultJdkVersion) set(defaultJdkVersion)
@ -352,7 +354,8 @@ public class KScienceNativeConfiguration(private val project: Project) {
): Unit = target(KScienceNativeTarget(preset, targetName, targetConfiguration)) ): Unit = target(KScienceNativeTarget(preset, targetName, targetConfiguration))
} }
public open class KScienceMppExtension(project: Project) : KScienceExtension(project) { public abstract class KScienceMppExtension @Inject constructor(project: Project) : KScienceExtension(project) {
/** /**
* Enable jvm target * Enable jvm target
*/ */
@ -414,10 +417,6 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
*/ */
@OptIn(ExperimentalWasmDsl::class) @OptIn(ExperimentalWasmDsl::class)
public fun wasm(block: KotlinWasmJsTargetDsl.() -> Unit = {}) { public fun wasm(block: KotlinWasmJsTargetDsl.() -> Unit = {}) {
// if (project.requestPropertyOrNull("kscience.wasm.disabled") == "true") {
// project.logger.warn("Wasm target is disabled with 'kscience.wasm.disabled' property")
// return
// }
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
project.configure<KotlinMultiplatformExtension> { project.configure<KotlinMultiplatformExtension> {
@ -538,9 +537,11 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
} }
internal inline fun <reified T : KScienceExtension> Project.registerKScienceExtension(constructor: (Project) -> T): T { internal inline fun <reified T : KScienceExtension> Project.registerKScienceExtension():T {
extensions.findByType<T>()?.let { return it } // extensions.findByType<T>()?.let { return it }
return constructor(this).also { // return constructor(this).also {
extensions.add("kscience", it) // extensions.add("kscience", it)
} // }
return extensions.create("kscience", T::class.java)
} }

View File

@ -22,7 +22,7 @@ public open class KScienceJVMPlugin : Plugin<Project> {
} else { } else {
logger.info("Kotlin JVM plugin is already present") logger.info("Kotlin JVM plugin is already present")
} }
val extension = registerKScienceExtension(::KScienceExtension) val extension = registerKScienceExtension<KScienceExtension>()
//logger.info("Applying KScience configuration for JVM project") //logger.info("Applying KScience configuration for JVM project")
configure<KotlinJvmProjectExtension> { configure<KotlinJvmProjectExtension> {

View File

@ -21,7 +21,7 @@ public open class KScienceMPPlugin : Plugin<Project> {
logger.info("Kotlin MPP plugin is already present") logger.info("Kotlin MPP plugin is already present")
} }
registerKScienceExtension(::KScienceMppExtension) val kscience = registerKScienceExtension<KScienceMppExtension>()
configure<KotlinMultiplatformExtension> { configure<KotlinMultiplatformExtension> {
sourceSets { sourceSets {
@ -46,6 +46,12 @@ public open class KScienceMPPlugin : Plugin<Project> {
} }
if (explicitApi == null) explicitApiWarning() if (explicitApi == null) explicitApiWarning()
//pass compose extension inside kscience extensions to make it available inside kscience block
plugins.withId("org.jetbrains.compose"){
kscience.extensions.add("compose", (this@configure as org.gradle.api.plugins.ExtensionAware).extensions.getByName("compose"))
}
} }