Commit 432bc410 authored by Matyáš Latner's avatar Matyáš Latner

Ability to install different beta version on same device for dekstop and...

Ability to install different beta version on same device for dekstop and Android platform. Beta name visible in application launcher
parent 2f0e5a51
......@@ -20,23 +20,26 @@ 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
buildConfigField ASSETS_CHECKSUM_FIELD_TYPE, ASSETS_CHECKSUM_FIELD_NAME, rootProject.ext.assetsChecksumPattern
resValue "string", "app_name", "${tablexiaAppName}"
}
release {
debuggable false
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}"
}
}
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Tablexia</string>
</resources>
......@@ -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,18 @@ 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'
applicationIdDebugSuffix = '.debug'
applicationIdDebug = applicationIdRelease + applicationIdDebugSuffix
applicationIdRelease = applicationBaseId + getTablexiaAppId()
applicationIdDebugSuffix = getTablexiaAppId()
applicationIdDebug = applicationBaseId + applicationIdDebugSuffix
applicationIdDevelSuffix = '.devel'
applicationIdDevel = applicationIdRelease + applicationIdDevelSuffix
applicationIdDevel = applicationBaseId + applicationIdDevelSuffix
gdxVersion = '1.9.2'
gdxUtilsVersion = '0.13.2'
......@@ -66,6 +65,8 @@ allprojects {
googlePlayServicesVersion = '8.3.+'
}
version = getVersionNameFromGit()
repositories {
mavenCentral()
jcenter {
......@@ -246,6 +247,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,7 +277,7 @@ def getVersionNameFromGit() {
String result = stdout.toString().trim();
// for non release branches add number of commits and branch name
if (!"master".equals(branchName)) {
if (!project.masterBranch.equals(branchName)) {
stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-list', "${result}..HEAD", '--count'
......@@ -266,13 +285,8 @@ def getVersionNameFromGit() {
}
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}"
}
// add branch name and number of commits
result = "${result}-${numberOfCommits}"
}
return result
}
......
......@@ -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" +
......
......@@ -54,7 +54,7 @@ public class TablexiaSettings {
public static final String DEV_VERSION_TYPE = "-SNAPSHOT-";
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;
......
......@@ -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);
......
......@@ -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)}}
......
......@@ -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;
......@@ -38,6 +39,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);
......
......@@ -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(), '')
}
......
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