From adcce9769ed90c149f338870d0060429e13e6be9 Mon Sep 17 00:00:00 2001 From: "Lukas Rieger (Blue)" Date: Tue, 11 Jan 2022 14:52:39 +0100 Subject: [PATCH] Update gradle, switch to kotlin-gradle and tidy up build-script --- LICENSE_HEADER | 24 ++++++++++ build.gradle | 27 ------------ build.gradle.kts | 56 ++++++++++++++++++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 81 insertions(+), 28 deletions(-) create mode 100644 LICENSE_HEADER delete mode 100644 build.gradle create mode 100644 build.gradle.kts diff --git a/LICENSE_HEADER b/LICENSE_HEADER new file mode 100644 index 0000000..0473d5e --- /dev/null +++ b/LICENSE_HEADER @@ -0,0 +1,24 @@ +/* + * This file is part of BlueMap, licensed under the MIT License (MIT). + * + * Copyright (c) Blue (Lukas Rieger) + * Copyright (c) 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. + */ \ No newline at end of file diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 5ca648e..0000000 --- a/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -plugins { - id 'java' - id 'java-library' -} - -repositories { - jcenter() - mavenCentral() -} - -dependencies { - api 'com.flowpowered:flow-math:1.0.3' -} - -apply plugin: 'java' - -group = 'de.bluecolored.bluemap.api' -version = apiVersion - -javadoc { - options { - links += [ - 'https://docs.oracle.com/javase/8/docs/api/', - 'https://javadoc.io/doc/com.flowpowered/flow-math/1.0.3/' - ] - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..315715b --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,56 @@ +plugins { + java + `java-library` + id("com.diffplug.spotless") version "6.1.2" +} + +group = "de.bluecolored.bluemap.api" + +val apiVersion: String by project +version = apiVersion + +val javaTarget = 8 +java { + sourceCompatibility = JavaVersion.toVersion(javaTarget) + targetCompatibility = JavaVersion.toVersion(javaTarget) +} + +repositories { + mavenCentral() +} + +dependencies { + api ("com.flowpowered:flow-math:1.0.3") +} + +spotless { + java { + target ("src/*/java/**/*.java") + + licenseHeaderFile("LICENSE_HEADER") + indentWithSpaces() + trimTrailingWhitespace() + } +} + +tasks.withType(JavaCompile::class).configureEach { + options.apply { + encoding = "utf-8" + } +} + +tasks.withType(AbstractArchiveTask::class).configureEach { + isReproducibleFileOrder = true + isPreserveFileTimestamps = false +} + +tasks.javadoc { + options { + this as StandardJavadocDocletOptions + + links( + "https://docs.oracle.com/javase/8/docs/api/", + "https://javadoc.io/doc/com.flowpowered/flow-math/1.0.3/" + ) + } +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0f80bbf..2e6e589 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists