Notices automation install (#6228)

This will generate the NOTICES.txt license file and SPDX-Licenses.json manifest file on every installer run.

Signed-off-by: Mike Chang <changml@amazon.com>
This commit is contained in:
Mike Chang
2021-12-08 12:45:44 -08:00
committed by GitHub
parent 0b028a827c
commit 6c299000a7
4 changed files with 62 additions and 4 deletions
+17
View File
@@ -94,6 +94,23 @@ endif()
# cpack generation. CPACK_BINARY_DIR persists across cpack invocations
set(LY_CMAKE_PACKAGE_DOWNLOAD_PATH ${CPACK_BINARY_DIR}/${CPACK_CMAKE_PACKAGE_FILE})
# Scan the source and 3p packages for licenses, then add the generated license results to the binary output folder.
# These results will be installed to the root of the install folder and copied to the S3 bucket specific to each platform
set(CPACK_3P_LICENSE_FILE "${CPACK_BINARY_DIR}/NOTICES.txt")
set(CPACK_3P_MANIFEST_FILE "${CPACK_BINARY_DIR}/SPDX-License.json")
configure_file(${LY_ROOT_FOLDER}/cmake/Packaging/LicenseScan.cmake.in
${CPACK_BINARY_DIR}/LicenseScan.cmake
@ONLY
)
ly_install(SCRIPT ${CPACK_BINARY_DIR}/LicenseScan.cmake
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
)
ly_install(FILES ${CPACK_3P_LICENSE_FILE} ${CPACK_3P_MANIFEST_FILE}
DESTINATION .
COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
)
configure_file(${LY_ROOT_FOLDER}/cmake/Packaging/CMakeDownload.cmake.in
${CPACK_BINARY_DIR}/CMakeDownload.cmake
@ONLY
+38
View File
@@ -0,0 +1,38 @@
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
set(LY_ROOT_FOLDER "@LY_ROOT_FOLDER@")
set(CMAKE_SCRIPT_MODE_FILE TRUE)
# Scan the engine and 3rd Party folders for licenses
cmake_path(SET _license_script_path "@LY_ROOT_FOLDER@/scripts/license_scanner")
cmake_path(SET _license_script "${_license_script_path}/license_scanner.py")
cmake_path(SET _license_config "${_license_script_path}/scanner_config.json")
set(_license_scan_path "@LY_ROOT_FOLDER@" "@LY_PACKAGE_UNPACK_LOCATION@")
set(_license_command
@LY_PYTHON_CMD@ -s
-u ${_license_script}
--config-file ${_license_config}
--license-file-path @CPACK_3P_LICENSE_FILE@
--package-file-path @CPACK_3P_MANIFEST_FILE@
)
message("Scanning ${_license_scan_path} for package licenses")
execute_process(
COMMAND ${_license_command} --scan-path ${_license_scan_path}
RESULT_VARIABLE _license_result
ERROR_VARIABLE _license_errors
OUTPUT_VARIABLE _license_output
ECHO_OUTPUT_VARIABLE
)
if(NOT ${_license_result} EQUAL 0)
message(FATAL_ERROR "An error occurred during license scan. ${_license_errors}")
endif()
@@ -33,6 +33,8 @@ if(CPACK_UPLOAD_URL)
"${CPACK_TOPLEVEL_DIRECTORY}/*.deb"
"${CPACK_TOPLEVEL_DIRECTORY}/*.sha256"
"${LY_ROOT_FOLDER}/scripts/signer/Platform/Linux/*.gpg"
"${CPACK_3P_LICENSE_FILE}"
"${CPACK_3P_MANIFEST_FILE}"
)
file(COPY ${_artifacts}
DESTINATION ${CPACK_UPLOAD_DIRECTORY}
@@ -42,7 +44,7 @@ if(CPACK_UPLOAD_URL)
ly_upload_to_url(
${CPACK_UPLOAD_URL}
${CPACK_UPLOAD_DIRECTORY}
".*(.deb|.gpg|.sha256)$"
".*(.deb|.gpg|.sha256|.txt|.json)$"
)
# for auto tagged builds, we will also upload a second copy of just the boostrapper
@@ -102,6 +102,8 @@ file(GLOB _artifacts
"${_cpack_wix_out_dir}/*.msi"
"${_cpack_wix_out_dir}/*.cab"
"${_cpack_wix_out_dir}/*.exe"
"${CPACK_3P_LICENSE_FILE}"
"${CPACK_3P_MANIFEST_FILE}"
)
file(COPY ${_artifacts}
DESTINATION ${CPACK_UPLOAD_DIRECTORY}
@@ -109,11 +111,10 @@ file(COPY ${_artifacts}
message(STATUS "Artifacts copied to ${CPACK_UPLOAD_DIRECTORY}")
if(CPACK_UPLOAD_URL)
file(TO_NATIVE_PATH "${_cpack_wix_out_dir}" _cpack_wix_out_dir)
ly_upload_to_url(
${CPACK_UPLOAD_URL}
${_cpack_wix_out_dir}
".*(cab|exe|msi)$"
${CPACK_UPLOAD_DIRECTORY}
".*(.cab|.exe|.msi|.txt|.json)$"
)
# for auto tagged builds, we will also upload a second copy of just the boostrapper