Changeset View
Changeset View
Standalone View
Standalone View
build.gradle
Show All 14 Lines | |||||
*/ | */ | ||||
//region Plugins | //region Plugins | ||||
import org.gradle.internal.jvm.Jvm | import org.gradle.internal.jvm.Jvm | ||||
plugins { | plugins { | ||||
id 'java' | id 'java' | ||||
id 'findbugs' | id 'com.github.spotbugs' version '1.6.10' | ||||
id 'signing' // To GPG-sign the archives that will be published. | id 'signing' // To GPG-sign the archives that will be published. | ||||
id 'maven' // To export to Maven | id 'maven' // To export to Maven | ||||
id 'io.codearte.nexus-staging' version '0.11.0' // Confirm publication to MavenCentral | id 'io.codearte.nexus-staging' version '0.11.0' // Confirm publication to MavenCentral | ||||
id 'org.jetbrains.kotlin.jvm' version '1.2.70' | id 'org.jetbrains.kotlin.jvm' version '1.2.70' | ||||
id 'org.jetbrains.dokka' version '0.9.17' | id 'org.jetbrains.dokka' version '0.9.17' | ||||
id 'jacoco' // Code coverage | id 'jacoco' // Code coverage | ||||
} | } | ||||
repositories { | repositories { | ||||
mavenCentral() | mavenCentral() | ||||
} | } | ||||
//endregion | //endregion | ||||
//region Version handling | //region Version handling | ||||
group 'net.wildfyre' | group 'net.wildfyre' | ||||
getVersion() | getVersion() | ||||
sourceCompatibility = 1.8 | sourceCompatibility = 1.8 | ||||
targetCompatibility = 1.8 | targetCompatibility = 1.8 | ||||
def spotbugsVersion = '3.1.12' | |||||
void getVersion(){ | void getVersion(){ | ||||
def stdout = new ByteArrayOutputStream() | def stdout = new ByteArrayOutputStream() | ||||
exec { | exec { | ||||
commandLine 'git', 'describe', '--tags', '--candidates=30', '--dirty=-SNAPSHOT' | commandLine 'git', 'describe', '--tags', '--candidates=30', '--dirty=-SNAPSHOT' | ||||
standardOutput = stdout | standardOutput = stdout | ||||
} | } | ||||
version stdout | version stdout | ||||
.toString()[1..-2] // Remove the \n character at the end of the command and the 'v' | .toString()[1..-2] // Remove the \n character at the end of the command and the 'v' | ||||
Show All 15 Lines | jar { | ||||
} | } | ||||
} | } | ||||
//enregion | //enregion | ||||
dependencies { | dependencies { | ||||
testCompile group: 'junit', name: 'junit', version: '4.12' | testCompile group: 'junit', name: 'junit', version: '4.12' | ||||
implementation group: 'com.eclipsesource.minimal-json', name: 'minimal-json', version: '0.9.5' | implementation group: 'com.eclipsesource.minimal-json', name: 'minimal-json', version: '0.9.5' | ||||
fatJar group: 'com.eclipsesource.minimal-json', name: 'minimal-json', version: '0.9.5' | fatJar group: 'com.eclipsesource.minimal-json', name: 'minimal-json', version: '0.9.5' | ||||
compile 'com.google.code.findbugs:annotations:3.0.1' | api group: 'com.github.spotbugs', name: 'spotbugs', version: spotbugsVersion | ||||
Hackintosh5: don't use compile its deprecated
use format strings not concatenation | |||||
Done Inline ActionsThe FindBugs to SpotBugs migration post says to use compile CLOVIS: The FindBugs to SpotBugs migration post says to use `compile` | |||||
Not Done Inline ActionsDon't. Hackintosh5: Don't.
From https://stackoverflow.com/a/44419574/5509575:
Using `api` is the equivalent of… | |||||
compile 'com.google.code.findbugs:jsr305:3.0.1' | implementation 'net.jcip:jcip-annotations:1.0' | ||||
Not Done Inline Actionsagain, format strings please Hackintosh5: again, format strings please | |||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8" | implementation group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: spotbugsVersion | ||||
api 'com.google.code.findbugs:jsr305:3.0.1' | |||||
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8" | |||||
} | } | ||||
javadoc { | javadoc { | ||||
options { | options { | ||||
addStringOption('source', '8') | addStringOption('source', '8') | ||||
addStringOption('link', "https://docs.oracle.com/javase/8/docs/api/") | addStringOption('link', "https://docs.oracle.com/javase/8/docs/api/") | ||||
//addBooleanOption('html5', true) Only in Java 9+, breaks in Java 8 | //addBooleanOption('html5', true) Only in Java 9+, breaks in Java 8 | ||||
} | } | ||||
} | } | ||||
tasks.withType(FindBugs) { | |||||
reports { | test { | ||||
xml.enabled = false | // Using less cores than available, because JUnit needs some to work | ||||
html.enabled = true | def runners = Runtime.runtime.availableProcessors() - 2 | ||||
} | maxParallelForks = runners > 0 ? runners : 1 | ||||
} | } | ||||
findbugsMain { | spotbugs { | ||||
classpath += files Jvm.current().getJavaHome() | toolVersion = spotbugsVersion | ||||
} | } | ||||
findbugsTest { | tasks.withType(com.github.spotbugs.SpotBugsTask) { | ||||
classpath += files Jvm.current().getJavaHome() | reports.xml.enabled = false | ||||
reports.html.enabled = true | |||||
} | } | ||||
// Removes the directories out/ (created by IntelliJ) and wildfyre.net/ (created by the maven plugin) when calling | // Removes the directories out/ (created by IntelliJ) and wildfyre.net/ (created by the maven plugin) when calling | ||||
// 'gradle clean'. | // 'gradle clean'. | ||||
clean { | clean { | ||||
delete "${rootDir}/out" | delete "${rootDir}/out" | ||||
delete "${rootDir}/wildfyre.net" | delete "${rootDir}/wildfyre.net" | ||||
delete "${rootDir}/http/out" | delete "${rootDir}/http/out" | ||||
▲ Show 20 Lines • Show All 169 Lines • Show Last 20 Lines |
don't use compile its deprecated
use format strings not concatenation