Skip to content

Commit

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

* Add copyright header check to CI.
  • Loading branch information
xStrom authored Mar 1, 2024
1 parent 9dbc920 commit 3ba6970
Show file tree
Hide file tree
Showing 74 changed files with 232 additions and 20 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 Piet 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 Piet 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
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,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
2 changes: 1 addition & 1 deletion piet-cairo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "piet-cairo"
version = "0.6.2"
authors = ["Raph Levien <[email protected]>"]
description = "Cairo backend for piet 2D graphics abstraction."
license = "MIT/Apache-2.0"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/linebender/piet"
readme = "../README.md"
edition = "2018"
Expand Down
3 changes: 3 additions & 0 deletions piet-cairo/benches/make_image.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2021 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

use cairo::{Context, Format, ImageSurface};
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use piet::{ImageFormat, RenderContext};
Expand Down
3 changes: 3 additions & 0 deletions piet-cairo/examples/test-picture.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Basic example of rendering on Cairo.
use std::fmt::Write as _;
Expand Down
3 changes: 3 additions & 0 deletions piet-cairo/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! The Cairo backend for the Piet 2D graphics abstraction.
#![deny(clippy::trivially_copy_pass_by_ref)]
Expand Down
3 changes: 3 additions & 0 deletions piet-cairo/src/text.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Text functionality for Piet cairo backend
use std::convert::TryInto;
Expand Down
2 changes: 1 addition & 1 deletion piet-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "piet-common"
version = "0.6.2"
authors = ["Raph Levien <[email protected]>"]
description = "Selection of a single preferred back-end for piet"
license = "MIT/Apache-2.0"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/linebender/piet"
readme = "README.md"
edition = "2018"
Expand Down
3 changes: 3 additions & 0 deletions piet-common/examples/mondrian.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2021 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! This example implements a generative algorithm for making pictures like
//! Piet Mondrian's squares.
// TODO: Remove all the wasm32 cfg guards once this compiles with piet-web
Expand Down
3 changes: 3 additions & 0 deletions piet-common/src/cairo_back.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

// allows e.g. raw_data[dst_off + x * 4 + 2] = buf[src_off + x * 4 + 0];
#![allow(clippy::identity_op)]

Expand Down
3 changes: 3 additions & 0 deletions piet-common/src/cg_back.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

// allows e.g. raw_data[dst_off + x * 4 + 2] = buf[src_off + x * 4 + 0];
#![allow(clippy::identity_op)]

Expand Down
3 changes: 3 additions & 0 deletions piet-common/src/direct2d_back.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Support for piet Direct2D back-end.
#[cfg(feature = "png")]
Expand Down
3 changes: 3 additions & 0 deletions piet-common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! A piet backend appropriate for the current platform.
//!
//! This crate reexports the [piet crate][piet], alongside an appropriate backend
Expand Down
3 changes: 3 additions & 0 deletions piet-common/src/web_back.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Support for piet Web back-end.
use std::fmt;
Expand Down
3 changes: 3 additions & 0 deletions piet-common/tests/image.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

use kurbo::{Rect, Size};
use piet_common::*;

Expand Down
3 changes: 3 additions & 0 deletions piet-common/tests/text.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Basic conformance testing for text.
#[cfg(target_arch = "wasm32")]
Expand Down
2 changes: 1 addition & 1 deletion piet-coregraphics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "piet-coregraphics"
version = "0.6.2"
authors = ["Jeff Muizelaar <[email protected]>, Raph Levien <[email protected]>, Colin Rofls <[email protected]>"]
description = "CoreGraphics backend for piet 2D graphics abstraction."
license = "MIT/Apache-2.0"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/linebender/piet"
readme = "../README.md"
edition = "2018"
Expand Down
3 changes: 3 additions & 0 deletions piet-coregraphics/examples/test-picture.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Run the piet-test examples with the coregraphics backend.
use std::path::Path;
Expand Down
3 changes: 3 additions & 0 deletions piet-coregraphics/src/ct_helpers.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Wrappers around CF/CT types, with nice interfaces.
#![allow(clippy::upper_case_acronyms)]
Expand Down
3 changes: 3 additions & 0 deletions piet-coregraphics/src/gradient.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

#![allow(non_upper_case_globals)]

