Add public dev flag
This commit is contained in:
parent
aafcb06a1e
commit
187b8e8076
@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Added
|
### Added
|
||||||
|
- Public `isInDevelopment` project flag
|
||||||
- Add `-Xjdk-release` key
|
- Add `-Xjdk-release` key
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -13,8 +13,8 @@ kotlinx-datetime = "0.4.0"
|
|||||||
kotlinx-html = "0.7.5"
|
kotlinx-html = "0.7.5"
|
||||||
kotlinx-knit = "0.4.0"
|
kotlinx-knit = "0.4.0"
|
||||||
kotlinx-nodejs = "0.0.7"
|
kotlinx-nodejs = "0.0.7"
|
||||||
kotlinx-serialization = "1.4.0-RC"
|
kotlinx-serialization = "1.4.0"
|
||||||
ktor = "2.0.3"
|
ktor = "2.1.0"
|
||||||
xmlutil = "0.84.2"
|
xmlutil = "0.84.2"
|
||||||
yamlkt = "0.12.0"
|
yamlkt = "0.12.0"
|
||||||
jsBom = "1.0.0-pre.353"
|
jsBom = "1.0.0-pre.353"
|
||||||
|
@ -114,7 +114,7 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
apply<BinaryCompatibilityValidatorPlugin>()
|
apply<BinaryCompatibilityValidatorPlugin>()
|
||||||
|
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
if (isSnapshot()) {
|
if (isInDevelopment) {
|
||||||
configure<ApiValidationExtension> {
|
configure<ApiValidationExtension> {
|
||||||
validationDisabled = true
|
validationDisabled = true
|
||||||
}
|
}
|
||||||
@ -275,7 +275,7 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Disable API validation for snapshots
|
// Disable API validation for snapshots
|
||||||
if (isSnapshot()) {
|
if (isInDevelopment) {
|
||||||
extensions.findByType<ApiValidationExtension>()?.apply {
|
extensions.findByType<ApiValidationExtension>()?.apply {
|
||||||
validationDisabled = true
|
validationDisabled = true
|
||||||
logger.warn("API validation is disabled for snapshot or dev version")
|
logger.warn("API validation is disabled for snapshot or dev version")
|
||||||
|
@ -19,11 +19,24 @@ import space.kscience.gradle.internal.fromJsDependencies
|
|||||||
private val defaultKotlinJvmArgs: List<String> =
|
private val defaultKotlinJvmArgs: List<String> =
|
||||||
listOf("-Xjvm-default=all", "-Xlambdas=indy", "-Xjdk-release=${KScienceVersions.JVM_TARGET}")
|
listOf("-Xjvm-default=all", "-Xlambdas=indy", "-Xjdk-release=${KScienceVersions.JVM_TARGET}")
|
||||||
|
|
||||||
private fun resolveKotlinVersion():KotlinVersion {
|
private fun resolveKotlinVersion(): KotlinVersion {
|
||||||
val (major, minor, patch) = KScienceVersions.kotlinVersion.split(".", "-")
|
val (major, minor, patch) = KScienceVersions.kotlinVersion.split(".", "-")
|
||||||
return KotlinVersion(major.toInt(),minor.toInt(),patch.toInt())
|
return KotlinVersion(major.toInt(), minor.toInt(), patch.toInt())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this project version has a development tag (`development` property to true, "dev" in the middle or "SNAPSHOT" in the end).
|
||||||
|
*/
|
||||||
|
public val Project.isInDevelopment: Boolean
|
||||||
|
get() = findProperty("development") == true
|
||||||
|
|| "dev" in version.toString()
|
||||||
|
|| version.toString().endsWith("SNAPSHOT")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure KScience extensions
|
||||||
|
*/
|
||||||
|
@Suppress("UNUSED_VARIABLE")
|
||||||
public fun Project.configureKScience(
|
public fun Project.configureKScience(
|
||||||
kotlinVersion: KotlinVersion = resolveKotlinVersion(),
|
kotlinVersion: KotlinVersion = resolveKotlinVersion(),
|
||||||
) {
|
) {
|
||||||
@ -160,19 +173,40 @@ public fun Project.configureKScience(
|
|||||||
}
|
}
|
||||||
|
|
||||||
configuration.nativeConfiguration?.let { nativeConfiguration ->
|
configuration.nativeConfiguration?.let { nativeConfiguration ->
|
||||||
val nativeTargets: List<KotlinNativeTargetWithHostTests> = nativeConfiguration.targets.values.mapNotNull { nativeTarget ->
|
val nativeTargets: List<KotlinNativeTargetWithHostTests> =
|
||||||
when (nativeTarget.preset) {
|
nativeConfiguration.targets.values.mapNotNull { nativeTarget ->
|
||||||
KotlinNativePreset.linuxX64 -> linuxX64(nativeTarget.targetName, nativeTarget.targetConfiguration)
|
when (nativeTarget.preset) {
|
||||||
KotlinNativePreset.mingwX64 -> linuxX64(nativeTarget.targetName, nativeTarget.targetConfiguration)
|
KotlinNativePreset.linuxX64 -> linuxX64(
|
||||||
KotlinNativePreset.macosX64 -> linuxX64(nativeTarget.targetName, nativeTarget.targetConfiguration)
|
nativeTarget.targetName,
|
||||||
KotlinNativePreset.iosX64 -> linuxX64(nativeTarget.targetName, nativeTarget.targetConfiguration)
|
nativeTarget.targetConfiguration
|
||||||
KotlinNativePreset.iosArm64 -> linuxX64(nativeTarget.targetName, nativeTarget.targetConfiguration)
|
)
|
||||||
else -> {
|
|
||||||
logger.error("Native preset ${nativeTarget.preset} not recognised.")
|
KotlinNativePreset.mingwX64 -> linuxX64(
|
||||||
null
|
nativeTarget.targetName,
|
||||||
|
nativeTarget.targetConfiguration
|
||||||
|
)
|
||||||
|
|
||||||
|
KotlinNativePreset.macosX64 -> linuxX64(
|
||||||
|
nativeTarget.targetName,
|
||||||
|
nativeTarget.targetConfiguration
|
||||||
|
)
|
||||||
|
|
||||||
|
KotlinNativePreset.iosX64 -> linuxX64(
|
||||||
|
nativeTarget.targetName,
|
||||||
|
nativeTarget.targetConfiguration
|
||||||
|
)
|
||||||
|
|
||||||
|
KotlinNativePreset.iosArm64 -> linuxX64(
|
||||||
|
nativeTarget.targetName,
|
||||||
|
nativeTarget.targetConfiguration
|
||||||
|
)
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
logger.error("Native preset ${nativeTarget.preset} not recognised.")
|
||||||
|
null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
val nativeMain by creating {
|
val nativeMain by creating {
|
||||||
dependsOn(commonMain)
|
dependsOn(commonMain)
|
||||||
|
@ -11,6 +11,7 @@ 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.util.targets
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.targets
|
||||||
|
import space.kscience.gradle.isInDevelopment
|
||||||
|
|
||||||
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)
|
||||||
@ -108,8 +109,6 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun Project.isSnapshot() = "dev" in version.toString() || version.toString().endsWith("SNAPSHOT")
|
|
||||||
|
|
||||||
internal fun Project.addGithubPublishing(
|
internal fun Project.addGithubPublishing(
|
||||||
githubOrg: String,
|
githubOrg: String,
|
||||||
githubProject: String,
|
githubProject: String,
|
||||||
@ -184,8 +183,8 @@ internal fun Project.addSonatypePublishing() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSnapshot()) {
|
if (isInDevelopment) {
|
||||||
logger.info("Sonatype publishing skipped for dev version")
|
logger.info("Sonatype publishing skipped for development version")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user