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

Suggestion: Make outputDir configurable instead of fixing it to 'generated' #281

Open
grahamrvvup opened this issue Nov 18, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@grahamrvvup
Copy link

We'd like to be able to add the generated code to source control so we can still see the history of that code over time. One problem we're having is that we'd like it to fit the usual src/{set}/{language} convention but the outputDir is always set to 'generated' which prevents us from doing that. If that directory could be changed so it could be overridden then we could get it working the way we need but the default could continue to be the existing hard-coded value.

I could put together a quick PR if other people would find it useful?

@npwork
Copy link
Contributor

npwork commented Nov 21, 2021

I totally agree about configuring outputDir, it's probably useful config.
In regards to tracking generated code in src/{set}/{language} I think it's not a good idea.
It's better to track changes of .graphqls files and don't depend on generated classes since generated implementation might change in time(without changing interface).

@berngp
Copy link
Contributor

berngp commented Dec 6, 2021

I agree with @npwork. In general you want to track the .graphqls files, that said, I understand folks can be hesitant on the generated code, or be pulling the graphqls files dynamically, and therefore want to have a clear understanding on what was generated.

I think that today you should be able to do something like...

generateJava {
    description "Generates Java code based on Rosetta's GraphQL schemas"
    packageName = 'foo.bar.baz'
    generatedSourcesDir = "${projectDir}/src/foo-bar-schema"
}
sourceSets.main.java.srcDirs += ["${projectDir}/src/foo-bar-schema/generated"]

@berngp
Copy link
Contributor

berngp commented Dec 6, 2021

I'm not discarding the idea of being able to configure the full path, the question then is how to convey it without making it confusing for folks that use generatedSourcesDir already.

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

No branches or pull requests

3 participants