From f6c74e90a821d45be85086325321046c35e29750 Mon Sep 17 00:00:00 2001 From: Daniel Chao Date: Tue, 7 Jan 2025 10:15:07 +0000 Subject: [PATCH] Update license year (#871) * Update license header file spec to use placeholder year * Update spotless to use ratchet formatting (only format files that have changed) --- DEVELOPMENT.adoc | 4 ++++ NOTICE.txt | 2 +- buildSrc/src/main/kotlin/pklAllProjects.gradle.kts | 6 +++++- buildSrc/src/main/resources/license-header.line-comment.txt | 2 +- buildSrc/src/main/resources/license-header.star-block.txt | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/DEVELOPMENT.adoc b/DEVELOPMENT.adoc index c7c07d79..d4ed0010 100644 --- a/DEVELOPMENT.adoc +++ b/DEVELOPMENT.adoc @@ -24,6 +24,10 @@ Enable _jenv_ plugins for better handling by `gradle`: jenv enable-plugin gradle jenv enable-plugin export ---- +. (optional) If you've named the original apple/pkl git repository something other than `origin`, set env var `PKL_ORIGINAL_REMOTE_NAME` to that name in your `.bashrc`, `.zshrc`, `config.fish` or however you manage your local environment. ++ +This will allow spotless to pick the correct starting branch when formatting source code files. +Otherwise, you might see that _every_ file has its copyright year updated. === Additional Windows Setup . (optional) Go to `System->For developers` and enable `Developer Mode`. diff --git a/NOTICE.txt b/NOTICE.txt index 1389b135..3e9e4daa 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,4 +1,4 @@ -Copyright © 2024 Apple Inc. and the Pkl project authors +Copyright © 2024-2025 Apple Inc. and the Pkl project authors Portions of this software were originally based on 'SnakeYAML' developed by Andrey Somov. diff --git a/buildSrc/src/main/kotlin/pklAllProjects.gradle.kts b/buildSrc/src/main/kotlin/pklAllProjects.gradle.kts index 5d4e1687..4b036cbe 100644 --- a/buildSrc/src/main/kotlin/pklAllProjects.gradle.kts +++ b/buildSrc/src/main/kotlin/pklAllProjects.gradle.kts @@ -1,5 +1,5 @@ /* - * 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. @@ -132,7 +132,11 @@ private fun KotlinGradleExtension.configureFormatter() { licenseHeaderFile(licenseHeaderFile, "([a-zA-Z]|@file|//)") } +val originalRemoteName = System.getenv("PKL_ORIGINAL_REMOTE_NAME") ?: "origin" + spotless { + ratchetFrom = "$originalRemoteName/main" + // When building root project, format buildSrc files too. // We need this because buildSrc is not a subproject of the root project, so a top-level // `spotlessApply` will not trigger `buildSrc:spotlessApply`. diff --git a/buildSrc/src/main/resources/license-header.line-comment.txt b/buildSrc/src/main/resources/license-header.line-comment.txt index 02c9978d..1e60c644 100644 --- a/buildSrc/src/main/resources/license-header.line-comment.txt +++ b/buildSrc/src/main/resources/license-header.line-comment.txt @@ -1,5 +1,5 @@ //===----------------------------------------------------------------------===// -// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. +// Copyright © $YEAR 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. diff --git a/buildSrc/src/main/resources/license-header.star-block.txt b/buildSrc/src/main/resources/license-header.star-block.txt index 33c2c1df..b1089248 100644 --- a/buildSrc/src/main/resources/license-header.star-block.txt +++ b/buildSrc/src/main/resources/license-header.star-block.txt @@ -1,5 +1,5 @@ /* - * Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. + * Copyright © $YEAR 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.