Comments (12)
How should we configure this option?
buildkonfig {
packageName = 'com.example.app'
objectName = 'AwesomeConfig'
exposeObject = true
defaultConfigs {
buildConfigField 'STRING', 'name', 'value'
}
}
Above is one option, but I think we should avoid this as we cannot infer the requirement.
So basically I've been thinking about these two options below.
buildkonfig {
packageName = 'com.example.app'
exposeObjectWithName = 'AwesomeConfig'
defaultConfigs {
buildConfigField 'STRING', 'name', 'value'
}
}
With this, we can be explicit about the requirement, but now we have multiple ways to configure the object name.
Another option is to make objectName
property a function and add a second parameter.
fun objectName(name: String, expose: Boolean = false)
buildkonfig {
packageName = 'com.example.app'
objectName('AwesomeConfig', true)
defaultConfigs {
buildConfigField 'STRING', 'name', 'value'
}
}
This is less explicit, but no duplication.
🤔
Any idea?
from buildkonfig.
This is intended behavior, as the object is named BuildKonfig(which is obviously not the name people intentionally named as their API) and I think it should not be exposed as a part of public API.
This option should be paired with an option to change the name of the generated object.
from buildkonfig.
As I said it should be optional and default to current behavior.
from buildkonfig.
I understand, and I think we first need to add an option to change the name of the generated object.
from buildkonfig.
Any progress here?
from buildkonfig.
Nothing really
PR is really welcome
from buildkonfig.
The configurable object name is supported since v0.6.0. So if anyone wants to add an option to make generated objects public, you are good to go.
from buildkonfig.
Doesn't make a lot of difference. I was expecting a boolean parameter that controlled whether it was public or internal
from buildkonfig.
Don't understand what you meant by "we cannot infer the requirement" unless you were saying you have to rename it to expose it. If so I see no reason why that is a requirement. Whether you want to change the name or you want it to be public are really unrelated. I have no problem with exposing it as BuildKonfig so I favor the first choice.
from buildkonfig.
Thanks for your input! I really appreciate it.
As I said before I don't want BuildKonfig to be a part of someone's public API.
Say I have an api
module that wants to expose server URL using BuildKonfig and the presentation
module wants to use it. What api
module should expose is ApiConfig
or Endpoint
object, but shouldn't be BuildKonfig
. BuildKonfig
tells nothing about its content and I think it's not a good design decision to expose it as is. So I won't make that happen in the first place.
I'm leaning towards the second one.
buildkonfig {
packageName = 'com.example.app'
exposeObjectWithName = 'AwesomeConfig'
defaultConfigs {
buildConfigField 'STRING', 'name', 'value'
}
}
from buildkonfig.
Though I must agree that the first one looks more concise. Maybe we could go with the first one and throw the exception when people forget to change the name.
from buildkonfig.
from buildkonfig.
Related Issues (20)
- Cause: non-flavored defaultConfigs must be provided. HOT 2
- Specify flavor in build time HOT 7
- 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
- BuildType & ProductFlavor & sourceSets support ? HOT 1
- Plugin generates invalid class so build fails HOT 5
- Readme does not document hierarchical project support HOT 2
- Type ...BuildConfig is defined multiple times HOT 2
- BuildKonfig doesn't work with npm-publish HOT 4
- Set generated value visibility modifier public/internal HOT 2
- non-flavored defaultConfigs must be provided. HOT 3
- Unresolved reference HOT 2
- 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.