diff --git a/.github/workflows/android_enterprise_release.yml b/.github/workflows/android_enterprise_release.yml index 47d416a9..d68e0712 100644 --- a/.github/workflows/android_enterprise_release.yml +++ b/.github/workflows/android_enterprise_release.yml @@ -1,9 +1,11 @@ name: Android Enterprise Release -on: - push: - branches: - - develop +# TODO uncomment trigger on client project + +#on: +# push: +# branches: +# - develop concurrency: group: ${{ github.workflow }}-${{ github.repository }} diff --git a/.github/workflows/android_google_play_release.yml b/.github/workflows/android_google_play_release.yml index d0a8e165..aced419b 100644 --- a/.github/workflows/android_google_play_release.yml +++ b/.github/workflows/android_google_play_release.yml @@ -1,8 +1,10 @@ name: Android Google Play Release -on: - release: - types: [ published ] +# TODO uncomment trigger on client project + +#on: +# release: +# types: [ published ] jobs: release: diff --git a/.github/workflows/ios_build.yml b/.github/workflows/ios_build.yml index daaf7ca2..338c140d 100644 --- a/.github/workflows/ios_build.yml +++ b/.github/workflows/ios_build.yml @@ -1,9 +1,11 @@ name: iOS Build -on: - push: - branches: - - develop +# TODO uncomment trigger on client project + +#on: +# push: +# branches: +# - develop jobs: build: diff --git a/.github/workflows/ios_release.yml b/.github/workflows/ios_release.yml index 0e573b56..8ccdf29d 100644 --- a/.github/workflows/ios_release.yml +++ b/.github/workflows/ios_release.yml @@ -1,8 +1,10 @@ name: iOS Release -on: - release: - types: [published] +# TODO uncomment trigger on client project + +#on: +# release: +# types: [published] jobs: release: diff --git a/buildSrc/src/main/kotlin/app/futured/kmptemplate/gradle/configuration/ProductFlavors.kt b/buildSrc/src/main/kotlin/app/futured/kmptemplate/gradle/configuration/ProductFlavors.kt new file mode 100644 index 00000000..4ed6ab2a --- /dev/null +++ b/buildSrc/src/main/kotlin/app/futured/kmptemplate/gradle/configuration/ProductFlavors.kt @@ -0,0 +1,27 @@ +package app.futured.kmptemplate.gradle.configuration + +/** + * Defines all flavor-specific values provided to KMP during compilation. + */ +interface ProductFlavor { + val name: String + val apolloApiUrl: String + val restApiUrl: String +} + +object ProductFlavors { + + val DEFAULT = Dev + + object Dev : ProductFlavor { + override val name: String = "dev" + override val apolloApiUrl: String = "https://rickandmortyapi.com/graphql" + override val restApiUrl: String = "https://swapi.dev/api/" + } + + object Prod : ProductFlavor { + override val name: String = "prod" + override val apolloApiUrl: String = "https://rickandmortyapi.com/graphql" + override val restApiUrl: String = "https://swapi.dev/api/" + } +} diff --git a/buildSrc/src/main/kotlin/app/futured/kmptemplate/gradle/configuration/ProjectSettings.kt b/buildSrc/src/main/kotlin/app/futured/kmptemplate/gradle/configuration/ProjectSettings.kt index 74ad360c..6bb3bb5a 100644 --- a/buildSrc/src/main/kotlin/app/futured/kmptemplate/gradle/configuration/ProjectSettings.kt +++ b/buildSrc/src/main/kotlin/app/futured/kmptemplate/gradle/configuration/ProjectSettings.kt @@ -9,22 +9,7 @@ object ProjectSettings { } object Kotlin { - const val JvmToolchainVersion = 17 - - object ProductFlavors { - object Dev { - const val NAME = "dev" - const val ApolloApiUrl = "https://rickandmortyapi.com/graphql" - const val RestApiUrl = "https://swapi.dev/api/" - } - - object Prod { - const val NAME = "prod" - const val ApolloApiUrl = "https://rickandmortyapi.com/graphql" - const val RestApiUrl = "https://swapi.dev/api/" - } - } } object Android { diff --git a/shared/network/graphql/build.gradle.kts b/shared/network/graphql/build.gradle.kts index 98164ca4..473ea0cf 100644 --- a/shared/network/graphql/build.gradle.kts +++ b/shared/network/graphql/build.gradle.kts @@ -1,3 +1,4 @@ +import app.futured.kmptemplate.gradle.configuration.ProductFlavors import app.futured.kmptemplate.gradle.configuration.ProjectSettings import app.futured.kmptemplate.gradle.ext.iosTargets import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.STRING @@ -74,20 +75,18 @@ apollo { buildkonfig { packageName = libs.versions.project.shared.network.graphql.packageName.get() + objectName = "FlavorConstants" - with(ProjectSettings.Kotlin.ProductFlavors.Dev) { - defaultConfigs { - buildConfigField(STRING, "apiUrl", ApolloApiUrl) - } - - defaultConfigs(flavor = NAME) { - buildConfigField(STRING, "apiUrl", ApolloApiUrl) - } + defaultConfigs { + buildConfigField(STRING, "apiUrl", ProductFlavors.DEFAULT.apolloApiUrl) } - with(ProjectSettings.Kotlin.ProductFlavors.Prod) { - defaultConfigs(flavor = NAME) { - buildConfigField(STRING, "apiUrl", ApolloApiUrl) + listOf( + ProductFlavors.Dev, + ProductFlavors.Prod, + ).forEach { + defaultConfigs(flavor = it.name) { + buildConfigField(STRING, "apiUrl", it.apolloApiUrl) } } } diff --git a/shared/network/graphql/src/commonMain/kotlin/app/futured/kmptemplate/network/graphql/tools/Constants.kt b/shared/network/graphql/src/commonMain/kotlin/app/futured/kmptemplate/network/graphql/tools/Constants.kt index 4d906c9f..e12e8a13 100644 --- a/shared/network/graphql/src/commonMain/kotlin/app/futured/kmptemplate/network/graphql/tools/Constants.kt +++ b/shared/network/graphql/src/commonMain/kotlin/app/futured/kmptemplate/network/graphql/tools/Constants.kt @@ -1,12 +1,12 @@ package app.futured.kmptemplate.network.graphql.tools -import app.futured.kmptemplate.network.graphql.BuildKonfig +import app.futured.kmptemplate.network.graphql.FlavorConstants import kotlin.time.Duration.Companion.seconds internal object Constants { object Configuration { - val API_URL = BuildKonfig.apiUrl + val API_URL = FlavorConstants.apiUrl val REQUEST_TIMEOUT = 20.seconds } } diff --git a/shared/network/rest/build.gradle.kts b/shared/network/rest/build.gradle.kts index 07991b72..1c63bfd4 100644 --- a/shared/network/rest/build.gradle.kts +++ b/shared/network/rest/build.gradle.kts @@ -1,3 +1,4 @@ +import app.futured.kmptemplate.gradle.configuration.ProductFlavors import app.futured.kmptemplate.gradle.configuration.ProjectSettings import app.futured.kmptemplate.gradle.ext.iosTargets import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.STRING @@ -71,20 +72,18 @@ android { buildkonfig { packageName = libs.versions.project.shared.network.rest.packageName.get() + objectName = "FlavorConstants" - with(ProjectSettings.Kotlin.ProductFlavors.Dev) { - defaultConfigs { - buildConfigField(STRING, "apiUrl", RestApiUrl) - } - - defaultConfigs(flavor = NAME) { - buildConfigField(STRING, "apiUrl", RestApiUrl) - } + defaultConfigs { + buildConfigField(STRING, "apiUrl", ProductFlavors.DEFAULT.restApiUrl) } - with(ProjectSettings.Kotlin.ProductFlavors.Prod) { - defaultConfigs(flavor = NAME) { - buildConfigField(STRING, "apiUrl", RestApiUrl) + listOf( + ProductFlavors.Dev, + ProductFlavors.Prod, + ).forEach { + defaultConfigs(flavor = it.name) { + buildConfigField(STRING, "apiUrl", it.restApiUrl) } } } diff --git a/shared/network/rest/src/commonMain/kotlin/app/futured/kmptemplate/network/rest/injection/NetworkModule.kt b/shared/network/rest/src/commonMain/kotlin/app/futured/kmptemplate/network/rest/injection/NetworkModule.kt index f6c9629c..23eb7c82 100644 --- a/shared/network/rest/src/commonMain/kotlin/app/futured/kmptemplate/network/rest/injection/NetworkModule.kt +++ b/shared/network/rest/src/commonMain/kotlin/app/futured/kmptemplate/network/rest/injection/NetworkModule.kt @@ -1,6 +1,6 @@ package app.futured.kmptemplate.network.rest.injection -import app.futured.kmptemplate.network.rest.BuildKonfig +import app.futured.kmptemplate.network.rest.FlavorConstants import app.futured.kmptemplate.network.rest.api.StarWarsApi import app.futured.kmptemplate.network.rest.logging.KtorKermitLogger import app.futured.kmptemplate.network.rest.result.NetworkResultConverterFactory @@ -23,7 +23,7 @@ class NetworkRestModule { @Single @Named("apiUrl") - fun apiUrl(): String = BuildKonfig.apiUrl + fun apiUrl(): String = FlavorConstants.apiUrl @Single @Named("restApiJson")