Coder Social home page Coder Social logo

Comments (12)

yshrsmz avatar yshrsmz commented on May 30, 2024 1

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.

yshrsmz avatar yshrsmz commented on May 30, 2024

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.

dalewking avatar dalewking commented on May 30, 2024

As I said it should be optional and default to current behavior.

from buildkonfig.

yshrsmz avatar yshrsmz commented on May 30, 2024

I understand, and I think we first need to add an option to change the name of the generated object.

from buildkonfig.

romanandreyvich avatar romanandreyvich commented on May 30, 2024

Any progress here?

from buildkonfig.

yshrsmz avatar yshrsmz commented on May 30, 2024

Nothing really

PR is really welcome

from buildkonfig.

yshrsmz avatar yshrsmz commented on May 30, 2024

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.

dalewking avatar dalewking commented on May 30, 2024

Doesn't make a lot of difference. I was expecting a boolean parameter that controlled whether it was public or internal

from buildkonfig.

dalewking avatar dalewking commented on May 30, 2024

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.

yshrsmz avatar yshrsmz commented on May 30, 2024

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.

yshrsmz avatar yshrsmz commented on May 30, 2024

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.

dalewking avatar dalewking commented on May 30, 2024

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.