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
120120target(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
124131target(name: "bundle", description: "Builds the project release bundle", dependsOn: ["jar"]) {
@@ -136,3 +143,37 @@ target(name: "bundle", description: "Builds the project release bundle", depends
136143target(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+ }
0 commit comments