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