diff --git a/.github/workflows/formatting-checks.yml b/.github/workflows/formatting-checks.yml index 34dab7a0..e5536f5e 100644 --- a/.github/workflows/formatting-checks.yml +++ b/.github/workflows/formatting-checks.yml @@ -38,3 +38,6 @@ jobs: - name: Run YAML Format Checks run: sh scripts/yml_linter.sh + + - name: Run Banner License Checks + run: sh scripts/check_license_banner.sh diff --git a/scripts/check_license_banner.sh b/scripts/check_license_banner.sh new file mode 100644 index 00000000..b5ce4869 --- /dev/null +++ b/scripts/check_license_banner.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# @copyright Copyright (c) contributors to Project Ocre, +# which has been established as Project Ocre a Series of LF Projects, LLC +# +# SPDX-License-Identifier: Apache-2.0 + +# Checks all C/C++ files for license banner + +set -e + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +SRC_DIR="$ROOT_DIR/src" + +check_license_banner() { + local file="$1" + local file_header + + file_header=$(head -n 6 "$file") + + # Expected license banner + local expected_banner="/** + * @copyright Copyright (c) contributors to Project Ocre, + * which has been established as Project Ocre a Series of LF Projects, LLC + * + * SPDX-License-Identifier: Apache-2.0 + */" + + if [ "$file_header" != "$expected_banner" ]; then + echo "ERROR: Missing or incorrect license banner in $file" + return 1 + fi + + return 0 +} + +echo "Checking license banners." +ERROR_FOUND=0 +for file in $(find . -type f \( -name '*.c' -o -name '*.h' \) \ + ! -name 'utlist.h' \ + ! -name 'CMakeCCompilerId.c' \ + ! -path './tests/Unity/*' \ + ! -path './build/*' \ + ! -path './wasm-micro-runtime/*' \ + ! -path './ocre-sdk/*' \ + ! -path './src/shell/sha256/*' \ + ! -path './src/runtime/wamr-wasip1/ocre_api/utils/*' \ + | sort); do + + if ! check_license_banner "$file"; then + ERROR_FOUND=1 + fi +done + +if [ $ERROR_FOUND -ne 0 ]; then + echo "License check failed." + exit 1 +fi diff --git a/src/common/common.c b/src/common/common.c index 367117a5..e7e2b1e6 100644 --- a/src/common/common.c +++ b/src/common/common.c @@ -1,3 +1,10 @@ +/** + * @copyright Copyright (c) contributors to Project Ocre, + * which has been established as Project Ocre a Series of LF Projects, LLC + * + * SPDX-License-Identifier: Apache-2.0 + */ + #include #include #include diff --git a/src/platform/zephyr/memory.c b/src/platform/zephyr/memory.c index d98b89ef..5b79f1d4 100644 --- a/src/platform/zephyr/memory.c +++ b/src/platform/zephyr/memory.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/core/core_eventq.c b/src/runtime/wamr-wasip1/ocre_api/core/core_eventq.c index 9ecbfe51..8f797d10 100644 --- a/src/runtime/wamr-wasip1/ocre_api/core/core_eventq.c +++ b/src/runtime/wamr-wasip1/ocre_api/core/core_eventq.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/core/core_external.h b/src/runtime/wamr-wasip1/ocre_api/core/core_external.h index b1435174..74b72990 100644 --- a/src/runtime/wamr-wasip1/ocre_api/core/core_external.h +++ b/src/runtime/wamr-wasip1/ocre_api/core/core_external.h @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/core/core_internal.h b/src/runtime/wamr-wasip1/ocre_api/core/core_internal.h index ba915f37..f22ee886 100644 --- a/src/runtime/wamr-wasip1/ocre_api/core/core_internal.h +++ b/src/runtime/wamr-wasip1/ocre_api/core/core_internal.h @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/core/core_memory.c b/src/runtime/wamr-wasip1/ocre_api/core/core_memory.c index cfd3471b..656bb9c0 100644 --- a/src/runtime/wamr-wasip1/ocre_api/core/core_memory.c +++ b/src/runtime/wamr-wasip1/ocre_api/core/core_memory.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/core/core_misc.c b/src/runtime/wamr-wasip1/ocre_api/core/core_misc.c index 1bee91de..1aff9ceb 100644 --- a/src/runtime/wamr-wasip1/ocre_api/core/core_misc.c +++ b/src/runtime/wamr-wasip1/ocre_api/core/core_misc.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/core/core_mutex.c b/src/runtime/wamr-wasip1/ocre_api/core/core_mutex.c index 5c511458..45c56f09 100644 --- a/src/runtime/wamr-wasip1/ocre_api/core/core_mutex.c +++ b/src/runtime/wamr-wasip1/ocre_api/core/core_mutex.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/core/core_timer.c b/src/runtime/wamr-wasip1/ocre_api/core/core_timer.c index f39dec16..9ec55330 100644 --- a/src/runtime/wamr-wasip1/ocre_api/core/core_timer.c +++ b/src/runtime/wamr-wasip1/ocre_api/core/core_timer.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_api.c b/src/runtime/wamr-wasip1/ocre_api/ocre_api.c index 1ca8db8c..5377064a 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_api.c +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_api.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_api.h b/src/runtime/wamr-wasip1/ocre_api/ocre_api.h index a0e8385f..f5822a4d 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_api.h +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_api.h @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_common.c b/src/runtime/wamr-wasip1/ocre_api/ocre_common.c index f2032345..35b07c8d 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_common.c +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_common.c @@ -1,6 +1,6 @@ /** - * @copyright Copyright © contributors to Project Ocre, - * which has been established as Project Ocre, a Series of LF Projects, LLC + * @copyright Copyright (c) contributors to Project Ocre, + * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_common.h b/src/runtime/wamr-wasip1/ocre_api/ocre_common.h index 71a3649e..699b97bf 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_common.h +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_common.h @@ -1,8 +1,8 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * - * SPDX-License-License: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 */ #ifndef OCRE_COMMON_H diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.c b/src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.c index f3e9de61..ce49fc0c 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.c +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.c @@ -1,6 +1,6 @@ /** - * @copyright Copyright © contributors to Project Ocre, - * which has been established as Project Ocre, a Series of LF Projects, LLC + * @copyright Copyright (c) contributors to Project Ocre, + * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.h b/src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.h index 4164ed06..f002d48c 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.h +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.h @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.c b/src/runtime/wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.c index 791fc271..2f1a02f4 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.c +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.c @@ -1,8 +1,8 @@ /** - * @copyright Copyright © contributors to Project Ocre, - * which has been established as Project Ocre, a Series of LF Projects, LLC + * @copyright Copyright (c) contributors to Project Ocre, + * which has been established as Project Ocre a Series of LF Projects, LLC * - * SPDX-License-License: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 */ #include diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.h b/src/runtime/wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.h index 34f13267..a728235d 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.h +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.h @@ -1,8 +1,8 @@ /** - * @copyright Copyright © contributors to Project Ocre, - * which has been established as Project Ocre, a Series of LF Projects, LLC + * @copyright Copyright (c) contributors to Project Ocre, + * which has been established as Project Ocre a Series of LF Projects, LLC * - * SPDX-License-License: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 */ #ifndef OCRE_MESSAGING_H diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.c b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.c index 285ae090..ba106a5b 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.c +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.h b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.h index 31059638..ab1a54e1 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.h +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.h @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.c b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.c index 22acc6df..fd739bec 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.c +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.h b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.h index 77c90f4f..2e25e783 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.h +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.h @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.c b/src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.c index 53d3dd05..036950d9 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.c +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.c @@ -1,6 +1,6 @@ /** - * @copyright Copyright © contributors to Project Ocre, - * which has been established as Project Ocre, a Series of LF Projects, LLC + * @copyright Copyright (c) contributors to Project Ocre, + * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.h b/src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.h index d922d4a3..14c024d7 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.h +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.h @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0