From 50ddc7dac0d34566bc5b334fc0d0717f81acc306 Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Wed, 22 Jan 2020 12:56:32 -0800 Subject: [PATCH 1/3] fix(java): relax license header replacement regex and use current year --- synthtool/languages/java.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/synthtool/languages/java.py b/synthtool/languages/java.py index 0083affa2..7a25860f0 100644 --- a/synthtool/languages/java.py +++ b/synthtool/languages/java.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from datetime import date import glob import os import xml.etree.ElementTree as ET @@ -26,9 +27,9 @@ JAR_DOWNLOAD_URL = "https://github.com/google/google-java-format/releases/download/google-java-format-{version}/google-java-format-{version}-all-deps.jar" DEFAULT_FORMAT_VERSION = "1.7" -GOOD_LICENSE = """ +GOOD_LICENSE = f""" /* - * Copyright 2019 Google LLC + * Copyright {date.today().year} Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +46,7 @@ """ PROTOBUF_HEADER = "// Generated by the protocol buffer compiler. DO NOT EDIT!" BAD_LICENSE = """/\\* - \\* Copyright 2018 Google LLC + \\* Copyright \\d{4} Google LLC \\* \\* 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 @@ -96,6 +97,7 @@ def fix_proto_headers(proto_root: Path) -> None: PROTOBUF_HEADER, f"{GOOD_LICENSE}{PROTOBUF_HEADER}", ) + # https://github.com/googleapis/gapic-generator/issues/3074 s.replace( [proto_root / "src/**/*Name.java", proto_root / "src/**/*Names.java"], BAD_LICENSE, From d388724427279161119a5fd2f9f7909e9697ad10 Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Wed, 22 Jan 2020 14:04:48 -0800 Subject: [PATCH 2/3] fix: hardcode 2020 as the license year --- synthtool/languages/java.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synthtool/languages/java.py b/synthtool/languages/java.py index 7a25860f0..2fa951235 100644 --- a/synthtool/languages/java.py +++ b/synthtool/languages/java.py @@ -29,7 +29,7 @@ DEFAULT_FORMAT_VERSION = "1.7" GOOD_LICENSE = f""" /* - * Copyright {date.today().year} Google LLC + * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From d18382b72c18cb31600066d606a89debb788c295 Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Wed, 22 Jan 2020 14:09:41 -0800 Subject: [PATCH 3/3] chore: remove unused import --- synthtool/languages/java.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/synthtool/languages/java.py b/synthtool/languages/java.py index 2fa951235..092a946da 100644 --- a/synthtool/languages/java.py +++ b/synthtool/languages/java.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from datetime import date import glob import os import xml.etree.ElementTree as ET @@ -27,7 +26,7 @@ JAR_DOWNLOAD_URL = "https://github.com/google/google-java-format/releases/download/google-java-format-{version}/google-java-format-{version}-all-deps.jar" DEFAULT_FORMAT_VERSION = "1.7" -GOOD_LICENSE = f""" +GOOD_LICENSE = """ /* * Copyright 2020 Google LLC *