Skip to content

Commit

Permalink
chore: spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
powercasgamer committed Nov 11, 2023
1 parent a73cd4f commit 102ede2
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .spotless/mizule.importorder
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Organize Import Order
#Tue Mar 30 19:56:59 PDT 2021
0=
1=java
2=javax
3=\#
55 changes: 54 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import com.diffplug.gradle.spotless.FormatExtension
import net.kyori.indra.licenser.spotless.HeaderFormat
import java.util.*

plugins {
id("org.jetbrains.kotlin.jvm") version "1.9.20"
`java-library`
id("com.github.johnrengelman.shadow") version "8.1.1"
id("net.kyori.indra") version "3.1.3"
id("net.kyori.indra.licenser.spotless") version "3.1.3"
id("net.kyori.indra.git") version "3.1.3"
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.7"
application
}

Expand Down Expand Up @@ -33,6 +40,45 @@ indra {
mitLicense()
}

spotless {
fun FormatExtension.applyCommon() {
trimTrailingWhitespace()
endWithNewline()
encoding("UTF-8")
toggleOffOn()
}
java {
importOrderFile(rootProject.file(".spotless/mizule.importorder"))
removeUnusedImports()
formatAnnotations()
applyCommon()
target("*/src/*/java/**/*.java")
}
kotlinGradle {
applyCommon()
}
kotlin {
applyCommon()
}
}

indraSpotlessLicenser {
headerFormat(HeaderFormat.starSlash())
licenseHeaderFile(rootProject.projectDir.resolve("HEADER"))

val currentYear = Calendar.getInstance().apply {
time = Date()
}.get(Calendar.YEAR)
val createdYear = providers.gradleProperty("createdYear").map { it.toInt() }.getOrElse(currentYear)
val year = if (createdYear == currentYear) createdYear.toString() else "$createdYear-$currentYear"

property("name", providers.gradleProperty("projectName").getOrElse("template"))
property("year", year)
property("description", project.description ?: "A template project")
property("author", providers.gradleProperty("projectAuthor").getOrElse("template"))

}

application {
mainClass.set("dev.mizule.imagery.app.launcher.Launcher")
}
Expand All @@ -48,4 +94,11 @@ tasks {
systemProperty("terminal.jline", false)
systemProperty("terminal.ansi", true)
}
}
}

idea {
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}
24 changes: 24 additions & 0 deletions app/src/main/kotlin/dev/mizule/imagery/app/App.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
/*
* This file is part of Imagery, licensed under the MIT License.
*
* Copyright (c) 2023 powercas_gamer
* Copyright (c) 2023 contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package dev.mizule.imagery.app

import com.github.benmanes.caffeine.cache.Caffeine
Expand Down
24 changes: 24 additions & 0 deletions app/src/main/kotlin/dev/mizule/imagery/app/config/Config.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
/*
* This file is part of Imagery, licensed under the MIT License.
*
* Copyright (c) 2023 powercas_gamer
* Copyright (c) 2023 contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package dev.mizule.imagery.app.config

import org.spongepowered.configurate.objectmapping.ConfigSerializable
Expand Down
24 changes: 24 additions & 0 deletions app/src/main/kotlin/dev/mizule/imagery/app/launcher/Launcher.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
/*
* This file is part of Imagery, licensed under the MIT License.
*
* Copyright (c) 2023 powercas_gamer
* Copyright (c) 2023 contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
@file:JvmName("Launcher")
package dev.mizule.imagery.app.launcher

Expand Down
24 changes: 24 additions & 0 deletions app/src/main/kotlin/dev/mizule/imagery/app/model/UploadedFile.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
/*
* This file is part of Imagery, licensed under the MIT License.
*
* Copyright (c) 2023 powercas_gamer
* Copyright (c) 2023 contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package dev.mizule.imagery.app.model

import org.spongepowered.configurate.objectmapping.ConfigSerializable
Expand Down

0 comments on commit 102ede2

Please sign in to comment.