Skip to content

Commit

Permalink
Standardize copyright headers. (#2399)
Browse files Browse the repository at this point in the history
The Linebender standard for copyright headers was decided last year in
[kurbo#207](linebender/kurbo#207) as the
following:

```
// Copyright <year of file creation> the <Project> Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT
```

This PR converts all file headers to this standard form. Note that Druid
is not dual licensed under MIT and is Apache 2.0 only.
  • Loading branch information
xStrom authored May 21, 2024
1 parent f45c892 commit fe5228b
Show file tree
Hide file tree
Showing 254 changed files with 538 additions and 3,267 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 Druid Authors( and .+)?$\n^// SPDX-License-Identifier: Apache-2\.0$\n\n" --files-without-match --multiline -g "*.rs" -g "!{druid-derive/tests/ui,docs/book_examples/src}" .)

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 Druid Authors"
echo "// SPDX-License-Identifier: Apache-2.0"
echo -e "\n... rest of the file ...\n"
exit 1
fi

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

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

test-stable:
runs-on: ${{ matrix.os }}
strategy:
Expand Down
9 changes: 5 additions & 4 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# This is the list of Druid authors for copyright purposes.
# This is the list of Druid's significant contributors.
#
# This does not necessarily list everyone who has contributed code, since in
# some cases, their employer may be the copyright holder. To see the full list
# of contributors, see the revision history in source control.
# 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
Raph Levien
Hilmar Gústafsson
Expand Down
15 changes: 2 additions & 13 deletions druid-derive/src/attr.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2019 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

//! parsing #[druid(attributes)]

Expand Down
15 changes: 2 additions & 13 deletions druid-derive/src/data.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2019 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

//! The implementation for #[derive(Data)]

Expand Down
15 changes: 2 additions & 13 deletions druid-derive/src/lens.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2019 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

use super::attr::{FieldKind, Fields, LensAttrs};
use proc_macro2::{Ident, Span};
Expand Down
15 changes: 2 additions & 13 deletions druid-derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2019 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

//! derive macros for Druid.

Expand Down
15 changes: 2 additions & 13 deletions druid-derive/tests/data.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2019 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

//! Test #[derive(Data)]

Expand Down
15 changes: 2 additions & 13 deletions druid-derive/tests/ignore.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2019 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

//! testing the ignore attribute

Expand Down
15 changes: 2 additions & 13 deletions druid-derive/tests/lens_generic.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2020 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

use druid::{Lens, LensExt};
use std::fmt::Debug;
Expand Down
15 changes: 2 additions & 13 deletions druid-derive/tests/ui.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2021 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2021 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

// https://github.com/dtolnay/trybuild
// trybuild is a crate that essentially runs cargo on the provided files, and checks the output.
Expand Down
15 changes: 2 additions & 13 deletions druid-derive/tests/with_lens.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2020 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

use float_cmp::assert_approx_eq;

Expand Down
15 changes: 2 additions & 13 deletions druid-derive/tests/with_same.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2019 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

use druid::Data;

Expand Down
15 changes: 2 additions & 13 deletions druid-shell/build.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2021 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2021 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

#[cfg(not(any(feature = "x11", feature = "wayland")))]
fn main() {}
Expand Down
15 changes: 2 additions & 13 deletions druid-shell/examples/edit_text.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2020 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

//! This example shows a how a single-line text field might be implemented for `druid-shell`.
//! Beyond the omission of multiple lines and text wrapping, it also is missing many motions
Expand Down
15 changes: 2 additions & 13 deletions druid-shell/examples/invalidate.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2020 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

use std::any::Any;

Expand Down
15 changes: 2 additions & 13 deletions druid-shell/examples/perftest.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2018 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

use std::any::Any;

Expand Down
15 changes: 2 additions & 13 deletions druid-shell/examples/quit.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2020 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

use std::any::Any;

Expand Down
15 changes: 2 additions & 13 deletions druid-shell/examples/shello.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2018 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

use std::any::Any;

Expand Down
15 changes: 2 additions & 13 deletions druid-shell/src/application.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2019 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

//! The top-level application type.

Expand Down
15 changes: 2 additions & 13 deletions druid-shell/src/backend/gtk/application.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2019 The Druid Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0

//! GTK implementation of features at the application scope.

Expand Down
Loading

0 comments on commit fe5228b

Please sign in to comment.