From 621f21b605a7c95155e9d24b3b4733ead0272d03 Mon Sep 17 00:00:00 2001 From: Matthew Nelson Date: Tue, 7 Mar 2023 11:20:07 -0500 Subject: [PATCH 1/5] Refactor gradle files to use composite builds --- build-logic/.gitignore | 1 + build-logic/build.gradle.kts | 24 +++++++ build-logic/settings.gradle.kts | 31 +++++++++ .../main/kotlin/-KmpConfigurationExtension.kt | 63 +++++++++++++++++++ .../src/main/kotlin/configuration.gradle.kts | 32 ++++++++++ .../src/main/kotlin/publication.gradle.kts | 26 ++++++++ build.gradle.kts | 42 ++----------- gradle/libs.versions.toml | 7 +-- library/encoding-base16/build.gradle.kts | 41 +----------- library/encoding-base32/build.gradle.kts | 41 +----------- library/encoding-base64/build.gradle.kts | 41 +----------- library/encoding-core/build.gradle.kts | 47 +------------- library/encoding-test/build.gradle.kts | 37 +---------- sample/build.gradle.kts | 2 +- sample/src/commonMain/kotlin/Main.kt | 2 +- settings.gradle.kts | 9 +++ tools/check-publication/build.gradle.kts | 29 +-------- 17 files changed, 209 insertions(+), 266 deletions(-) create mode 100644 build-logic/.gitignore create mode 100644 build-logic/build.gradle.kts create mode 100644 build-logic/settings.gradle.kts create mode 100644 build-logic/src/main/kotlin/-KmpConfigurationExtension.kt create mode 100644 build-logic/src/main/kotlin/configuration.gradle.kts create mode 100644 build-logic/src/main/kotlin/publication.gradle.kts diff --git a/build-logic/.gitignore b/build-logic/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/build-logic/.gitignore @@ -0,0 +1 @@ +/build diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts new file mode 100644 index 0000000..6832bca --- /dev/null +++ b/build-logic/build.gradle.kts @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2023 Matthew Nelson + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ +plugins { + `kotlin-dsl` +} + +dependencies { + implementation(libs.gradle.kotlin) + implementation(libs.gradle.maven.publish) + implementation(libs.gradle.kmp.configuration) +} diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts new file mode 100644 index 0000000..3f15d58 --- /dev/null +++ b/build-logic/settings.gradle.kts @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 Matthew Nelson + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ +@file:Suppress("UnstableApiUsage") + +rootProject.name = "build-logic" + +dependencyResolutionManagement { + repositories { + mavenCentral() + gradlePluginPortal() + } + + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} diff --git a/build-logic/src/main/kotlin/-KmpConfigurationExtension.kt b/build-logic/src/main/kotlin/-KmpConfigurationExtension.kt new file mode 100644 index 0000000..57998b9 --- /dev/null +++ b/build-logic/src/main/kotlin/-KmpConfigurationExtension.kt @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2023 Matthew Nelson + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ +import io.matthewnelson.kmp.configuration.extension.KmpConfigurationExtension +import io.matthewnelson.kmp.configuration.extension.container.target.KmpConfigurationContainerDsl +import org.gradle.api.Action +import org.gradle.api.JavaVersion + +fun KmpConfigurationExtension.configureShared( + publish: Boolean = false, + explicitApi: Boolean = true, + action: Action +) { + configure { + jvm { + target { withJava() } + + kotlinJvmTarget = JavaVersion.VERSION_1_8 + compileSourceCompatibility = JavaVersion.VERSION_1_8 + compileTargetCompatibility = JavaVersion.VERSION_1_8 + } + + js() +// wasm() + wasmNativeAll() + + androidNativeAll() + + iosAll() + macosAll() + tvosAll() + watchosAll() + + linuxAll() + mingwAll() + + common { + if (publish) { pluginIds("publication") } + + sourceSetTest { + dependencies { + implementation(kotlin("test")) + } + } + } + + if (explicitApi) { kotlin { explicitApi() } } + + action.execute(this) + } +} diff --git a/build-logic/src/main/kotlin/configuration.gradle.kts b/build-logic/src/main/kotlin/configuration.gradle.kts new file mode 100644 index 0000000..4064a86 --- /dev/null +++ b/build-logic/src/main/kotlin/configuration.gradle.kts @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023 Matthew Nelson + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ +import org.gradle.api.tasks.testing.logging.TestExceptionFormat +import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED +import org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED +import org.gradle.api.tasks.testing.logging.TestLogEvent.SKIPPED +import org.gradle.api.tasks.testing.logging.TestLogEvent.STARTED + +plugins { + id("io.matthewnelson.kmp.configuration") +} + +tasks.withType { + testLogging { + exceptionFormat = TestExceptionFormat.FULL + events(STARTED, PASSED, SKIPPED, FAILED) + showStandardStreams = true + } +} diff --git a/build-logic/src/main/kotlin/publication.gradle.kts b/build-logic/src/main/kotlin/publication.gradle.kts new file mode 100644 index 0000000..bebbda4 --- /dev/null +++ b/build-logic/src/main/kotlin/publication.gradle.kts @@ -0,0 +1,26 @@ +import org.gradle.plugins.signing.SigningExtension + +/* + * Copyright (c) 2023 Matthew Nelson + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ +plugins { + id("com.vanniktech.maven.publish") +} + +if (!version.toString().endsWith("-SNAPSHOT")) { + extensions.configure("signing") { + useGpgCmd() + } +} diff --git a/build.gradle.kts b/build.gradle.kts index 9d5aa10..720c6c8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,29 +14,14 @@ * limitations under the License. **/ import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask -import org.gradle.api.tasks.testing.logging.TestExceptionFormat -import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED -import org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED -import org.gradle.api.tasks.testing.logging.TestLogEvent.SKIPPED -import org.gradle.api.tasks.testing.logging.TestLogEvent.STARTED import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension -buildscript { - - repositories { - mavenCentral() - gradlePluginPortal() - } - - dependencies { - classpath(libs.gradle.kotlin) - classpath(libs.gradle.maven.publish) - classpath(libs.gradle.versions) - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle.kts files - } +@Suppress("DSL_SCOPE_VIOLATION") +plugins { + alias(libs.plugins.multiplatform) apply(false) + alias(libs.plugins.binaryCompat) + alias(libs.plugins.gradleVersions) } allprojects { @@ -49,29 +34,14 @@ allprojects { mavenCentral() } - tasks.withType { - testLogging { - exceptionFormat = TestExceptionFormat.FULL - events(STARTED, PASSED, SKIPPED, FAILED) - showStandardStreams = true - } - } - } plugins.withType { the().lockFileDirectory = rootDir.resolve(".kotlin-js-store") } -plugins { - @Suppress("DSL_SCOPE_VIOLATION") - alias(libs.plugins.binaryCompat) -} - -plugins.apply(libs.plugins.gradleVersions.get().pluginId) - -@Suppress("LocalVariableName") apiValidation { + @Suppress("LocalVariableName") val CHECK_PUBLICATION = findProperty("CHECK_PUBLICATION") as? String if (CHECK_PUBLICATION != null) { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 26f666a..79ca448 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,17 +1,16 @@ [versions] binaryCompat = "0.13.0" -configuration = "0.1.0-beta01" +configuration = "0.1.0-beta02" gradleVersions = "0.46.0" kotlin = "1.8.10" publish = "0.24.0" [libraries] +gradle-kmp-configuration = { module = "io.matthewnelson:gradle-kmp-configuration-plugin", version.ref = "configuration" } gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } gradle-maven-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "publish" } -gradle-versions = { module = "com.github.ben-manes:gradle-versions-plugin", version.ref = "gradleVersions" } [plugins] binaryCompat = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binaryCompat" } -publish = { id = "com.vanniktech.maven.publish", version.ref = "publish" } -configuration = { id = "io.matthewnelson.kmp.configuration", version.ref = "configuration" } gradleVersions = { id = "com.github.ben-manes.versions", version.ref = "gradleVersions" } +multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } diff --git a/library/encoding-base16/build.gradle.kts b/library/encoding-base16/build.gradle.kts index e20b75e..85a830a 100644 --- a/library/encoding-base16/build.gradle.kts +++ b/library/encoding-base16/build.gradle.kts @@ -13,60 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. **/ -@Suppress("DSL_SCOPE_VIOLATION") plugins { - alias(libs.plugins.configuration) + id("configuration") } kmpConfiguration { - configure { - jvm { - target { - withJava() - } - - kotlinJvmTarget = JavaVersion.VERSION_1_8 - compileSourceCompatibility = JavaVersion.VERSION_1_8 - compileTargetCompatibility = JavaVersion.VERSION_1_8 - } - - js() -// wasm() - wasmNativeAll() - - androidNativeAll() - - iosAll() - macosAll() - tvosAll() - watchosAll() - - linuxAll() - mingwAll() - + configureShared(publish = true) { common { - pluginIds(libs.plugins.publish.get().pluginId) - sourceSetMain { dependencies { api(project(":library:encoding-core")) } } - sourceSetTest { dependencies { - implementation(kotlin("test")) implementation(project(":library:encoding-test")) } } } - - kotlin { - explicitApi() - - extensions.configure("signing") { - useGpgCmd() - } - } } } diff --git a/library/encoding-base32/build.gradle.kts b/library/encoding-base32/build.gradle.kts index e20b75e..85a830a 100644 --- a/library/encoding-base32/build.gradle.kts +++ b/library/encoding-base32/build.gradle.kts @@ -13,60 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. **/ -@Suppress("DSL_SCOPE_VIOLATION") plugins { - alias(libs.plugins.configuration) + id("configuration") } kmpConfiguration { - configure { - jvm { - target { - withJava() - } - - kotlinJvmTarget = JavaVersion.VERSION_1_8 - compileSourceCompatibility = JavaVersion.VERSION_1_8 - compileTargetCompatibility = JavaVersion.VERSION_1_8 - } - - js() -// wasm() - wasmNativeAll() - - androidNativeAll() - - iosAll() - macosAll() - tvosAll() - watchosAll() - - linuxAll() - mingwAll() - + configureShared(publish = true) { common { - pluginIds(libs.plugins.publish.get().pluginId) - sourceSetMain { dependencies { api(project(":library:encoding-core")) } } - sourceSetTest { dependencies { - implementation(kotlin("test")) implementation(project(":library:encoding-test")) } } } - - kotlin { - explicitApi() - - extensions.configure("signing") { - useGpgCmd() - } - } } } diff --git a/library/encoding-base64/build.gradle.kts b/library/encoding-base64/build.gradle.kts index e20b75e..85a830a 100644 --- a/library/encoding-base64/build.gradle.kts +++ b/library/encoding-base64/build.gradle.kts @@ -13,60 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. **/ -@Suppress("DSL_SCOPE_VIOLATION") plugins { - alias(libs.plugins.configuration) + id("configuration") } kmpConfiguration { - configure { - jvm { - target { - withJava() - } - - kotlinJvmTarget = JavaVersion.VERSION_1_8 - compileSourceCompatibility = JavaVersion.VERSION_1_8 - compileTargetCompatibility = JavaVersion.VERSION_1_8 - } - - js() -// wasm() - wasmNativeAll() - - androidNativeAll() - - iosAll() - macosAll() - tvosAll() - watchosAll() - - linuxAll() - mingwAll() - + configureShared(publish = true) { common { - pluginIds(libs.plugins.publish.get().pluginId) - sourceSetMain { dependencies { api(project(":library:encoding-core")) } } - sourceSetTest { dependencies { - implementation(kotlin("test")) implementation(project(":library:encoding-test")) } } } - - kotlin { - explicitApi() - - extensions.configure("signing") { - useGpgCmd() - } - } } } diff --git a/library/encoding-core/build.gradle.kts b/library/encoding-core/build.gradle.kts index 7d50817..5a24db2 100644 --- a/library/encoding-core/build.gradle.kts +++ b/library/encoding-core/build.gradle.kts @@ -13,53 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. **/ -@Suppress("DSL_SCOPE_VIOLATION") plugins { - alias(libs.plugins.configuration) + id("configuration") } kmpConfiguration { - configure { - jvm { - target { - withJava() - } - - kotlinJvmTarget = JavaVersion.VERSION_1_8 - compileSourceCompatibility = JavaVersion.VERSION_1_8 - compileTargetCompatibility = JavaVersion.VERSION_1_8 - } - - js() -// wasm() - wasmNativeAll() - - androidNativeAll() - - iosAll() - macosAll() - tvosAll() - watchosAll() - - linuxAll() - mingwAll() - - common { - pluginIds(libs.plugins.publish.get().pluginId) - - sourceSetTest { - dependencies { - implementation(kotlin("test")) - } - } - } - - kotlin { - explicitApi() - - extensions.configure("signing") { - useGpgCmd() - } - } - } + configureShared(publish = true) {} } diff --git a/library/encoding-test/build.gradle.kts b/library/encoding-test/build.gradle.kts index c00e850..5bd055e 100644 --- a/library/encoding-test/build.gradle.kts +++ b/library/encoding-test/build.gradle.kts @@ -13,43 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. **/ -@Suppress("DSL_SCOPE_VIOLATION") plugins { - alias(libs.plugins.configuration) + id("configuration") } kmpConfiguration { - configure { - jvm { - target { - withJava() - } - - kotlinJvmTarget = JavaVersion.VERSION_1_8 - compileSourceCompatibility = JavaVersion.VERSION_1_8 - compileTargetCompatibility = JavaVersion.VERSION_1_8 - } - - js() -// wasm() - wasmNativeAll() - - androidNativeAll() - - iosAll() - macosAll() - tvosAll() - watchosAll() - - linuxAll() - mingwAll() - - common { - sourceSetMain { - dependencies { - implementation(kotlin("test")) - } - } - } - } + configureShared(explicitApi = false) {} } diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index 9e5da2f..40a8681 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -17,7 +17,7 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget **/ @Suppress("DSL_SCOPE_VIOLATION") plugins { - alias(libs.plugins.configuration) + id("configuration") } kmpConfiguration { diff --git a/sample/src/commonMain/kotlin/Main.kt b/sample/src/commonMain/kotlin/Main.kt index eed4641..36d10a9 100644 --- a/sample/src/commonMain/kotlin/Main.kt +++ b/sample/src/commonMain/kotlin/Main.kt @@ -70,7 +70,7 @@ fun main() { val base64 = bytes.encodeToString(base64DefaultEncoderDecoder) val base64UrlSafe = bytes.encodeToString(base64UrlSafeEncoderDecoder) - println("Hello World Encodes to:") + println("'Hello World!' Encodes to:") println(" Base16 (hex): $base16") println(" Base32 Crockford[checkSymbol = *, hyphenInterval = 5]: $crockford") diff --git a/settings.gradle.kts b/settings.gradle.kts index ba892fb..0b92892 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,14 @@ rootProject.name = "encoding" +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + } +} + +includeBuild("build-logic") + @Suppress("PrivatePropertyName") private val CHECK_PUBLICATION: String? by settings diff --git a/tools/check-publication/build.gradle.kts b/tools/check-publication/build.gradle.kts index cc46cef..27449cb 100644 --- a/tools/check-publication/build.gradle.kts +++ b/tools/check-publication/build.gradle.kts @@ -13,9 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. **/ -@Suppress("DSL_SCOPE_VIOLATION") plugins { - alias(libs.plugins.configuration) + id("configuration") } repositories { @@ -36,31 +35,7 @@ repositories { } kmpConfiguration { - configure { - jvm { - target { - withJava() - } - - kotlinJvmTarget = JavaVersion.VERSION_1_8 - compileSourceCompatibility = JavaVersion.VERSION_1_8 - compileTargetCompatibility = JavaVersion.VERSION_1_8 - } - - js() -// wasm() - wasmNativeAll() - - androidNativeAll() - - iosAll() - macosAll() - tvosAll() - watchosAll() - - linuxAll() - mingwAll() - + configureShared(explicitApi = false) { common { sourceSetMain { dependencies { From 7403f2cc6cd8f9b068f12182a2a4ba133e9dbf18 Mon Sep 17 00:00:00 2001 From: Matthew Nelson Date: Tue, 7 Mar 2023 11:35:59 -0500 Subject: [PATCH 2/5] Add a Bill of Materials publication --- README.md | 44 +++++++------------ .../src/main/kotlin/bom-include.gradle.kts | 1 + encoding-bom/.gitignore | 0 encoding-bom/build.gradle.kts | 32 ++++++++++++++ encoding-bom/gradle.properties | 16 +++++++ library/encoding-base16/build.gradle.kts | 1 + library/encoding-base32/build.gradle.kts | 1 + library/encoding-base64/build.gradle.kts | 1 + library/encoding-core/build.gradle.kts | 1 + settings.gradle.kts | 1 + 10 files changed, 70 insertions(+), 28 deletions(-) create mode 100644 build-logic/src/main/kotlin/bom-include.gradle.kts create mode 100644 encoding-bom/.gitignore create mode 100644 encoding-bom/build.gradle.kts create mode 100644 encoding-bom/gradle.properties diff --git a/README.md b/README.md index a66ee6e..25b6945 100644 --- a/README.md +++ b/README.md @@ -240,44 +240,32 @@ dependencies { implementation("io.matthewnelson.kotlin-components:encoding-base16:$encoding") implementation("io.matthewnelson.kotlin-components:encoding-base32:$encoding") implementation("io.matthewnelson.kotlin-components:encoding-base64:$encoding") - - // Alternatively, if you only want the abstractions to create your own EncoderDecoder(s) + + // Only necessary if you just want the abstractions to create your own EncoderDecoder(s) implementation("io.matthewnelson.kotlin-components:encoding-core:$encoding") } ``` + - -| encoding | kotlin | -|:--------:|:------:| -| 1.2.1 | 1.8.0 | -| 1.2.0 | 1.8.0 | -| 1.1.5 | 1.8.0 | -| 1.1.4 | 1.7.20 | -| 1.1.3 | 1.6.21 | -| 1.1.2 | 1.6.21 | -| 1.1.1 | 1.6.21 | -| 1.1.0 | 1.6.10 | -| 1.0.3 | 1.5.31 | +--> [badge-latest-release]: https://img.shields.io/badge/latest--release-1.2.1-blue.svg?style=flat diff --git a/build-logic/src/main/kotlin/bom-include.gradle.kts b/build-logic/src/main/kotlin/bom-include.gradle.kts new file mode 100644 index 0000000..ed7bed3 --- /dev/null +++ b/build-logic/src/main/kotlin/bom-include.gradle.kts @@ -0,0 +1 @@ +// include project in BOM diff --git a/encoding-bom/.gitignore b/encoding-bom/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/encoding-bom/build.gradle.kts b/encoding-bom/build.gradle.kts new file mode 100644 index 0000000..e988140 --- /dev/null +++ b/encoding-bom/build.gradle.kts @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023 Matthew Nelson + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + **/ +plugins { + id("publication") + id("java-platform") +} + +dependencies { + constraints { + rootProject.subprojects.forEach { + if ( + it.path.startsWith(":library:") + && evaluationDependsOn(it.path).plugins.hasPlugin("bom-include") + ) { + api(project(it.path)) + } + } + } +} diff --git a/encoding-bom/gradle.properties b/encoding-bom/gradle.properties new file mode 100644 index 0000000..7a41666 --- /dev/null +++ b/encoding-bom/gradle.properties @@ -0,0 +1,16 @@ +# Copyright (c) 2023 Matthew Nelson +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +POM_ARTIFACT_ID=encoding-bom +POM_NAME=encoding-bom +POM_DESCRIPTION=Bill of materials for encoding library diff --git a/library/encoding-base16/build.gradle.kts b/library/encoding-base16/build.gradle.kts index 85a830a..6cf6ed0 100644 --- a/library/encoding-base16/build.gradle.kts +++ b/library/encoding-base16/build.gradle.kts @@ -15,6 +15,7 @@ **/ plugins { id("configuration") + id("bom-include") } kmpConfiguration { diff --git a/library/encoding-base32/build.gradle.kts b/library/encoding-base32/build.gradle.kts index 85a830a..6cf6ed0 100644 --- a/library/encoding-base32/build.gradle.kts +++ b/library/encoding-base32/build.gradle.kts @@ -15,6 +15,7 @@ **/ plugins { id("configuration") + id("bom-include") } kmpConfiguration { diff --git a/library/encoding-base64/build.gradle.kts b/library/encoding-base64/build.gradle.kts index 85a830a..6cf6ed0 100644 --- a/library/encoding-base64/build.gradle.kts +++ b/library/encoding-base64/build.gradle.kts @@ -15,6 +15,7 @@ **/ plugins { id("configuration") + id("bom-include") } kmpConfiguration { diff --git a/library/encoding-core/build.gradle.kts b/library/encoding-core/build.gradle.kts index 5a24db2..8691859 100644 --- a/library/encoding-core/build.gradle.kts +++ b/library/encoding-core/build.gradle.kts @@ -15,6 +15,7 @@ **/ plugins { id("configuration") + id("bom-include") } kmpConfiguration { diff --git a/settings.gradle.kts b/settings.gradle.kts index 0b92892..126432e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -25,5 +25,6 @@ if (CHECK_PUBLICATION != null) { include(":library:$name") } + include(":encoding-bom") include(":sample") } From 9e6afffa9e59a8afd447e3c243d497c883904b0b Mon Sep 17 00:00:00 2001 From: Matthew Nelson Date: Tue, 7 Mar 2023 11:43:49 -0500 Subject: [PATCH 3/5] Add test dependency --- library/encoding-test/build.gradle.kts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/library/encoding-test/build.gradle.kts b/library/encoding-test/build.gradle.kts index 5bd055e..bcc2341 100644 --- a/library/encoding-test/build.gradle.kts +++ b/library/encoding-test/build.gradle.kts @@ -18,5 +18,13 @@ plugins { } kmpConfiguration { - configureShared(explicitApi = false) {} + configureShared(explicitApi = false) { + common { + sourceSetMain { + dependencies { + implementation(kotlin("test")) + } + } + } + } } From e0bb3f4f3043b58546f737e625c608be24809cf5 Mon Sep 17 00:00:00 2001 From: Matthew Nelson Date: Tue, 7 Mar 2023 11:44:12 -0500 Subject: [PATCH 4/5] Remove now-unnecessary suppress annotation --- sample/build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index 40a8681..6b889c9 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -15,7 +15,6 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget * See the License for the specific language governing permissions and * limitations under the License. **/ -@Suppress("DSL_SCOPE_VIOLATION") plugins { id("configuration") } From 75c389eb1f37796ffcf1f5fa8dfdc89f638b5a8d Mon Sep 17 00:00:00 2001 From: Matthew Nelson Date: Tue, 7 Mar 2023 11:45:30 -0500 Subject: [PATCH 5/5] Use BOM in check-publication tool --- tools/check-publication/build.gradle.kts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/check-publication/build.gradle.kts b/tools/check-publication/build.gradle.kts index 27449cb..edfa8a1 100644 --- a/tools/check-publication/build.gradle.kts +++ b/tools/check-publication/build.gradle.kts @@ -39,10 +39,11 @@ kmpConfiguration { common { sourceSetMain { dependencies { - implementation("${group}:encoding-base16:${version}") - implementation("${group}:encoding-base32:${version}") - implementation("${group}:encoding-base64:${version}") - implementation("${group}:encoding-core:${version}") + implementation(platform("$group:encoding-bom:$version")) + implementation("$group:encoding-base16") + implementation("$group:encoding-base32") + implementation("$group:encoding-base64") + implementation("$group:encoding-core") } } }