Use Spotless for license formatting
This commit is contained in:
@@ -2,6 +2,7 @@ plugins {
|
||||
`kotlin-dsl`
|
||||
checkstyle
|
||||
id("net.kyori.indra.publishing") version "2.0.6"
|
||||
id("com.diffplug.spotless") version "6.12.0"
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -9,6 +10,10 @@ repositories {
|
||||
maven("https://plugins.gradle.org/m2")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.12.0")
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
plugins {
|
||||
register("set-manifest-impl-version") {
|
||||
@@ -19,9 +24,19 @@ gradlePlugin {
|
||||
id = "velocity-checkstyle"
|
||||
implementationClass = "com.velocitypowered.script.VelocityCheckstylePlugin"
|
||||
}
|
||||
register("velocity-spotless") {
|
||||
id = "velocity-spotless"
|
||||
implementationClass = "com.velocitypowered.script.VelocitySpotlessPlugin"
|
||||
}
|
||||
register("velocity-publish") {
|
||||
id = "velocity-publish"
|
||||
implementationClass = "com.velocitypowered.script.VelocityPublishPlugin"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
spotless {
|
||||
kotlin {
|
||||
licenseHeaderFile(project.rootProject.file("../HEADER.txt"))
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Velocity Contributors
|
||||
* Copyright (C) 2023 Velocity Contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Velocity Contributors
|
||||
* Copyright (C) 2023 Velocity Contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Velocity Contributors
|
||||
* Copyright (C) 2023 Velocity Contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Velocity Contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.velocitypowered.script
|
||||
|
||||
import com.diffplug.gradle.spotless.SpotlessExtension
|
||||
import com.diffplug.gradle.spotless.SpotlessPlugin
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import java.io.File
|
||||
|
||||
class VelocitySpotlessPlugin : Plugin<Project> {
|
||||
override fun apply(target: Project) = target.configure()
|
||||
|
||||
private fun Project.configure() {
|
||||
apply<SpotlessPlugin>()
|
||||
|
||||
extensions.configure<SpotlessExtension> {
|
||||
java {
|
||||
if (project.name == "velocity-api") {
|
||||
licenseHeaderFile(project.file("HEADER.txt"))
|
||||
} else {
|
||||
licenseHeaderFile(project.rootProject.file("HEADER.txt"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user