0.15.8-kotlin-2.1.0 #51
@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Added
|
### Added
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
- All publishing is enabled by default. Introduce `publishing.targets` variable to regulate what is added to the module.
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
|
@ -211,7 +211,6 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvmToolchain {
|
jvmToolchain {
|
||||||
languageVersion.set(JavaLanguageVersion.of(11))
|
languageVersion.set(JavaLanguageVersion.of(11))
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[versions]
|
[versions]
|
||||||
tools = "0.14.4-kotlin-1.8.20-RC"
|
tools = "0.14.5-kotlin-1.8.20-RC"
|
||||||
kotlin = "1.8.20-RC"
|
kotlin = "1.8.20-RC"
|
||||||
atomicfu = "0.19.0"
|
atomicfu = "0.19.0"
|
||||||
binary-compatibility-validator = "0.12.1"
|
binary-compatibility-validator = "0.12.1"
|
||||||
|
@ -24,6 +24,7 @@ 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 space.kscience.gradle.internal.defaultKotlinJvmArgs
|
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.useCommonDependency
|
import space.kscience.gradle.internal.useCommonDependency
|
||||||
|
|
||||||
public enum class DependencyConfiguration {
|
public enum class DependencyConfiguration {
|
||||||
@ -292,14 +293,30 @@ public data class KScienceNativeTarget(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class KScienceNativeConfiguration {
|
public class KScienceNativeConfiguration(private val project: Project) {
|
||||||
|
|
||||||
|
|
||||||
internal companion object {
|
internal companion object {
|
||||||
private fun defaultNativeTargets(): Map<KotlinNativePreset, KScienceNativeTarget> {
|
private fun defaultNativeTargets(project: Project): Map<KotlinNativePreset, KScienceNativeTarget> {
|
||||||
|
|
||||||
val hostOs = System.getProperty("os.name")
|
val hostOs = System.getProperty("os.name")
|
||||||
|
|
||||||
|
val targets = project.requestPropertyOrNull("publishing.targets")
|
||||||
|
|
||||||
return when {
|
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(
|
hostOs.startsWith("Windows") -> listOf(
|
||||||
KScienceNativeTarget.linuxX64,
|
KScienceNativeTarget.linuxX64,
|
||||||
KScienceNativeTarget.mingwX64
|
KScienceNativeTarget.mingwX64
|
||||||
@ -314,6 +331,7 @@ public class KScienceNativeConfiguration {
|
|||||||
)
|
)
|
||||||
|
|
||||||
hostOs == "Linux" -> listOf(KScienceNativeTarget.linuxX64)
|
hostOs == "Linux" -> listOf(KScienceNativeTarget.linuxX64)
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
emptyList()
|
emptyList()
|
||||||
}
|
}
|
||||||
@ -322,7 +340,7 @@ public class KScienceNativeConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal var targets: Map<KotlinNativePreset, KScienceNativeTarget> = defaultNativeTargets()
|
internal var targets: Map<KotlinNativePreset, KScienceNativeTarget> = defaultNativeTargets(project)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -459,7 +477,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
|
|||||||
* Enable all supported native targets
|
* Enable all supported native targets
|
||||||
*/
|
*/
|
||||||
public fun native(block: KScienceNativeConfiguration.() -> Unit = {}): Unit = with(project) {
|
public fun native(block: KScienceNativeConfiguration.() -> Unit = {}): Unit = with(project) {
|
||||||
val nativeConfiguration = KScienceNativeConfiguration().apply(block)
|
val nativeConfiguration = KScienceNativeConfiguration(this).apply(block)
|
||||||
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||||
configure<KotlinMultiplatformExtension> {
|
configure<KotlinMultiplatformExtension> {
|
||||||
val nativeTargets: List<KotlinNativeTarget> =
|
val nativeTargets: List<KotlinNativeTarget> =
|
||||||
|
@ -116,22 +116,18 @@ internal fun Project.addGithubPublishing(
|
|||||||
githubOrg: String,
|
githubOrg: String,
|
||||||
githubProject: String,
|
githubProject: String,
|
||||||
) {
|
) {
|
||||||
if (requestPropertyOrNull("publishing.enabled") != "true") {
|
val githubUser: String? = requestPropertyOrNull("publishing.github.user")
|
||||||
logger.info("Skipping github publishing because publishing is disabled")
|
val githubToken: String? = requestPropertyOrNull("publishing.github.token")
|
||||||
return
|
|
||||||
}
|
|
||||||
if (requestPropertyOrNull("publishing.github") != "false") {
|
|
||||||
logger.info("Skipping github publishing because `publishing.github != true`")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val githubUser: String = requestProperty("publishing.github.user")
|
if (githubUser == null || githubToken == null) {
|
||||||
val githubToken: String = requestProperty("publishing.github.token")
|
logger.info("Skipping Github publishing because Github credentials are not defined")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
plugins.withId("maven-publish") {
|
plugins.withId("maven-publish") {
|
||||||
configure<PublishingExtension> {
|
configure<PublishingExtension> {
|
||||||
logger.info("Adding github publishing to project [${project.name}]")
|
logger.info("Adding Github publishing to project [${project.name}]")
|
||||||
|
|
||||||
repositories.maven {
|
repositories.maven {
|
||||||
name = "github"
|
name = "github"
|
||||||
@ -148,23 +144,18 @@ internal fun Project.addGithubPublishing(
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal fun Project.addSpacePublishing(spaceRepo: String) {
|
internal fun Project.addSpacePublishing(spaceRepo: String) {
|
||||||
if (requestPropertyOrNull("publishing.enabled") != "true") {
|
val spaceUser: String? = requestPropertyOrNull("publishing.space.user")
|
||||||
logger.info("Skipping space publishing because publishing is disabled")
|
val spaceToken: String? = requestPropertyOrNull("publishing.space.token")
|
||||||
|
|
||||||
|
if (spaceUser == null || spaceToken == null) {
|
||||||
|
logger.info("Skipping Space publishing because Space credentials are not defined")
|
||||||
return
|
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 {
|
allprojects {
|
||||||
plugins.withId("maven-publish") {
|
plugins.withId("maven-publish") {
|
||||||
configure<PublishingExtension> {
|
configure<PublishingExtension> {
|
||||||
project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]")
|
project.logger.info("Adding SPC Space publishing to project [${project.name}]")
|
||||||
|
|
||||||
repositories.maven {
|
repositories.maven {
|
||||||
name = "space"
|
name = "space"
|
||||||
@ -181,24 +172,19 @@ internal fun Project.addSpacePublishing(spaceRepo: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal fun Project.addSonatypePublishing() {
|
internal fun Project.addSonatypePublishing() {
|
||||||
if (requestPropertyOrNull("publishing.enabled") != "true") {
|
|
||||||
logger.info("Skipping sonatype publishing because publishing is disabled")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isInDevelopment) {
|
if (isInDevelopment) {
|
||||||
logger.info("Sonatype publishing skipped for development version")
|
logger.info("Sonatype publishing skipped for development version")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requestPropertyOrNull("publishing.sonatype") == "false") {
|
val sonatypeUser: String? = requestPropertyOrNull("publishing.sonatype.user")
|
||||||
logger.info("Skipping sonatype publishing because `publishing.sonatype == false`")
|
val sonatypePassword: String? = requestPropertyOrNull("publishing.sonatype.password")
|
||||||
|
|
||||||
|
if (sonatypeUser == null || sonatypePassword == null) {
|
||||||
|
logger.info("Skipping Sonatype publishing because Sonatype credentials are not defined")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val sonatypeUser: String = requestProperty("publishing.sonatype.user")
|
|
||||||
val sonatypePassword: String = requestProperty("publishing.sonatype.password")
|
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
plugins.withId("maven-publish") {
|
plugins.withId("maven-publish") {
|
||||||
configure<PublishingExtension> {
|
configure<PublishingExtension> {
|
||||||
|
Loading…
Reference in New Issue
Block a user