mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-1298: Ensure LICENSE/NOTICE generation takes current build into account (not central repository).
This commit is contained in:
@@ -28,8 +28,8 @@
|
|||||||
# generate-license-files.sh
|
# generate-license-files.sh
|
||||||
# -------------------------
|
# -------------------------
|
||||||
#
|
#
|
||||||
# Automatically iterates through the runtime dependencies of the Maven project
|
# Automatically iterates through the provided runtime dependencies of the Maven
|
||||||
# in the current directory, creating new LICENSE and NOTICE files which
|
# project in the current directory, creating new LICENSE and NOTICE files which
|
||||||
# contain all the license information of bundled dependencies, as well as any
|
# contain all the license information of bundled dependencies, as well as any
|
||||||
# required notices.
|
# required notices.
|
||||||
#
|
#
|
||||||
@@ -38,10 +38,12 @@
|
|||||||
#
|
#
|
||||||
# USAGE:
|
# USAGE:
|
||||||
#
|
#
|
||||||
# path/to/generate-license-files.sh OUTPUT_DIRECTORY
|
# path/to/generate-license-files.sh DEPENDENCY_LIST OUTPUT_DIRECTORY
|
||||||
#
|
#
|
||||||
# where OUTPUT_DIRECTORY is the directory in which the LICENSE and NOTICE
|
# where DEPENDENCY_LIST is the list of Maven dependencies to consider when
|
||||||
# files should be written, along with verbatim copies of all relevant licenses.
|
# generating LICENSE and NOTICE (as produced by "mvn dependency:list") and
|
||||||
|
# OUTPUT_DIRECTORY is the directory in which the LICENSE and NOTICE files
|
||||||
|
# should be written.
|
||||||
#
|
#
|
||||||
# Structure of license information
|
# Structure of license information
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
@@ -110,26 +112,22 @@ LICENSES_DIR="`dirname "$0"`"
|
|||||||
##
|
##
|
||||||
BASEDIR="$LICENSES_DIR/../.."
|
BASEDIR="$LICENSES_DIR/../.."
|
||||||
|
|
||||||
|
##
|
||||||
|
## The file containing all relevant runtime dependencies, as generated by
|
||||||
|
## "mvn dependency:list".
|
||||||
|
##
|
||||||
|
DEPENDENCY_LIST="$1"
|
||||||
|
|
||||||
##
|
##
|
||||||
## The output directory in which the generated LICENSE, NOTICE, etc. files
|
## The output directory in which the generated LICENSE, NOTICE, etc. files
|
||||||
## should be placed.
|
## should be placed.
|
||||||
##
|
##
|
||||||
OUTPUT_DIR="$1"
|
OUTPUT_DIR="$2"
|
||||||
|
|
||||||
##
|
|
||||||
## Lists the Maven coordinates of all runtime dependencies of the current
|
|
||||||
## project. Each dependency is listed on its own line.
|
|
||||||
##
|
|
||||||
list_dependencies() {
|
|
||||||
mvn -q dependency:list -DincludeScope=runtime -DoutputFile=/dev/stdout \
|
|
||||||
| grep -v '\<org\.apache\.guacamole\>' \
|
|
||||||
| grep -o '[^: ]*:[^: ]*:[^: ]*:[^: ]*' | sort -u
|
|
||||||
}
|
|
||||||
|
|
||||||
##
|
##
|
||||||
## Lists the license information directories (subdirectories of the
|
## Lists the license information directories (subdirectories of the
|
||||||
## "doc/licenses/" directory in the main guacamole-client source tree) that
|
## "doc/licenses/" directory in the main guacamole-client source tree) that
|
||||||
## apply to runtime dependencies of the current project. If any runtime
|
## apply to the list of runtime dependencies provided via STDIN. If any runtime
|
||||||
## dependencies are not described by license information included in the
|
## dependencies are not described by license information included in the
|
||||||
## guacamole-client source tree, a error is printed to STDERR.
|
## guacamole-client source tree, a error is printed to STDERR.
|
||||||
##
|
##
|
||||||
@@ -141,7 +139,7 @@ list_dependency_license_info() {
|
|||||||
|
|
||||||
# List the license directories of all runtime dependencies, as dictated by
|
# List the license directories of all runtime dependencies, as dictated by
|
||||||
# the "maven-coordinates.txt" files included within those directores
|
# the "maven-coordinates.txt" files included within those directores
|
||||||
list_dependencies | while read DEPENDENCY; do
|
grep -o '[^: ]*:[^: ]*:[^: ]*:[^: ]*' | while read DEPENDENCY; do
|
||||||
|
|
||||||
if ! grep -l "$DEPENDENCY[[:space:]]*$" "$LICENSES_DIR"/*/maven-coordinates.txt; then
|
if ! grep -l "$DEPENDENCY[[:space:]]*$" "$LICENSES_DIR"/*/maven-coordinates.txt; then
|
||||||
error "License information missing for $DEPENDENCY"
|
error "License information missing for $DEPENDENCY"
|
||||||
@@ -269,8 +267,14 @@ trim_file() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Verify that an output directory was provided
|
# Verify that an output directory was provided
|
||||||
if [ -z "$OUTPUT_DIR" ]; then
|
if [ -z "$DEPENDENCY_LIST" -o -z "$OUTPUT_DIR" ]; then
|
||||||
error "USAGE: $0 OUTPUT_DIRECTORY"
|
error "USAGE: $0 DEPENDENCY_LIST OUTPUT_DIRECTORY"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify input file actually exists
|
||||||
|
if [ ! -r "$DEPENDENCY_LIST" ]; then
|
||||||
|
error "$DEPENDENCY_LIST cannot be read."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -293,7 +297,7 @@ cp "$BASEDIR/NOTICE" "$OUTPUT_DIR/"
|
|||||||
#
|
#
|
||||||
|
|
||||||
PREAMBLE_ADDED=0
|
PREAMBLE_ADDED=0
|
||||||
list_dependency_license_info | sort_dependency_license_info | \
|
list_dependency_license_info < "$DEPENDENCY_LIST" | sort_dependency_license_info | \
|
||||||
while read LICENSE_INFO_DIR; do
|
while read LICENSE_INFO_DIR; do
|
||||||
|
|
||||||
# Add subcomponent license preamble if not already added
|
# Add subcomponent license preamble if not already added
|
||||||
|
23
pom.xml
23
pom.xml
@@ -120,6 +120,28 @@
|
|||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<!-- Automatically generate list of runtime dependencies -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<version>3.1.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>list-runtime-dependencies</id>
|
||||||
|
<phase>generate-resources</phase>
|
||||||
|
<configuration>
|
||||||
|
<includeScope>runtime</includeScope>
|
||||||
|
<excludeReactor>false</excludeReactor>
|
||||||
|
<excludeGroupIds>org.apache.guacamole</excludeGroupIds>
|
||||||
|
<outputFile>${project.build.directory}/runtime-dependencies.txt</outputFile>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>list</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
||||||
<pluginManagement>
|
<pluginManagement>
|
||||||
@@ -163,6 +185,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<executable>${rootlocation}/doc/licenses/generate-license-files.sh</executable>
|
<executable>${rootlocation}/doc/licenses/generate-license-files.sh</executable>
|
||||||
<arguments>
|
<arguments>
|
||||||
|
<argument>${project.build.directory}/runtime-dependencies.txt</argument>
|
||||||
<argument>${project.build.directory}/licenses</argument>
|
<argument>${project.build.directory}/licenses</argument>
|
||||||
</arguments>
|
</arguments>
|
||||||
<skip>${skipLicenseGeneration}</skip>
|
<skip>${skipLicenseGeneration}</skip>
|
||||||
|
Reference in New Issue
Block a user