An error occurred while loading the file. Please try again.
-
Matyáš Latner authored
* new api for loading texture regions from atlases * removed old texture loader * gradle tasks for assets preparing * gradle UP-TO-DATE task check * application new api fix * atlases automatic linear filtering * sound assets conversion to flat hierarchy * automatic global assets loading * automatic screen and game local assets loading
ea6caab0
build.gradle 9.71 KiB
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.tools.texturepacker.TexturePacker
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'org.robovm:robovm-gradle-plugin:1.2.0'
classpath 'de.felixschulze.gradle:gradle-spoon-plugin:2.1'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
classpath 'com.novoda:gradle-android-command-plugin:1.3.0'
classpath "com.badlogicgames.gdx:gdx-tools:1.6.1"
}
}
final assetsDirName = "assets"
final assetsSourceDirName = "src"
final assetsDestinationDirName = "dest"
ext {
assetsChecksumPattern = "\"=======ASSETS_CHECKSUM=======\""
assetsChecksum = [:]
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = getVersionNameFromGit()
ext {
appName = 'Tablexia'
tablexiaVersionName = getVersionNameFromGit()
tablexiaVersionCode = getVersionCodeFromGit()
applicationIdRelease = 'cz.nic.tablexia'
applicationIdDebugSuffix = '.debug'
applicationIdDebug = applicationIdRelease + applicationIdDebugSuffix
applicationIdDevelSuffix = '.devel'
applicationIdDevel = applicationIdRelease + applicationIdDevelSuffix
gdxVersion = '1.6.1'
gdxUtilsVersion = '0.9.1'
mbassadorVersion = '1.2.0'
roboVMVersion = '1.2.0'
box2DLightsVersion = '1.3'
ashleyVersion = '1.3.1'
aiVersion = '1.4.0'
sqlDroidVersion = '1.0.3'
sqlLiteJdbcVersion = '3.8.10.1'
guavaVersion = '18.0'
}
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
task clean << {
delete "${buildDir}"
}
task prepareAssets {
def sourceDir = new File(project(":core").projectDir.absolutePath + "/${assetsDirName}")
inputs.dir(sourceDir.absolutePath)
outputs.dir("${buildDir}/${assetsDirName}/${assetsSourceDirName}/")
doLast {
sourceDir.eachDir() { dir ->
if (!dir.name.equals('common')) {
String dirName = dir.getName()
String destDir = "${buildDir}/${assetsDirName}/${assetsSourceDirName}/${dirName}"
task("${name}_${dirName}", type: Copy) {
from sourceDir.absolutePath + "/common"
from dir.absolutePath
into destDir
}.execute()
}
}
}
}
task prepareSoundAssets(dependsOn: prepareAssets) {
def assetsDir = new File("${buildDir}/${assetsDirName}/")
inputs.dir("${assetsDir.absolutePath}/${assetsSourceDirName}/")
outputs.dir("${assetsDir.absolutePath}/${assetsDestinationDirName}/")
doLast {
new File("${assetsDir}/${assetsSourceDirName}/").eachDir() { langDir ->
langDir.eachDir() { sectionDir ->
sectionDir.eachDir() { atlasDir ->
task("${name}_" + atlasDir.name + "_" + langDir.name, type: Copy) {
from atlasDir
into "${buildDir}/${assetsDirName}/${assetsDestinationDirName}/${langDir.name}/${sectionDir.name}/${atlasDir.name}/"
include '**/*.mp3'
includeEmptyDirs false
eachFile { FileCopyDetails fcd ->
fcd.setPath(fcd.getRelativePath().toString().replace(File.separator, '.'))
}
}.execute()
}
}
}
}
}
task prepareGraphicAssets(dependsOn: prepareAssets) {
def assetsDir = new File("${buildDir}/${assetsDirName}/")
inputs.dir("${assetsDir.absolutePath}/${assetsSourceDirName}/")
outputs.dir("${assetsDir.absolutePath}/${assetsDestinationDirName}/")
doLast {
TexturePacker.Settings settings = new TexturePacker.Settings();
settings.pot = false;
settings.maxWidth = 2048;
settings.maxHeight = 2048;
settings.combineSubdirectories = true;
settings.filterMin = Texture.TextureFilter.Linear;
settings.filterMag = Texture.TextureFilter.Linear;
new File("${assetsDir.absolutePath}/${assetsSourceDirName}/").eachDir() { langDir ->
langDir.eachDir() { sectionDir ->
sectionDir.eachDir() { atlasDir ->
TexturePacker.process(settings,
"${atlasDir}",
"${assetsDir.absolutePath}/${assetsDestinationDirName}/${langDir.name}/${sectionDir.name}/${atlasDir.name}/",
"${atlasDir.name}")
}
}
}
}
}
task zipAssets(dependsOn: [prepareSoundAssets, prepareGraphicAssets]) {
doLast {
new File(project(":core").projectDir.absolutePath + "/${assetsDirName}").eachDir() { dir ->
if (!dir.name.equals('common')) {
task("${name}_${dir.name}", type: Zip) {
archiveName = dir.getName() + ".zip"
destinationDir = new File(project(":android").projectDir.absolutePath + "/${assetsDirName}")
from "${buildDir}/${assetsDirName}/${assetsDestinationDirName}/${dir.name}"
}.execute()
}
}
}
}
def getVersionNameFromGit() {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags', '--always'
standardOutput = stdout
}
return stdout.toString().trim()
}
def getVersionCodeFromGit() {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'log', '-1', '--format=%at'
standardOutput = stdout
}
return stdout.toString().trim().toInteger()
}
def getMapConvertedToString(Map map) {
String result = "";
map.each { key, value ->
if (result.size() > 0) result = result + ","
result = result + "$key:$value"
}
return result;
}
project(":desktop") {
apply plugin: "java"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
compile "net.engio:mbassador:$mbassadorVersion"
compile "com.jcabi:jcabi-manifests:1.1"
compile "org.xerial:sqlite-jdbc:$sqlLiteJdbcVersion"
}
}
project(":android") {
apply plugin: 'android-sdk-manager'
apply plugin: "android"
apply plugin: "spoon"
apply plugin: 'android-command'
configurations { natives }
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "net.engio:mbassador:$mbassadorVersion"
compile "org.sqldroid:sqldroid:$sqlDroidVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
testCompile 'org.robolectric:robolectric:2.3'
androidTestCompile "com.squareup.spoon:spoon-client:1.1.7"
androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.3.1'
}
}
project(":ios") {
apply plugin: "java"
apply plugin: "robovm"
configurations { natives }
dependencies {
compile project(":core")
compile "org.robovm:robovm-rt:${roboVMVersion}"
compile "org.robovm:robovm-cocoatouch:${roboVMVersion}"
compile "net.engio:mbassador:$mbassadorVersion"
compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
}
}
/*
project(":html") {
apply plugin: "gwt"
apply plugin: "war"
dependencies {
compile project(":core")
compile "net.engio:mbassador:$mbassadorVersion"
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
compile "net.dermetfan.libgdx-utils:libgdx-utils:$gdxUtilsVersion"
}
}
*/
project(":core") {
apply plugin: "java"
sourceSets.test.java.srcDirs = ["test/"]
tasks.processResources.dependsOn zipAssets
dependencies {
compile project(":util:checksum")
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "net.dermetfan.libgdx-utils:libgdx-utils:$gdxUtilsVersion"
compile "net.engio:mbassador:$mbassadorVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "com.google.guava:guava:$guavaVersion"
testCompile "junit:junit:4.11"
testCompile "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
testCompile "com.badlogicgames.gdx:gdx:$gdxVersion"
testCompile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
}
}
tasks.eclipse.doLast {
delete ".project"
}