Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/formatting-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ jobs:

- name: Run YAML Format Checks
run: sh scripts/yml_linter.sh

- name: Run Banner License Checks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Run Banner License Checks
- name: License Banner Checks

run: sh scripts/check_license_banner.sh
58 changes: 58 additions & 0 deletions scripts/check_license_banner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this file should be named check_license_banner_c.sh, because we will have other scripts for other types, but I guess we can rename it in next PRs.

# @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
7 changes: 7 additions & 0 deletions src/common/common.c
Original file line number Diff line number Diff line change
@@ -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 <stddef.h>
#include <ctype.h>
#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion src/platform/zephyr/memory.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/wamr-wasip1/ocre_api/core/core_eventq.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/wamr-wasip1/ocre_api/core/core_external.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/wamr-wasip1/ocre_api/core/core_internal.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/wamr-wasip1/ocre_api/core/core_memory.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/wamr-wasip1/ocre_api/core/core_misc.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/wamr-wasip1/ocre_api/core/core_mutex.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/wamr-wasip1/ocre_api/core/core_timer.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/wamr-wasip1/ocre_api/ocre_api.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/wamr-wasip1/ocre_api/ocre_api.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/wamr-wasip1/ocre_api/ocre_common.c
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/wamr-wasip1/ocre_api/ocre_common.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.c
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <string.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.c
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading