From 47e714b9934e4a45819be12f7ca52050e20a0c41 Mon Sep 17 00:00:00 2001 From: tarassh Date: Wed, 21 Aug 2024 11:01:38 -0700 Subject: [PATCH] add header script --- scripts/add_header_if_missing.sh | 30 ++++++++++++++++++++++++++++++ src/dory.rs | 2 +- src/errors.rs | 2 +- src/inner_product.rs | 2 +- src/lib.rs | 2 +- src/proof.rs | 2 +- src/pubs.rs | 2 +- src/verification_key.rs | 2 +- src/verify_generic.rs | 2 +- 9 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 scripts/add_header_if_missing.sh diff --git a/scripts/add_header_if_missing.sh b/scripts/add_header_if_missing.sh new file mode 100644 index 0000000..13de210 --- /dev/null +++ b/scripts/add_header_if_missing.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Check if at least two arguments are provided +if [ "$#" -lt 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +# Read arguments +HEADER_FILE="$1" +FILE_PATTERN="$2" + +# Read the license header from the specified file +if [ ! -f "$HEADER_FILE" ]; then + echo "Header file not found: $HEADER_FILE" + exit 1 +fi + +LICENSE_HEADER=$(cat "$HEADER_FILE") + +# Loop through all Rust files matching the pattern +shopt -s globstar +for file in $FILE_PATTERN; do + if [[ -f "$file" && "$file" == *.rs ]]; then + if ! grep -q "Copyright 2024, Horizen Labs, Inc." "$file"; then + echo "Adding license header to $file" + echo -e "$LICENSE_HEADER\n$(cat $file)" > "$file" + fi + fi +done \ No newline at end of file diff --git a/src/dory.rs b/src/dory.rs index 3d16e72..c1501ae 100644 --- a/src/dory.rs +++ b/src/dory.rs @@ -1,4 +1,4 @@ -// Copyright 2024, The Horizen Foundation +// Copyright 2024, Horizen Labs, Inc. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/errors.rs b/src/errors.rs index 5abaf6e..688448a 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,4 +1,4 @@ -// Copyright 2024, The Horizen Foundation +// Copyright 2024, Horizen Labs, Inc. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/inner_product.rs b/src/inner_product.rs index 3c07c46..8dbc4db 100644 --- a/src/inner_product.rs +++ b/src/inner_product.rs @@ -1,4 +1,4 @@ -// Copyright 2024, The Horizen Foundation +// Copyright 2024, Horizen Labs, Inc. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/lib.rs b/src/lib.rs index 764eea7..0fe699c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2024, The Horizen Foundation +// Copyright 2024, Horizen Labs, Inc. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/proof.rs b/src/proof.rs index d7a0cde..cb2be2f 100644 --- a/src/proof.rs +++ b/src/proof.rs @@ -1,4 +1,4 @@ -// Copyright 2024, The Horizen Foundation +// Copyright 2024, Horizen Labs, Inc. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/pubs.rs b/src/pubs.rs index b7ca1c4..4cd2bc0 100644 --- a/src/pubs.rs +++ b/src/pubs.rs @@ -1,4 +1,4 @@ -// Copyright 2024, The Horizen Foundation +// Copyright 2024, Horizen Labs, Inc. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/verification_key.rs b/src/verification_key.rs index cd5f980..7f1e173 100644 --- a/src/verification_key.rs +++ b/src/verification_key.rs @@ -1,4 +1,4 @@ -// Copyright 2024, The Horizen Foundation +// Copyright 2024, Horizen Labs, Inc. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/verify_generic.rs b/src/verify_generic.rs index 54bf5d0..8367b8a 100644 --- a/src/verify_generic.rs +++ b/src/verify_generic.rs @@ -1,4 +1,4 @@ -// Copyright 2024, The Horizen Foundation +// Copyright 2024, Horizen Labs, Inc. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License");