From 7873894b05be07311de42af58c504a6a5a30cb3e Mon Sep 17 00:00:00 2001 From: Jonathan Schneider Date: Sat, 14 Dec 2024 19:34:31 -0500 Subject: [PATCH] Default skip existing license headers back to true --- .../openrewrite/gradle/RewriteLicensePlugin.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/openrewrite/gradle/RewriteLicensePlugin.java b/src/main/java/org/openrewrite/gradle/RewriteLicensePlugin.java index 9f4e26a..45e60f1 100644 --- a/src/main/java/org/openrewrite/gradle/RewriteLicensePlugin.java +++ b/src/main/java/org/openrewrite/gradle/RewriteLicensePlugin.java @@ -37,7 +37,7 @@ public void apply(Project project) { project.getPlugins().apply(LicenseReportPlugin.class); project.getExtensions().configure(LicenseReportExtension.class, ext -> { - ext.renderers = new ReportRenderer[] { new com.github.jk1.license.render.CsvReportRenderer() }; + ext.renderers = new ReportRenderer[]{new com.github.jk1.license.render.CsvReportRenderer()}; }); project.getTasks().withType(LicenseFormat.class, task -> { @@ -46,8 +46,10 @@ public void apply(Project project) { }); project.getExtensions().configure(LicenseExtension.class, ext -> { - ext.setSkipExistingHeaders(Optional.ofNullable((Boolean) project - .findProperty("licenseSkipExistingHeaders")).orElse(false)); + ext.setSkipExistingHeaders(Optional + .ofNullable((String) project.findProperty("licenseSkipExistingHeaders")) + .map(Boolean::parseBoolean) + .orElse(true)); ext.getExcludePatterns().addAll(Arrays.asList("**/*.tokens", "**/*.config", "**/*.interp", "**/*.txt", "**/*.bat", "**/*.zip", "**/*.csv", "**/gradlew", "**/*.dontunpack", "**/*.css", "**/*.editorconfig", "**/*.md", "**/*.jar")); @@ -57,8 +59,10 @@ public void apply(Project project) { put("java", "SLASHSTAR_STYLE"); put("ts", "SLASHSTAR_STYLE"); }}); - ext.setStrictCheck(Optional.ofNullable((Boolean) project - .findProperty("licenseStrictCheck")).orElse(true)); + ext.setStrictCheck(Optional + .ofNullable((String) project.findProperty("licenseStrictCheck")) + .map(Boolean::parseBoolean) + .orElse(true)); }); } }