diff --git a/.copywrite.hcl b/.copywrite.hcl index 65d053d7b..9df2c2cea 100644 --- a/.copywrite.hcl +++ b/.copywrite.hcl @@ -3,6 +3,7 @@ schema_version = 1 project { license = "BUSL-1.1" copyright_year = 2024 + ignore_year1 = true # required to preserve existing start years header_ignore = [ ".github/**", diff --git a/Makefile b/Makefile index f1b3a9147..819d692e7 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,7 @@ tools: golangci-lint go generate -tags tools tools/tools.go go install github.com/bufbuild/buf/cmd/buf@v1.27.2 go install github.com/mfridman/tparse@v0.13.1 + go install github.com/hashicorp/copywrite@v0.25.2 # golangci-lint recommends installing the binary directly, instead of using go get # See the note: https://golangci-lint.run/usage/install/#install-from-source @@ -145,7 +146,7 @@ perms-table: @go run internal/website/permstable/permstable.go .PHONY: gen -gen: cleangen proto api cli perms-table fmt #copywrite - Removing copywrite; we will need to switch to IBM's tooling, when available +gen: cleangen copywrite proto api cli perms-table fmt ### oplog requires protoc-gen-go v1.20.0 or later # GO111MODULE=on go get -u github.com/golang/protobuf/protoc-gen-go@v1.40 @@ -290,16 +291,19 @@ protolint: cd internal/proto && buf breaking --against 'https://github.com/hashicorp/boundary.git#branch=stable-website,subdir=internal/proto' \ --config buf.breaking.wire.yaml -# Removing copywrite; we will need to switch to IBM's tooling, when available -#.PHONY: copywrite -#copywrite: -# copywrite headers - # In the protobuf API directories, remove the BUSL headers - # and rerun copywrite with the directory specific configuration. -# cd internal/proto/controller/api && find . -type f -name '*.proto' -exec sed -i '1,3d' {} + && copywrite headers -# cd internal/proto/controller/custom_options && find . -type f -name '*.proto' -exec sed -i '1,3d' {} + && copywrite headers -# cd internal/proto/plugin && find . -type f -name '*.proto' -exec sed -i '1,3d' {} + && copywrite headers -# cd internal/proto/worker/proxy/v1 && find . -type f -name '*.proto' -exec sed -i '1,3d' {} + && copywrite headers +.PHONY: copywrite +copywrite: + copywrite headers + # Run copywrite in specific subdirectories that require different licenses (e.g., MPL-2.0) + # or specific ignore rules for generated files (.gen.go, .pb.go). + # Note: We rely on the nested .copywrite.hcl files inside these directories to manage + # the SPDX license identifiers and years correctly + cd internal/proto/controller/api && copywrite headers + cd internal/proto/controller/custom_options && copywrite headers + cd internal/proto/plugin && copywrite headers + cd internal/proto/worker/proxy/v1 && copywrite headers + cd api && copywrite headers + cd sdk && copywrite headers .PHONY: website # must have nodejs and npm installed diff --git a/api/.copywrite.hcl b/api/.copywrite.hcl new file mode 100644 index 000000000..b43e0d690 --- /dev/null +++ b/api/.copywrite.hcl @@ -0,0 +1,14 @@ +schema_version = 1 + +project { + license = "MPL-2.0" + copyright_year = 2024 + ignore_year1 = true # required to preserve existing start years + + # Ignore all auto-generated protobuf and go-generate files + header_ignore = [ + "**/*.gen.go", + "**/*.pb.go", + "**/*.pb.gw.go" + ] +} diff --git a/internal/proto/controller/api/.copywrite.hcl b/internal/proto/controller/api/.copywrite.hcl index c4b09f336..8be2da62a 100644 --- a/internal/proto/controller/api/.copywrite.hcl +++ b/internal/proto/controller/api/.copywrite.hcl @@ -3,6 +3,7 @@ schema_version = 1 project { license = "MPL-2.0" copyright_year = 2024 + ignore_year1 = true # required to preserve existing start years header_ignore = [] } diff --git a/internal/proto/controller/custom_options/.copywrite.hcl b/internal/proto/controller/custom_options/.copywrite.hcl index c4b09f336..8be2da62a 100644 --- a/internal/proto/controller/custom_options/.copywrite.hcl +++ b/internal/proto/controller/custom_options/.copywrite.hcl @@ -3,6 +3,7 @@ schema_version = 1 project { license = "MPL-2.0" copyright_year = 2024 + ignore_year1 = true # required to preserve existing start years header_ignore = [] } diff --git a/internal/proto/plugin/.copywrite.hcl b/internal/proto/plugin/.copywrite.hcl index c4b09f336..8be2da62a 100644 --- a/internal/proto/plugin/.copywrite.hcl +++ b/internal/proto/plugin/.copywrite.hcl @@ -3,6 +3,7 @@ schema_version = 1 project { license = "MPL-2.0" copyright_year = 2024 + ignore_year1 = true # required to preserve existing start years header_ignore = [] } diff --git a/internal/proto/worker/proxy/v1/.copywrite.hcl b/internal/proto/worker/proxy/v1/.copywrite.hcl index c4b09f336..8be2da62a 100644 --- a/internal/proto/worker/proxy/v1/.copywrite.hcl +++ b/internal/proto/worker/proxy/v1/.copywrite.hcl @@ -3,6 +3,7 @@ schema_version = 1 project { license = "MPL-2.0" copyright_year = 2024 + ignore_year1 = true # required to preserve existing start years header_ignore = [] } diff --git a/sdk/.copywrite.hcl b/sdk/.copywrite.hcl new file mode 100644 index 000000000..b43e0d690 --- /dev/null +++ b/sdk/.copywrite.hcl @@ -0,0 +1,14 @@ +schema_version = 1 + +project { + license = "MPL-2.0" + copyright_year = 2024 + ignore_year1 = true # required to preserve existing start years + + # Ignore all auto-generated protobuf and go-generate files + header_ignore = [ + "**/*.gen.go", + "**/*.pb.go", + "**/*.pb.gw.go" + ] +}