Commit b82086eb authored by Vitaliy Vashchenko's avatar Vitaliy Vashchenko

#884 fixed hd checksum task being executed when hd assets are not needed. Added new HD assets

parent 6a4704a4
......@@ -201,29 +201,35 @@ task prepareJsonAssets(dependsOn: prepareAssets) {
}
}
task copyDefaulAssets(){
}
task prepareHdAssets(dependsOn: [prepareAssets, prepareSoundAssets, prepareJsonAssets]) {
task prepareHdAssets(dependsOn: prepareAssets) {
def sourceDir = new File("${buildDir}/${assetsDirName}/src/")
def assetsDir = new File("${buildDir}/${assetsDirName}/")
def hdSourceDir = new File(project(":desktop").projectDir.absolutePath + "/${assetsDirName}/${assetsHdDirName}")
inputs.dir(sourceDir.absolutePath)
inputs.dir(hdSourceDir.absolutePath)
outputs.dir("${buildDir}/${assetsDirName}/${assetsHdDirName}/${assetsSourceDirName}/")
outputs.upToDateWhen { false }
doLast {
if (project.hasProperty('TABLEXIA_HD_ASSETS') && Boolean.valueOf(TABLEXIA_HD_ASSETS).booleanValue()) {
task("copyingDefaultDest", type: Copy) {
from buildDir.absolutePath + "/${assetsDirName}/${assetsDestinationDirName}/"
into buildDir.absolutePath + "/${assetsDirName}/${assetsHdDirName}/${assetsDestinationDirName}/"
new File("${assetsDir}/${assetsSourceDirName}/").eachDir() { langDir ->
langDir.eachDir() { sectionDir ->
sectionDir.eachDir() { atlasDir ->
task("${name}_sounds_" + sectionDir.name + "_" + atlasDir.name + "_" + langDir.name, type: Copy) {
from atlasDir
into "${buildDir}/${assetsDirName}/${assetsHdDirName}/${assetsDestinationDirName}/${langDir.name}/${sectionDir.name}/${atlasDir.name}/"
include '**/*.mp3', '**/*.json'
includeEmptyDirs false
eachFile { FileCopyDetails fcd ->
fcd.setPath(fcd.getRelativePath().toString().replace('/', '.'))
}
outputs.upToDateWhen { false }
}.execute()
}
}
}
sourceDir.eachDir() { dir ->
......@@ -328,9 +334,8 @@ task zipAssets(dependsOn: [prepareSoundAssets, prepareGraphicAssets, prepareJson
task prepareHdGraphicAssets(dependsOn: prepareHdAssets) {
def assetsDir = new File("${buildDir}/${assetsDirName}/${assetsHdDirName}/")
inputs.dir("${assetsDir.absolutePath}/${assetsHdDirName}/${assetsSourceDirName}/")
outputs.dir("${assetsDir.absolutePath}/${assetsHdDirName}/${assetsDestinationDirName}/")
outputs.upToDateWhen { false }
inputs.dir("${assetsDir.absolutePath}/${assetsSourceDirName}/")
outputs.dir("${assetsDir.absolutePath}/${assetsDestinationDirName}/")
doLast {
if (project.hasProperty('TABLEXIA_HD_ASSETS') && Boolean.valueOf(TABLEXIA_HD_ASSETS).booleanValue()) {
......@@ -390,13 +395,6 @@ task prepareHdGraphicAssets(dependsOn: prepareHdAssets) {
}
task zipHdAssets(dependsOn: prepareHdGraphicAssets) {
def assetsDir = new File("${buildDir}/${assetsDirName}/")
inputs.dir("${assetsDir.absolutePath}/${assetsHdDirName}/${assetsSourceDirName}/")
outputs.dir("${assetsDir.absolutePath}/${assetsHdDirName}/${assetsDestinationDirName}/")
outputs.upToDateWhen { false }
doLast {
if (project.hasProperty('TABLEXIA_HD_ASSETS') && Boolean.valueOf(TABLEXIA_HD_ASSETS).booleanValue()) {
new File(project(":core").projectDir.absolutePath + "/${assetsDirName}/").eachDir() { dir ->
......@@ -448,17 +446,23 @@ task processAssets(dependsOn: [':util:checksum:runChecksum', ':util:checksum:run
task prepareHdPack(dependsOn: [':util:checksum:runHdChecksum', ':util:checksum:runHdAssetsArchivesChecksum']) {
doLast {
//prepare and upload hd packs
if (project.hasProperty('TABLEXIA_HD_ASSETS_UPLOAD_USER') && project.hasProperty('TABLEXIA_ASSETS_UPLOAD_URL') && project.hasProperty('TABLEXIA_ASSETS_UPLOAD') && Boolean.valueOf(TABLEXIA_ASSETS_UPLOAD).booleanValue()) {
if (project.hasProperty('TABLEXIA_HD_ASSETS') &&
project.hasProperty('TABLEXIA_ASSETS_UPLOAD_USER') &&
project.hasProperty('TABLEXIA_ASSETS_UPLOAD_URL') &&
project.hasProperty('TABLEXIA_ASSETS_UPLOAD') &&
Boolean.valueOf(TABLEXIA_ASSETS_UPLOAD).booleanValue() &&
Boolean.valueOf(TABLEXIA_HD_ASSETS).booleanValue()) {
def data = new URL(project.assetsDownloadUrl).getText()
rootProject.ext.assetsHdPackDir.eachFile() { file ->
String fileName = file.getName()
String[] fileNameParts = fileName.split("_SNAPSHOT\\.");
String packageName = "${fileNameParts[0]}_${assetsHdChecksum[fileNameParts[0]]}.${fileNameParts[1]}";
String[] fileNameParts = fileName.split("_SNAPSHOT");
String packageName = "${fileNameParts[0]}_${assetsHdChecksum[fileNameParts[0]]}${fileNameParts[1]}";
if (!data.contains(packageName)) {
String assetsUploadPath = "${project.assetsUploadURL}${packageName}"
String assetsUploadPath = "${project.assetsDebugURLPart}${packageName}"
println "AssetsUploader: UPLOADING FILE: ${project.assetsDebugURLPart}${packageName}"
task ("${name}_${packageName}", type:Exec) {
task("${name}_${packageName}", type: Exec) {
workingDir "${rootProject.projectDir}"
commandLine 'scp', file.getAbsolutePath(), assetsUploadPath
standardOutput = new ByteArrayOutputStream()
......@@ -571,6 +575,7 @@ def getMapConvertedToString(Map map) {
project(":desktop") {
apply plugin: "java"
tasks.processResources.dependsOn prepareHdPack
dependencies {
compile project(":core")
......@@ -623,7 +628,6 @@ project(":core") {
sourceSets.test.java.srcDirs = ["test/"]
tasks.processResources.dependsOn processAssets
tasks.processResources.dependsOn prepareHdPack
dependencies {
compile project(":util:checksum")
......
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.tools.texturepacker.TexturePacker
import edu.sc.seis.launch4j.tasks.Launch4jLibraryTask
import groovy.io.FileType
import org.apache.tools.ant.filters.ReplaceTokens
......
......@@ -66,6 +66,7 @@ task runAssetsArchivesChecksum(dependsOn: [classes, rootProject.tasks.zipAssets]
task runHdChecksum(dependsOn: [classes, rootProject.tasks.prepareHdGraphicAssets]) {
doLast {
if (project.hasProperty("TABLEXIA_HD_ASSETS") && Boolean.valueOf(TABLEXIA_HD_ASSETS).booleanValue()) {
def sourceDir = new File("${rootProject.buildDir}/assets/hd/dest/")
sourceDir.eachDir() { dir ->
String dirName = dir.getName()
......@@ -83,10 +84,12 @@ task runHdChecksum(dependsOn: [classes, rootProject.tasks.prepareHdGraphicAssets
}.execute()
}
}
}
}
task runHdAssetsArchivesChecksum(dependsOn: [classes, rootProject.tasks.zipHdAssets]) {
doLast {
if (project.hasProperty("TABLEXIA_HD_ASSETS") && Boolean.valueOf(TABLEXIA_HD_ASSETS).booleanValue()) {
rootProject.ext.assetsHdPackDir.eachFile() { file ->
String fileName = file.getName()
if (fileName.endsWith(".zip")) {
......@@ -105,4 +108,5 @@ task runHdAssetsArchivesChecksum(dependsOn: [classes, rootProject.tasks.zipHdAss
}
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment