Comments (7)
Ah I see. I think it could be done using same techniques moko-resources uses under the hood.
from buildkonfig.
https://github.com/google/secrets-gradle-plugin
from buildkonfig.
@yshrsmz do you have a plan to add multiplatform support for secrets-gradle-plugin
?
from buildkonfig.
@PhilipDukhov
I think I'm not going to "support" secrets-gradle-plugin, as it looks like an Android-specific plugin, but borrow some idea/implementation from it.
Do you have any idea or suggestion?
from buildkonfig.
Thanks, will take a look!
from buildkonfig.
In case it helps anyone I'm using BuildKonfig happily in conjunction with the SnakeYAML library, within Gradle (Kotlin DSL), like so:
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type
import org.yaml.snakeyaml.Yaml
...
buildkonfig {
packageName = "mypackage"
objectName = "MyConfig"
val configFilename: String = projectDir.toString() + File.separator + "MyConfig.yml"
val appConfigYaml: String = File(configFilename).readText()
val appConfigMap: Map<String, Any?> = Yaml().load(appConfigYaml)
defaultConfigs {
appConfigMap.forEach { (key, value) ->
val (fieldType: Type, fieldContent: String) = when (value) {
is Boolean -> Type.BOOLEAN to value.toString()
is String -> Type.STRING to value
is List<*> -> Type.STRING to value.joinToString(",") { it.toString() }
else -> Type.STRING to (value?.toString() ?: "")
}
buildConfigField(
type = fieldType,
name = key,
value = fieldContent
)
}
}
}
from buildkonfig.
It seems like properties file is not suitable for BuildKonfig, as it's just a key-value map
Something like yaml or toml should be fine
https://github.com/Peanuuutz/tomlkt
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
- 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.