Prepare Sponge for Project Unify. Closes #557.

Split build script into a common purpose build script.
This commit is contained in:
Minecrell authored and Chris Sanders committed 2015-04-11 12:01:28 -05:00
1 parent ec7dff4ae3
commit 4365dbb5eb
11 files changed
+227 -198

No files matched your search

+6
View File
@@ -1,6 +1,12 @@
# Normalize as LF in the repository, OS native locally
* text=auto
*.bat text eol=crlf
gradlew text eol=lf
*.sh text eol=lf
*.java text
*.java diff=java
# Binary files that should not be modified
*.dat binary
+4 -1
View File
@@ -1,12 +1,15 @@
sudo: false
language: java
jdk:
- openjdk6
- openjdk7
- oraclejdk7
- oraclejdk8
env: GRADLE_OPTS="-Xms1g -Xmx3g"
install: true
script: gradle build
script: ./gradlew build
notifications:
email: false
+2 -2
View File
@@ -1,6 +1,6 @@
This file is part of Sponge, licensed under the MIT License (MIT).
This file is part of ${name}, licensed under the MIT License (MIT).
Copyright (c) SpongePowered.org <http://www.spongepowered.org>
Copyright (c) ${organization} <${url}>
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
+6 -186
View File
@@ -1,58 +1,17 @@
// Gradle repositories and dependencies
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
}
}
// Apply plugin
apply plugin: 'java'
apply plugin: 'license'
apply plugin: 'checkstyle'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'idea'
// Default tasks
defaultTasks 'licenseFormat', 'check', 'build'
// Basic project information
group = 'org.spongepowered'
archivesBaseName = 'spongeapi'
version = '1.1-SNAPSHOT'
// Extended project information
ext.projectName = 'SpongeAPI'
ext.inceptionYear = '2014'
ext.packaging = 'jar'
ext.url = 'http://spongepowered.org'
ext.description = 'SpongeAPI'
ext.organization = 'SpongePowered'
// Define variables
ext.buildNumber = project.hasProperty("buildNumber") ? buildNumber : '0'
ext.ciSystem = project.hasProperty("ciSystem") ? ciSystem : 'unknown'
ext.commit = project.hasProperty("commit") ? commit : 'unknown'
// Minimum version of Java required
sourceCompatibility = '1.6'
targetCompatibility = '1.6'
// Project repositories
repositories {
mavenCentral()
// Add Sponge repo for custom checkstyle implementation to fix some wrong warnings
maven { url 'http://repo.spongepowered.org/maven' }
}
configurations {
deployerJars // maven stuff
}
ext.api = project
apply from: 'gradle/java.gradle'
// Project dependencies
dependencies {
@@ -63,150 +22,11 @@ dependencies {
compile 'ninja.leaping.configurate:configurate-hocon:1.1'
compile 'com.flowpowered:flow-math:1.0.0'
compile 'org.ow2.asm:asm:5.0.3'
testCompile 'junit:junit:4.11'
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'org.mockito:mockito-core:1.9.0'
checkstyle 'org.spongepowered:checkstyle:6.1.1-sponge1'
// maven
deployerJars 'org.apache.maven.wagon:wagon-ftp:2.7'
}
// Filter, process, and include resources
processResources {
// Include in final JAR
from 'LICENSE.txt'
}
// License header formatting
license {
ext.name = project.name
ext.organization = project.organization
ext.url = project.url
ext.year = project.inceptionYear
exclude "**/*.info"
exclude "assets/**"
header file('HEADER.txt')
sourceSets = project.sourceSets
ignoreFailures false
strictCheck true
mapping {
java = 'SLASHSTAR_STYLE'
}
}
test {
testLogging {
exceptionFormat = 'full'
}
}
checkstyle {
configFile = file('checkstyle.xml')
configProperties = [
"name": project.name,
"organization": project.organization,
"url": project.url,
"year": project.inceptionYear,
"basedir": project.projectDir,
"severity": 'warning'
]
}
// Source compiler configuration
configure([compileJava, compileTestJava]) {
options.compilerArgs += ['-Xlint:all', '-Xlint:-path']
options.deprecation = true
options.encoding = 'utf8'
}
javadoc {
options.jFlags('-Xms256m', '-Xmx512m')
options.links("http://docs.guava-libraries.googlecode.com/git-history/v17.0/javadoc/",
"http://google.github.io/guice/api-docs/latest/javadoc/",
"http://flowpowered.com/math/",
"http://asm.ow2.org/asm50/javadoc/user/",
"http://www.slf4j.org/apidocs/",
"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')
}
}
// JAR manifest configuration
jar.manifest.mainAttributes(
"Built-By": System.properties['user.name'],
"Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
"Implementation-Title": name,
"Implementation-Version": version + "+" + ciSystem + "-b" + buildNumber + ".git-" + commit,
"Implementation-Vendor": url,
"Main-Class": "org.spongepowered.api.util.InformativeMain")
task sourceJar(type: Jar) {
from sourceSets.main.java
from sourceSets.main.resources
classifier = "sources"
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier = "javadoc"
}
artifacts {
archives jar
archives sourceJar
archives javadocJar
}
uploadArchives {
repositories {
mavenDeployer {
configuration = configurations.deployerJars
if (project.hasProperty("chRepo"))
{
repository(url: project.chRepo) {
authentication(userName: project.chUsername, password: project.chPassword)
}
}
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName
project {
name project.archivesBaseName
packaging 'jar'
description 'Sponge API'
url 'http://www.spongepowered.org/'
scm {
url 'https://github.com/SpongePowered/SpongeAPI'
connection 'scm:git:git://github.com/SpongePowered/SpongeAPI.git'
developerConnection 'scm:git:git@github.com:SpongePowered/SpongeAPI.git'
}
issueManagement {
system 'youtrack'
url 'https://issues.spongepowered.org/'
}
licenses {
license {
name 'MIT license'
url 'http://opensource.org/licenses/MIT'
distribution 'repo'
}
}
}
}
}
jar {
manifest {
attributes('Main-Class': 'org.spongepowered.api.util.InformativeMain')
}
}
+1 -1
View File
@@ -220,7 +220,7 @@
<module name="NewlineAtEndOfFile"/>
<module name="SuppressionFilter">
<property name="file" value="${basedir}/checkstyle-suppressions.xml"/>
<property name="file" value="${suppressions}"/>
</module>
<property name="basedir" value="${basedir}"/>
+3 -5
View File
@@ -1,6 +1,4 @@
theName=SpongeAPI
inceptionYear=2014
packaging=jar
url=http://spongepowered.org
description=SpongeAPI
name=SpongeAPI
description=A Minecraft plugin API
url=https://www.spongepowered.org
organization=SpongePowered
+61
View File
@@ -0,0 +1,61 @@
apply plugin: 'maven'
ext {
buildNumber = System.getenv().BUILD_NUMBER != null ? System.getenv().BUILD_NUMBER : '0'
ciSystem = System.getenv().ciSystem != null ? System.getenv().ciSystem : 'unknown'
commit = System.getenv().commit != null ? System.getenv().commit : 'unknown'
}
configurations {
deployerJars // Deployment dependency
}
dependencies {
deployerJars 'org.apache.maven.wagon:wagon-ftp:2.8'
}
uploadArchives {
repositories {
mavenDeployer {
configuration = configurations.deployerJars
if (project.hasProperty('chRepo')) {
repository(url: project.chRepo) {
authentication(userName: project.chUsername, password: project.chPassword)
}
}
pom {
groupId = project.group
artifactId = project.archivesBaseName
version = project.version
project {
name project.archivesBaseName
description project.description
packaging 'jar'
url project.url
scm {
url "https://github.com/$project.organization/$project.name"
connection "scm:git:https://github.com/$project.organization/${project.name}.git"
developerConnection "scm:git:git@github.com:$project.organization/${project.name}.git"
}
issueManagement {
system 'youtrack'
url 'https://issues.spongepowered.org'
}
licenses {
license {
name 'MIT License'
url 'http://opensource.org/licenses/MIT'
distribution 'repo'
}
}
}
}
}
}
}
+141
View File
@@ -0,0 +1,141 @@
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'
}
Binary file not shown.
+2 -2
View File
@@ -1,6 +1,6 @@
#Sat May 03 12:44:05 CDT 2014
#Fri Apr 03 11:08:44 CEST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-2.0-all.zip
distributionUrl=http\://services.gradle.org/distributions/gradle-2.3-bin.zip
+1 -1
View File
@@ -1 +1 @@
rootProject.name = theName
rootProject.name = name