mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-773: Allow automatic license generation to consider multiple dependency lists, not necessarily from Maven.
This commit is contained in:
@@ -28,7 +28,7 @@
|
|||||||
# generate-license-files.sh
|
# generate-license-files.sh
|
||||||
# -------------------------
|
# -------------------------
|
||||||
#
|
#
|
||||||
# Automatically iterates through the provided runtime dependencies of the Maven
|
# Automatically iterates through the provided runtime dependencies of the
|
||||||
# project 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.
|
||||||
@@ -40,10 +40,13 @@
|
|||||||
#
|
#
|
||||||
# path/to/generate-license-files.sh DEPENDENCY_LIST OUTPUT_DIRECTORY
|
# path/to/generate-license-files.sh DEPENDENCY_LIST OUTPUT_DIRECTORY
|
||||||
#
|
#
|
||||||
# where DEPENDENCY_LIST is the list of Maven dependencies to consider when
|
# where DEPENDENCY_LIST is the list of dependencies to consider when generating
|
||||||
# generating LICENSE and NOTICE (as produced by "mvn dependency:list") and
|
# LICENSE and NOTICE (as produced by "mvn dependency:list" or our
|
||||||
# OUTPUT_DIRECTORY is the directory in which the LICENSE and NOTICE files
|
# DependencyListPlugin for Webpack) and OUTPUT_DIRECTORY is the directory in
|
||||||
# should be written.
|
# which the LICENSE and NOTICE files should be written.
|
||||||
|
#
|
||||||
|
# If DEPENDENCY_LIST is a directory, all normal files within the directory will
|
||||||
|
# be concatenated to produce the list.
|
||||||
#
|
#
|
||||||
# Ignoring license errors
|
# Ignoring license errors
|
||||||
# -----------------------
|
# -----------------------
|
||||||
@@ -69,22 +72,22 @@
|
|||||||
# License information for the bundled runtime dependencies of all subprojects
|
# License information for the bundled runtime dependencies of all subprojects
|
||||||
# is included in the subdirectories of the "doc/licenses/" directory of the
|
# is included in the subdirectories of the "doc/licenses/" directory of the
|
||||||
# main guacamole-client source tree. Each subdirectory is associated with a
|
# main guacamole-client source tree. Each subdirectory is associated with a
|
||||||
# single, logical dependency, with the Maven coordinatees of that dependency
|
# single, logical dependency, with the coordinates of that dependency listed in
|
||||||
# listed in the "maven-coordinates.txt" file within that subdirectory. There
|
# the "dep-coordinates.txt" file within that subdirectory. There may be
|
||||||
# may be multiple coordinates associated with a dependency, in which case each
|
# multiple coordinates associated with a dependency, in which case each
|
||||||
# relevant set of coordinates should be listed on its own line.
|
# relevant set of coordinates should be listed on its own line.
|
||||||
#
|
#
|
||||||
# For dependencies that are not associated with Maven coordinates, the licenses
|
# For dependencies that are not associated with coordinates that can be
|
||||||
# of those dependencies should instead be documented within subdirectories of
|
# automatically deteremined, the licenses of those dependencies should instead
|
||||||
# the "src/licenses/bundled/" directory of the relevant subproject.
|
# be documented within subdirectories of the "src/licenses/bundled/" directory
|
||||||
|
# of the relevant subproject.
|
||||||
#
|
#
|
||||||
# Regardless of whether a dependency is documented within the top-level
|
# Regardless of whether a dependency is documented within the top-level
|
||||||
# guacamole-client project (Maven dependencies) or within the relevant
|
# guacamole-client project or within the relevant subproject, the subdirectory
|
||||||
# subproject (non-Maven dependencies), the subdirectory for each dependency
|
# for each dependency must contain a "README" file describing the dependency,
|
||||||
# must contain a "README" file describing the dependency, the version used, the
|
# the version used, the copyright holder(s), and the license. Examples of the
|
||||||
# copyright holder(s), and the license. Examples of the formatting expected for
|
# formatting expected for these README files can be found within the existing
|
||||||
# these README files can be found within the existing dependency license
|
# dependency license directories.
|
||||||
# directories.
|
|
||||||
#
|
#
|
||||||
# Files that contain the word "notice", regardless of case, are considered by
|
# Files that contain the word "notice", regardless of case, are considered by
|
||||||
# this script to be the notice file mentioned within the Apache License, and
|
# this script to be the notice file mentioned within the Apache License, and
|
||||||
@@ -141,16 +144,16 @@ OUTPUT_DIR="$2"
|
|||||||
## guacamole-client source tree, a error is printed to STDERR.
|
## guacamole-client source tree, a error is printed to STDERR.
|
||||||
##
|
##
|
||||||
## The license information directories for dependencies that are not pulled in
|
## The license information directories for dependencies that are not pulled in
|
||||||
## by Maven (subdirectories of the "src/licenses/bundled/" directory within the
|
## automatically (subdirectories of the "src/licenses/bundled/" directory
|
||||||
## current project) will also be included, if any.
|
## within the current project) will also be included, if any.
|
||||||
##
|
##
|
||||||
list_dependency_license_info() {
|
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 "dep-coordinates.txt" files included within those directories
|
||||||
grep -o '[^: ]*:[^: ]*:[^: ]*:[^: ]*' | while read DEPENDENCY; do
|
sed 's/^[[:space:]]\+//' | grep -o '^[^: ]\+\(:[^: ]*\)\{1,3\}' | while read DEPENDENCY; do
|
||||||
|
|
||||||
if ! grep -l "$DEPENDENCY[[:space:]]*$" "$LICENSES_DIR"/*/maven-coordinates.txt; then
|
if ! grep -l "$DEPENDENCY[[:space:]]*$" "$LICENSES_DIR"/*/dep-coordinates.txt; then
|
||||||
error "License information missing for $DEPENDENCY"
|
error "License information missing for $DEPENDENCY"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -158,7 +161,7 @@ list_dependency_license_info() {
|
|||||||
dirname "$LICENSE_INFO_COORDS_FILE"
|
dirname "$LICENSE_INFO_COORDS_FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Include license directories for all dependencies not pulled in by Maven
|
# Include license directories for all dependencies not pulled in automatically
|
||||||
if [ -d ./src/licenses/bundled/ ]; then
|
if [ -d ./src/licenses/bundled/ ]; then
|
||||||
find src/licenses/bundled/ -mindepth 1 -maxdepth 1 -type d
|
find src/licenses/bundled/ -mindepth 1 -maxdepth 1 -type d
|
||||||
fi
|
fi
|
||||||
@@ -232,7 +235,7 @@ license_file() {
|
|||||||
DIR="$1"
|
DIR="$1"
|
||||||
find "$DIR" -mindepth 1 \
|
find "$DIR" -mindepth 1 \
|
||||||
-a \! -iname "*notice*" \
|
-a \! -iname "*notice*" \
|
||||||
-a \! -name "maven-coordinates.txt" \
|
-a \! -name "dep-coordinates.txt" \
|
||||||
-a \! -name "README" \
|
-a \! -name "README" \
|
||||||
| if ! single_result; then
|
| if ! single_result; then
|
||||||
error "Multiple license files found within $DIR"
|
error "Multiple license files found within $DIR"
|
||||||
@@ -306,7 +309,8 @@ cp "$BASEDIR/NOTICE" "$OUTPUT_DIR/"
|
|||||||
#
|
#
|
||||||
|
|
||||||
PREAMBLE_ADDED=0
|
PREAMBLE_ADDED=0
|
||||||
list_dependency_license_info < "$DEPENDENCY_LIST" | sort_dependency_license_info | \
|
find "$DEPENDENCY_LIST" -type f -exec cat '{}' + | \
|
||||||
|
list_dependency_license_info | 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
|
||||||
@@ -363,8 +367,8 @@ EOF
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Do not double-bundle the information contained in the README files (it's
|
# Do not double-bundle the information contained in the README files (it's
|
||||||
# already in LICENSE), nor internal mappings like maven-coordinates.txt
|
# already in LICENSE), nor internal mappings like dep-coordinates.txt
|
||||||
for EXCLUDED_FILE in README maven-coordinates.txt; do
|
for EXCLUDED_FILE in README dep-coordinates.txt; do
|
||||||
rm -f "$OUTPUT_DIR/bundled"/*/"$EXCLUDED_FILE"
|
rm -f "$OUTPUT_DIR/bundled"/*/"$EXCLUDED_FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
12
pom.xml
12
pom.xml
@@ -46,6 +46,10 @@
|
|||||||
<logback.version>1.2.3</logback.version>
|
<logback.version>1.2.3</logback.version>
|
||||||
<slf4j.version>1.7.30</slf4j.version>
|
<slf4j.version>1.7.30</slf4j.version>
|
||||||
|
|
||||||
|
<!-- The directory that should receive all generated dependency lists
|
||||||
|
(for LICENSE generation) -->
|
||||||
|
<dependency.list.directory>${project.build.directory}/dependencies</dependency.list.directory>
|
||||||
|
|
||||||
<!-- Set to "true" to ignore errors that occur during automatic LICENSE
|
<!-- Set to "true" to ignore errors that occur during automatic LICENSE
|
||||||
file generation (such as non-existent license documentation) as
|
file generation (such as non-existent license documentation) as
|
||||||
well as errors that occur during the RAT check (such as incorrect
|
well as errors that occur during the RAT check (such as incorrect
|
||||||
@@ -126,20 +130,20 @@
|
|||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- Automatically generate list of runtime dependencies -->
|
<!-- Automatically generate list of Maven runtime dependencies -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
<version>3.1.2</version>
|
<version>3.1.2</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>list-runtime-dependencies</id>
|
<id>list-maven-runtime-dependencies</id>
|
||||||
<phase>generate-resources</phase>
|
<phase>generate-resources</phase>
|
||||||
<configuration>
|
<configuration>
|
||||||
<includeScope>runtime</includeScope>
|
<includeScope>runtime</includeScope>
|
||||||
<excludeReactor>false</excludeReactor>
|
<excludeReactor>false</excludeReactor>
|
||||||
<excludeGroupIds>org.apache.guacamole</excludeGroupIds>
|
<excludeGroupIds>org.apache.guacamole</excludeGroupIds>
|
||||||
<outputFile>${project.build.directory}/runtime-dependencies.txt</outputFile>
|
<outputFile>${dependency.list.directory}/maven-runtime-dependencies.txt</outputFile>
|
||||||
</configuration>
|
</configuration>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>list</goal>
|
<goal>list</goal>
|
||||||
@@ -205,7 +209,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>${dependency.list.directory}</argument>
|
||||||
<argument>${project.build.directory}/licenses</argument>
|
<argument>${project.build.directory}/licenses</argument>
|
||||||
</arguments>
|
</arguments>
|
||||||
<environmentVariables>
|
<environmentVariables>
|
||||||
|
Reference in New Issue
Block a user