diff --git a/dev_tools/oneapi/add_host_function.sh b/dev_tools/oneapi/add_host_function.sh index dfff1ac90aa..9f2a28ba14f 100755 --- a/dev_tools/oneapi/add_host_function.sh +++ b/dev_tools/oneapi/add_host_function.sh @@ -80,9 +80,9 @@ SKIP="false" rm "${MAP_FILE}" while IFS='' read -r line || [ -n "$line" ]; do - if [ "${EXTRACT_KERNEL}" = "false" ] && ([ "${line}" = "/*${GINKGO_LICENSE_BEACON}" ] || [ "${DURING_LICENSE}" = "true" ]); then + if [ "${EXTRACT_KERNEL}" = "false" ] && ([[ "${line}" =~ {GINKGO_LICENSE_BEGIN} ]] || [ "${DURING_LICENSE}" = "true" ]); then DURING_LICENSE="true" - if [ "${line}" = "${GINKGO_LICENSE_BEACON}*/" ]; then + if [[ "${line}" =~ ${GINKGO_LICENSE_END} ]]; then DURING_LICENSE="false" SKIP="true" fi diff --git a/dev_tools/oneapi/convert_source.sh b/dev_tools/oneapi/convert_source.sh index 7aabca6f17d..54ea792209f 100755 --- a/dev_tools/oneapi/convert_source.sh +++ b/dev_tools/oneapi/convert_source.sh @@ -167,8 +167,10 @@ fi rm "${OUTPUT_FILE}" echo "#define GET_QUEUE 0" >> "${OUTPUT_FILE}" # add empty ginkgo license such that format_header recognize some header before header def macro -echo "/*${GINKGO_LICENSE_BEACON}" >> "${OUTPUT_FILE}" -echo "${GINKGO_LICENSE_BEACON}*/" >> "${OUTPUT_FILE}" +CURRENT_YEAR=$(date +%Y) +echo "${GINKGO_LICENSE_BEGIN} 2017-${CURRENT_YEAR} The Ginkgo authors" > "$1" +echo "//" > "$1" +echo "${GINKGO_LICENSE_END} BSD-3-Clause" > "$1" rm "${GLOBAL_FILE}" rm "${EMBED_FILE}" diff --git a/dev_tools/oneapi/shared.sh b/dev_tools/oneapi/shared.sh index 7caee4d0c61..deac097edbb 100644 --- a/dev_tools/oneapi/shared.sh +++ b/dev_tools/oneapi/shared.sh @@ -17,6 +17,7 @@ check_closed() { fi } -GINKGO_LICENSE_BEACON="************************************************************" +GINKGO_LICENSE_BEGIN="// SPDX-FileCopyrightText:" +GINKGO_LICENSE_END="// SPDX-License-Identifier:" HOST_SUFFIX="_AUTOHOSTFUNC" MAP_FILE="map_list" diff --git a/dev_tools/scripts/add_license.sh b/dev_tools/scripts/add_license.sh index be4b286f3bf..32f27445e7e 100755 --- a/dev_tools/scripts/add_license.sh +++ b/dev_tools/scripts/add_license.sh @@ -46,7 +46,9 @@ if ! command -v date &> /dev/null; then fi CURRENT_YEAR=$(date +%Y) -echo -e "${GINKGO_LICENSE_BEGIN} 2017-${CURRENT_YEAR} The Ginkgo authors\n//\n${GINKGO_LICENSE_END} BSD-3-Clause\n" > "${COMMENTED_LICENSE_FILE}" +echo "${GINKGO_LICENSE_BEGIN} 2017-${CURRENT_YEAR} The Ginkgo authors" > "$1" +echo "//" > "$1" +echo "${GINKGO_LICENSE_END} BSD-3-Clause" > "$1" # Does not work if a found file (including the path) contains a newline find "${GINKGO_ROOT_DIR}" \ diff --git a/dev_tools/scripts/format_header.sh b/dev_tools/scripts/format_header.sh index 2437a03d623..9b57cff6f9a 100755 --- a/dev_tools/scripts/format_header.sh +++ b/dev_tools/scripts/format_header.sh @@ -193,7 +193,8 @@ if [ ! -f "$1" ]; then exit 1 fi -GINKGO_LICENSE_BEACON="************************************************************" +GINKGO_LICENSE_BEGIN="// SPDX-FileCopyrightText:" +GINKGO_LICENSE_END="// SPDX-License-Identifier:" CONTENT="content.cpp" # Store the residual part (start from namespace) BEFORE="before.cpp" # Store the main header and the #ifdef/#define of header file @@ -230,9 +231,9 @@ CONSIDER_REGEX="${START_BLOCK_REX}|${END_BLOCK_REX}|${COMMENT_REGEX}|${INCLUDE_R # This part capture the main header and give the possible fail arrangement information while IFS='' read -r line || [ -n "$line" ]; do - if [ "${line}" = "/*${GINKGO_LICENSE_BEACON}" ] || [ "${DURING_LICENSE}" = "true" ]; then + if [[ "${line}" =~ ${GINKGO_LICENSE_BEGIN} ]] || [ "${DURING_LICENSE}" = "true" ]; then DURING_LICENSE="true" - if [ "${line}" = "${GINKGO_LICENSE_BEACON}*/" ]; then + if [[ "${line}" = ${GINKGO_LICENSE_END} ]]; then DURING_LICENSE="false" SKIP="true" fi @@ -292,10 +293,10 @@ if [ "${ALARM}" = "true" ]; then fi # Write license -echo "/*${GINKGO_LICENSE_BEACON}" > "$1" -cat LICENSE >> "$1" -echo "${GINKGO_LICENSE_BEACON}*/" >> "$1" -echo "" >> "$1" +CURRENT_YEAR=$(date +%Y) +echo "${GINKGO_LICENSE_BEGIN} 2017-${CURRENT_YEAR} The Ginkgo authors" > "$1" +echo "//" > "$1" +echo "${GINKGO_LICENSE_END} BSD-3-Clause" > "$1" # Write the definition of header according to path if [ -n "${IFNDEF}" ] && [ -n "${DEFINE}" ]; then