Commit 1428cf04 authored by laggedHero's avatar laggedHero Committed by GitHub

Merge pull request #80 from RocketChat/feature/ci-build-prepare

Preparing new build
parents 4e4dd2f5 cc1775c8
...@@ -33,3 +33,9 @@ proguard/ ...@@ -33,3 +33,9 @@ proguard/
# MacOS # MacOS
.DS_Store .DS_Store
# Auth files
*.jks
app/rocket-chat.json
app/src/release/google-services.json
app/src/release/res/values/api_key_strings.xml
...@@ -2,6 +2,7 @@ apply plugin: 'com.android.application' ...@@ -2,6 +2,7 @@ apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda' apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'realm-android' apply plugin: 'realm-android'
apply plugin: 'com.jakewharton.hugo' apply plugin: 'com.jakewharton.hugo'
apply plugin: 'com.github.triplet.play'
apply from: '../config/quality/quality.gradle' apply from: '../config/quality/quality.gradle'
buildscript { buildscript {
...@@ -19,6 +20,7 @@ buildscript { ...@@ -19,6 +20,7 @@ buildscript {
classpath rootProject.ext.realmPlugin classpath rootProject.ext.realmPlugin
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1' classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
classpath 'com.google.gms:google-services:3.0.0' classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.github.triplet.gradle:play-publisher:1.1.5'
} }
// Exclude the version that the android plugin depends on. // Exclude the version that the android plugin depends on.
...@@ -59,6 +61,14 @@ android { ...@@ -59,6 +61,14 @@ android {
signingConfig signingConfigs.release signingConfig signingConfigs.release
} }
} }
productFlavors {
qa {
// something - qa builds will have some extra stuff for alpha testers
}
prod {
// another
}
}
packagingOptions { packagingOptions {
exclude 'META-INF/LICENSE.txt' exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt' exclude 'META-INF/NOTICE.txt'
...@@ -72,6 +82,10 @@ android { ...@@ -72,6 +82,10 @@ android {
lintConfig file("lint.xml") lintConfig file("lint.xml")
} }
} }
play {
jsonFile = file('rocket-chat.json')
track = "${track}"
}
repositories { repositories {
mavenCentral() mavenCentral()
...@@ -89,7 +103,7 @@ dependencies { ...@@ -89,7 +103,7 @@ dependencies {
compile rootProject.ext.supportAppCompat compile rootProject.ext.supportAppCompat
compile rootProject.ext.supportDesign compile rootProject.ext.supportDesign
compile('com.instabug.library:instabug:3.1.0') { qaCompile('com.instabug.library:instabug:3.1.0') {
exclude group: 'io.reactivex' exclude group: 'io.reactivex'
} }
compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:multidex:1.0.1'
......
...@@ -4,13 +4,11 @@ import android.support.multidex.MultiDexApplication; ...@@ -4,13 +4,11 @@ import android.support.multidex.MultiDexApplication;
import chat.rocket.android.model.ServerConfig; import chat.rocket.android.model.ServerConfig;
import chat.rocket.android.realm_helper.RealmStore; import chat.rocket.android.realm_helper.RealmStore;
import com.facebook.stetho.Stetho; import com.facebook.stetho.Stetho;
import com.instabug.library.Feature;
import com.instabug.library.Instabug;
import com.instabug.library.invocation.InstabugInvocationEvent;
import com.uphyca.stetho_realm.RealmInspectorModulesProvider; import com.uphyca.stetho_realm.RealmInspectorModulesProvider;
import io.realm.Realm; import io.realm.Realm;
import io.realm.RealmConfiguration; import io.realm.RealmConfiguration;
import java.util.List; import java.util.List;
import chat.rocket.android.wrappers.InstabugWrapper;
/** /**
* Customized Application-class for Rocket.Chat * Customized Application-class for Rocket.Chat
...@@ -34,10 +32,7 @@ public class RocketChatApplication extends MultiDexApplication { ...@@ -34,10 +32,7 @@ public class RocketChatApplication extends MultiDexApplication {
.enableWebKitInspector(RealmInspectorModulesProvider.builder(this).build()) .enableWebKitInspector(RealmInspectorModulesProvider.builder(this).build())
.build()); .build());
new Instabug.Builder(this, getString(R.string.instabug_api_key)) InstabugWrapper.build(this, getString(R.string.instabug_api_key));
.setInvocationEvent(InstabugInvocationEvent.FLOATING_BUTTON)
.setInAppMessagingState(Feature.State.DISABLED) //not available in Free plan...
.build();
//TODO: add periodic trigger for RocketChatService.keepalive(this) here! //TODO: add periodic trigger for RocketChatService.keepalive(this) here!
} }
......
...@@ -6,29 +6,37 @@ import android.support.annotation.Nullable; ...@@ -6,29 +6,37 @@ import android.support.annotation.Nullable;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.view.MotionEvent; import android.view.MotionEvent;
import chat.rocket.android.helper.OnBackPressListener; import chat.rocket.android.helper.OnBackPressListener;
import chat.rocket.android.log.RCLog; import chat.rocket.android.log.RCLog;
import com.instabug.library.InstabugTrackingDelegate;
import com.trello.rxlifecycle.components.support.RxAppCompatActivity; import com.trello.rxlifecycle.components.support.RxAppCompatActivity;
import chat.rocket.android.wrappers.InstabugWrapper;
import icepick.Icepick; import icepick.Icepick;
abstract class AbstractFragmentActivity extends RxAppCompatActivity { abstract class AbstractFragmentActivity extends RxAppCompatActivity {
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { @Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Icepick.restoreInstanceState(this, savedInstanceState); Icepick.restoreInstanceState(this, savedInstanceState);
} }
@Override protected void onSaveInstanceState(Bundle outState) { @Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
Icepick.saveInstanceState(this, outState); Icepick.saveInstanceState(this, outState);
} }
protected abstract @IdRes int getLayoutContainerForFragment(); protected abstract
@IdRes
int getLayoutContainerForFragment();
@Override public final void onBackPressed() { @Override
public final void onBackPressed() {
if (!onBackPress()) { if (!onBackPress()) {
onBackPresseNotHandled(); onBackPressedNotHandled();
} }
} }
...@@ -49,7 +57,7 @@ abstract class AbstractFragmentActivity extends RxAppCompatActivity { ...@@ -49,7 +57,7 @@ abstract class AbstractFragmentActivity extends RxAppCompatActivity {
return false; return false;
} }
protected void onBackPresseNotHandled() { protected void onBackPressedNotHandled() {
super.onBackPressed(); super.onBackPressed();
} }
...@@ -66,9 +74,10 @@ abstract class AbstractFragmentActivity extends RxAppCompatActivity { ...@@ -66,9 +74,10 @@ abstract class AbstractFragmentActivity extends RxAppCompatActivity {
.commit(); .commit();
} }
@Override public boolean dispatchTouchEvent(MotionEvent event) { @Override
public boolean dispatchTouchEvent(MotionEvent event) {
try { try {
InstabugTrackingDelegate.notifyActivityGotTouchEvent(event, this); InstabugWrapper.wrap(event, this);
} catch (IllegalStateException exception) { } catch (IllegalStateException exception) {
RCLog.w(exception, "Instabug error (ignored)"); RCLog.w(exception, "Instabug error (ignored)");
} }
......
...@@ -101,7 +101,7 @@ public class AddServerActivity extends AbstractFragmentActivity { ...@@ -101,7 +101,7 @@ public class AddServerActivity extends AbstractFragmentActivity {
fragment.setArguments(args); fragment.setArguments(args);
} }
@Override protected void onBackPresseNotHandled() { @Override protected void onBackPressedNotHandled() {
moveTaskToBack(true); moveTaskToBack(true);
} }
} }
...@@ -104,7 +104,7 @@ public class ServerConfigActivity extends AbstractFragmentActivity { ...@@ -104,7 +104,7 @@ public class ServerConfigActivity extends AbstractFragmentActivity {
fragment.setArguments(args); fragment.setArguments(args);
} }
@Override protected void onBackPresseNotHandled() { @Override protected void onBackPressedNotHandled() {
moveTaskToBack(true); moveTaskToBack(true);
} }
} }
package chat.rocket.android.wrappers;
import android.app.Activity;
import android.app.Application;
import android.view.MotionEvent;
public class InstabugWrapper {
public static void build(Application application, String apiKey) {
// stub
}
public static void wrap(MotionEvent event, Activity activity) {
// stub
}
}
package chat.rocket.android.wrappers;
import android.app.Activity;
import android.app.Application;
import android.view.MotionEvent;
import com.instabug.library.Feature;
import com.instabug.library.Instabug;
import com.instabug.library.InstabugTrackingDelegate;
import com.instabug.library.invocation.InstabugInvocationEvent;
public class InstabugWrapper {
public static void build(Application application, String apiKey) {
new Instabug.Builder(application, apiKey)
.setInvocationEvent(InstabugInvocationEvent.FLOATING_BUTTON)
.setInAppMessagingState(Feature.State.DISABLED) //not available in Free plan...
.build();
}
public static void wrap(MotionEvent event, Activity activity) {
InstabugTrackingDelegate.notifyActivityGotTouchEvent(event, activity);
}
}
...@@ -7,12 +7,14 @@ ...@@ -7,12 +7,14 @@
machine: machine:
environment: environment:
ANDROID_HOME: /usr/local/android-sdk-linux ANDROID_HOME: /usr/local/android-sdk-linux
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
dependencies: dependencies:
pre: pre:
- echo "sdk.dir="$ANDROID_HOME > local.properties - echo "sdk.dir="$ANDROID_HOME > local.properties
- echo $ROCKET_JKS_BASE64 | base64 --decode > Rocket.jks - echo $ROCKET_JKS_BASE64 | base64 --decode > Rocket.jks
- echo $ROCKET_PLAY_JSON | base64 --decode > app/rocket-chat.json
- mkdir -p app/src/release/res/values - mkdir -p app/src/release/res/values
- echo $GOOGLE_SERVICES_BASE64 | base64 --decode > app/src/release/google-services.json - echo $GOOGLE_SERVICES_BASE64 | base64 --decode > app/src/release/google-services.json
......
...@@ -40,7 +40,7 @@ task checkstyle(type: Checkstyle, group: 'Verification', description: 'Runs code ...@@ -40,7 +40,7 @@ task checkstyle(type: Checkstyle, group: 'Verification', description: 'Runs code
task findbugs(type: FindBugs, task findbugs(type: FindBugs,
group: 'Verification', group: 'Verification',
description: 'Inspect java bytecode for bugs', description: 'Inspect java bytecode for bugs',
dependsOn: ['compileDebugSources', 'compileReleaseSources']) { dependsOn: ['compileQaDebugSources']) {
ignoreFailures = false ignoreFailures = false
effort = "max" effort = "max"
......
...@@ -19,6 +19,8 @@ ext { ...@@ -19,6 +19,8 @@ ext {
okhttp3 = 'com.squareup.okhttp3:okhttp:3.4.1' okhttp3 = 'com.squareup.okhttp3:okhttp:3.4.1'
picasso = 'com.squareup.picasso:picasso:2.5.2' picasso = 'com.squareup.picasso:picasso:2.5.2'
picasso2Okhttp3Downloader = 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0' picasso2Okhttp3Downloader = 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
preDexLibs = !"true".equals(System.getenv("CI"))
} }
subprojects { project -> subprojects { project ->
...@@ -32,4 +34,14 @@ subprojects { project -> ...@@ -32,4 +34,14 @@ subprojects { project ->
} }
} }
} }
}
subprojects {
project.plugins.whenPluginAdded { plugin ->
if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
} else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
}
}
} }
\ No newline at end of file
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