From 5fc5bc87dba33c35a5558df306e0220f89cd9c67 Mon Sep 17 00:00:00 2001 From: Noel Date: Fri, 17 Feb 2023 13:14:49 -0700 Subject: [PATCH] :sparkles: spotless apply (again) --- .../plugins/module/JavaModulePlugin.java | 34 +++++++++---------- .../plugins/module/KotlinModulePlugin.java | 32 +++++++++-------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/main/java/org/noelware/infra/gradle/plugins/module/JavaModulePlugin.java b/src/main/java/org/noelware/infra/gradle/plugins/module/JavaModulePlugin.java index 77a4e30..3c04296 100644 --- a/src/main/java/org/noelware/infra/gradle/plugins/module/JavaModulePlugin.java +++ b/src/main/java/org/noelware/infra/gradle/plugins/module/JavaModulePlugin.java @@ -23,11 +23,7 @@ package org.noelware.infra.gradle.plugins.module; import com.diffplug.gradle.spotless.SpotlessExtension; - -import java.io.File; import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; import java.util.Calendar; import org.gradle.api.GradleException; import org.gradle.api.Plugin; @@ -62,20 +58,22 @@ public void apply(@NotNull Project project) { spotless.java((java) -> { try { java.licenseHeader(ext.getLicense() - .getOrElse(Licenses.MIT) - .getTemplate( - ext.getProjectName() - .getOrElse(project.getRootProject().getName()), - ext.getProjectDescription() - .getOrElse( - project.getDescription() != null - ? project.getDescription() - : "fill this out"), - ext.getCurrentYear() - .getOrElse(String.valueOf( - Calendar.getInstance().get(Calendar.YEAR))), - ext.getProjectEmoji().getOrElse("")) - .trim() + (OperatingSystem.current().isUnix() ? "\n" : "\r\n")); + .getOrElse(Licenses.MIT) + .getTemplate( + ext.getProjectName() + .getOrElse(project.getRootProject() + .getName()), + ext.getProjectDescription() + .getOrElse( + project.getDescription() != null + ? project.getDescription() + : "fill this out"), + ext.getCurrentYear() + .getOrElse(String.valueOf(Calendar.getInstance() + .get(Calendar.YEAR))), + ext.getProjectEmoji().getOrElse("")) + .trim() + + (OperatingSystem.current().isUnix() ? "\n" : "\r\n")); java.trimTrailingWhitespace(); java.removeUnusedImports(); diff --git a/src/main/java/org/noelware/infra/gradle/plugins/module/KotlinModulePlugin.java b/src/main/java/org/noelware/infra/gradle/plugins/module/KotlinModulePlugin.java index 56ddc06..c798f76 100644 --- a/src/main/java/org/noelware/infra/gradle/plugins/module/KotlinModulePlugin.java +++ b/src/main/java/org/noelware/infra/gradle/plugins/module/KotlinModulePlugin.java @@ -71,21 +71,23 @@ public void apply(@NotNull Project project) { spotless.kotlin((kotlin) -> { try { kotlin.licenseHeader(ext.getLicense() - .convention(Licenses.MIT) - .get() - .getTemplate( - ext.getProjectName() - .getOrElse(project.getRootProject().getName()), - ext.getProjectDescription() - .getOrElse( - project.getDescription() != null - ? project.getDescription() - : "fill this out"), - ext.getCurrentYear() - .getOrElse(String.valueOf( - Calendar.getInstance().get(Calendar.YEAR))), - ext.getProjectEmoji().getOrElse("")) - .trim() + (OperatingSystem.current().isUnix() ? "\n" : "\r\n")); + .convention(Licenses.MIT) + .get() + .getTemplate( + ext.getProjectName() + .getOrElse(project.getRootProject() + .getName()), + ext.getProjectDescription() + .getOrElse( + project.getDescription() != null + ? project.getDescription() + : "fill this out"), + ext.getCurrentYear() + .getOrElse(String.valueOf(Calendar.getInstance() + .get(Calendar.YEAR))), + ext.getProjectEmoji().getOrElse("")) + .trim() + + (OperatingSystem.current().isUnix() ? "\n" : "\r\n")); kotlin.trimTrailingWhitespace(); kotlin.endWithNewline();