GUACAMOLE-773: Allow license checks to be bypassed when necessary for testing/development.

This commit is contained in:
Michael Jumper
2021-04-03 17:21:34 -07:00
parent 481a2ca60b
commit d155975d93
2 changed files with 26 additions and 5 deletions

View File

@@ -45,6 +45,15 @@
# OUTPUT_DIRECTORY is the directory in which the LICENSE and NOTICE files
# should be written.
#
# Ignoring license errors
# -----------------------
#
# By default, this script will exit with a non-zero exit code if any license
# errors are encountered, failing the build. If this is undesirable (dependency
# changes are being tested, a full list of all license errors across all
# projects is needed, etc.), set the IGNORE_LICENSE_ERRORS environment variable
# to "true".
#
# Structure of license information
# --------------------------------
#
@@ -359,6 +368,12 @@ for EXCLUDED_FILE in README maven-coordinates.txt; do
rm -f "$OUTPUT_DIR/bundled"/*/"$EXCLUDED_FILE"
done
# Fail if any errors occurred
[ "`cat "$HAS_ERRORS"`" != "1" ] && info "Dependency licenses processed successfully."
# Fail if any errors occured unless explicitly configured to ignore errors with
# the IGNORE_LICENSE_ERRORS environment variable
if [ "`cat "$HAS_ERRORS"`" = "1" ]; then
[ "$IGNORE_LICENSE_ERRORS" = "true" ] || exit 1
info "Ignoring above license errors (IGNORE_LICENSE_ERRORS was set to \"$IGNORE_LICENSE_ERRORS\")."
else
info "Dependency licenses processed successfully."
fi

12
pom.xml
View File

@@ -45,8 +45,11 @@
<logback.version>1.2.3</logback.version>
<slf4j.version>1.7.30</slf4j.version>
<!-- Build control -->
<skipLicenseGeneration>false</skipLicenseGeneration>
<!-- Set to "true" to ignore errors that occur during automatic LICENSE
file generation (such as non-existent license documentation) as
well as errors that occur during the RAT check (such as incorrect
or missing license headers). -->
<ignoreLicenseErrors>false</ignoreLicenseErrors>
</properties>
@@ -99,6 +102,7 @@
<exclude>src/licenses/**/*</exclude>
<exclude>target/**/*</exclude>
</excludes>
<skip>${ignoreLicenseErrors}</skip>
</configuration>
</execution>
</executions>
@@ -202,7 +206,9 @@
<argument>${project.build.directory}/runtime-dependencies.txt</argument>
<argument>${project.build.directory}/licenses</argument>
</arguments>
<skip>${skipLicenseGeneration}</skip>
<environmentVariables>
<IGNORE_LICENSE_ERRORS>${ignoreLicenseErrors}</IGNORE_LICENSE_ERRORS>
</environmentVariables>
</configuration>
<goals>
<goal>exec</goal>