Skip to content

Commit

Permalink
Standardize copyright headers. (#5)
Browse files Browse the repository at this point in the history
* Standardize copyright headers.

* Clear `AUTHORS` file.

* Add Google LLC to the `AUTHORS` file.
  • Loading branch information
xStrom authored Mar 29, 2024
1 parent d4bd04d commit 43099d1
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 9 deletions.
23 changes: 23 additions & 0 deletions .github/copyright.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# If there are new files with headers that can't match the conditions here,
# then the files can be ignored by an additional glob argument via the -g flag.
# For example:
# -g "!src/special_file.rs"
# -g "!src/special_directory"

# Check all the standard Rust source files
output=$(rg "^// Copyright (19|20)[\d]{2} (.+ and )?the Android Trace Authors( and .+)?$\n^// SPDX-License-Identifier: Apache-2\.0 OR MIT$\n\n" --files-without-match --multiline -g "*.rs" .)

if [ -n "$output" ]; then
echo -e "The following files lack the correct copyright header:\n"
echo $output
echo -e "\n\nPlease add the following header:\n"
echo "// Copyright $(date +%Y) the Android Trace Authors"
echo "// SPDX-License-Identifier: Apache-2.0 OR MIT"
echo -e "\n... rest of the file ...\n"
exit 1
fi

echo "All files have correct copyright headers."
exit 0
15 changes: 7 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,13 @@ jobs:
- name: cargo fmt
run: cargo fmt --all --check

# TODO: Probably should have copyright headers
# - name: install ripgrep
# run: |
# sudo apt update
# sudo apt install ripgrep

# - name: check copyright headers
# run: bash .github/copyright.sh
- name: install ripgrep
run: |
sudo apt update
sudo apt install ripgrep
- name: check copyright headers
run: bash .github/copyright.sh

clippy-stable:
name: cargo clippy
Expand Down
7 changes: 7 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This is the list of Android Trace's significant contributors.
#
# This does not necessarily list everyone who has contributed code,
# especially since many employees of one corporation may be contributing.
# To see the full list of contributors, see the revision history in
# source control.
Google LLC
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resolver = "2"

[workspace.package]
version = "0.1.0"
license = "MIT OR Apache-2.0"
license = "Apache-2.0 OR MIT"
# Keep in sync with RUST_MIN_VER in .github/workflows/ci.yml and with the relevant README.md files.
# We use C string literals
rust-version = "1.77"
Expand Down
3 changes: 3 additions & 0 deletions android_trace/src/ffi.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024 the Android Trace Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

#[cfg(not(all(feature = "api_level_23", feature = "api_level_29")))]
use core::{
ffi::{c_void, CStr},
Expand Down
3 changes: 3 additions & 0 deletions android_trace/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024 the Android Trace Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

#![doc = concat!(
// TODO: Is this a new pattern?
"[AndroidTrace]: crate::AndroidTrace
Expand Down
3 changes: 3 additions & 0 deletions tracing_android_trace/src/async_layer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024 the Android Trace Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

use std::ffi::CString;

use android_trace::AndroidTrace;
Expand Down
3 changes: 3 additions & 0 deletions tracing_android_trace/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024 the Android Trace Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

#![doc = concat!(
// TODO: Is this a new pattern?
"[`tracing`]: tracing
Expand Down
3 changes: 3 additions & 0 deletions tracing_android_trace/src/sync_layer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024 the Android Trace Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

use thread_local::ThreadLocal;

use std::{
Expand Down

0 comments on commit 43099d1

Please sign in to comment.