Commit cb6b7530 authored by Drahomír Karchňák's avatar Drahomír Karchňák

#421 WIP Different gradle dsn key parameters for Debug and Release. Needs to be tested on iOS.

parent 386eff38
......@@ -29,18 +29,24 @@ android {
applicationIdSuffix rootProject.applicationIdBranch + rootProject.applicationIdDebugSuffix
buildConfigField ASSETS_CHECKSUM_FIELD_TYPE, ASSETS_CHECKSUM_FIELD_NAME, rootProject.ext.assetsChecksumPattern
resValue "string", "app_name", "${tablexiaAppName}"
resValue "string", "sentry_dsn", project.hasProperty('SENTRY_DSN_DEBUG') ? "$SENTRY_DSN_DEBUG" : "$project.sentryDSNFallbackValue";
resValue "string", "sentry_dsn_fallback_value", "$project.sentryDSNFallbackValue";
}
release {
debuggable false
applicationIdSuffix rootProject.applicationIdBranch
buildConfigField ASSETS_CHECKSUM_FIELD_TYPE, ASSETS_CHECKSUM_FIELD_NAME, rootProject.ext.assetsChecksumPattern
resValue "string", "app_name", "${tablexiaAppName}"
resValue "string", "sentry_dsn", project.hasProperty('SENTRY_DSN_RELEASE') ? "$SENTRY_DSN_RELEASE" : "$project.sentryDSNFallbackValue";
resValue "string", "sentry_dsn_fallback_value", "$project.sentryDSNFallbackValue";
}
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}"
resValue "string", "sentry_dsn", "$project.sentryDSNFallbackValue";
resValue "string", "sentry_dsn_fallback_value", "$project.sentryDSNFallbackValue";
}
}
......
......@@ -18,6 +18,7 @@ import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.TablexiaBuildConfig;
import cz.nic.tablexia.TablexiaSettings;
import cz.nic.tablexia.debug.BuildConfig;
import cz.nic.tablexia.debug.R;
import cz.nic.tablexia.screen.loader.IConnectionManager;
import cz.nic.tablexia.util.Log;
......@@ -37,10 +38,15 @@ public class AndroidLauncher extends AndroidApplication {
config.useWakelock = true;
config.numSamples = MULTI_SAMPLING_2X;
String sentryDSNFallback = getResources().getString(R.string.sentry_dsn_fallback_value);
String sentryDSN = getResources().getString(R.string.sentry_dsn);
String DSN = (sentryDSNFallback == null || sentryDSN == null || sentryDSN.equals(sentryDSNFallback)) ? null : sentryDSN;
initialize(tablexia = new Tablexia(BuildConfig.BUILD_TYPE,
getResources().getConfiguration().locale,
SQL_CONNECTION_TYPE,
new AndroidConnectionManager(getContext()),
DSN, //Pass null if sentryDSN doesnt exist
HAS_SOFT_BACK_BUTTON,
savedInstanceState == null), config);
......
......@@ -54,6 +54,9 @@ allprojects {
applicationIdDevelSuffix = '.devel'
applicationIdDevel = applicationBaseId + applicationIdDevelSuffix
//Fallback value if sentry DSN is not defined (gradle parameter SENTRY_DSN_DEBUG or SENTRY_DSN_RELEASE)
sentryDSNFallbackValue = "None"
gdxVersion = '1.9.2'
gdxUtilsVersion = '0.13.2'
mbassadorVersion = '1.2.0'
......
......@@ -43,7 +43,6 @@ task writeTablexiaBuildConfig {
" public final static Integer TABLEXIA_SERVER_PORT = ${project.hasProperty('TABLEXIA_SERVER_PORT') ? "$TABLEXIA_SERVER_PORT" : "null"};\n" +
" public final static String TABLEXIA_SERVER_SECRET = ${project.hasProperty('TABLEXIA_SERVER_SECRET') ? "\"$TABLEXIA_SERVER_SECRET\"" : "null"};\n" +
" public final static String FLURRY_KEY = ${project.hasProperty('TABLEXIA_FLURRY_KEY') ? "\"$TABLEXIA_FLURRY_KEY\"" : "null"};\n" +
" public final static String SENTRY_DSN_KEY = ${project.hasProperty('TABLEXIA_SENTRY_DSN_KEY') ? "\"$TABLEXIA_SENTRY_DSN_KEY\"" : "null"};\n" +
"\n" +
"}", BUILD_CONFIG_FILE_ENCODING)
}
......
......@@ -98,7 +98,7 @@ public class Tablexia extends TablexiaApplication {
}
}
public Tablexia(String buildType, Locale systemLocale, SQLConnectionType sqlConnectionType, IConnectionManager connManager, boolean hasSoftBackButton, boolean reset) {
public Tablexia(String buildType, Locale systemLocale, SQLConnectionType sqlConnectionType, IConnectionManager connManager, String sentryDSN, boolean hasSoftBackButton, boolean reset) {
this.reset = reset;
connectionManager = validateConnectionManager(connManager);
this.sqlConnectionType = sqlConnectionType;
......@@ -114,7 +114,7 @@ public class Tablexia extends TablexiaApplication {
});
if(TablexiaSettings.getInstance().getBuildType().isBugReport())
TablexiaRaven.start(TablexiaBuildConfig.SENTRY_DSN_KEY);
TablexiaRaven.start(sentryDSN);
}
private void loadingComplete() {
......
......@@ -27,6 +27,9 @@ task debugJar(type: Jar) {
attributes 'Build-Type': 'debug'
attributes 'Version-Name': tablexiaVersionName
attributes 'Assets-Cheksums': getMapConvertedToString(rootProject.ext.assetsChecksum)
attributes 'Sentry-DSN': project.hasProperty('SENTRY_DSN_DEBUG') ? "$SENTRY_DSN_DEBUG" : "$project.sentryDSNFallbackValue";
attributes 'Sentry-DSN-Fallback': "$project.sentryDSNFallbackValue";
}
}
}
......@@ -44,6 +47,9 @@ task releaseJar(type: Jar) {
attributes 'Build-Type': 'release'
attributes 'Version-Name': tablexiaVersionName
attributes 'Assets-Cheksums': getMapConvertedToString(rootProject.ext.assetsChecksum)
attributes 'Sentry-DSN': project.hasProperty('SENTRY_DSN_RELEASE') ? "$SENTRY_DSN_RELEASE" : "$project.sentryDSNFallbackValue";
attributes 'Sentry-DSN-Fallback': "$project.sentryDSNFallbackValue";
}
}
}
......
......@@ -14,8 +14,10 @@ import cz.nic.tablexia.screen.loader.IConnectionManager;
public class DesktopLauncher {
private static final String BUILD_VARIANT_MANIFEST_ATTRIBUTE = "Build-Type";
private static final boolean HAS_SOFT_BACK_BUTTON = true;
private static final String BUILD_VARIANT_MANIFEST_ATTRIBUTE = "Build-Type";
private static final String SENTRY_DSN_KEY_MANIFEST_ATTRIBUTE = "Sentry-DSN";
private static final String SENTRY_DSN_FALLBACK_MANIFEST_ATTRIBUTE = "Sentry-DSN-Fallback";
private static final boolean HAS_SOFT_BACK_BUTTON = true;
private static final String DESKTOP_ICON_PATH = "icon/";
private static final String DESKTOP_ICON_16 = DESKTOP_ICON_PATH + "desktop_icon_16.png";
......@@ -33,7 +35,12 @@ public class DesktopLauncher {
public static void main(String[] arg) {
String buildType = loadAttributeFromManifest(BUILD_VARIANT_MANIFEST_ATTRIBUTE, TablexiaSettings.BuildType.DEVEL.getKey());
String buildType = loadAttributeFromManifest(BUILD_VARIANT_MANIFEST_ATTRIBUTE, TablexiaSettings.BuildType.DEVEL.getKey());
String sentryDSN = loadAttributeFromManifest(SENTRY_DSN_KEY_MANIFEST_ATTRIBUTE, null);
String sentryDSNFallback = loadAttributeFromManifest(SENTRY_DSN_FALLBACK_MANIFEST_ATTRIBUTE, null);
String DSN = (sentryDSNFallback == null || sentryDSN == null || sentryDSN.equals(sentryDSNFallback)) ? null : sentryDSN;
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.resizable = buildType == null || buildType.equals(TablexiaSettings.BuildType.DEVEL.getKey());
......@@ -56,7 +63,7 @@ public class DesktopLauncher {
config.addIcon(DESKTOP_ICON_128, Files.FileType.Internal);
}
new LwjglApplication(new Tablexia(buildType, Locale.getDefault(), SQL_CONNECTION_TYPE, new DesktopConnectionManager(), HAS_SOFT_BACK_BUTTON, true), config);
new LwjglApplication(new Tablexia(buildType, Locale.getDefault(), SQL_CONNECTION_TYPE, new DesktopConnectionManager(), DSN, HAS_SOFT_BACK_BUTTON, true), config);
}
private static String loadAttributeFromManifest(String attributeName, String defaultValue) {
......
......@@ -13,7 +13,7 @@ ext {
}
// Updates or create a robovm.properties file.
def updateRoboVMProperties(String buildType, String applicationId, String iconName) {
def updateRoboVMProperties(String buildType, String applicationId, String iconName, String DSN) {
Properties props = new Properties()
def propsFile = file('robovm.properties')
......@@ -30,6 +30,8 @@ def updateRoboVMProperties(String buildType, String applicationId, String iconNa
props.setProperty('app.buildtype', buildType)
props.setProperty('app.build', '' + tablexiaVersionCode)
props.setProperty('app.executable', tablexiaAppName + '-' + buildType + '-' + tablexiaVersionName)
props.setProperty('app.sentryDSNFallbackValue', sentryDSNFallbackValue)
props.setProperty('app.sentryDSN', DSN)
props.store(propsFile.newDataOutputStream(), '')
}
......@@ -85,24 +87,25 @@ task updateRoboVMXML << {
tasks.launchIPadSimulator.doFirst {
robovm.iosSignIdentity = TABLEXIA_IOS_SIGNING_IDENTITY
updateRoboVMProperties("devel", applicationIdDevel, 'Icon_devel')
updateRoboVMProperties("devel", applicationIdDevel, 'Icon_devel', sentryDSNFallbackValue)
}
tasks.launchIPhoneSimulator.doFirst {
robovm.iosSignIdentity = TABLEXIA_IOS_SIGNING_IDENTITY
updateRoboVMProperties("devel", applicationIdDevel, 'Icon_devel')
updateRoboVMProperties("devel", applicationIdDevel, 'Icon_devel', sentryDSNFallbackValue)
}
tasks.launchIOSDevice.doFirst {
robovm.iosSignIdentity = TABLEXIA_IOS_SIGNING_IDENTITY
updateRoboVMProperties("devel", applicationIdDevel, 'Icon_devel')
updateRoboVMProperties("devel", applicationIdDevel, 'Icon_devel', sentryDSNFallbackValue)
}
tasks.create(name: "createDebugIPA", type: org.robovm.gradle.tasks.ArchiveTask) {
doFirst {
robovm.iosSignIdentity = TABLEXIA_IOS_SIGNING_IDENTITY
robovm.iosProvisioningProfile = TABLEXIA_IOS_DEBUG_PROVISIONING
updateRoboVMProperties("debug", applicationIdDebug, 'Icon_debug')
String DSN = project.hasProperty('SENTRY_DSN_DEBUG') ? "$SENTRY_DSN_DEBUG" : sentryDSNFallbackValue;
updateRoboVMProperties("debug", applicationIdDebug, 'Icon_debug', DSN)
}
}
......@@ -110,7 +113,8 @@ tasks.create(name: "createReleaseIPA", type: org.robovm.gradle.tasks.ArchiveTask
doFirst {
robovm.iosSignIdentity = TABLEXIA_IOS_SIGNING_IDENTITY
robovm.iosProvisioningProfile = TABLEXIA_IOS_RELEASE_PROVISIONING
updateRoboVMProperties("release", applicationIdRelease, 'Icon_release')
String DSN = project.hasProperty('SENTRY_DSN_RELEASE') ? "$SENTRY_DSN_RELEASE" : sentryDSNFallbackValue;
updateRoboVMProperties("release", applicationIdRelease, 'Icon_release', DSN)
}
}
......
......@@ -41,11 +41,16 @@ public class IOSLauncher extends IOSApplication.Delegate {
NSDictionary infoDictionary = NSBundle.getMainBundle().getInfoDictionary();
String buildType = infoDictionary.get(new NSString("cz.nic.tablexia.BuildType")).toString();
String sentryDSNFallback = infoDictionary.get(new NSString("app.sentryDSNFallbackValue")).toString();
String sentryDSN = infoDictionary.get(new NSString("app.sentryDSN")).toString();
String DSN = (sentryDSNFallback == null || sentryDSN == null || sentryDSN.equals(sentryDSNFallback)) ? null : sentryDSN;
tablexiaIOSFiles = new TablexiaIOSFiles();
IOSApplication iosApplication = new IOSApplication(new Tablexia(buildType,
Locale.getDefault(),
SQL_CONNECTION_TYPE,
new IOSConnectionManager(),
DSN,
HAS_SOFT_BACK_BUTTON,
false), config) {
......
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