-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Bring buildscript back to groovy
- Loading branch information
Showing
1 changed file
with
40 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,11 @@ import java.io.StringWriter | |
import java.util.stream.Collectors | ||
|
||
plugins { | ||
jacoco | ||
id("org.spongepowered.gradle.sponge.dev") version "1.1.0" | ||
id("math-templates") | ||
id("net.kyori.indra.publishing.sonatype") version "2.0.2" | ||
id("net.ltgt.errorprone") version "2.0.1" | ||
id 'jacoco' | ||
id "org.spongepowered.gradle.sponge.dev" version "1.1.0" | ||
id "math-templates" | ||
id "net.kyori.indra.publishing.sonatype" version "2.0.2" | ||
id "net.ltgt.errorprone" version "2.0.1" | ||
} | ||
|
||
// -- General setup -- // | ||
|
@@ -16,7 +16,8 @@ version = "2.0.1-SNAPSHOT" | |
description = "Immutable math library for Java with a focus on games and computer graphics." | ||
|
||
repositories { | ||
maven("https://repo.spongepowered.org/repository/maven-public/") { | ||
maven { | ||
url = "https://repo.spongepowered.org/repository/maven-public/" | ||
name = "sponge" | ||
} | ||
} | ||
|
@@ -31,33 +32,26 @@ spongeConvention { | |
|
||
mitLicense() | ||
licenseParameters { | ||
val organization: String by project | ||
val url: String by project | ||
this["name"] = "Math" | ||
this["organization"] = organization | ||
this["url"] = url | ||
name = "Math" | ||
organization = project.organization | ||
url = project.url | ||
} | ||
|
||
sharedManifest { | ||
attributes( | ||
"Specification-Title" to project.name, | ||
"Specification-Vendor" to "SpongePowered - https://spongepowered.org" | ||
) | ||
attributes "Specification-Title": project.name, | ||
"Specification-Vendor": "SpongePowered - https://spongepowered.org" | ||
} | ||
} | ||
|
||
val floatData = file("src/templateData/float.yaml") | ||
val intData = file("src/templateData/integer.yaml") | ||
val licenseText = objects.property(String::class) | ||
def floatData = file("src/templateData/float.yaml") | ||
def intData = file("src/templateData/integer.yaml") | ||
def licenseText = objects.property(String) | ||
licenseText.set(provider { | ||
val properties = (license as ExtensionAware).extra.properties.toMutableMap() | ||
val template = groovy.text.SimpleTemplateEngine().createTemplate(file("HEADER.txt")).make(properties) | ||
|
||
val writer = StringWriter() | ||
template.writeTo(writer) | ||
val text = writer.toString() | ||
val lineEnding = license.lineEnding.get() | ||
text.split(Regex("\r?\n")).stream() | ||
def properties = [*: license.ext.properties] | ||
def template = new groovy.text.SimpleTemplateEngine().createTemplate(file("HEADER.txt")).make(properties) | ||
def text = template.toString() | ||
def lineEnding = license.lineEnding.get() | ||
Arrays.stream(text.split("\r?\n")) | ||
.map { if (it.isEmpty()) { " *" } else { " * $it" } } | ||
.collect(Collectors.joining(lineEnding, "/*$lineEnding", "$lineEnding */")) | ||
}) | ||
|
@@ -107,9 +101,6 @@ sourceSets { | |
|
||
|
||
dependencies { | ||
val errorproneVersion: String by project | ||
val junitVersion: String by project | ||
|
||
compileOnlyApi("com.google.errorprone:error_prone_annotations:$errorproneVersion") | ||
errorprone("com.google.errorprone:error_prone_core:$errorproneVersion") | ||
|
||
|
@@ -118,17 +109,14 @@ dependencies { | |
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") | ||
} | ||
|
||
tasks { | ||
jar { | ||
from(rootProject.file("LICENSE.txt")) { | ||
rename { "LICENSE-spongepowered-math.txt" } | ||
} | ||
jar { | ||
from(rootProject.file("LICENSE.txt")) { | ||
rename { "LICENSE-spongepowered-math.txt" } | ||
} | ||
} | ||
|
||
withType(JavaCompile::class) { | ||
options.compilerArgs.add("-Xlint:-cast") // skip cast warnings, the generated source is most likely just overly safe. | ||
|
||
} | ||
tasks.withType(JavaCompile.class) { | ||
options.compilerArgs << "-Xlint:-cast" // skip cast warnings, the generated source is most likely just overly safe. | ||
} | ||
|
||
// -- Publishing -- // | ||
|
@@ -138,29 +126,29 @@ indra { | |
} | ||
configurePublications { | ||
pom { | ||
name.set("Math") | ||
inceptionYear.set("2013") | ||
name = "Math" | ||
inceptionYear = "2013" | ||
|
||
developers { | ||
developer { | ||
id.set("DDoS") | ||
name.set("Aleksi Sapon") | ||
email.set("[email protected]") | ||
id = "DDoS" | ||
name = "Aleksi Sapon" | ||
email = "[email protected]" | ||
} | ||
developer { | ||
id.set("kitskub") | ||
name.set("Jack Huey") | ||
email.set("[email protected]") | ||
id = "kitskub" | ||
name = "Jack Huey" | ||
email = "[email protected]" | ||
} | ||
developer { | ||
id.set("Wolf480pl") | ||
name.set("Wolf480pl") | ||
email.set("[email protected]") | ||
id = "Wolf480pl" | ||
name = "Wolf480pl" | ||
email = "[email protected]" | ||
} | ||
developer { | ||
id.set("lukespragg") | ||
name.set("Luke Spragg") | ||
email.set("[email protected]") | ||
id = "lukespragg" | ||
name = "Luke Spragg" | ||
email = "[email protected]" | ||
} | ||
} | ||
} | ||
|