Commit 436e5412 authored by Vitaliy Vashchenko's avatar Vitaliy Vashchenko

#884 code refactoring of build file

parent c193239a
......@@ -40,6 +40,8 @@ final assetsDirName = "assets"
final assetsSourceDirName = "src"
final assetsDestinationDirName = "dest"
final assetsHdDirName = "hd"
final assetsGameDirectory = "game"
final assetsGameGlobalDirectory = "_global"
final assetsGameCommonDifficultyDirectory = "common"
......@@ -58,7 +60,7 @@ ext {
assetsPackDir = new File("${rootProject.buildDir}/${assetsDirName}/pack/")
assetsHdPackDir = new File("${rootProject.buildDir}/${assetsDirName}/hd/pack/")
assetsHdPackDir = new File("${rootProject.buildDir}/${assetsDirName}/${assetsHdDirName}/pack/")
}
allprojects {
......@@ -206,11 +208,11 @@ task copyDefaulAssets(){
task prepareHdAssets(dependsOn: [prepareAssets, prepareSoundAssets, prepareJsonAssets]) {
def sourceDir = new File("${buildDir}/${assetsDirName}/src/")
def hdSourceDir = new File(project(":desktop").projectDir.absolutePath + "/${assetsDirName}/" + "hd/")
def hdSourceDir = new File(project(":desktop").projectDir.absolutePath + "/${assetsDirName}/${assetsHdDirName}")
inputs.dir(sourceDir.absolutePath)
outputs.dir("${buildDir}/${assetsDirName}/" + "hd/" + "${assetsSourceDirName}/")
outputs.dir("${buildDir}/${assetsDirName}/${assetsHdDirName}/${assetsSourceDirName}/")
outputs.upToDateWhen { false }
doLast {
......@@ -219,7 +221,7 @@ task prepareHdAssets(dependsOn: [prepareAssets, prepareSoundAssets, prepareJsonA
task("copyingDefaultDest", type: Copy) {
from buildDir.absolutePath + "/${assetsDirName}/${assetsDestinationDirName}/"
into buildDir.absolutePath + "/${assetsDirName}/hd/dest/"
into buildDir.absolutePath + "/${assetsDirName}/${assetsHdDirName}/${assetsDestinationDirName}/"
}.execute()
......@@ -227,7 +229,7 @@ task prepareHdAssets(dependsOn: [prepareAssets, prepareSoundAssets, prepareJsonA
if (!dir.name.equals('common')) {
String dirName = dir.getName()
String destDir = "${buildDir}/${assetsDirName}/" + "hd/" + "${assetsSourceDirName}/${dirName}"
String destDir = "${buildDir}/${assetsDirName}/${assetsHdDirName}/${assetsSourceDirName}/${dirName}"
task("${name}_${dirName}", type: Copy) {
from dir.absolutePath
from hdSourceDir.absolutePath + "/common"
......@@ -324,10 +326,10 @@ task zipAssets(dependsOn: [prepareSoundAssets, prepareGraphicAssets, prepareJson
}
task prepareHdGraphicAssets(dependsOn: prepareHdAssets) {
def assetsDir = new File("${buildDir}/${assetsDirName}/" + "hd/")
def assetsDir = new File("${buildDir}/${assetsDirName}/${assetsHdDirName}/")
inputs.dir("${assetsDir.absolutePath}/"+"hd/"+"${assetsSourceDirName}/")
outputs.dir("${assetsDir.absolutePath}/"+"hd/"+"${assetsDestinationDirName}/")
inputs.dir("${assetsDir.absolutePath}/${assetsHdDirName}/${assetsSourceDirName}/")
outputs.dir("${assetsDir.absolutePath}/${assetsHdDirName}/${assetsDestinationDirName}/")
outputs.upToDateWhen { false }
doLast {
......@@ -356,7 +358,7 @@ task prepareHdGraphicAssets(dependsOn: prepareHdAssets) {
} else {
task("${name}_" + sectionDir.name + "_" + langDir.name + "_" + atlasDir.name + "_" + difficultyDir.name, type: Copy) {
from difficultyDir
into "${buildDir}/${assetsDirName}/" + "hd/" + "${assetsDestinationDirName}/${langDir.name}/${sectionDir.name}/${atlasDir.name}/${difficultyDir.name}"
into "${buildDir}/${assetsDirName}/${assetsHdDirName}/${assetsDestinationDirName}/${langDir.name}/${sectionDir.name}/${atlasDir.name}/${difficultyDir.name}"
include '**/*'
includeEmptyDirs false
outputs.upToDateWhen { false }
......@@ -373,7 +375,7 @@ task prepareHdGraphicAssets(dependsOn: prepareHdAssets) {
} else {
task("${name}_" + sectionDir.name + "_" + langDir.name, type: Copy) {
from sectionDir
into "${buildDir}/${assetsDirName}/" + "hd/" + "${assetsDestinationDirName}/${langDir.name}/${sectionDir.name}"
into "${buildDir}/${assetsDirName}/${assetsHdDirName}/${assetsDestinationDirName}/${langDir.name}/${sectionDir.name}"
include '**/*'
includeEmptyDirs false
outputs.upToDateWhen { false }
......@@ -391,8 +393,8 @@ task zipHdAssets(dependsOn: prepareHdGraphicAssets) {
def assetsDir = new File("${buildDir}/${assetsDirName}/")
inputs.dir("${assetsDir.absolutePath}/"+"hd/"+"${assetsSourceDirName}/")
outputs.dir("${assetsDir.absolutePath}/"+"hd/"+"${assetsDestinationDirName}/")
inputs.dir("${assetsDir.absolutePath}/${assetsHdDirName}/${assetsSourceDirName}/")
outputs.dir("${assetsDir.absolutePath}/${assetsHdDirName}/${assetsDestinationDirName}/")
outputs.upToDateWhen { false }
doLast {
......@@ -403,7 +405,7 @@ task zipHdAssets(dependsOn: prepareHdGraphicAssets) {
task("${name}_${dir.name}", type: Zip) {
archiveName = dir.getName() + "_SNAPSHOT_HD.zip"
destinationDir = rootProject.ext.assetsHdPackDir
from "${buildDir}/${assetsDirName}/" + "hd/" + "${assetsDestinationDirName}/${dir.name}"
from "${buildDir}/${assetsDirName}/${assetsHdDirName}/${assetsDestinationDirName}/${dir.name}"
}.execute()
}
}
......
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