Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

240 lines (213 sloc) 6.604 kB
/*
* This is a Gradle build file:
* - Gradle Homepage: http://gradle.org/
* - Gradle Installation: http://gradle.org/installation
* - View tasks for this project: $ gradle tasks
*/
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'eclipse'
apply plugin: 'idea'
task extractWindowsNatives(type:Copy) {
from {
configurations.compile.collect { it.getName().contains('-natives-window') ? zipTree(it) : [] }
}
into ('natives/windows')
exclude ('META-INF/**')
}
task extractMacOSXNatives(type:Copy) {
from {
configurations.compile.collect { it.getName().contains('-natives-osx') ? zipTree(it) : [] }
}
into ('natives/macosx')
exclude ('META-INF/**')
}
task extractLinuxNatives(type:Copy) {
from {
configurations.compile.collect { it.getName().contains('-natives-linux') ? zipTree(it) : [] }
}
into ('natives/linux')
exclude ('META-INF/**')
}
task extractNatives {
dependsOn extractWindowsNatives
dependsOn extractLinuxNatives
dependsOn extractMacOSXNatives
}
idea {
project {
jdkName = '1.6'
languageLevel = '1.6'
ipr {
withXml { provider ->
provider.node.component.find { it.@name == 'ProjectRootManager' }.output.@url = 'file://$PROJECT_DIR$/target'
}
}
}
module {
inheritOutputDirs = false
outputDir = file('target/classes/main')
testOutputDir = file('target/classes/test')
testSourceDirs += file('src/perfTest/java')
excludeDirs += file('protobuf')
excludeDirs += file('blender_addons')
excludeDirs += file('gradle')
excludeDirs += file('rawAssets')
excludeDirs += file('logs')
excludeDirs += file('SAVED_WORLDS')
excludeDirs += file('target')
excludeDirs += file('out')
}
}
ideaModule.dependsOn extractNatives
eclipseClasspath.dependsOn extractNatives
sourceCompatibility = 1.6
//version = '0.5.0' //TODO: Disabled version tagging until we actually have something solid to do with it (was breaking old artifact links)
buildDir = 'target'
task wrapper(type: Wrapper) {
gradleVersion = '1.0-milestone-8a'
}
// Compiles everything as groovy, due to java<->groovy interdependencies
sourceSets {
main {
java { srcDirs = [] }
groovy { srcDirs = ['src/main/java','src/main/groovy'] }
resources { srcDir = 'src/main/resources' }
output.resourcesDir = 'target/classes/main'
}
perfTest
}
test {
//Uncomment to makes the standard streams (err and out) visible at console when running tests
//testLogging.showStandardStreams = true
jvmArgs '-Xms512m', '-Xmx1024m', '-XX:MaxPermSize=128m'
}
task perfTests(type: Test) {
testClassesDir = sourceSets.perfTest.output.classesDir
classpath = sourceSets.perfTest.runtimeClasspath
jvmArgs '-Xms512m', '-Xmx1024m', '-XX:MaxPermSize=128m'
}
repositories {
mavenCentral()
}
dependencies{
groovy group: 'org.codehaus.groovy', name: 'groovy', version: '1.8.2'
compile group: 'com.google.guava', name: 'guava', version: '11.0.1'
compile group: 'com.google.code.gson', name: 'gson', version: '2.1'
compile group: 'com.google.protobuf', name: 'protobuf-java', version: '2.4.1'
compile group: 'net.sf.trove4j', name: 'trove4j', version: '3.0.2'
compile group: 'com.projectdarkstar.ext.jorbis', name: 'jorbis', version: '0.0.17'
compile group: 'org.lwjgl.lwjgl', name: 'lwjgl', version: '2.8.3'
compile group: 'org.lwjgl.lwjgl', name: 'lwjgl_util', version: '2.8.3'
compile fileTree(dir: 'libs', include: '*.jar')
testCompile group: 'junit', name: 'junit', version: '4.10'
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.0'
perfTestCompile sourceSets.main.output
perfTestCompile configurations.testCompile
perfTestCompile sourceSets.test.output
perfTestRuntime configurations.testRuntime
}
jar {
manifest {
def manifestClasspath = 'libs/'+configurations.runtime.collect { it.getName() }.join(' libs/')
attributes("Main-Class": "org.terasology.game.Terasology", "Manifest-Version": "1.0", "Class-Path" : manifestClasspath)
}
archiveName('Terasology.jar')
}
jar.doFirst {
// Work around for duplicate entries in jar bug
sourceSets.main.output.resourcesDir = '/dev/null'
}
jar.doLast {
ant.signjar(jar: jar.archivePath, keystore: 'applet/tera.keystore', alias: 'Terasology', storepass: 'Terasology')
sourceSets.main.output.resourcesDir = 'target/classes/main'
}
task distLibs(type:Copy) {
from {
configurations.compile.collect { !it.isDirectory() && !it.getName().contains('-natives-') ? it : [] }
}
into('target/dist/libs')
}
task distMods {
mkdir('target/dist/mods')
file('mods').listFiles().each { File mod ->
if (mod.isDirectory() ) {
task('distMod-' + mod.getName(), type: Zip) {
from (mod)
archiveName = mod.getName() + '.zip'
destinationDir = file('target/dist/mods/')
}
distMods.dependsOn tasks['distMod-' + mod.getName()]
}
}
}
task dist(type:Copy) {
description = 'Creates a fully-functional game folder.'
dependsOn jar
dependsOn extractNatives
dependsOn distLibs
dependsOn distMods
from('.') {
include 'README.markdown'
include 'LICENSE.txt'
include 'natives/**'
include 'data/**'
}
from('launchScripts') {
exclude('Launcher.xml')
}
from(jar.archivePath)
into('target/dist')
}
task zip(type:Zip) {
description = 'Creates a fully-functionional game archive.'
dependsOn dist
from('target/dist')
into('Terasology')
destinationDir = buildDir
}
task appletMods {
mkdir('target/applet/mods')
file('mods').listFiles().each { File mod ->
if (mod.isDirectory() ) {
task('appletMod-' + mod.getName(), type: Zip) {
from (mod)
archiveName = mod.getName() + '.zip'
destinationDir = file('target/applet/mods/')
}
appletMods.dependsOn tasks['appletMod-' + mod.getName()]
}
}
}
task appletLibs(type:Copy) {
from {
configurations.compile.collect { !it.isDirectory() ? it : [] }
}
into('target/applet/libs')
exclude { details -> details.file.name.contains("lwjgl") || details.file.name.contains("jinput") }
}
task applet(type:Copy) {
description = 'Creates a game distribution playable through a browser.'
dependsOn jar
dependsOn appletLibs
dependsOn appletMods
from('applet') {
exclude '*.keystore'
}
from (jar.archivePath)
into('target/applet')
}
applet.doLast {
file('target/applet/libs').listFiles().each {
if (it.getName().endsWith(".jar"))
ant.signjar(jar: it, keystore: 'applet/tera.keystore', alias: 'Terasology', storepass: 'Terasology')
}
}
task run(type:JavaExec) {
description = 'Run Terasology'
dependsOn extractNatives
dependsOn classes
main = 'org.terasology.game.Terasology'
classpath sourceSets.main.output.classesDir
classpath configurations.runtime
}
Jump to Line
Something went wrong with that request. Please try again.