diff --git a/.circleci/config.pkl b/.circleci/config.pkl index cc4e403..a327ba6 100644 --- a/.circleci/config.pkl +++ b/.circleci/config.pkl @@ -3,12 +3,14 @@ amends "package://pkg.pkl-lang.org/pkl-project-commons/pkl.impl.circleci@1.0.1#/ prb { jobs { "test" + "test-license-headers" } } main { jobs { "test" + "test-license-headers" } } @@ -32,4 +34,18 @@ jobs { } } } + + ["test-license-headers"] { + docker { + new { + image = "ghcr.io/korandoru/hawkeye" + } + } + steps { + "checkout" + new RunStep { + command = "/bin/hawkeye check --fail-if-unknown" + } + } + } } \ No newline at end of file diff --git a/.circleci/config.yml b/.circleci/config.yml index 5014738..c5e60c8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,6 +15,13 @@ jobs: PKL_EXEC=$(pwd)/pkl.bin swift test docker: - image: swift:5.9 + test-license-headers: + steps: + - checkout + - run: + command: /bin/hawkeye check --fail-if-unknown + docker: + - image: ghcr.io/korandoru/hawkeye workflows: prb: jobs: @@ -26,6 +33,10 @@ workflows: requires: - hold - pr-approval/authenticate + - test-license-headers: + requires: + - hold + - pr-approval/authenticate when: matches: value: << pipeline.git.branch >> @@ -33,6 +44,7 @@ workflows: main: jobs: - test + - test-license-headers when: equal: - main diff --git a/Package.swift b/Package.swift index 9a0d28a..9cfe71e 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,20 @@ // swift-tools-version:5.9 +//===----------------------------------------------------------------------===// +// Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. +// +// 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 +// +// https://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. +//===----------------------------------------------------------------------===// + import PackageDescription let package = Package( diff --git a/Sources/App/configure.swift b/Sources/App/configure.swift index e3aa594..f05fb7a 100644 --- a/Sources/App/configure.swift +++ b/Sources/App/configure.swift @@ -1,18 +1,18 @@ -// ===----------------------------------------------------------------------===// -// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. +//===----------------------------------------------------------------------===// +// Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. // // 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 // -// https://www.apache.org/licenses/LICENSE-2.0 +// https://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. -// ===----------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// import Gen import PklSwift diff --git a/Sources/App/entrypoint.swift b/Sources/App/entrypoint.swift index 9557b42..f7b2c70 100644 --- a/Sources/App/entrypoint.swift +++ b/Sources/App/entrypoint.swift @@ -1,18 +1,18 @@ -// ===----------------------------------------------------------------------===// -// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. +//===----------------------------------------------------------------------===// +// Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. // // 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 // -// https://www.apache.org/licenses/LICENSE-2.0 +// https://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. -// ===----------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// import Logging import Vapor diff --git a/Sources/App/routes.swift b/Sources/App/routes.swift index 2dfb131..0bb6bf7 100644 --- a/Sources/App/routes.swift +++ b/Sources/App/routes.swift @@ -1,18 +1,18 @@ -// ===----------------------------------------------------------------------===// -// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. +//===----------------------------------------------------------------------===// +// Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. // // 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 // -// https://www.apache.org/licenses/LICENSE-2.0 +// https://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. -// ===----------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// import Vapor diff --git a/Sources/Gen/Config.pkl.swift b/Sources/Gen/Config.pkl.swift index 43b1118..f66b7bc 100644 --- a/Sources/Gen/Config.pkl.swift +++ b/Sources/Gen/Config.pkl.swift @@ -1,18 +1,18 @@ -// ===----------------------------------------------------------------------===// -// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. +//===----------------------------------------------------------------------===// +// Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. // // 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 // -// https://www.apache.org/licenses/LICENSE-2.0 +// https://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. -// ===----------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// // Code generated from Pkl module `Config`. DO NOT EDIT. import PklSwift diff --git a/Tests/AppTests/AppTests.swift b/Tests/AppTests/AppTests.swift index 19f76a8..16f22f0 100644 --- a/Tests/AppTests/AppTests.swift +++ b/Tests/AppTests/AppTests.swift @@ -1,18 +1,18 @@ -// ===----------------------------------------------------------------------===// -// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. +//===----------------------------------------------------------------------===// +// Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. // // 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 // -// https://www.apache.org/licenses/LICENSE-2.0 +// https://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. -// ===----------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// @testable import App import XCTVapor diff --git a/licenserc.toml b/licenserc.toml new file mode 100644 index 0000000..f8b8162 --- /dev/null +++ b/licenserc.toml @@ -0,0 +1,30 @@ +additionalHeaders = ["scripts/swift-header-style.toml"] + +headerPath = "scripts/license-header.txt" + +includes = [ + "*.swift", + "*.pkl", + "*.h", + "*.cpp", + "*.sh", + "PklProject", +] + +excludes = [ + "Sources/pkl-gen-swift/Generated", + "Tests/PklSwiftTests/Fixtures", + "codegen/snippet-tests", + "doc", +] + +[git] +attrs = 'enable' +ignore = 'enable' + +[properties] +copyrightOwner = "Apple Inc. and the Pkl project authors" + +[mapping.SWIFT_STYLE] +extensions = ["swift"] + diff --git a/pkl/Config.pkl b/pkl/Config.pkl index 3f884ef..d07edb7 100644 --- a/pkl/Config.pkl +++ b/pkl/Config.pkl @@ -1,18 +1,19 @@ -// ===----------------------------------------------------------------------===// -// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. +//===----------------------------------------------------------------------===// +// Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. // // 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 // -// https://www.apache.org/licenses/LICENSE-2.0 +// https://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. -// ===----------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// + module Config /// The address the server will accept connections on diff --git a/pkl/dev/config.pkl b/pkl/dev/config.pkl index f6a4b33..7e607eb 100644 --- a/pkl/dev/config.pkl +++ b/pkl/dev/config.pkl @@ -1,18 +1,19 @@ -// ===----------------------------------------------------------------------===// -// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. +//===----------------------------------------------------------------------===// +// Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. // // 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 // -// https://www.apache.org/licenses/LICENSE-2.0 +// https://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. -// ===----------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// + amends "../Config.pkl" hostname = "localhost" diff --git a/scripts/license-header.txt b/scripts/license-header.txt new file mode 100644 index 0000000..9099d30 --- /dev/null +++ b/scripts/license-header.txt @@ -0,0 +1,13 @@ +Copyright ©{{ " " }}{%- if attrs.git_file_modified_year != attrs.git_file_created_year -%}{{ attrs.git_file_created_year }}-{{ attrs.git_file_modified_year }}{%- else -%}{{ attrs.git_file_created_year }}{%- endif -%}{{ " " }}{{ props["copyrightOwner"] }}. All rights reserved. + +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 + + https://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. diff --git a/scripts/swift-header-style.toml b/scripts/swift-header-style.toml new file mode 100644 index 0000000..ccbb6a7 --- /dev/null +++ b/scripts/swift-header-style.toml @@ -0,0 +1,11 @@ +[SWIFT_STYLE] +firstLine = '//===----------------------------------------------------------------------===//' +endLine = "//===----------------------------------------------------------------------===//\n" +beforeEachLine = '// ' +afterEachLine = '' +allowBlankLines = false +multipleLines = true +padLines = false +firstLineDetectionPattern = '//\s?===' +lastLineDetectionPattern = '//\s?===' +skipLinePattern = '// swift-tools-version'