Comments (9)
I'm using kts. The current method is buildConfigField
I was thinking about adding simple buildConfigNullableField
.
However, it's a bit more wast problem. Right now we are constrained by Type
enum in FieldSpec
. I think it maybe could be a sealed class and we should allow a user to enter any primitive supported by the language.
I could help with two PR, one for simple nullable and one that would try to tackle that second matter. It could also provide some type safety before compilation.
fun <T: Any?> buildConfigField(
name: String,
value: T
)
would be a perfect method signature if possible.
from buildkonfig.
Could you elaborate on this?
What is the usecase of the null value as a constant?
from buildkonfig.
I'm using Gradle properties to read some constants. I'd like to model absence of them.
What I do is defining in local.properties proxy address for app and if it's not defined like on CI it's not installed on http client.
from buildkonfig.
Thanks for the detail!
Do you really need to distinguish null and empty string?
If not, I'd recommend you to use an empty string as an empty value, rather than using null.
from buildkonfig.
What about exposing a getHasKey
method?
from buildkonfig.
With String
it's kind of okay... however I also have some int's there and modeling it as -1/0 is just, you know :)
I feel that it would be a good addition to support nullable types since it's very deep in Kotlin roots.
from buildkonfig.
That sounds reasonable.
How would you like to configure nullable value? Any idea?
from buildkonfig.
buildConfigNullableField
looks nice 👍
Regarding the second suggestion, I'm not sure if it works well but let's see how it goes ;)
from buildkonfig.
I've just released 0.5.0 with changes from #21
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
- 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 6
- Support Gradle Config Cache HOT 4
- Issue With New Compiler Options DSL HOT 4
- How to support KMM multimodular project? HOT 3
- 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.