142 lines
3.4 KiB
Groovy
142 lines
3.4 KiB
Groovy
apply plugin: 'java'
|
|
apply plugin: 'eclipse'
|
|
apply plugin: 'idea'
|
|
|
|
defaultTasks 'licenseFormat', 'build'
|
|
|
|
group = 'org.spongepowered'
|
|
archivesBaseName = project.name.toLowerCase()
|
|
|
|
// Java version
|
|
sourceCompatibility = '1.6'
|
|
targetCompatibility = '1.6'
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
name = 'sponge'
|
|
url = 'http://repo.spongepowered.org/maven'
|
|
}
|
|
}
|
|
|
|
// Testing dependencies
|
|
dependencies {
|
|
testCompile 'junit:junit:4.12'
|
|
testCompile 'org.hamcrest:hamcrest-library:1.3'
|
|
testCompile 'org.mockito:mockito-core:1.10.19'
|
|
}
|
|
|
|
// Source compiler configuration
|
|
configure([compileJava, compileTestJava]) {
|
|
options.compilerArgs += ['-Xlint:all', '-Xlint:-path']
|
|
options.deprecation = true
|
|
options.encoding = 'UTF-8'
|
|
}
|
|
|
|
test {
|
|
testLogging {
|
|
exceptionFormat = 'full'
|
|
}
|
|
}
|
|
|
|
// Set manifest entries
|
|
jar {
|
|
manifest {
|
|
attributes(
|
|
'Built-By': System.properties['user.name'],
|
|
'Created-By': "${System.properties['java.vm.version']} (${System.properties['java.vm.vendor']})",
|
|
'Implementation-Name': project.name,
|
|
'Implementation-Version': project.version,
|
|
'Implementation-Vendor': project.url
|
|
)
|
|
}
|
|
}
|
|
|
|
javadoc {
|
|
options.encoding = 'UTF-8'
|
|
options.charSet = 'UTF-8'
|
|
options.jFlags('-Xms256m', '-Xmx512m')
|
|
options.links(
|
|
'http://www.slf4j.org/apidocs/',
|
|
'http://docs.guava-libraries.googlecode.com/git-history/v17.0/javadoc/',
|
|
'http://google.github.io/guice/api-docs/latest/javadoc/',
|
|
/*'http://zachsthings.com/configurate/configurate-core/apidocs/',
|
|
'http://zachsthings.com/configurate/configurate-hocon/apidocs/',*/
|
|
'http://flowpowered.com/math/',
|
|
'http://asm.ow2.org/asm50/javadoc/user/',
|
|
'http://docs.oracle.com/javase/6/docs/api/'
|
|
)
|
|
}
|
|
|
|
if (JavaVersion.current().isJava8Compatible()) {
|
|
tasks.withType(Javadoc) {
|
|
// Disable the crazy super-strict doclint tool in Java 8
|
|
options.addStringOption('Xdoclint:none', '-quiet')
|
|
}
|
|
}
|
|
|
|
task sourceJar(type: Jar) {
|
|
classifier = 'sources'
|
|
from sourceSets.main.allSource
|
|
}
|
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
classifier = 'javadoc'
|
|
from javadoc.destinationDir
|
|
}
|
|
|
|
artifacts {
|
|
archives sourceJar
|
|
archives javadocJar
|
|
}
|
|
|
|
// Apply code style plugins
|
|
apply plugin: 'license'
|
|
apply plugin: 'checkstyle'
|
|
|
|
// License header formatting
|
|
license {
|
|
ext {
|
|
name = project.name
|
|
organization = project.organization
|
|
url = project.url
|
|
}
|
|
|
|
header api.file('HEADER.txt')
|
|
include '**/*.java'
|
|
|
|
ignoreFailures false
|
|
strictCheck true
|
|
|
|
mapping {
|
|
java = 'SLASHSTAR_STYLE'
|
|
}
|
|
}
|
|
|
|
processResources {
|
|
// Include in final JAR
|
|
from 'LICENSE.txt'
|
|
}
|
|
|
|
dependencies {
|
|
// Add custom checkstyle dependency (fixes a few wrong warnings about imports and @param tags in annotations)
|
|
checkstyle 'org.spongepowered:checkstyle:6.1.1-sponge1'
|
|
}
|
|
|
|
// Checkstyle settings
|
|
checkstyle {
|
|
configFile = api.file('checkstyle.xml')
|
|
configProperties = [
|
|
'basedir': project.projectDir,
|
|
'suppressions': project.file('checkstyle-suppressions.xml'),
|
|
'severity': 'warning'
|
|
]
|
|
}
|
|
|
|
// Deployment configuration
|
|
apply from: api.file('gradle/deploy.gradle')
|
|
|
|
task wrapper(type: Wrapper) {
|
|
gradleVersion = '2.3'
|
|
}
|