Giter Club home page Giter Club logo

Comments (7)

yshrsmz avatar yshrsmz commented on July 18, 2024 1

Or why not just update buildkonfig.flavor property with that project.findProperty(KotlinCocoapodsPlugin.CONFIGURATION_PROPERTY) value? I think that should work.

from buildkonfig.

jadar avatar jadar commented on July 18, 2024 1

Ah, that worked well. I put a setProperty based on that value I was using before, and now I can use buildkonfig as it was designed. Thanks!

from buildkonfig.

yshrsmz avatar yshrsmz commented on July 18, 2024

buildkonfig.flavor is just a property, so you can pass it via gradlew command

 ./gradlew build -Pbuildkonfig.flavor=release

See detail here:
https://docs.gradle.org/current/userguide/build_environment.html#sec:project_properties

Also there's a note in README:
https://github.com/yshrsmz/BuildKonfig#product-flavor

from buildkonfig.

jadar avatar jadar commented on July 18, 2024

It doesn't seem that there's a ton of guidance on this. Perhaps not everyone has the same build environment that this was designed for.
One thing I am trying to figure out is how I would specify the flavor when I am using Cocoapods to keep the library in sync with my Xcode project. It's not super apparent how I can vary the flavor from my Xcode build configuration, through Cocoapods, and to Gradle.

from buildkonfig.

jadar avatar jadar commented on July 18, 2024

Here is what I have done in the meantime. However, this doesn't seem to leverage the actual "flavor" feature.

buildkonfig {
    packageName = "com.example.mykmpproject"

    defaultConfigs {
        when (project.findProperty(KotlinCocoapodsPlugin.CONFIGURATION_PROPERTY)) {
            "Debug" ->
                buildConfigField(FieldSpec.Type.STRING, "defaultEnvironment", "Debug", const = true)
            "Beta  " ->
                buildConfigField(FieldSpec.Type.STRING, "defaultEnvironment", "Beta", const = true)
            else ->
                buildConfigField(FieldSpec.Type.STRING, "defaultEnvironment", "Production", const = true)
        }
    }
}

from buildkonfig.

yshrsmz avatar yshrsmz commented on July 18, 2024

For the OP case, you can get an actual task name that a user passes to gradlew via project.gradle.startParameter.taskNames. So it's possible to dynamically change the value of buildkonfig.flavor property.

from buildkonfig.

yshrsmz avatar yshrsmz commented on July 18, 2024

For cocoapods, please open a separate issue as this one is already closed.
(And I'm not sure how Cocoapods & Kotlin Cocoapods Plugin build the project.)

from buildkonfig.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.