Coder Social home page Coder Social logo

Comments (7)

PhilipDukhov avatar PhilipDukhov commented on May 29, 2024 1

Ah I see. I think it could be done using same techniques moko-resources uses under the hood.

from buildkonfig.

yshrsmz avatar yshrsmz commented on May 29, 2024

https://github.com/google/secrets-gradle-plugin

from buildkonfig.

PhilipDukhov avatar PhilipDukhov commented on May 29, 2024

@yshrsmz do you have a plan to add multiplatform support for secrets-gradle-plugin?

from buildkonfig.

yshrsmz avatar yshrsmz commented on May 29, 2024

@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.

yshrsmz avatar yshrsmz commented on May 29, 2024

Thanks, will take a look!

from buildkonfig.

chris-hatton avatar chris-hatton commented on May 29, 2024

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.

yshrsmz avatar yshrsmz commented on May 29, 2024

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)

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.