|
|
|
@ -18,12 +18,9 @@ package org.springframework.security.convention.versions; |
|
|
|
|
|
|
|
|
|
|
|
import org.gradle.api.DefaultTask; |
|
|
|
import org.gradle.api.DefaultTask; |
|
|
|
import org.gradle.api.Project; |
|
|
|
import org.gradle.api.Project; |
|
|
|
import org.gradle.api.tasks.Input; |
|
|
|
|
|
|
|
import org.gradle.api.tasks.Optional; |
|
|
|
|
|
|
|
import org.gradle.api.tasks.TaskAction; |
|
|
|
import org.gradle.api.tasks.TaskAction; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.File; |
|
|
|
import java.io.FileNotFoundException; |
|
|
|
|
|
|
|
import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
|
|
|
|
@ -31,10 +28,6 @@ public abstract class UpdateToSnapshotVersionTask extends DefaultTask { |
|
|
|
|
|
|
|
|
|
|
|
private static final String RELEASE_VERSION_PATTERN = "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(-M\\d+|-RC\\d+)?$"; |
|
|
|
private static final String RELEASE_VERSION_PATTERN = "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(-M\\d+|-RC\\d+)?$"; |
|
|
|
|
|
|
|
|
|
|
|
@Input |
|
|
|
|
|
|
|
@Optional |
|
|
|
|
|
|
|
private Boolean commit; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@TaskAction |
|
|
|
@TaskAction |
|
|
|
public void updateToSnapshotVersion() { |
|
|
|
public void updateToSnapshotVersion() { |
|
|
|
String currentVersion = getProject().getVersion().toString(); |
|
|
|
String currentVersion = getProject().getVersion().toString(); |
|
|
|
@ -49,12 +42,6 @@ public abstract class UpdateToSnapshotVersionTask extends DefaultTask { |
|
|
|
gradlePropertiesText = gradlePropertiesText.replace("version=" + currentVersion, "version=" + nextVersion); |
|
|
|
gradlePropertiesText = gradlePropertiesText.replace("version=" + currentVersion, "version=" + nextVersion); |
|
|
|
return gradlePropertiesText; |
|
|
|
return gradlePropertiesText; |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (this.commit) { |
|
|
|
|
|
|
|
System.out.println("Committing the version update"); |
|
|
|
|
|
|
|
File rootDir = getProject().getRootDir(); |
|
|
|
|
|
|
|
String commitMessage = "Next development version"; |
|
|
|
|
|
|
|
CommandLineUtils.runCommand(rootDir, "git", "commit", "-am", commitMessage); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String calculateNextSnapshotVersion(String currentVersion) { |
|
|
|
private String calculateNextSnapshotVersion(String currentVersion) { |
|
|
|
@ -78,12 +65,4 @@ public abstract class UpdateToSnapshotVersionTask extends DefaultTask { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Boolean getCommit() { |
|
|
|
|
|
|
|
return commit; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setCommit(Boolean commit) { |
|
|
|
|
|
|
|
this.commit = commit; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|