diff --git a/build.gradle b/build.gradle index e5d1a53..a30e34b 100644 --- a/build.gradle +++ b/build.gradle @@ -15,11 +15,14 @@ plugins { alias(dolbyio.plugins.android.library) apply false alias(dolbyio.plugins.kotlin.jvm) apply false alias(dolbyio.plugins.multiplatform.moko.resources.generator) apply false + alias(dolbyio.plugins.multiplatform.buildkonfig) apply false } group = "eu.codlab" version = property("version") +ext.commit = 'git rev-parse --verify --short HEAD'.execute().text.trim() + subprojects { group = "eu.codlab" version = property("version") diff --git a/gradle.properties b/gradle.properties index afa81b2..0a300a5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ kotlin.code.style=official android.useAndroidX=true android.nonTransitiveRClass=true -version=0.0.4 +version=0.1.0 pomDescription=Lorcana set descriptions and data pomUrl=https://github.com/codlab/lorcana-data diff --git a/library/lorcana-data/build.gradle.kts b/library/lorcana-data/build.gradle.kts index 29d068c..e9edd46 100644 --- a/library/lorcana-data/build.gradle.kts +++ b/library/lorcana-data/build.gradle.kts @@ -1,3 +1,4 @@ +import com.codingfeline.buildkonfig.compiler.FieldSpec import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import java.nio.file.Files @@ -7,6 +8,7 @@ plugins { alias(dolbyio.plugins.kotlin.multiplatform) alias(dolbyio.plugins.kotlin.serialization) alias(dolbyio.plugins.multiplatform.moko.resources.generator) + alias(dolbyio.plugins.multiplatform.buildkonfig) id("iosSimulatorConfiguration") id("jvmCompat") id("publication") @@ -76,6 +78,14 @@ multiplatformResources { multiplatformResourcesVisibility = dev.icerock.gradle.MRVisibility.Public } +buildkonfig { + packageName = "eu.codlab.lorcana.buildconfig" + + defaultConfigs { + buildConfigField(FieldSpec.Type.STRING, "commit", rootProject.extra["commit"] as String) + } +} + val original = file("${rootProject.projectDir.absolutePath}/data") val link = file("src/commonMain/resources/MR/files") diff --git a/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingCards.kt b/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingCards.kt index 4561849..bd3c373 100644 --- a/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingCards.kt +++ b/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingCards.kt @@ -20,7 +20,7 @@ class TestLoadingCards { } listOf( - "d23" to 23, + "d23" to 24, "tfc" to 216 ).forEach { set -> val (name, count) = set diff --git a/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingCompiledSet.kt b/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingCompiledSet.kt index eb46e28..141e5f1 100644 --- a/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingCompiledSet.kt +++ b/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingCompiledSet.kt @@ -1,5 +1,6 @@ package eu.codlab.lorcana +import eu.codlab.lorcana.buildconfig.BuildKonfig import eu.codlab.platform.Platform import eu.codlab.platform.currentPlatform import kotlinx.coroutines.test.runTest @@ -53,7 +54,7 @@ class TestLoadingCompiledSet { @Test fun testLoadingSetsFromGithub() = runTest { runTestList { - it.loadFromGithub("main") + it.loadFromGithub(BuildKonfig.commit) } } diff --git a/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingSet.kt b/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingSet.kt index d5bc570..5c003fa 100644 --- a/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingSet.kt +++ b/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingSet.kt @@ -1,5 +1,6 @@ package eu.codlab.lorcana +import eu.codlab.lorcana.buildconfig.BuildKonfig import eu.codlab.platform.Platform import eu.codlab.platform.currentPlatform import kotlinx.coroutines.test.runTest @@ -45,7 +46,7 @@ class TestLoadingSet { @Test fun testLoadingSetsFromGithub() = runTest { runTestList { - it.loadFromGithub("main") + it.loadFromGithub(BuildKonfig.commit) } } diff --git a/library/lorcana-data/src/jvmMain/kotlin/eu/codlab/lorcana/SetLegacy.kt b/library/lorcana-data/src/jvmMain/kotlin/eu/codlab/lorcana/SetLegacy.kt index d893acb..a0184f6 100644 --- a/library/lorcana-data/src/jvmMain/kotlin/eu/codlab/lorcana/SetLegacy.kt +++ b/library/lorcana-data/src/jvmMain/kotlin/eu/codlab/lorcana/SetLegacy.kt @@ -1,5 +1,6 @@ package eu.codlab.lorcana +import eu.codlab.lorcana.buildconfig.BuildKonfig import korlibs.io.async.Promise import korlibs.io.async.launch import korlibs.io.experimental.KorioExperimentalApi diff --git a/scripts/publish.sh b/scripts/publish.sh index 3f585fe..052e382 100644 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -2,6 +2,9 @@ set -xe +# generation, to be sure about the current state +./gradlew generateMR generateBuildKonfig + # running validation ./gradlew ktlint detekt ./gradlew check