Compare commits

..

No commits in common. "beta/1.9.0" and "master" have entirely different histories.

8 changed files with 79 additions and 109 deletions

View File

@ -9,7 +9,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
### Changed
- All publishing is enabled by default. Introduce `publishing.targets` variable to regulate what is added to the module.
### Deprecated

View File

@ -211,6 +211,7 @@ publishing {
}
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(11))

View File

@ -1,26 +1,26 @@
[versions]
tools = "0.14.9-kotlin-1.9.0-RC-dev-1"
kotlin = "1.9.0-RC"
atomicfu = "0.20.2"
binary-compatibility-validator = "0.13.1"
tools = "0.14.4-kotlin-1.8.20-RC"
kotlin = "1.8.20-RC"
atomicfu = "0.19.0"
binary-compatibility-validator = "0.12.1"
changelog = "2.0.0"
dokka = "1.8.10"
kotlin-jupyter = "0.11.0-360"
dokka = "1.7.20"
kotlin-jupyter = "0.11.0-317"
kotlinx-benchmark = "0.4.7"
kotlinx-cli = "0.3.5"
kotlinx-coroutines = "1.7.1"
kotlinx-coroutines = "1.6.4"
kotlinx-datetime = "0.4.0"
kotlinx-html = "0.8.0"
kotlinx-knit = "0.4.0"
kotlinx-nodejs = "0.0.7"
kotlinx-serialization = "1.5.1"
ktor = "2.3.0"
xmlutil = "0.86.0"
yamlkt = "0.13.0"
jsBom = "1.0.0-pre.546"
junit = "5.9.3"
compose = "1.4.0"
logback = "1.4.7"
kotlinx-serialization = "1.4.1"
ktor = "2.2.3"
xmlutil = "0.84.3"
yamlkt = "0.12.0"
jsBom = "1.0.0-pre.509"
junit = "5.9.2"
compose = "1.3.0"
logback = "1.4.5"
[libraries]
atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" }
@ -37,8 +37,6 @@ kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", v
kotlin-jupyter-gradle = { module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin", version.ref = "kotlin-jupyter" }
kotlin-js-wrappers = { module = "org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom", version.ref = "jsBom" }
kotlinx-benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
@ -81,13 +79,13 @@ xmlutil-serialization = { module = "io.github.pdvrieze.xmlutil:serialization", v
yamlkt = { module = "net.mamoe.yamlkt:yamlkt", version.ref = "yamlkt" }
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
logback-classic = {module = "ch.qos.logback:logback-classic", version.ref = "logback"}
[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
compose = { id = "org.jetbrains.compose", version.ref = "compose" }
compose = {id = "org.jetbrains.compose", version.ref = "compose"}
gradle-common = { id = "space.kscience.gradle.common", version.ref = "tools" }
gradle-project = { id = "space.kscience.gradle.project", version.ref = "tools" }

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -13,7 +13,6 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
@ -25,7 +24,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlinx.jupyter.api.plugin.tasks.JupyterApiResourcesTask
import space.kscience.gradle.internal.defaultKotlinJvmArgs
import space.kscience.gradle.internal.fromJsDependencies
import space.kscience.gradle.internal.requestPropertyOrNull
import space.kscience.gradle.internal.useCommonDependency
public enum class DependencyConfiguration {
@ -209,7 +207,6 @@ public open class KScienceExtension(public val project: Project) {
/**
* Mark this module as an application module. JVM application should be enabled separately
*/
@Deprecated("Use platform-specific applications")
public fun application() {
project.extensions.findByType<KotlinProjectExtension>()?.apply {
explicitApi = null
@ -288,37 +285,21 @@ public data class KScienceNativeTarget(
public val linuxX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.linuxX64)
public val mingwX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.mingwX64)
public val macosX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.macosX64)
public val macosArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.macosArm64)
public val macosArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.macosX64)
public val iosX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosX64)
public val iosArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosArm64)
public val iosSimulatorArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosSimulatorArm64)
}
}
public class KScienceNativeConfiguration(private val project: Project) {
public class KScienceNativeConfiguration {
internal companion object {
private fun defaultNativeTargets(project: Project): Map<KotlinNativePreset, KScienceNativeTarget> {
private fun defaultNativeTargets(): Map<KotlinNativePreset, KScienceNativeTarget> {
val hostOs = System.getProperty("os.name")
val targets = project.requestPropertyOrNull("publishing.targets")
return when {
targets == "all" -> listOf(
KScienceNativeTarget.linuxX64,
KScienceNativeTarget.mingwX64,
KScienceNativeTarget.macosX64,
KScienceNativeTarget.macosArm64,
KScienceNativeTarget.iosX64,
KScienceNativeTarget.iosArm64,
KScienceNativeTarget.iosSimulatorArm64,
)
targets != null -> {
targets.split(",").map { KScienceNativeTarget(KotlinNativePreset.valueOf(it)) }
}
hostOs.startsWith("Windows") -> listOf(
KScienceNativeTarget.linuxX64,
KScienceNativeTarget.mingwX64
@ -333,7 +314,6 @@ public class KScienceNativeConfiguration(private val project: Project) {
)
hostOs == "Linux" -> listOf(KScienceNativeTarget.linuxX64)
else -> {
emptyList()
}
@ -342,7 +322,7 @@ public class KScienceNativeConfiguration(private val project: Project) {
}
internal var targets: Map<KotlinNativePreset, KScienceNativeTarget> = defaultNativeTargets(project)
internal var targets: Map<KotlinNativePreset, KScienceNativeTarget> = defaultNativeTargets()
/**
@ -425,32 +405,12 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
@OptIn(ExperimentalWasmDsl::class)
public fun wasm(block: KotlinWasmTargetDsl.() -> 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.configure<KotlinMultiplatformExtension> {
wasm {
browser {
testTask {
useKarma {
this.webpackConfig.experiments.add("topLevelAwait")
useChromeHeadlessWasmGc()
useConfigDirectory(project.projectDir.resolve("karma.config.d").resolve("wasm"))
}
}
}
browser()
block()
}
sourceSets {
getByName("wasmTest") {
dependencies {
implementation(kotlin("test"))
}
}
}
}
}
}
@ -473,7 +433,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
binaries.executable()
browser {
webpackTask {
mainOutputFileName.set(bundleName)
outputFileName = bundleName
}
browserConfig()
}
@ -481,7 +441,8 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
}
jvm {
val processResourcesTaskName =
compilations[KotlinCompilation.MAIN_COMPILATION_NAME].processResourcesTaskName
compilations[org.jetbrains.kotlin.gradle.plugin.KotlinCompilation.MAIN_COMPILATION_NAME]
.processResourcesTaskName
val jsBrowserDistribution = project.tasks.getByName("jsBrowserDistribution")
@ -498,7 +459,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
* Enable all supported native targets
*/
public fun native(block: KScienceNativeConfiguration.() -> Unit = {}): Unit = with(project) {
val nativeConfiguration = KScienceNativeConfiguration(this).apply(block)
val nativeConfiguration = KScienceNativeConfiguration().apply(block)
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
configure<KotlinMultiplatformExtension> {
val nativeTargets: List<KotlinNativeTarget> =
@ -560,7 +521,6 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
}
configure(nativeTargets) {
compilations["main"]?.apply {
configure(kotlinSourceSets) {
dependsOn(nativeMain)

View File

@ -12,9 +12,6 @@ import org.jetbrains.changelog.ChangelogPlugin
import org.jetbrains.changelog.ChangelogPluginExtension
import org.jetbrains.dokka.gradle.AbstractDokkaTask
import org.jetbrains.dokka.gradle.DokkaPlugin
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
import space.kscience.gradle.internal.*
/**
@ -91,9 +88,9 @@ public class KSciencePublishingExtension(public val project: Project) {
*
* @param addToRelease publish packages in the `release` task to the Sonatype repository.
*/
public fun sonatype(sonatypeRoot: String = "https://s01.oss.sonatype.org") {
public fun sonatype() {
require(isVcsInitialized) { "The project vcs is not set up use 'pom' method to do so" }
project.addSonatypePublishing(sonatypeRoot)
project.addSonatypePublishing()
}
}
@ -107,8 +104,8 @@ public open class KScienceProjectPlugin : Plugin<Project> {
apply<DokkaPlugin>()
apply<BinaryCompatibilityValidatorPlugin>()
allprojects {
repositories {
allprojects{
repositories{
mavenCentral()
maven("https://repo.kotlin.link")
maven("https://maven.pkg.jetbrains.space/spc/p/sci/dev")
@ -253,11 +250,9 @@ public open class KScienceProjectPlugin : Plugin<Project> {
}
}
plugins.withType<YarnPlugin>() {
rootProject.configure<YarnRootExtension> {
lockFileDirectory = rootDir.resolve("gradle")
yarnLockMismatchReport = YarnLockMismatchReport.WARNING
}
plugins.withType(org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin::class.java) {
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension>().lockFileDirectory =
rootDir.resolve("gradle")
}
}

View File

@ -88,18 +88,12 @@ public class KScienceReadmeExtension(public val project: Project) {
public data class Feature(val id: String, val description: String, val ref: String?, val name: String = id)
public val features: MutableList<Feature> = mutableListOf()
public val features: MutableList<Feature> = ArrayList()
/**
* A plain readme feature with description
*/
public fun feature(id: String, ref: String? = null, name: String = id, description: () -> String) {
features += Feature(id, description(), ref, name)
}
/**
* A readme feature with HTML description
*/
public fun featureWithHtml(
id: String,
ref: String? = null,

View File

@ -27,10 +27,19 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
plugins.withId("org.jetbrains.kotlin.js") {
val kotlin: KotlinJsProjectExtension = extensions.findByType()!!
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
kotlin.sourceSets.forEach {
from(it.kotlin)
}
}
publications.create<MavenPublication>("js") {
kotlin.targets.flatMap { it.components }.forEach {
from(it)
}
artifact(sourcesJar)
}
}
@ -107,18 +116,22 @@ internal fun Project.addGithubPublishing(
githubOrg: String,
githubProject: String,
) {
val githubUser: String? = requestPropertyOrNull("publishing.github.user")
val githubToken: String? = requestPropertyOrNull("publishing.github.token")
if (githubUser == null || githubToken == null) {
logger.info("Skipping Github publishing because Github credentials are not defined")
if (requestPropertyOrNull("publishing.enabled") != "true") {
logger.info("Skipping github publishing because publishing is disabled")
return
}
if (requestPropertyOrNull("publishing.github") != "false") {
logger.info("Skipping github publishing because `publishing.github != true`")
return
}
val githubUser: String = requestProperty("publishing.github.user")
val githubToken: String = requestProperty("publishing.github.token")
allprojects {
plugins.withId("maven-publish") {
configure<PublishingExtension> {
logger.info("Adding Github publishing to project [${project.name}]")
logger.info("Adding github publishing to project [${project.name}]")
repositories.maven {
name = "github"
@ -135,18 +148,23 @@ internal fun Project.addGithubPublishing(
}
internal fun Project.addSpacePublishing(spaceRepo: String) {
val spaceUser: String? = requestPropertyOrNull("publishing.space.user")
val spaceToken: String? = requestPropertyOrNull("publishing.space.token")
if (spaceUser == null || spaceToken == null) {
logger.info("Skipping Space publishing because Space credentials are not defined")
if (requestPropertyOrNull("publishing.enabled") != "true") {
logger.info("Skipping space publishing because publishing is disabled")
return
}
if (requestPropertyOrNull("publishing.space") == "false") {
logger.info("Skipping space publishing because `publishing.space == false`")
return
}
val spaceUser: String = requestProperty("publishing.space.user")
val spaceToken: String = requestProperty("publishing.space.token")
allprojects {
plugins.withId("maven-publish") {
configure<PublishingExtension> {
project.logger.info("Adding SPC Space publishing to project [${project.name}]")
project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]")
repositories.maven {
name = "space"
@ -162,25 +180,30 @@ internal fun Project.addSpacePublishing(spaceRepo: String) {
}
}
internal fun Project.addSonatypePublishing(sonatypeRoot: String) {
internal fun Project.addSonatypePublishing() {
if (requestPropertyOrNull("publishing.enabled") != "true") {
logger.info("Skipping sonatype publishing because publishing is disabled")
return
}
if (isInDevelopment) {
logger.info("Sonatype publishing skipped for development version")
return
}
val sonatypeUser: String? = requestPropertyOrNull("publishing.sonatype.user")
val sonatypePassword: String? = requestPropertyOrNull("publishing.sonatype.password")
if (sonatypeUser == null || sonatypePassword == null) {
logger.info("Skipping Sonatype publishing because Sonatype credentials are not defined")
if (requestPropertyOrNull("publishing.sonatype") == "false") {
logger.info("Skipping sonatype publishing because `publishing.sonatype == false`")
return
}
val sonatypeUser: String = requestProperty("publishing.sonatype.user")
val sonatypePassword: String = requestProperty("publishing.sonatype.password")
allprojects {
plugins.withId("maven-publish") {
configure<PublishingExtension> {
repositories.maven {
val sonatypeRepo = "$sonatypeRoot/service/local/staging/deploy/maven2"
val sonatypeRepo = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2"
name = "sonatype"
url = uri(sonatypeRepo)