Skip to content

Commit

Permalink
Clean the build scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
pdvrieze committed May 19, 2024
1 parent 83790b1 commit d4c3b5d
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 121 deletions.
8 changes: 3 additions & 5 deletions core/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@
* under the License.
*/

import kotlinx.validation.ExperimentalBCVApi
import net.devrieze.gradle.ext.doPublish
import net.devrieze.gradle.ext.envAndroid
import org.gradle.api.attributes.java.TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinWithJavaTarget

plugins {
id("projectPlugin")
Expand All @@ -38,7 +36,7 @@ plugins {
}

base {
archivesName.set("core-android")
archivesName = "core-android"
}

val autoModuleName = "net.devrieze.xmlutil.core"
Expand All @@ -47,7 +45,6 @@ kotlin {
explicitApi()

target {
val t: KotlinWithJavaTarget<KotlinJvmOptions, KotlinJvmCompilerOptions> = this
attributes {
attribute(TARGET_JVM_ENVIRONMENT_ATTRIBUTE, envAndroid)
}
Expand Down Expand Up @@ -77,6 +74,7 @@ dependencies {
}

apiValidation {
@OptIn(ExperimentalBCVApi::class)
klib {
enabled = true
}
Expand Down
43 changes: 24 additions & 19 deletions core/base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@
* under the License.
*/

import kotlinx.validation.api.klib.KlibSignatureVersion
import kotlinx.validation.ExperimentalBCVApi
import net.devrieze.gradle.ext.addNativeTargets
import net.devrieze.gradle.ext.applyDefaultXmlUtilHierarchyTemplate
import net.devrieze.gradle.ext.doPublish
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.HasConfigurableKotlinCompilerOptions
import org.jetbrains.kotlin.gradle.dsl.JsMainFunctionExecutionMode
import org.jetbrains.kotlin.gradle.dsl.JsModuleKind
import org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl

plugins {
Expand Down Expand Up @@ -83,18 +88,16 @@ kotlin {

}
js {
browser()
compilations.all {
kotlinOptions {
sourceMap = true
sourceMapEmbedSources = "always"
suppressWarnings = false
verbose = true
metaInfo = true
moduleKind = "umd"
main = "call"
}
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
sourceMap = true
sourceMapEmbedSources = JsSourceMapEmbedMode.SOURCE_MAP_SOURCE_CONTENT_ALWAYS
suppressWarnings = false
verbose = true
moduleKind = JsModuleKind.MODULE_UMD
main = JsMainFunctionExecutionMode.CALL
}
browser()
}

@OptIn(ExperimentalWasmDsl::class)
Expand All @@ -107,22 +110,23 @@ kotlin {
nodejs()
browser {
testTask {
isEnabled = ! System.getenv().containsKey("GITHUB_ACTION")
isEnabled = !System.getenv().containsKey("GITHUB_ACTION")
}
}
}

targets.all {
val targetName = name
mavenPublication {
when(targetName) {
"jvm" -> artifactId = "core-jvmCommon"
else -> artifactId = "core-$targetName"
artifactId = when (targetName) {
"jvm" -> "core-jvmCommon"
else -> "core-$targetName"
}
}
compilations.all {
kotlinOptions {
freeCompilerArgs += "-Xexpect-actual-classes"
@Suppress("OPT_IN_USAGE")
when (val t = this) {
is HasConfigurableKotlinCompilerOptions<*> -> t.compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}
Expand Down Expand Up @@ -171,6 +175,7 @@ publishing {
addNativeTargets()

apiValidation {
@OptIn(ExperimentalBCVApi::class)
klib {
enabled = true
}
Expand Down
11 changes: 7 additions & 4 deletions core/compat/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import net.devrieze.gradle.ext.addNativeTargets
import net.devrieze.gradle.ext.applyDefaultXmlUtilHierarchyTemplate
import net.devrieze.gradle.ext.doPublish
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.HasConfigurableKotlinCompilerOptions

plugins {
id("projectPlugin")
Expand All @@ -32,7 +34,7 @@ plugins {
}

base {
archivesName.set("xmlutil")
archivesName = "xmlutil"
}

val autoModuleName = "net.devrieze.xmlutil.core"
Expand Down Expand Up @@ -70,9 +72,10 @@ kotlin {
else -> artifactId = "compat-${targetName}"
}
}
compilations.all {
kotlinOptions {
freeCompilerArgs += "-Xexpect-actual-classes"
@OptIn(ExperimentalKotlinGradlePluginApi::class)
if (this is HasConfigurableKotlinCompilerOptions<*>) {
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion core/jdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* under the License.
*/

import kotlinx.validation.ExperimentalBCVApi
import net.devrieze.gradle.ext.doPublish

plugins {
Expand All @@ -31,7 +32,7 @@ plugins {
}

base {
archivesName.set("xmlutil")
archivesName = "xmlutil"
}

val autoModuleName = "net.devrieze.xmlutil.core.jdk"
Expand Down Expand Up @@ -69,6 +70,7 @@ dependencies {
}

apiValidation {
@OptIn(ExperimentalBCVApi::class)
klib {
enabled = true
}
Expand All @@ -79,6 +81,7 @@ apiValidation {
add("nl.adaptivity.xmlutil.util.impl")
}
}

publishing {
publications {
create<MavenPublication>("mavenKotlin") {
Expand Down
8 changes: 1 addition & 7 deletions examples/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@ plugins {
}

base {
archivesName.set("examples")
}

kotlin {
compilerOptions {
freeCompilerArgs.set(freeCompilerArgs.get() + "-Xjvm-default=all")
}
archivesName = "examples"
}

val autoModuleName = "net.devrieze.serialexamples"
Expand Down
46 changes: 21 additions & 25 deletions serialization/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@
import net.devrieze.gradle.ext.addNativeTargets
import net.devrieze.gradle.ext.applyDefaultXmlUtilHierarchyTemplate
import net.devrieze.gradle.ext.doPublish
import org.jetbrains.kotlin.gradle.dsl.HasConfigurableKotlinCompilerOptions
import org.jetbrains.kotlin.gradle.dsl.JsMainFunctionExecutionMode
import org.jetbrains.kotlin.gradle.dsl.JsModuleKind
import org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
import org.jetbrains.kotlin.js.config.SourceMapSourceEmbedding

plugins {
id("projectPlugin")
Expand All @@ -39,7 +44,7 @@ plugins {
}

base {
archivesName.set("serialization")
archivesName = "serialization"
}

val autoModuleName = "net.devrieze.xmlutil.serialization"
Expand All @@ -56,9 +61,6 @@ kotlin {
attributes("Automatic-Module-Name" to autoModuleName)
}
}
kotlinOptions {
freeCompilerArgs += "-Xjvm-default=all"
}
}

/*
Expand All @@ -76,27 +78,19 @@ kotlin {
*/

}
// androidTarget("actualAndroid")

jvm("android") {
compilations.all {
kotlinOptions {
freeCompilerArgs += "-Xjvm-default=all"
}
}
}
jvm("android")

js {
browser()
compilations.all {
kotlinOptions {
sourceMap = true
sourceMapEmbedSources = "always"
suppressWarnings = false
verbose = true
metaInfo = true
moduleKind = "umd"
main = "call"
}
@Suppress("OPT_IN_USAGE")
compilerOptions {
sourceMap = true
sourceMapEmbedSources = JsSourceMapEmbedMode.SOURCE_MAP_SOURCE_CONTENT_ALWAYS
suppressWarnings = false
verbose = true
moduleKind = JsModuleKind.MODULE_UMD
main = JsMainFunctionExecutionMode.CALL
}
}

Expand All @@ -108,9 +102,10 @@ kotlin {
}
}
}
compilations.all {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + "-Xexpect-actual-classes"
@Suppress("OPT_IN_USAGE")
if (this is HasConfigurableKotlinCompilerOptions<*>) {
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}
Expand Down Expand Up @@ -236,6 +231,7 @@ dependencies {
}

apiValidation {
@Suppress("OPT_IN_USAGE")
klib {
strictValidation = false
enabled = true
Expand Down
42 changes: 17 additions & 25 deletions serialutil/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import net.devrieze.gradle.ext.addNativeTargets
import net.devrieze.gradle.ext.applyDefaultXmlUtilHierarchyTemplate
import net.devrieze.gradle.ext.doPublish
import org.jetbrains.kotlin.gradle.dsl.JsMainFunctionExecutionMode
import org.jetbrains.kotlin.gradle.dsl.JsModuleKind
import org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode

plugins {
id("projectPlugin")
Expand All @@ -36,40 +39,28 @@ plugins {
}

base {
archivesName.set("serialutil")
archivesName = "serialutil"
}

val autoModuleName = "net.devrieze.serialutil"

kotlin {
applyDefaultXmlUtilHierarchyTemplate()
jvm {
compilations.all {
kotlinOptions {
freeCompilerArgs += "-Xjvm-default=all"
}
}
}
jvm("android") {
compilations.all {
kotlinOptions {
freeCompilerArgs += "-Xjvm-default=all"
}
}
}
jvm()

jvm("android")

js {
browser()
nodejs()
compilations.all {
kotlinOptions {
sourceMap = true
sourceMapEmbedSources = "always"
suppressWarnings = false
verbose = true
metaInfo = true
moduleKind = "umd"
main = "call"
}
@Suppress("OPT_IN_USAGE")
compilerOptions {
sourceMap = true
sourceMapEmbedSources = JsSourceMapEmbedMode.SOURCE_MAP_SOURCE_CONTENT_ALWAYS
suppressWarnings = false
verbose = true
moduleKind = JsModuleKind.MODULE_UMD
main = JsMainFunctionExecutionMode.CALL
}
}

Expand Down Expand Up @@ -114,6 +105,7 @@ kotlin {
addNativeTargets()

apiValidation {
@Suppress("OPT_IN_USAGE")
klib {
enabled = true
}
Expand Down
Loading

0 comments on commit d4c3b5d

Please sign in to comment.