Comments (7)
Or why not just update buildkonfig.flavor
property with that project.findProperty(KotlinCocoapodsPlugin.CONFIGURATION_PROPERTY)
value? I think that should work.
from buildkonfig.
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.
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.
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.
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.
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.
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)
- Cause: non-flavored defaultConfigs must be provided. HOT 2
- ios configuration and environment variables
- Support Kotlin 1.9.20 HOT 7
- Automate changelog generation
- BuildKonfigs objects are not available in dependent modules. HOT 1
- add an easy way to load flavor from arbitrary properties file HOT 2
- Add Support to change build types or Build Variants from dropdown like native android HOT 3
- target ios does not contains correct values. (ComposeApp module hierarchy) HOT 6
- How to configure for compose multiplatform nativeMain?
- Unable to detect shared ios SourceSet created by KMP plugin HOT 1
- Add option to disable @JsExport HOT 4
- [Kotlin v2] CONST_VAL_WITHOUT_INITIALIZER warnings HOT 1
- Support Kotlin 2.0.0
- Flavor Selection Based on Build Variants in Android HOT 4
- How to solve "Unresolved reference: BuildKonfig" error? HOT 4
- Rename `buildkonfig` to `buildKonfig` HOT 1
- Support for Kotlin 1.9.0? HOT 4
- Dependency Dashboard
- SourceSet change support HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from buildkonfig.