From d21a91f20c174578091ee1e2138526653a7b9aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?= Date: Mon, 11 Dec 2023 22:44:20 +0100 Subject: [PATCH] build(gradle): Move the template modules to gradle/templates This will reduce the number of conflicts in the future, which should hopefully make adoption simpler. --- build.gradle.kts | 2 +- .../templates/template-app}/build.gradle.kts | 2 +- .../template-app}/src/commonMain/kotlin/Main.kt | 0 .../templates/template-lib}/README.md | 0 .../templates/template-lib}/build.gradle.kts | 16 ++++++++++++++++ .../src/commonMain/kotlin/HelloWorld.kt | 0 .../src/commonTest/kotlin/HelloWorldTest.kt | 0 settings.gradle.kts | 4 ++-- 8 files changed, 20 insertions(+), 4 deletions(-) rename {app => gradle/templates/template-app}/build.gradle.kts (83%) rename {app => gradle/templates/template-app}/src/commonMain/kotlin/Main.kt (100%) rename {core => gradle/templates/template-lib}/README.md (100%) rename {core => gradle/templates/template-lib}/build.gradle.kts (68%) rename {core => gradle/templates/template-lib}/src/commonMain/kotlin/HelloWorld.kt (100%) rename {core => gradle/templates/template-lib}/src/commonTest/kotlin/HelloWorldTest.kt (100%) diff --git a/build.gradle.kts b/build.gradle.kts index 33856b88..04ac20c9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,7 +18,7 @@ plugins { dependencies { // List the 'library' projects - dokkatoo(projects.core) + // dokkatoo(projects.core) } // region Check the users of the project didn't forget to rename the group diff --git a/app/build.gradle.kts b/gradle/templates/template-app/build.gradle.kts similarity index 83% rename from app/build.gradle.kts rename to gradle/templates/template-app/build.gradle.kts index 4ffb5d7c..28177ee9 100644 --- a/app/build.gradle.kts +++ b/gradle/templates/template-app/build.gradle.kts @@ -9,7 +9,7 @@ kotlin { } sourceSets.commonMain.dependencies { - implementation(projects.core) + implementation(projects.gradle.templates.templateLib) } } diff --git a/app/src/commonMain/kotlin/Main.kt b/gradle/templates/template-app/src/commonMain/kotlin/Main.kt similarity index 100% rename from app/src/commonMain/kotlin/Main.kt rename to gradle/templates/template-app/src/commonMain/kotlin/Main.kt diff --git a/core/README.md b/gradle/templates/template-lib/README.md similarity index 100% rename from core/README.md rename to gradle/templates/template-lib/README.md diff --git a/core/build.gradle.kts b/gradle/templates/template-lib/build.gradle.kts similarity index 68% rename from core/build.gradle.kts rename to gradle/templates/template-lib/build.gradle.kts index c4d6cace..8a39f636 100644 --- a/core/build.gradle.kts +++ b/gradle/templates/template-lib/build.gradle.kts @@ -38,3 +38,19 @@ library { url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") } } + +// region Publication test +// Even though this module is included in all repositories that import the Playground, we +// don't want to always publish this template. + +val appGroup: String? by project + +if (appGroup != "dev.opensavvy.playground") { + tasks.configureEach { + if (name.startsWith("publish")) { + onlyIf("Publishing is only enabled when built as part of the Playground") { false } + } + } +} + +// endregion diff --git a/core/src/commonMain/kotlin/HelloWorld.kt b/gradle/templates/template-lib/src/commonMain/kotlin/HelloWorld.kt similarity index 100% rename from core/src/commonMain/kotlin/HelloWorld.kt rename to gradle/templates/template-lib/src/commonMain/kotlin/HelloWorld.kt diff --git a/core/src/commonTest/kotlin/HelloWorldTest.kt b/gradle/templates/template-lib/src/commonTest/kotlin/HelloWorldTest.kt similarity index 100% rename from core/src/commonTest/kotlin/HelloWorldTest.kt rename to gradle/templates/template-lib/src/commonTest/kotlin/HelloWorldTest.kt diff --git a/settings.gradle.kts b/settings.gradle.kts index 3715a71c..a7955ae9 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -26,6 +26,6 @@ plugins { } include( - "app", - "core", + "gradle:templates:template-app", + "gradle:templates:template-lib", ) -- 2.51.2