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]
|
||||
### Added
|
||||
- Public `isInDevelopment` project flag
|
||||
- Add `-Xjdk-release` key
|
||||
|
||||
### Changed
|
||||
|
@ -13,8 +13,8 @@ kotlinx-datetime = "0.4.0"
|
||||
kotlinx-html = "0.7.5"
|
||||
kotlinx-knit = "0.4.0"
|
||||
kotlinx-nodejs = "0.0.7"
|
||||
kotlinx-serialization = "1.4.0-RC"
|
||||
ktor = "2.0.3"
|
||||
kotlinx-serialization = "1.4.0"
|
||||
ktor = "2.1.0"
|
||||
xmlutil = "0.84.2"
|
||||
yamlkt = "0.12.0"
|
||||
jsBom = "1.0.0-pre.353"
|
||||
|
@ -114,7 +114,7 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
||||
apply<BinaryCompatibilityValidatorPlugin>()
|
||||
|
||||
afterEvaluate {
|
||||
if (isSnapshot()) {
|
||||
if (isInDevelopment) {
|
||||
configure<ApiValidationExtension> {
|
||||
validationDisabled = true
|
||||
}
|
||||
@ -275,7 +275,7 @@ public open class KScienceProjectPlugin : Plugin<Project> {
|
||||
}
|
||||
|
||||
// Disable API validation for snapshots
|
||||
if (isSnapshot()) {
|
||||
if (isInDevelopment) {
|
||||
extensions.findByType<ApiValidationExtension>()?.apply {
|
||||
validationDisabled = true
|
||||
logger.warn("API validation is disabled for snapshot or dev version")
|
||||
|
@ -24,6 +24,19 @@ private fun resolveKotlinVersion():KotlinVersion {
|
||||
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(
|
||||
kotlinVersion: KotlinVersion = resolveKotlinVersion(),
|
||||
) {
|
||||
@ -160,13 +173,34 @@ public fun Project.configureKScience(
|
||||
}
|
||||
|
||||
configuration.nativeConfiguration?.let { nativeConfiguration ->
|
||||
val nativeTargets: List<KotlinNativeTargetWithHostTests> = nativeConfiguration.targets.values.mapNotNull { nativeTarget ->
|
||||
val nativeTargets: List<KotlinNativeTargetWithHostTests> =
|
||||
nativeConfiguration.targets.values.mapNotNull { nativeTarget ->
|
||||
when (nativeTarget.preset) {
|
||||
KotlinNativePreset.linuxX64 -> linuxX64(nativeTarget.targetName, nativeTarget.targetConfiguration)
|
||||
KotlinNativePreset.mingwX64 -> linuxX64(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)
|
||||
KotlinNativePreset.linuxX64 -> linuxX64(
|
||||
nativeTarget.targetName,
|
||||
nativeTarget.targetConfiguration
|
||||
)
|
||||
|
||||
KotlinNativePreset.mingwX64 -> linuxX64(
|
||||
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
|
||||
|
@ -11,6 +11,7 @@ import org.gradle.plugins.signing.SigningPlugin
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||
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
|
||||
?: 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(
|
||||
githubOrg: String,
|
||||
githubProject: String,
|
||||
@ -184,8 +183,8 @@ internal fun Project.addSonatypePublishing() {
|
||||
return
|
||||
}
|
||||
|
||||
if (isSnapshot()) {
|
||||
logger.info("Sonatype publishing skipped for dev version")
|
||||
if (isInDevelopment) {
|
||||
logger.info("Sonatype publishing skipped for development version")
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user