-
Notifications
You must be signed in to change notification settings - Fork 21
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
set the jakartaPackages flag via a gradle property #1250
base: blaub/jakartaPackagesTest-v2
Are you sure you want to change the base?
set the jakartaPackages flag via a gradle property #1250
Conversation
Generate changelog in
|
If the gradle property `conjure.java.jakartaPackages` is set to `true`, then the corresponding flag will be set within the `java` options container in `ConjureExtension` at the time the extension object is created. This ensures that we can eagerly read the property value and configure the extension early in the gradle lifecycle, before any subprojects are configured, and the value will propagate correctly. This change removes previously-added `afterEvaluate` calls in some places.
6a53321
to
3d5a6d9
Compare
@@ -31,12 +32,16 @@ public class ConjureExtension { | |||
private final GeneratorOptions pythonOptions = new GeneratorOptions(); | |||
private final Map<String, GeneratorOptions> genericOptions = new HashMap<>(); | |||
|
|||
public ConjureExtension() { | |||
public ConjureExtension(Project project) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could potentially change this to be String jakartaPackagesProperty
and just make the caller use project.findProperty
- i'm not really sure which is preferred.
'''.stripIndent() | ||
createFile('gradle.properties') << """ | ||
conjure.java.jakartaPackages=true | ||
""".stripIndent() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might as well test both
Before this PR
This flag was previously set thusly in a build script:
While that's still possible, it potentially causes problems when configuring subprojects due to evaluation order; the flag's value is not populated within the extension object until some time after the plugin application finishes, which results in incorrect dependencies getting added to some subprojects when they are set up in
ConjurePlugin
and similar plugin applications.After this PR
==COMMIT_MSG==
Adding a gradle property
conjure.java.jakartaPackages=true
will cause the value to be set eagerly on the extension object such that it will always exist at the time theConjurePlugin
's application logic runs, and so should have the value set correctly at the time subproject dependencies are added.==COMMIT_MSG==
Possible downsides?
It's an extra level of annoyance to have to set this e.g. via a
gradle.properties
file.