Skip to content

Commit ce2b40c

Browse files
authored
Merge pull request #119 from FusionAuth/degroff/pom_int_improvements
Add pom target to int and check the diff
2 parents 6bb58c7 + b9cbde0 commit ce2b40c

2 files changed

Lines changed: 43 additions & 2 deletions

File tree

build.savant

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019-2024, FusionAuth, All Rights Reserved
2+
* Copyright (c) 2019-2025, FusionAuth, All Rights Reserved
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -119,6 +119,13 @@ target(name: "idea", description: "Updates the IntelliJ IDEA module file") {
119119

120120
target(name: "pom", description: "Updates the pom.xml file") {
121121
pom.update()
122+
123+
// Hack. I think we need to update the pom plugin to optionally remove -{integration} from versions.
124+
file.copy(to: ".") {
125+
fileSet(dir: ".", includePatterns: [~/pom.xml/])
126+
filter(token: "-\\{integration\\}", value: "")
127+
}
128+
ensureFileNotChanged("pom.xml", "pom")
122129
}
123130

124131
target(name: "bundle", description: "Builds the project release bundle", dependsOn: ["jar"]) {
@@ -136,3 +143,37 @@ target(name: "bundle", description: "Builds the project release bundle", depends
136143
target(name: "write-licenses", description: "Write licenses to build/licenses") {
137144
dependency.writeLicenses(to: "build/licenses")
138145
}
146+
147+
def ensureFileNotChanged(String filename, String target) {
148+
if (!cleanExecute("git",
149+
"diff",
150+
"--exit-code",
151+
filename)) {
152+
fail(
153+
"${filename} was changed. If this is not being run locally, run the [${target}] Savant target locally to update the file and commit/push the result.")
154+
}
155+
}
156+
157+
boolean cleanExecute(String... args) {
158+
ProcessBuilder pb = new ProcessBuilder(args)
159+
clearEnvironment(pb)
160+
return execute(pb, '.')
161+
}
162+
163+
boolean execute(ProcessBuilder pb, String pathname) {
164+
def process = pb.inheritIO().directory(new File(pathname)).start()
165+
process.consumeProcessOutput(System.out, System.err)
166+
process.waitFor()
167+
return process.exitValue() == 0
168+
}
169+
170+
/**
171+
* Clears out the RBENV variables in the environment.
172+
*
173+
* @param pb The ProcessBuilder to clear out.
174+
*/
175+
static def clearEnvironment(ProcessBuilder pb) {
176+
pb.environment().remove("RBENV_VERSION")
177+
pb.environment().remove("RBENV_DIR")
178+
pb.environment().remove("RBENV_ROOT")
179+
}

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,4 @@
214214
</profile>
215215
</profiles>
216216

217-
</project>
217+
</project>

0 commit comments

Comments
 (0)