Skip to content

Commit 3232038

Browse files
Issue #957: Updating docker Script to Use Latest Groovy5
1 parent 60f7b99 commit 3232038

File tree

3 files changed

+40
-16
lines changed

3 files changed

+40
-16
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ workflows:
5151
jobs:
5252
- validate-with-maven-script:
5353
name: "releasenotes-builder"
54-
image-name: &custom_img "amitkumardeoghoria/jdk-17-groovy-git-mvn:v1.0"
54+
image-name: &custom_img "amitkumardeoghoria/jdk-21-groovy5-git-mvn-ant-jq:latest"
5555
command: "./.ci/validation.sh releasenotes-builder"
5656
- validate-with-maven-script:
5757
name: "patch-diff-report-tool"

checkstyle-tester/diff.groovy

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import static java.nio.file.StandardCopyOption.REPLACE_EXISTING
33

44
import java.nio.file.Files
55
import java.nio.file.Paths
6+
import java.nio.file.Path
67
import java.util.regex.Pattern
8+
import groovy.cli.picocli.CliBuilder
79

810
static void main(String[] args) {
911
def cliOptions = getCliOptions(args)
@@ -571,7 +573,7 @@ def generateAndPrintConfigHtmlFile(diffDir, configFile, textTransform, summaryIn
571573
def configfilenameWithoutExtension = getFilenameWithoutExtension(configFile.name)
572574
def configFileHtml = new File("$diffDir/${configfilenameWithoutExtension}.html")
573575
textTransform.transform(configFile.name, configFileHtml.toPath().toString(), Locale.ENGLISH,
574-
"UTF-8", "UTF-8")
576+
"UTF-8", "UTF-8", "UTF-8")
575577

576578
summaryIndexHtml << ('<h6>')
577579
summaryIndexHtml << ("<a href='${configFileHtml.name}'>${configFile.name} file</a>")
@@ -703,27 +705,51 @@ def runMavenExecution(srcDir, excludes, checkstyleConfig,
703705
}
704706

705707
def postProcessCheckstyleReport(targetDir, repoName, repoPath) {
706-
new AntBuilder().replace(
707-
file: getOsSpecificPath("$targetDir", "checkstyle-result.xml"),
708-
token: new File(getOsSpecificPath("src", "main", "java", "$repoName")).absolutePath,
709-
value: getOsSpecificPath("$repoPath")
710-
)
708+
def checkstyleResultFile = new File(getOsSpecificPath("$targetDir", "checkstyle-result.xml"))
709+
if (checkstyleResultFile.exists()) {
710+
def content = checkstyleResultFile.text
711+
def oldPath = new File(getOsSpecificPath("src", "main", "java", "$repoName")).absolutePath
712+
def newContent = content.replace(oldPath, getOsSpecificPath("$repoPath"))
713+
checkstyleResultFile.text = newContent
714+
}
711715
}
712716

713717
def copyDir(source, destination) {
714-
new AntBuilder().copy(todir: destination) {
715-
fileset(dir: source)
718+
def sourceDir = new File(source)
719+
def destDir = new File(destination)
720+
721+
if (!destDir.exists()) {
722+
destDir.mkdirs()
723+
}
724+
725+
sourceDir.eachFileRecurse { file ->
726+
def relativePath = sourceDir.toPath().relativize(file.toPath())
727+
def destFile = new File(destDir, relativePath.toString())
728+
729+
if (file.isDirectory()) {
730+
destFile.mkdirs()
731+
} else {
732+
Files.copy(file.toPath(), destFile.toPath(), REPLACE_EXISTING)
733+
}
716734
}
717735
}
718736

719737
def moveDir(source, destination) {
720-
new AntBuilder().move(todir: destination) {
721-
fileset(dir: source)
738+
def sourceDir = new File(source)
739+
def destDir = new File(destination)
740+
741+
if (sourceDir.exists()) {
742+
// First copy, then delete
743+
copyDir(source, destination)
744+
deleteDir(source)
722745
}
723746
}
724747

725748
def deleteDir(dir) {
726-
new AntBuilder().delete(dir: dir, failonerror: false)
749+
def dirFile = new File(dir)
750+
if (dirFile.exists() && dirFile.isDirectory()) {
751+
dirFile.deleteDir()
752+
}
727753
}
728754

729755
def executeCmd(cmd, dir = new File("").absoluteFile) {

devops/docker/no-exception-build-image/jdk-21-groovy-git-mvn-ant-jq/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RUN curl -s "https://get.sdkman.io" | bash
1212
# Install Java 21, Groovy, Maven via SDKMAN
1313
RUN bash -c "source $SDKMAN_DIR/bin/sdkman-init.sh && \
1414
sdk install java 21.0.4-tem && \
15-
sdk install groovy 3.0.21 && \
15+
sdk install groovy 5.0.0 && \
1616
sdk install maven 3.9.11"
1717

1818
# Update PATH and setup environment
@@ -24,6 +24,4 @@ ENV PATH=$GROOVY_HOME/bin:$SDKMAN_DIR/candidates/maven/current/bin:$JAVA_HOME/bi
2424
RUN bash -c "source $SDKMAN_DIR/bin/sdkman-init.sh && \
2525
java -version && \
2626
groovy --version && \
27-
mvn -version && \
28-
groovy -e 'new CliBuilder(); println \"CliBuilder OK\"' && \
29-
groovy -e 'new AntBuilder(); println \"AntBuilder OK\"'"
27+
mvn -version"

0 commit comments

Comments
 (0)