diff --git a/android/build.gradle b/android/build.gradle index 64d3d94fe1e8ab66b32ad3f5fdccd34fbabdd021..58840a8c18c0d8b9dd1c2594fa405eb3c3f2d9cb 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -20,23 +20,27 @@ android { targetSdkVersion 17 versionName tablexiaVersionName versionCode tablexiaVersionCode - applicationId rootProject.applicationIdRelease - testApplicationId rootProject.applicationIdRelease + ".test" + applicationId rootProject.applicationBaseId + testApplicationId rootProject.applicationBaseId + ".test" } buildTypes { debug { - applicationIdSuffix rootProject.applicationIdDebugSuffix + applicationIdSuffix rootProject.applicationIdBranch + rootProject.applicationIdDebugSuffix buildConfigField ASSETS_CHECKSUM_FIELD_TYPE, ASSETS_CHECKSUM_FIELD_NAME, rootProject.ext.assetsChecksumPattern + resValue "string", "app_name", "${tablexiaAppName}" } release { debuggable false + applicationIdSuffix rootProject.applicationIdBranch buildConfigField ASSETS_CHECKSUM_FIELD_TYPE, ASSETS_CHECKSUM_FIELD_NAME, rootProject.ext.assetsChecksumPattern + resValue "string", "app_name", "${tablexiaAppName}" } devel.initWith(buildTypes.debug) devel { applicationIdSuffix rootProject.applicationIdDevelSuffix buildConfigField ASSETS_CHECKSUM_FIELD_TYPE, ASSETS_CHECKSUM_FIELD_NAME, rootProject.ext.assetsChecksumPattern + resValue "string", "app_name", "${tablexiaAppName}" } } diff --git a/android/res/main/values/strings.xml b/android/res/main/values/strings.xml index 5537f804146ce44eebb32399e17e812600aad24c..045e125f3d8dad8668061d471dd9869e29e4713a 100644 --- a/android/res/main/values/strings.xml +++ b/android/res/main/values/strings.xml @@ -1,6 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - - <string name="app_name">Tablexia</string> - </resources> diff --git a/build.gradle b/build.gradle index 19bd20c4812d4ab6c6e2c98de9e1bb9eacecddaa..d1faa25b5e3bfcc257c4c0d20b9522bfce6b9742 100644 --- a/build.gradle +++ b/build.gradle @@ -26,8 +26,6 @@ final assetsGameGlobalDirectory = "_global" final assetsGameCommonDifficultyDirectory = "common" final assetsGameExcludedDirectory = "excluded" -final String ASSETS_DOWNLOAD_URL = "https://www.tablexia.cz/static/assets/" - System.setProperty("javax.net.ssl.trustStore", new File("${project(":android").projectDir.absolutePath}/assets/keystore/tablexiaTrustKeystore").getAbsolutePath()); System.setProperty("javax.net.ssl.trustStorePassword", "tablexia"); @@ -42,17 +40,19 @@ allprojects { apply plugin: "eclipse" apply plugin: "idea" - version = getVersionNameFromGit() - ext { appName = 'Tablexia' + masterBranch = 'master' + applicationBaseId = 'cz.nic.tablexia' + tablexiaAppName = getTablexiaAppName() tablexiaVersionName = getVersionNameFromGit() tablexiaVersionCode = getVersionCodeFromGit() - applicationIdRelease = 'cz.nic.tablexia' + applicationIdBranch = getTablexiaAppId() + applicationIdRelease = applicationBaseId + applicationIdBranch applicationIdDebugSuffix = '.debug' applicationIdDebug = applicationIdRelease + applicationIdDebugSuffix applicationIdDevelSuffix = '.devel' - applicationIdDevel = applicationIdRelease + applicationIdDevelSuffix + applicationIdDevel = applicationBaseId + applicationIdDevelSuffix gdxVersion = '1.9.2' gdxUtilsVersion = '0.13.2' @@ -66,6 +66,8 @@ allprojects { googlePlayServicesVersion = '8.3.+' } + version = getVersionNameFromGit() + repositories { mavenCentral() jcenter { @@ -246,6 +248,24 @@ task processAssets(dependsOn: [':util:checksum:runChecksum', ':util:checksum:run } } +def getTablexiaAppName() { + String branchName = getBranchNameFromGit() + if (project.masterBranch.equals(branchName)) { + return "${project.appName}" + } else { + return "${project.appName} (${branchName})" + } +} + +def getTablexiaAppId() { + String branchName = getBranchNameFromGit() + if (project.masterBranch.equals(branchName)) { + return "" + } else { + return ".${branchName.trim().replaceAll('-', '').replaceAll('\\.', '').toLowerCase()}" + } +} + def getVersionNameFromGit() { def stdout = new ByteArrayOutputStream() String branchName = getBranchNameFromGit() @@ -258,23 +278,17 @@ def getVersionNameFromGit() { String result = stdout.toString().trim(); // for non release branches add number of commits and branch name - //FIXME workaround for BETA-3.2 AppStore upload -// if (!"master".equals(branchName)) { -// stdout = new ByteArrayOutputStream() -// exec { -// commandLine 'git', 'rev-list', "${result}..HEAD", '--count' -// standardOutput = stdout -// } -// String numberOfCommits = stdout.toString().trim() -// -// if ("devel".equals(branchName)) { -// // add only number of commits for devel branch -// result = "${result}-${numberOfCommits}" -// } else { -// // add branch name and number of commits -// result = "${result}-${branchName}-${numberOfCommits}" -// } -// } + if (!project.masterBranch.equals(branchName)) { + stdout = new ByteArrayOutputStream() + exec { + commandLine 'git', 'rev-list', "${result}..HEAD", '--count' + standardOutput = stdout + } + String numberOfCommits = stdout.toString().trim() + + // add branch name and number of commits + result = "${result}-${numberOfCommits}" + } return result } diff --git a/core/build.gradle b/core/build.gradle index c2f5180bd22a4fc4d84c073e1ab258432c687f11..6894b0f574f4314c8359a5f400ac1954b82a9ea0 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -34,6 +34,7 @@ task writeTablexiaBuildConfig { " */\n" + "public class TablexiaBuildConfig {\n" + "\n" + + " public final static String APP_NAME = \"${tablexiaAppName}\";\n" + " public final static String VERSION_NAME = \"${tablexiaVersionName}\";\n" + " public final static String ASSETS_CHECKSUM = \"${getMapConvertedToString(rootProject.ext.assetsChecksum)}\";\n" + " public final static String TABLEXIA_ASSETS_URL = ${project.hasProperty('TABLEXIA_ASSETS_DOWNLOAD_URL') ? "\"$TABLEXIA_ASSETS_DOWNLOAD_URL\"" : "null"};\n" + diff --git a/core/src/cz/nic/tablexia/TablexiaSettings.java b/core/src/cz/nic/tablexia/TablexiaSettings.java index cfed6a6a129514b79216a9d6f759eadd0fe23d18..1a0a5ed5ddb549c79f03a0179b286ce5420e414a 100644 --- a/core/src/cz/nic/tablexia/TablexiaSettings.java +++ b/core/src/cz/nic/tablexia/TablexiaSettings.java @@ -57,7 +57,7 @@ public class TablexiaSettings { private static boolean winterMode = false; - private static final String APP_NAME = "Tablexia"; + private static final String APP_NAME = TablexiaBuildConfig.APP_NAME; private final String VERSION_NAME = TablexiaBuildConfig.VERSION_NAME; private final BuildType BUILD_TYPE; private final boolean HAS_SOFT_BACK_BUTTON; diff --git a/core/src/cz/nic/tablexia/menu/AbstractMenu.java b/core/src/cz/nic/tablexia/menu/AbstractMenu.java index b14c1effe9cdd9061b8fdba773534d2a4fae7fad..a266f56a6c08f1b7b757640de82dfafed2bb4f6c 100644 --- a/core/src/cz/nic/tablexia/menu/AbstractMenu.java +++ b/core/src/cz/nic/tablexia/menu/AbstractMenu.java @@ -302,7 +302,7 @@ public abstract class AbstractMenu extends Stack implements Disposable { float footerContentWidth = getBackground().getDrawable().getMinWidth() - (2 * MAINMENU_PADDING) - APP_NAME_TEXT_PADDING_LEFT; footerTable.add(new LocaleSelectBox(SELECTBOX_LOCALE_HEIGHT)).width(footerContentWidth * SELECTBOX_LOCALE_WIDTH_RATIO).center(); TablexiaLabel appName = new TablexiaLabel( - TablexiaSettings.getInstance().getAppName() + System.lineSeparator() + TablexiaSettings.getInstance().getVersionName(), + TablexiaSettings.getInstance().getAppName() + " " + TablexiaSettings.getInstance().getVersionName(), new TablexiaLabel.TablexiaLabelStyle(APP_NAME_TEXT_FONT, Color.BLACK)); appName.setAlignment(APP_NAME_TEXT_ALIGN); appName.setWrap(true); diff --git a/desktop/build.gradle b/desktop/build.gradle index 1cfd2b2107bf5af32edf32313261665a7d2df641..d2ee4b621fd5fb7578f8a17ae9bf5428e4f34c4c 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -15,7 +15,7 @@ task run(dependsOn: classes, type: JavaExec) { } task debugJar(type: Jar) { - baseName = appName + "-debug" + baseName = tablexiaAppName + "-debug" from files(sourceSets.main.output.classesDir) from files(sourceSets.main.output.resourcesDir) from {configurations.compile.collect {zipTree(it)}} @@ -32,7 +32,7 @@ task debugJar(type: Jar) { } task releaseJar(type: Jar) { - baseName = appName + "-release" + baseName = tablexiaAppName + "-release" from files(sourceSets.main.output.classesDir) from files(sourceSets.main.output.resourcesDir) from {configurations.compile.collect {zipTree(it)}} diff --git a/desktop/src/cz/nic/tablexia/desktop/DesktopLauncher.java b/desktop/src/cz/nic/tablexia/desktop/DesktopLauncher.java index 640ae117580f76edd14edd1531c69c48b0050225..2c10ac6529ab8738f0fd9d5abbeeced04223a356 100644 --- a/desktop/src/cz/nic/tablexia/desktop/DesktopLauncher.java +++ b/desktop/src/cz/nic/tablexia/desktop/DesktopLauncher.java @@ -8,6 +8,7 @@ import com.jcabi.manifests.Manifests; import java.util.Locale; import cz.nic.tablexia.Tablexia; +import cz.nic.tablexia.TablexiaBuildConfig; import cz.nic.tablexia.TablexiaSettings; import cz.nic.tablexia.screen.loader.IConnectionManager; @@ -39,6 +40,7 @@ public class DesktopLauncher { config.width = 1280; config.height = 800; config.samples = MULTI_SAMPLING_2X; + config.title = TablexiaBuildConfig.APP_NAME; if (buildType == null || buildType.equals(TablexiaSettings.BuildType.DEVEL.getKey())) { config.addIcon(DESKTOP_ICON_DEVEL_16, Files.FileType.Internal); diff --git a/ios/build.gradle b/ios/build.gradle index 0dc37319c3c76a2ef896d91061363190cbfdcd57..cb42d8ee7273cc52ecec2dc223b7b0ccfc4ec0a2 100644 --- a/ios/build.gradle +++ b/ios/build.gradle @@ -22,14 +22,14 @@ def updateRoboVMProperties(String buildType, String applicationId, String iconNa } props.load(propsFile.newDataInputStream()) - props.setProperty('app.name', appName) + props.setProperty('app.name', tablexiaAppName) props.setProperty('app.icon', iconName) props.setProperty('app.id', applicationId) props.setProperty('app.mainclass', mainClassName) props.setProperty('app.version', tablexiaVersionName) props.setProperty('app.buildtype', buildType) props.setProperty('app.build', '' + tablexiaVersionCode) - props.setProperty('app.executable', appName + '-' + buildType + '-' + tablexiaVersionName) + props.setProperty('app.executable', tablexiaAppName + '-' + buildType + '-' + tablexiaVersionName) props.store(propsFile.newDataOutputStream(), '') }