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

fix: input property fingerprinting #140

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package org.liquibase.gradle
* @author Steven C. Saliman
*/

abstract class LiquibaseCommand {
abstract class LiquibaseCommand implements Serializable {
// These constants represent the known arguments supported by a Liquibase command. They come
// from collecting all the CommandArgumentDefinition from CommandSteps in LB. If you add
// something here, you must add it to the collection later. LB uses camelCase in the Java code,
Expand Down
9 changes: 5 additions & 4 deletions src/main/groovy/org/liquibase/gradle/LiquibaseTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package org.liquibase.gradle

import org.gradle.api.Task
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.JavaExec
Expand All @@ -27,11 +28,11 @@ import static org.liquibase.gradle.Util.versionAtLeast
*
* @author Stven C. Saliman
*/
class LiquibaseTask extends JavaExec {
abstract class LiquibaseTask extends JavaExec {

/** The Liquibase command to run */
@Input
LiquibaseCommand liquibaseCommand
abstract Property<LiquibaseCommand> getLiquibaseCommand()

/** a {@code Provider} that can provide a value for the liquibase version. */
private Provider<String> liquibaseVersionProvider
Expand Down Expand Up @@ -73,10 +74,10 @@ class LiquibaseTask extends JavaExec {
// Set values on the JavaExec task using the Argument Builder appropriate for the Liquibase
// version we have.
if ( versionAtLeast(liquibaseVersion, '4.4') ) {
setArgs(ArgumentBuilder.buildLiquibaseArgs(project, activity, liquibaseCommand, liquibaseVersion))
setArgs(ArgumentBuilder.buildLiquibaseArgs(project, activity, liquibaseCommand.get(), liquibaseVersion))
} else {
logger.warn("using legacy argument builder. Consider updating to Liquibase 4.4+")
setArgs(LegacyArgumentBuilder.buildLiquibaseArgs(project, activity, liquibaseCommand, liquibaseVersion))
setArgs(LegacyArgumentBuilder.buildLiquibaseArgs(project, activity, liquibaseCommand.get(), liquibaseVersion))
}

def classpath = project.configurations.getByName(LiquibasePlugin.LIQUIBASE_RUNTIME_CONFIGURATION)
Expand Down
12 changes: 6 additions & 6 deletions src/test/groovy/org/liquibase/gradle/LiquibasePluginTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ class LiquibasePluginTest {
assertNotNull("Project is missing tag task", task)
assertTrue("tag task is the wrong type", task instanceof LiquibaseTask)
assertTrue("tag task should be enabled", task.enabled)
assertEquals("tag task has the wrong command", "tag", task.liquibaseCommand.command)
assertEquals("tag task has the wrong command", "tag", task.liquibaseCommand.get().command)
// and the update task does not.
task = project.tasks.findByName('update')
assertNotNull("Project is missing update task", task)
assertTrue("update task is the wrong type", task instanceof LiquibaseTask)
assertTrue("update task should be enabled", task.enabled)
assertEquals("update task has the wrong command", "update", task.liquibaseCommand.command)
assertEquals("update task has the wrong command", "update", task.liquibaseCommand.get().command)
}

/**
Expand All @@ -59,13 +59,13 @@ class LiquibasePluginTest {
assertNotNull("Project is missing tag task", task)
assertTrue("tag task is the wrong type", task instanceof LiquibaseTask)
assertTrue("tag task should be enabled", task.enabled)
assertEquals("tag task has the wrong command", "tag", task.liquibaseCommand.command)
assertEquals("tag task has the wrong command", "tag", task.liquibaseCommand.get().command)
// and the update task does not.
task = project.tasks.findByName('update')
assertNotNull("Project is missing update task", task)
assertTrue("update task is the wrong type", task instanceof LiquibaseTask)
assertTrue("update task should be enabled", task.enabled)
assertEquals("update task has the wrong command", "update", task.liquibaseCommand.command)
assertEquals("update task has the wrong command", "update", task.liquibaseCommand.get().command)
}

/**
Expand All @@ -86,13 +86,13 @@ class LiquibasePluginTest {
assertNotNull("Project is missing tag task", task)
assertTrue("tag task is the wrong type", task instanceof LiquibaseTask)
assertTrue("tag task should be enabled", task.enabled)
assertEquals("tag task has the wrong command", "tag", task.liquibaseCommand.command)
assertEquals("tag task has the wrong command", "tag", task.liquibaseCommand.get().command)
// and the update task does not.
task = project.tasks.findByName('liquibaseUpdate')
assertNotNull("Project is missing update task", task)
assertTrue("update task is the wrong type", task instanceof LiquibaseTask)
assertTrue("update task should be enabled", task.enabled)
assertEquals("update task has the wrong command", "update", task.liquibaseCommand.command)
assertEquals("update task has the wrong command", "update", task.liquibaseCommand.get().command)

// Make sure the standard tasks didn't get created, since we created them with different
// names.
Expand Down