Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add an easy way to load flavor from arbitrary properties file #129

Open
yshrsmz opened this issue Dec 19, 2023 · 2 comments
Open

add an easy way to load flavor from arbitrary properties file #129

yshrsmz opened this issue Dec 19, 2023 · 2 comments
Labels

Comments

@yshrsmz
Copy link
Owner

yshrsmz commented Dec 19, 2023

def configureBuildKonfigFlavorFromLocalProperties() {
    if (project.gradle.startParameter.projectProperties.containsKey("buildkonfig.flavor")) {
        // prefer cli parameter
        return
    }
    if (Files.exists(Paths.get("$project.rootDir/local.properties"))) {
        def key = "buildkonfig.flavor"
        // load buildkonfig.flavor if exists
        def localProperties = new Properties()
        localProperties.load(new FileInputStream("$project.rootDir/local.properties"))
        if (localProperties.containsKey(key)) {
            project.setProperty(key, localProperties.getProperty(key))
        }
    }
}

personally I wrote this script and use it in my project. But it would be nice if this is baked into BuildKonfig

@yshrsmz yshrsmz added the enhancement New feature or request label Dec 19, 2023
@jfrey-irhythm

This comment was marked as off-topic.

@yshrsmz
Copy link
Owner Author

yshrsmz commented Dec 29, 2023

@jfrey-irhythm Take a look at #128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants