From e2b5397500be5b3b9dbecffdb6b444ba6e61fecb Mon Sep 17 00:00:00 2001 From: crueter Date: Sun, 19 Oct 2025 01:12:21 -0400 Subject: [PATCH] docs, fixups Signed-off-by: crueter --- .ci/license-header.sh | 66 +++++++++++++++++++++++++++++++------------ docs/Development.md | 8 ++++-- 2 files changed, 53 insertions(+), 21 deletions(-) diff --git a/.ci/license-header.sh b/.ci/license-header.sh index 6a9b4dfa2b..a7b307b8f9 100755 --- a/.ci/license-header.sh +++ b/.ci/license-header.sh @@ -3,15 +3,40 @@ # SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project # SPDX-License-Identifier: GPL-3.0-or-later -# argparse +# specify full path if dupes may exist +EXCLUDE_FILES="CPM.cmake CPMUtil.cmake GetSCMRev.cmake sse2neon.h tools/cpm" + +# license header constants, please change when needed :)))) +YEAR=2025 +HOLDER="Eden Emulator Project" +LICENSE="GPL-3.0-or-later" usage() { cat << EOF -$0: Check license headers compared to this branch's merge base with master. Usage: $0 [uc] - -u, --update Fix license headers, if applicable - -c, --commit Commit changes to Git (requires --update) +Compares the current HEAD to the master branch to check for license +header discrepancies. Each file changed in a branch MUST have a +license header, and this script attempts to enforce that. + +Options: + -u, --update Fix license headers, if applicable; + if the license header exists but has the incorrect + year or is otherwise malformed, it will be fixed. + + -c, --commit Commit changes to Git (requires --update) + +Copyright $YEAR $HOLDER +Licensed under $LICENSE + +The following files/directories are marked as external +and thus will not have license headers asserted: EOF + + for file in $EXCLUDE_FILES; do + echo "- $file" + done + + exit 0 } while true; do @@ -27,15 +52,6 @@ while true; do shift done -# specify full path if dupes may exist -EXCLUDE_FILES="CPM.cmake CPMUtil.cmake GetSCMRev.cmake sse2neon.h" -EXCLUDE_FILES=$(echo "$EXCLUDE_FILES" | sed 's/ /|/g') - -# license header constants, please change when needed :)))) -YEAR=2025 -HOLDER="Eden Emulator Project" -LICENSE="GPL-3.0-or-later" - # human-readable header string header() { header_line1 "$1" @@ -83,17 +99,31 @@ FILES=$(git diff --name-only "$BASE") for file in $FILES; do [ -f "$file" ] || continue - case $(basename -- "$file") in - "$EXCLUDE_FILES") - # skip files that are third party (crueter's CMake modules, sse2neon, etc) - continue - ;; + # skip files that are third party (crueter's CMake modules, sse2neon, etc) + for pattern in $EXCLUDE_FILES; do + case "$file" in + *"$pattern"*) + excluded=true + continue + ;; + *) + excluded=false + ;; + esac + done + + [ "$excluded" = "true" ] && continue + + case "$file" in *.cmake|*.sh|CMakeLists.txt) begin="#" ;; *.kt*|*.cpp|*.h) begin="//" ;; + *) + continue + ;; esac check_header "$begin" "$file" diff --git a/docs/Development.md b/docs/Development.md index c223409243..34e590119d 100644 --- a/docs/Development.md +++ b/docs/Development.md @@ -6,19 +6,21 @@ All commits must have proper license header accreditation. You can easily add all necessary license headers by running: ```sh git fetch origin master:master -FIX=true COMMIT=true .ci/license-header.sh +.ci/license-header.sh -u -c git push ``` -Alternatively, you may omit `COMMIT=true` and do an amend commit: +Alternatively, you may omit `-c` and do an amend commit: ```sh git fetch origin master:master -FIX=true .ci/license-header.sh +.ci/license-header.sh git commit --amend -a --no-edit ``` If the work is licensed/vendored from other people or projects, you may omit the license headers. Additionally, if you wish to retain authorship over a piece of code, you may attribute it to yourself; however, the code may be changed at any given point and brought under the attribution of Eden. +For more information on the license header script, run `.ci/license-header.sh -h`. + ## Pull Requests Pull requests are only to be merged by core developers when properly tested and discussions conclude on Discord or other communication channels. Labels are recommended but not required. However, all PRs MUST be namespaced and optionally typed: ```