yshrsmz / BuildKonfig

BuildConfig for Kotlin Multiplatform Project
Apache License 2.0
799 stars 33 forks source link

How to configure for compose multiplatform nativeMain? #144

Closed ronjunevaldoz closed 7 months ago

ronjunevaldoz commented 7 months ago

In the below config, only the android package contains adMobBannerId


buildkonfig {
    packageName = "com.example.app"
    defaultConfigs {
        buildConfigField(STRING, "oAuthServerId", "test")
    }
    defaultConfigs("dev") {
        buildConfigField(STRING, "oAuthServerId", "test")
    }

    targetConfigs {
        create("android") {
            buildConfigField(STRING, "adMobBannerId", "valueAndroid")
        }

        create("ios") {
            buildConfigField(STRING, "adMobBannerId", "valueIos")
        }
    }
    // flavor is passed as a first argument of targetConfigs
    targetConfigs("dev") {
        create("ios") {
            buildConfigField(STRING, "adMobBannerId", "ca")
        }
        create("android") {
            buildConfigField(STRING, "adMobBannerId", "ca")
        }
    }
}