-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Gradle: Update Gradle Plugin extension to use properties #3879
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
base: main
Are you sure you want to change the base?
Conversation
This updates the flyway gradle plugin to provide `Property<>` values on the extension rather than using bare types. This is incredibly important for working with Gradle such that properties remain lazy. This allows values to be configured from different locations rather than relying on being available immediately.
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.
Apologies for the time since this PR was created. I have found some issues with the PR that are preventing Flyway working as expected with Gradle, so they will need to be addressed.
public Map<String, String> pluginConfiguration; | ||
private final MapProperty<String, String> pluginConfiguration; | ||
|
||
FlywayExtension(ObjectFactory objects) { |
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.
This needs to be made public
@@ -29,12 +29,12 @@ | |||
public class FlywayPlugin implements Plugin<Project> { | |||
public void apply(Project project) { | |||
project.getExtensions().create("flyway", FlywayExtension.class); |
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.
This would need to be updated to match the new constructor
if (value instanceof Provider<?> && ((Provider<?>) value).isPresent()) { | ||
config.put(key, ((Provider<?>) value).get().toString()); | ||
} else { | ||
config.put(key, value.toString()); |
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.
This will need a null check to ensure configuration parameters are properly set to null and not an empty string
|
||
/** | ||
* The version to tag an existing schema with when executing baseline. (default: 1) | ||
*/ | ||
public String baselineVersion; | ||
private final Property<String> baselineVersion; |
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.
This can create conflicts with baseline versions that are not written as a string. For example this will not accept baselineVersion = 1
This updates the flyway gradle plugin to provide
Property<>
values on the extension rather than using bare types. This is incredibly important for working with Gradle such that properties remain lazy. This allows values to be configured from different locations rather than relying on being available immediately.Drive-by: This bumps the version of Gradle from 6.1.1 (Jan 2020) to 6.9.4 (Feb 2023). The version in use is wildly out of date.
All changes within this PR are backwards compatible with Version 6.9.4.