Skip to content

Commit

Permalink
add header script
Browse files Browse the repository at this point in the history
  • Loading branch information
tarassh committed Aug 21, 2024
1 parent 773d52f commit 47e714b
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 8 deletions.
30 changes: 30 additions & 0 deletions scripts/add_header_if_missing.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Check if at least two arguments are provided
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <header-file> <file-pattern>"
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
2 changes: 1 addition & 1 deletion src/dory.rs
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/inner_product.rs
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/proof.rs
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/pubs.rs
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/verification_key.rs
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/verify_generic.rs
Original file line number Diff line number Diff line change
@@ -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");
Expand Down

0 comments on commit 47e714b

Please sign in to comment.