//! core graphics gradient support
Expand Down
3 changes: 3 additions & 0 deletions piet-coregraphics/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! The CoreGraphics backend for the Piet 2D graphics abstraction.
#![deny(clippy::trivially_copy_pass_by_ref)]
Expand Down
3 changes: 3 additions & 0 deletions piet-coregraphics/src/text.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Text related stuff for the coregraphics backend
use std::cell::RefCell;
Expand Down
2 changes: 1 addition & 1 deletion piet-direct2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "piet-direct2d"
version = "0.6.2"
authors = ["Raph Levien <[email protected]>"]
description = "Direct2D backend for piet 2D graphics abstraction."
license = "MIT/Apache-2.0"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/linebender/piet"
readme = "../README.md"
edition = "2018"
Expand Down
3 changes: 3 additions & 0 deletions piet-direct2d/examples/test-picture.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Basic example of rendering on Direct2D.
use std::path::Path;
Expand Down
3 changes: 3 additions & 0 deletions piet-direct2d/src/conv.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Conversions of types into Direct2D
use winapi::um::d2d1::{
Expand Down
3 changes: 3 additions & 0 deletions piet-direct2d/src/d2d.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Convenience wrappers for Direct2D objects.
//!
//! These also function as safety boundaries (though determining the
Expand Down
3 changes: 3 additions & 0 deletions piet-direct2d/src/d3d.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

use std::ptr::null_mut;

// TODO figure out whether to export this or to move `raw_pixels` into this module.
Expand Down
3 changes: 3 additions & 0 deletions piet-direct2d/src/dwrite.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Convenience wrappers for DirectWrite objects.
// TODO: get rid of this when we actually do use everything
Expand Down
3 changes: 3 additions & 0 deletions piet-direct2d/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Error conversion from D2D/DWrite to piet Error.
use std::fmt;
Expand Down
3 changes: 3 additions & 0 deletions piet-direct2d/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

#![cfg(windows)]
// allows for nice formatting for e.g. new_buf[i * 4 + 0] = premul(buf[i * 4 + 0, a)
#![allow(clippy::identity_op)]
Expand Down
3 changes: 3 additions & 0 deletions piet-direct2d/src/text.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Text functionality for Piet direct2d backend
mod lines;
Expand Down
3 changes: 3 additions & 0 deletions piet-direct2d/src/text/lines.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

use crate::dwrite;
use piet::{util, LineMetric};

Expand Down
2 changes: 1 addition & 1 deletion piet-svg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.6.2"
authors = ["Benjamin Saunders <[email protected]>"]
description = "SVG backend for piet 2D graphics abstraction."
edition = "2018"
license = "MIT/Apache-2.0"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/linebender/piet"
keywords = ["graphics", "2d"]
categories = ["rendering::graphics-api"]
Expand Down
3 changes: 3 additions & 0 deletions piet-svg/examples/basic-svg.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Basic example of rendering to a SVG
use std::io;
Expand Down
3 changes: 3 additions & 0 deletions piet-svg/src/evcxr.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2021 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Helpers to make the SVG output of `piet-svg` easier to use from within `evcxr_jupyter`.
//!
//! [`evcxr`] is a Rust REPL. It also provides a Rust kernel for the [Jupyter Notebook] through
Expand Down
3 changes: 3 additions & 0 deletions piet-svg/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! SVG output support for piet
#![deny(clippy::trivially_copy_pass_by_ref)]
Expand Down
3 changes: 3 additions & 0 deletions piet-svg/src/text.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Text functionality for Piet svg backend
use std::{
Expand Down
2 changes: 1 addition & 1 deletion piet-web/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "piet-web"
version = "0.6.2"
authors = ["Raph Levien <[email protected]>"]
description = "Web canvas backend for piet 2D graphics abstraction."
license = "MIT/Apache-2.0"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/linebender/piet"
readme = "../README.md"
edition = "2018"
Expand Down
3 changes: 3 additions & 0 deletions piet-web/examples/basic/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Basic example of rendering in the browser
use wasm_bindgen::prelude::*;
Expand Down
3 changes: 3 additions & 0 deletions piet-web/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

// allows e.g. raw_data[dst_off + x * 4 + 2] = buf[src_off + x * 4 + 0];
#![allow(clippy::identity_op)]
#![deny(clippy::trivially_copy_pass_by_ref)]
Expand Down
3 changes: 3 additions & 0 deletions piet-web/src/text.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Text functionality for Piet web backend
mod grapheme;
Expand Down
3 changes: 3 additions & 0 deletions piet-web/src/text/grapheme.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

use piet::HitTestPoint;
use unicode_segmentation::UnicodeSegmentation;
use web_sys::CanvasRenderingContext2d;
Expand Down
3 changes: 3 additions & 0 deletions piet-web/src/text/lines.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

// currently basically copied and pasted from cairo backend, except cairo::ScaledFont is replaced
// by web_sys::CanvasRenderingContext2d
//
Expand Down
2 changes: 1 addition & 1 deletion piet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "piet"
version = "0.6.2"
authors = ["Raph Levien <[email protected]>"]
description = "An abstraction for 2D graphics."
license = "MIT/Apache-2.0"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/linebender/piet"
readme = "../README.md"
edition = "2018"
Expand Down
3 changes: 3 additions & 0 deletions piet/src/color.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! A simple representation of color
use std::fmt::{Debug, Formatter};
Expand Down
3 changes: 3 additions & 0 deletions piet/src/conv.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Conversions of fundamental numeric and geometric types.
use kurbo::Vec2;
Expand Down
3 changes: 3 additions & 0 deletions piet/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! The common error type for piet operations.
use std::fmt;
Expand Down
3 changes: 3 additions & 0 deletions piet/src/font.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Font families, weights, etcetera
use std::sync::Arc;
Expand Down
3 changes: 3 additions & 0 deletions piet/src/gradient.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2019 the Piet Authors
// SPDX-License-Identifier: Apache-2.0 OR MIT

//! Gradient specifications.
//!
//! We provide both linear and radial gradients; and for each flavor
Expand Down
Loading

0 comments on commit 3ba6970

Please sign in to comment.