Updated build.gradle in line with develop

Updated README.markdown in line with develop
Changed mod.txt generation to use a template
Changed applet/index.html to be a template, which is now populated with the correct jars and mods and lwjgl version
Fixed the dependency on slick to ignore transitive lwjgl dependencies
develop
Immortius 2013-07-20 14:21:51 +10:00
parent 0d61683a02
commit e6b8d917b7
13 changed files with 319 additions and 156 deletions

25
.gitignore vendored
View File

@ -1,3 +1,10 @@
# Ignore general
/.*
!.gitignore
*~
._*
*.bak
# Ignore gradle
/.gradle/
/build/
@ -10,21 +17,16 @@
*.iws
# Ignore Eclipse
/.checkstyle
/.classpath
/.project
/.settings
/bin/
# Ignore OS generated files
# Ignore Linux
*.directory
*~
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
#Ignore OSX
Icon
Icon?
#Ignore Windows
ehthumbs.db
Thumbs.db
@ -37,7 +39,6 @@ config.cfg
entityDump.txt
# Historical Output
/SAVED_WORLDS/
/worlds/
/screens/

View File

@ -1,7 +1,7 @@
Terasology
==========
![Terasology](https://raw.github.com/MovingBlocks/Terasology/develop/src/main/resources/assets/textures/menuBackground.png "Terasology")
![Terasology](/src/main/resources/assets/textures/menuBackground.jpg "Terasology")
Terasology is a game that pays ample tribute to [Minecraft](http://www.minecraft.net) in initial look and origin, but stakes out its own niche by adopting the NPC-helper and caretaker feel from such games as [Dwarf Fortress](http://www.bay12games.com/dwarves) and [Dungeon Keeper](http://en.wikipedia.org/wiki/Dungeon_Keeper), while striving for added depth and sophistication.
@ -16,7 +16,7 @@ Setup
Terasology requires the latest version of Oracle's [Java Virtual Machine (JVM)](http://www.java.com/en/download/manual.jsp). Also make sure that your graphics card driver is up to date.
Download the latest stable version [here from GitHub](https://github.com/downloads/MovingBlocks/Terasology/TerasologyStable.zip) or our cutting-edge develop version [here from our Jenkins](http://jenkins.movingblocks.net/job/Terasology/lastSuccessfulBuild/artifact/build/distributions/Terasology.zip)
Download the latest [stable version here](http://jenkins.movingblocks.net/job/TerasologyStable/lastSuccessfulBuild/artifact/build/distributions/Terasology.zip) or our cutting-edge develop version [here from our Jenkins](http://jenkins.movingblocks.net/job/Terasology/lastSuccessfulBuild/artifact/build/distributions/Terasology.zip)
You can use one of the default launch scripts to start the game. The scripts will setup your JVM to allocate up to 1024 MB of heap space. Under Linux and Mac OS X the run script needs the access permission "Execute" to run properly: "chmod +x script.sh".
@ -31,8 +31,8 @@ Note that these instructions are meant for the stable release. The latest develo
* [Space] - Jump
* [Double Space] - God mode (fly / no-clip)
* [Shift] - Hold to run
* [Left click] - Activate left click action (default = place block)
* [Right click] - Activate right click action (default = remove block)
* [Left click] - Activate left click action (default = remove block)
* [Right click] - Activate right click action (default = place block)
* [Mouse wheel up/down] - Cycle through toolbar slots
* [1..0] - Change the active toolbar slot
* [I] - Toggle inventory screen
@ -50,9 +50,15 @@ Debug Features
Only works when the F3 debug mode is enabled (and may come and go)
* [Arrow up/down] - Adjust the current time in small steps
* [Arrow left/right] - Adjust the current time in larger steps
* [R] - Debug render wire-frame
* [P] - Activate first-person player camera
* [O] - Activate animated spawning point camera
* [K] - Don't try this :-)
* [F4] - Different debug metrics
* [F6] - Debug rendering enabled
* [F7] - Cycle debug rendering stage
* [F8] - Debug render chunk bounding boxes
Tools
--------
@ -61,9 +67,9 @@ May move slot or disappear as development continues
* Axe / Pickaxe - Faster right-click removal of some blocks
* Torch - Shiny! Place with left click
* Minituarizer - Left click one block, then another, then somewhere else to "clone" your selection in a tiny accurate representation
* Explosion tool - Big bada boom!
* Railgun - Bigger bada boom, in a straight line!
* Goodie chest - place it and open with 'e' for assorted goodies
Console Commands
--------
@ -109,24 +115,24 @@ Contributors
(Listed by primary team)
* Architects: Benjamin 'begla' Glatzel, Immortius, Kai Kratz, Ironchefpython, Andre Herber
* Art Team: Glasz, A'nW, basilix, Double_A, eleazzaar, metouto, Perdemot, RampageMode, SuperSnark, Wolfghard, zproc, Chrisk
* Architects: Benjamin 'begla' Glatzel, Immortius, Kai Kratz, Ironchefpython, Andre Herber, Panserbjoern
* Art Team: Glasz, A'nW, basilix, Double_A, eleazzaar, metouto, Perdemot, RampageMode, SuperSnark, Wolfghard, zproc, Chrisk, Maternal
* Design Team: Rasmus 'Cervator' Praestholm, Overdhose, Woodspeople, Mooncalf, Dei
* General: Janred, Josh, MrBarsack, Philaxx, Stuthulhu, t3hk0d3
* General: Janred, Josh, Stuthulhu, t3hk0d3, AbraCadaver, ahoehma, Brokenshakles, DizzyDragon, esereja, MiJyn, NowNewStart, pencilcheck, sdab, hagish, Philius342, temsa, nitrix, R41D3NN, Aperion, ilgarma, mcourteaux, 3000Lane, philip-wernersbach, Xeano, Jamoozy, sdab, zriezenman, NanjoW
* GUI Team: Anton "small-jeeper" Kireev, miniME89, x3ro
* Logistics Team: AlbireoX, Mathias Kalb, Richard "rapodaca" Apodaca, Stellarfirefly
* World Team: B!0HAX, ddr2, Nym Traveel, Skaldarnar, Tenson
* Logistics Team: AlbireoX, Mathias Kalb, Richard "rapodaca" Apodaca, Stellarfirefly, mkalb, MrBarsack, Philaxx
* World Team: B!0HAX, ddr2, Nym Traveel, Skaldarnar, Tenson, Laurimann
Soundtrack and Sound Effects
--------
* Primary soundtrack by ChrisK - https://soundcloud.com/chriskoebke
* Sunrise, Afternoon and Sunset composed by Karina Kireev.
* Dimlight, Resurface and Other Side composed and produced by Exile.
* Door Open sound by Pagancow, from FreeSound.org
* Door Close sound by Fresco, from FreeSound.org
* Other sound effects created by Exile.
* Additional music by ChrisK
Additional Notes
--------

View File

@ -12,21 +12,30 @@
color: #000000;
}
</style>
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-39937647-2', 'movingblocks.net');
ga('send', 'pageview');
</script>
</head>
<body>
<div align="center">
<applet code="org.lwjgl.util.applet.AppletLoader" archive="lwjgl_util_applet-2.9.0.jar" codebase="." width="640" height="360">
<applet code="org.lwjgl.util.applet.AppletLoader" archive="lwjgl_util_applet-${lwjglVersion}.jar" codebase="." width="640" height="360">
<param name="al_title" value="Terasology">
<param name="al_main" value="org.terasology.engine.TerasologyApplet">
<param name="al_jars" value="Terasology.jar, lwjgl_util_applet-2.9.0.jar, libs/lwjgl-2.9.0.jar, libs/jinput-2.0.5.jar, libs/lwjgl_util-2.9.0.jar, libs/lzma.jar, libs/slick.jar, libs/tera-bullet-1.0-SNAPSHOT.jar, libs/guava-13.0.1.jar, libs/gson-2.2.2.jar, libs/protobuf-java-2.4.1.jar, libs/trove4j-3.0.3.jar, libs/jorbis-0.0.17.jar, libs/netty-3.5.11.Final.jar, libs/reflections-0.9.8.jar, libs/vecmath-1.3.1.jar, libs/groovy-1.8.7.jar, libs/jutils-1.0.0.jar, libs/javassist-3.12.1.GA.jar, libs/xml-apis-1.0.b2.jar, libs/dom4j-1.6.1.jar libs/antlr-2.7.7.jar, libs/asm-3.2.jar, libs/asm-tree-3.2.jar, libs/asm-commons-3.2.jar, libs/asm-util-3.2.jar, libs/asm-analysis-3.2.jar, libs/slf4j-api-1.7.2.jar, libs/logback-classic-1.0.9.jar, libs/logback-core-1.0.9.jar, libs/jna-3.5.2.jar, libs/platform-3.5.2.jar">
<param name="al_windows" value="libs/lwjgl-platform-2.9.0-natives-windows.jar, libs/jinput-platform-2.0.5-natives-windows.jar">
<param name="al_linux" value="libs/lwjgl-platform-2.9.0-natives-linux.jar, libs/jinput-platform-2.0.5-natives-linux.jar">
<param name="al_mac" value="libs/lwjgl-platform-2.9.0-natives-osx.jar, libs/jinput-platform-2.0.5-natives-osx.jar">
<param name="al_jars" value="Terasology.jar, lwjgl_util_applet-${lwjglVersion}.jar, ${jars}">
<param name="al_windows" value="libs/lwjgl-platform-${lwjglVersion}-natives-windows.jar, libs/jinput-platform-${jinputVersion}-natives-windows.jar">
<param name="al_linux" value="libs/lwjgl-platform-${lwjglVersion}-natives-linux.jar, libs/jinput-platform-${jinputVersion}-natives-linux.jar">
<param name="al_mac" value="libs/lwjgl-platform-${lwjglVersion}-natives-osx.jar, libs/jinput-platform-${jinputVersion}-natives-osx.jar">
<param name="separate_jvm" value="true">
<param name="mods_path" value="http://blog.movingblocks.net/applet/">
<param name="mods" value="core.jar,funnyBlocks.jar,fences.jar,minerals.jar,morelights.jar,soils.jar,test.jar">
<param name="mods" value="${mods}">
<param name="java_arguments" value="-Xmx1024m">
</applet>
</div>
</body>
</html>
</html>

View File

@ -18,21 +18,26 @@ apply plugin: 'checkstyle'
* 3. Run 'gradlew wrapper'
* 4. Comment 'wrapper' task
*/
//task wrapper(type: Wrapper) {
// gradleVersion = '1.4'
//}
// task wrapper(type: Wrapper) {
// gradleVersion = '1.6'
// }
import groovy.json.JsonSlurper
import org.apache.tools.ant.filters.FixCrLfFilter;
import java.text.SimpleDateFormat;
def DEFAULT_MOD_TXT_START = '{\n "id" : "'
def DEFAULT_MOD_TXT_END = '",\n "displayName" : "",\n "description" : "",\n "dependencies" : []\n}'
def dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX")
dateTimeFormat.timeZone = TimeZone.getTimeZone("UTC")
def LWJGL_VERSION = '2.9.0'
def JINPUT_VERSION = '2.0.5'
// Declare "extra properties" (variables) for the project - a Gradle thing that makes them special.
ext {
startDateTimeString = new Date().format("yyyy-MM-dd_HH-mm-ss")
// Project paths
dirApplet = 'applet'
dirNatives = 'natives'
dirSavedWorlds = 'SAVED_WORLDS'
dirSaves = 'saves'
subDirLibs = 'libs'
subDirMods = 'mods'
destDirApplet = 'distributions/applet'
@ -41,26 +46,45 @@ ext {
destDirMods = "distributions/$subDirMods"
mainClassName = 'org.terasology.engine.Terasology'
jarFileName = 'Terasology.jar'
env = System.getenv() // read environment variables, including variables passed by jenking continuous integration server
templatesDir = file('templates')
// Read environment variables, including variables passed by jenkins continuous integration server
env = System.getenv()
// Settings for automatic version file
startDateTimeString = dateTimeFormat.format(new Date())
versionInfoFileDir = new File(sourceSets.main.output.resourcesDir, 'org/terasology/version')
versionInfoFile = new File(versionInfoFileDir, 'versionInfo.properties')
versionFileName = 'VERSION'
versionBase = rootProject.file("templates/version.txt").text.trim()
displayVersion = versionBase
}
// Declare remote repositories we're interested in - library files will be fetched from here
repositories {
mavenCentral()
maven {
url "http://slick2d-maven-dependencies.googlecode.com/svn/trunk/repository/"
}
}
/* Natives ----------------------------------------------------------------- */
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Natives
//
// Handling of pulling in and extracting native libraries for lwjgl
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Define a custom configuration for Natives
configurations {
natives
}
dependencies {
natives group: 'org.lwjgl.lwjgl', name: 'lwjgl', version: '2.9.0'
natives group: 'org.lwjgl.lwjgl', name: 'lwjgl', version: LWJGL_VERSION
}
task extractWindowsNatives(type:Sync) {
description = "Extracts the Windows natives from the downloaded zip"
from {
configurations.natives.collect { it.getName().contains('-natives-window') ? zipTree(it) : [] }
}
@ -69,6 +93,7 @@ task extractWindowsNatives(type:Sync) {
}
task extractMacOSXNatives(type:Sync) {
description = "Extracts the OSX natives from the downloaded zip"
from {
configurations.natives.collect { it.getName().contains('-natives-osx') ? zipTree(it) : [] }
}
@ -77,6 +102,7 @@ task extractMacOSXNatives(type:Sync) {
}
task extractLinuxNatives(type:Sync) {
description = "Extracts the Linux natives from the downloaded zip"
from {
configurations.natives.collect { it.getName().contains('-natives-linux') ? zipTree(it) : [] }
}
@ -85,26 +111,34 @@ task extractLinuxNatives(type:Sync) {
}
task extractNatives {
description = "Extracts all the native lwjgl libraries from the downloaded zip"
dependsOn extractWindowsNatives
dependsOn extractLinuxNatives
dependsOn extractMacOSXNatives
}
/* Java ------------------------------------------------------------- */
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Java
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sourceCompatibility = 1.7
// Add additional "source set" beyond the default (src/main/ + src/test/), in this case src/dev/ (utility)
sourceSets {
dev
}
// Customizations for the main compilation configuration
configurations {
// Exclude a couple of LWJGL modules that aren't needed during compilation
compile {
exclude module: 'lwjgl-platform'
exclude module: 'jinput-platform'
}
// Setup compilation for the dev source set
devCompile.extendsFrom compile
}
// Primary dependenices definition
dependencies {
compile group: 'org.codehaus.groovy', name: 'groovy', version: '1.8.7'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.2'
@ -113,28 +147,42 @@ dependencies {
compile group: 'com.google.protobuf', name: 'protobuf-java', version: '2.5.0'
compile group: 'net.sf.trove4j', name: 'trove4j', version: '3.0.3'
compile group: 'com.projectdarkstar.ext.jorbis', name: 'jorbis', version: '0.0.17'
compile group: 'org.lwjgl.lwjgl', name: 'lwjgl', version: '2.9.0'
compile group: 'org.lwjgl.lwjgl', name: 'lwjgl_util', version: '2.9.0'
compile group: 'org.lwjgl.lwjgl', name: 'lwjgl', version: LWJGL_VERSION
compile group: 'org.lwjgl.lwjgl', name: 'lwjgl_util', version: LWJGL_VERSION
compile group: 'io.netty', name: 'netty', version: '3.6.5.Final'
compile group: 'org.reflections', name: 'reflections', version: '0.9.8'
compile group: 'java3d', name: 'vecmath', version: '1.3.1'
compile group: 'net.java.dev.jna', name: 'jna', version: '3.5.2'
compile group: 'net.java.dev.jna', name: 'platform', version: '3.5.2'
// Would have liked to have left this runtime, but needed to "compile" the groovy config in IntelliJ
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.0.13'
compile group: 'net.java.dev.jna', name: 'jna', version: '3.5.2'
compile group: 'net.java.dev.jna', name: 'platform', version: '3.5.2'
compile ('org.newdawn.slick:slick:236') {
exclude module: 'lwjgl'
exclude module: 'natives-windows'
exclude module: 'natives-mac'
exclude module: 'natives-linux'
exclude module: 'jorbis'
}
// Also grab any libraries in the libs folder (not preferred)
compile fileTree(dir: 'libs', include: '*.jar')
// Needed as "compile" for logback.groovy in IntelliJ - otherwise it could be left as a runtime only dependency
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.0.13'
// These dependencies are only needed for running tests
testCompile group: 'junit', name: 'junit', version: '4.10'
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.0'
testCompile group: 'org.jboss.shrinkwrap', name: 'shrinkwrap-depchain-java7', version: '1.1.3'
testCompile group: 'org.jboss.shrinkwrap', name: 'shrinkwrap-depchain-java7', version: '1.1.3'
// The dev source set also needs these dependencines
devCompile sourceSets.main.output
}
// Instructions for packaging a jar file of the main project
jar {
archiveName = jarFileName
manifest {
def manifestClasspath = "$subDirLibs/"+configurations.runtime.collect { it.getName() }.join(" $subDirLibs/")
attributes("Main-Class": mainClassName, "Class-Path" : manifestClasspath, "Implementation-Title": project.name, "Implementation-Version": env.BUILD_NUMBER + " " + env.GIT_BRANCH + " " + env.BUILD_ID)
attributes("Main-Class": mainClassName, "Class-Path" : manifestClasspath, "Implementation-Title": project.name, "Implementation-Version": env.BUILD_NUMBER + ", " + env.GIT_BRANCH + ", " + env.BUILD_ID + ", " + displayVersion)
}
}
@ -152,23 +200,33 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
}
// Configuration for running unit tess
test {
dependsOn extractNatives
dependsOn extractNatives
// ignoreFailures: Specifies whether the build should break when the verifications performed by this task fail.
ignoreFailures = true
// showStandardStreams: makes the standard streams (err and out) visible at console when running tests
testLogging.showStandardStreams = true
// Arguments to include while running tests
jvmArgs '-Xms512m', '-Xmx1024m', '-XX:MaxPermSize=128m'
}
/* Mods -------------------------------------------------------------------- */
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Mods
//
// Configuration around the creation and inclusion of mods
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
subprojects {
// Ignore the actual "mods" directory as it itself is not a mod
if (name != 'mods') {
// Each mod gets set up as Java and prepped for being turned into an Eclipse or IntelliJ project
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
// Change the output dir of each mod to classes, as this is where Terasology will look when loading mods
sourceSets {
main {
java {
@ -176,35 +234,55 @@ subprojects {
}
}
}
task createSkeleton() {
mkdir('assets')
mkdir('src/main/java')
mkdir('assets/blocks')
mkdir('assets/blockTiles')
mkdir('assets/fonts')
mkdir('assets/materials')
mkdir('assets/mesh')
mkdir('assets/music')
mkdir('assets/prefabs')
mkdir('assets/shaders')
mkdir('assets/shapes')
mkdir('assets/sounds')
mkdir('assets/textures')
mkdir('src/test/java')
}
// Generate the mod directory structure if missing
task createSkeleton() {
mkdir('assets')
mkdir('assets/animations')
mkdir('assets/blocks')
mkdir('assets/blockTiles')
mkdir('assets/fonts')
mkdir('assets/materials')
mkdir('assets/mesh')
mkdir('assets/music')
mkdir('assets/prefabs')
mkdir('assets/shaders')
mkdir('assets/shapes')
mkdir('assets/skeletalMesh')
mkdir('assets/sounds')
mkdir('assets/textures')
mkdir('src/main/java')
mkdir('src/test/java')
}
// This task syncs everything in the assets dir into the output dir, used when jarring the mod
task syncAssets(type: Sync) {
from 'assets'
into 'classes/assets'
}
def modFile = file('mod.txt')
if (!modFile.exists()) {
modFile.createNewFile()
modFile.withWriter { writer ->
writer.write(DEFAULT_MOD_TXT_START)
writer.write(name)
writer.write(DEFAULT_MOD_TXT_END)
}
}
// This task creates a barebones mod.txt if it is missing, from a template
task createModManifest(type: Copy) {
from templatesDir
into projectDir
include 'mod.txt'
expand(id: project.name)
}
def modDepends = [];
def modFile = file('mod.txt')
// If modFile is missing, create it
if (!modFile.exists()) {
compileJava.dependsOn createModManifest
createSkeleton.dependsOn createModManifest
// Otherwise, retrieve dependencies information from it
} else {
def slurper = new JsonSlurper()
def modConfig = slurper.parseText( file('mod.txt').text)
modDepends = modConfig.dependencies;
}
// Jarring needs to copy mod.txt and all the assets into the output
jar.doFirst {
copy {
from 'mod.txt'
@ -212,11 +290,11 @@ subprojects {
}
}
jar.dependsOn syncAssets
def slurper = new JsonSlurper()
def modConfig = slurper.parseText( file('mod.txt').text)
def modDepends = modConfig.dependencies;
// Setup for IntelliJ projects
idea {
module {
// Output into classes and testClasses rather than the default
inheritOutputDirs = false
outputDir = file('classes')
testOutputDir = file('testClasses')
@ -225,26 +303,54 @@ subprojects {
}
}
}
// Setup for Eclipse projects
eclipse {
classpath {
// Output into classes rather than the default
defaultOutputDir = file('classes')
}
}
// Same repository configuration as root project
repositories {
mavenCentral()
maven {
url "http://slick2d-maven-dependencies.googlecode.com/svn/trunk/repository/"
}
}
// Set dependencies. Note that the dependency information from mod.txt is used
dependencies {
compile project(':')
testCompile group: 'junit', name: 'junit', version: '4.10'
for (dependency in modDepends) {
compile project(':mods:' + dependency)
}
for (dependency in modDepends) {
compile project(':mods:' + dependency)
}
}
}
}
task modClasses {
description = "Compile all mods"
subprojects.each { project ->
if (project.name != 'mods') {
modClasses.dependsOn project.tasks['classes']
}
}
}
task modAssemble {
description = "Assembles all mods"
subprojects.each { project ->
if (project.name != 'mods') {
modAssemble.dependsOn project.tasks['assemble']
}
}
}
/* Check ------------------------------------------------------------------- */
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Checkstyle
//
// This is used to check the style of the source for compliance with our code style guidelines
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
checkstyle.ignoreFailures = true
checkstyle.configProperties.samedir = checkstyle.configFile.parentFile
/* Optional check plugins
@ -258,30 +364,17 @@ findbugs.ignoreFailures = true
pmd.ignoreFailures = true
*/
/* Misc tasks ------------------------------------------------------------------- */
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Miscellaneous
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
task assembleMainOutput(type:Sync) {
description = "Helper task for when the game is being run from the command line"
from sourceSets.main.output
into "$buildDir/$destDirMainOutput"
}
task modClasses {
subprojects.each { project ->
if (project.name != 'mods') {
modClasses.dependsOn project.tasks['classes']
}
}
}
task modAssemble {
subprojects.each { project ->
if (project.name != 'mods') {
modAssemble.dependsOn project.tasks['assemble']
}
}
}
task run(type:JavaExec) {
description = "Run 'Terasology'"
description = "Run 'Terasology' to play the game"
dependsOn extractNatives
dependsOn assembleMainOutput
@ -291,22 +384,22 @@ task run(type:JavaExec) {
classpath configurations.runtime
}
task deleteSavedWorldsSubfolders(type: Delete) {
description = "Delete all subfolders from '$dirSavedWorlds'"
delete file(dirSavedWorlds).listFiles().findAll { it.directory }
task deleteSaves(type: Delete) {
description = "Delete all saved games"
delete file(dirSaves).listFiles().findAll { it.directory }
}
task deleteSavedWorldsFiles(type: Delete) {
description = "Delete all files from '$dirSavedWorlds'"
delete file(dirSavedWorlds).listFiles().findAll { !it.directory }
task deleteSaveFiles(type: Delete) {
description = "Delete all files in '$dirSaves'"
delete file(dirSaves).listFiles().findAll { !it.directory }
}
task zipSavedWorldsFolder(type: Zip) {
description = "Creates a SavedWorlds ZIP file from '$dirSavedWorlds'"
appendix = "SavedWorlds"
task zipSavesFolder(type: Zip) {
description = "Creates a Saves ZIP file from '$dirSaves'"
appendix = "SavedGames"
classifier = startDateTimeString
into (dirSavedWorlds) {
from dirSavedWorlds
into (dirSaves) {
from dirSaves
}
}
@ -315,8 +408,12 @@ task runProtobufWindows(type:Exec) {
commandLine 'protobuf\\compiler\\protoc.exe', '--proto_path=src\\main\\protobuf', '--java_out', 'src\\main\\java', 'src\\main\\protobuf\\*'
}
/* Distributions: Application/Applet ----------------------------------------*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Version file
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
task createVersionInfoFile {
dependsOn processResources
inputs.property('dateTime', startDateTimeString)
onlyIf { env.BUILD_URL != null }
doLast {
@ -326,13 +423,15 @@ task createVersionInfoFile {
ant.entry(key:'buildId',value:env.BUILD_ID)
ant.entry(key:'buildTag',value:env.BUILD_TAG)
ant.entry(key:'buildUrl',value:env.BUILD_URL)
ant.entry(key:'jobName',value:env.JOB_NAME)
ant.entry(key:'gitBranch',value:env.GIT_BRANCH)
ant.entry(key:'gitCommit',value:env.GIT_COMMIT)
ant.entry(key:'dateTime',value:startDateTimeString)
ant.entry(key:'displayVersion',value:displayVersion)
}
}
}
createVersionInfoFile.dependsOn processResources
jar.dependsOn createVersionInfoFile
task createVersionFile(type: Copy) {
@ -341,11 +440,15 @@ task createVersionFile(type: Copy) {
from 'src/template'
into "$buildDir"
include versionFileName
expand(buildNumber: env.BUILD_NUMBER, buildUrl: env.BUILD_URL, gitBranch: env.GIT_BRANCH, dateTime: startDateTimeString)
expand(buildNumber: env.BUILD_NUMBER, buildUrl: env.BUILD_URL, gitBranch: env.GIT_BRANCH, dateTime: startDateTimeString, displayVersion: displayVersion)
filter(FixCrLfFilter, eol:FixCrLfFilter.CrLf.newInstance("crlf"))
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Distributions
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
task distMods {
description = "Prepares the mods for distribution"
dependsOn modAssemble
subprojects.each { project ->
if (project.name != 'mods') {
@ -389,17 +492,19 @@ task distApplication(type:Sync) {
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Applet
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
configurations {
applet
}
dependencies {
applet group: 'org.lwjgl.lwjgl', name: 'lwjgl_util_applet', version: '2.8.5'
applet group: 'org.lwjgl.lwjgl', name: 'lwjgl_util_applet', version: LWJGL_VERSION
}
task distApplet(type:Sync) {
description = "Creates an Applet folder"
dependsOn distMods
task syncIntoApplet(type:Sync) {
into("$buildDir/$destDirApplet")
from ('README.markdown') {
filter(FixCrLfFilter, eol:FixCrLfFilter.CrLf.newInstance("crlf"))
@ -412,9 +517,6 @@ task distApplet(type:Sync) {
filter(FixCrLfFilter, eol:FixCrLfFilter.CrLf.newInstance("crlf"))
}
from jar
from(dirApplet) {
exclude '*.keystore'
}
from configurations.applet
into(subDirLibs) {
from configurations.runtime
@ -424,6 +526,33 @@ task distApplet(type:Sync) {
from "$buildDir/$destDirMods"
}
}
task createIndexHtml(type:Copy) {
mustRunAfter syncIntoApplet
def jars = []
configurations.runtime.each {
jars += 'lib/' + it.getName()
}
def mods = []
subprojects.each { project ->
if (project.name != 'mods') {
mods += project.name + '.jar'
}
}
from(dirApplet)
into("$buildDir/$destDirApplet")
include 'index.html'
expand(lwjglVersion: LWJGL_VERSION, jinputVersion : JINPUT_VERSION, jars : jars.join(", "), mods : mods.join(", "))
}
task distApplet {
description = "Creates an Applet folder"
dependsOn distMods
dependsOn syncIntoApplet
dependsOn createIndexHtml
}
// At the end of the applet distribution sign the jar files so they can get expanded rights in a browser
distApplet.doLast {
file("$buildDir/$destDirApplet").listFiles().each {
if (it.getName().endsWith(".jar"))
@ -466,38 +595,47 @@ task distAppletZip(type:Zip) {
from "$buildDir/$versionFileName"
}
/* IDE --------------------------------------------------------------------- */
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// IDE project setup
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ideaModule.dependsOn extractNatives
eclipseClasspath.dependsOn extractNatives
idea {
project {
jdkName = '1.7'
ipr {
withXml {
def node = it.asNode()
def copyrightManager = node.find {it.@name == 'CopyrightManager'}
copyrightManager.@default = "TerasologyEngine"
def copyright = copyrightManager.appendNode("copyright")
copyright.appendNode("option", [name : "notice", value : 'Copyright 2013 Moving Blocks\n\nLicensed under the Apache License, Version 2.0 (the "License");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an "AS IS" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.'])
copyright.appendNode("option", [name : "keyword", value : "Copyright"])
copyright.appendNode("option", [name : "allowReplaceKeywod", value : ""])
copyright.appendNode("option", [name : "myName", value : "TerasologyEngine"])
copyright.appendNode("option", [name : "myLocal", value : "true"])
def langOptions = copyrightManager.appendNode("LanguageOptions", [name : "__TEMPLATE__"])
langOptions.appendNode("option", [name : "addBlankAfter", value : "false"])
def entryPointsManager = node.appendNode('component', [name : "EntryPointsManager"])
def entryPoints = entryPointsManager.appendNode('entry_points', [version : '2.0'])
def entryPointsList = entryPointsManager.appendNode('list', [size : '3'])
entryPointsList.appendNode('item', [index : '0', class : 'java.lang.String', itemvalue : 'org.terasology.entitySystem.event.ReceiveEvent'])
entryPointsList.appendNode('item', [index : '1', class : 'java.lang.String', itemvalue : 'org.terasology.entitySystem.systems.In'])
entryPointsList.appendNode('item', [index : '2', class : 'java.lang.String', itemvalue : 'org.terasology.entitySystem.systems.RegisterSystem'])
entryPointsList.appendNode('item', [index : '3', class : 'java.lang.String', itemvalue : 'org.terasology.logic.console.Command'])
}
}
}
project {
jdkName = '1.7'
ipr {
withXml {
// Setup copyright statement injection
def node = it.asNode()
def copyrightManager = node.find {it.@name == 'CopyrightManager'}
copyrightManager.@default = "TerasologyEngine"
def copyright = copyrightManager.appendNode("copyright")
copyright.appendNode("option", [name : "notice", value : 'Copyright 2013 Moving Blocks\n\nLicensed under the Apache License, Version 2.0 (the "License");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an "AS IS" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.'])
copyright.appendNode("option", [name : "keyword", value : "Copyright"])
copyright.appendNode("option", [name : "allowReplaceKeywod", value : ""])
copyright.appendNode("option", [name : "myName", value : "TerasologyEngine"])
copyright.appendNode("option", [name : "myLocal", value : "true"])
def langOptions = copyrightManager.appendNode("LanguageOptions", [name : "__TEMPLATE__"])
langOptions.appendNode("option", [name : "addBlankAfter", value : "false"])
// Setup knowledge of certain annotations being entry points (so don't mark annotated items as unused)
def entryPointsManager = node.appendNode('component', [name : "EntryPointsManager"])
def entryPoints = entryPointsManager.appendNode('entry_points', [version : '2.0'])
def entryPointsList = entryPointsManager.appendNode('list', [size : '3'])
entryPointsList.appendNode('item', [index : '0', class : 'java.lang.String', itemvalue : 'org.terasology.entitySystem.event.ReceiveEvent'])
entryPointsList.appendNode('item', [index : '1', class : 'java.lang.String', itemvalue : 'org.terasology.entitySystem.systems.In'])
entryPointsList.appendNode('item', [index : '2', class : 'java.lang.String', itemvalue : 'org.terasology.entitySystem.systems.RegisterSystem'])
entryPointsList.appendNode('item', [index : '3', class : 'java.lang.String', itemvalue : 'org.terasology.logic.console.Command'])
}
}
}
// Add benchmarking "dev" directory
module.sourceDirs += sourceSets.dev.allJava.srcDirs
// Exclude these directories from the project view
module.excludeDirs += file('bin')
module.excludeDirs += file('gradle')
module.excludeDirs += file('logs')
module.excludeDirs += file('natives')
module.excludeDirs += file('protobuf')

Binary file not shown.

View File

@ -1,6 +1,6 @@
#Fri Feb 15 21:42:11 EST 2013
#Sat Jul 20 13:52:56 EST 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.4-bin.zip
distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip

6
gradlew vendored
View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
##############################################################################
##
@ -61,9 +61,9 @@ while [ -h "$PRG" ] ; do
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

Binary file not shown.

Binary file not shown.

View File

@ -68,7 +68,7 @@ public class PNGTextureLoader implements AssetLoader<TextureData> {
PNGDecoder decoder = new PNGDecoder(pngStream);
ByteBuffer buf = ByteBuffer.allocateDirect(4 * decoder.getWidth() * decoder.getHeight());
decoder.decode(buf, decoder.getWidth() * 4, PNGDecoder.RGBA);
decoder.decode(buf, decoder.getWidth() * 4, PNGDecoder.Format.RGBA);
buf.flip();
ByteBuffer data = buf;

View File

@ -85,7 +85,7 @@ public class WorldAtlasBuilder {
ImageIO.write(image, "png", bos);
PNGDecoder decoder = new PNGDecoder(new ByteArrayInputStream(bos.toByteArray()));
ByteBuffer buf = ByteBuffer.allocateDirect(4 * decoder.getWidth() * decoder.getHeight());
decoder.decode(buf, decoder.getWidth() * 4, PNGDecoder.RGBA);
decoder.decode(buf, decoder.getWidth() * 4, PNGDecoder.Format.RGBA);
buf.flip();
data[i] = buf;
} catch (IOException e) {

8
templates/mod.txt Normal file
View File

@ -0,0 +1,8 @@
{
"id" : "${id}",
"version" : "",
"author" : "",
"displayName" : "",
"description" : "",
"dependencies" : []
}

1
templates/version.txt Normal file
View File

@ -0,0 +1 @@
pre-alpha