summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2017-11-14 15:47:37 +0100
committercyBerta <cyberta@riseup.net>2017-11-14 15:47:37 +0100
commita19638c3e334454c23dbc93bb7945f6d2ace00de (patch)
treea9bd733d84480b7fef20c4c566d5a13dba275950
parent59303f0452ff79bcf57f0cbec472c608916e8bfd (diff)
recompile native code for ProductionBeta and ProductionRelease builds
-rw-r--r--app/build.gradle36
1 files changed, 36 insertions, 0 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 60ae394f..cdeccb6c 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,3 +1,6 @@
+import java.util.regex.Matcher
+import java.util.regex.Pattern
+
apply plugin: 'com.android.application'
android {
@@ -233,4 +236,37 @@ task buildNative ( type: Exec ) {
commandLine 'sh', 'misc/build-native.sh', 'USE_BREAKPAD=0', '-j 8'
}
+task cleanNative( type: Delete ) {
+ def shouldClean = getCurrentFlavorForBetaOrRelease() == "production"
+ println "cleanNative: " + shouldClean
+
+ if (shouldClean) {
+ def dirName = "obj"
+ file( dirName ).list().each{
+ f -> delete "${dirName}/${f}"
+ }
+ }
+}
+
+def getCurrentFlavorForBetaOrRelease() {
+ Gradle gradle = getGradle()
+ String tskReqStr = gradle.getStartParameter().getTaskRequests().toString()
+
+ Pattern pattern;
+
+ if( tskReqStr.contains( "assemble" ) )
+ pattern = Pattern.compile("assemble(\\w+)(Beta|Release)")
+ else
+ pattern = Pattern.compile("generate(\\w+)(Beta|Release)")
+
+ Matcher matcher = pattern.matcher( tskReqStr )
+
+ if( matcher.find() )
+ return matcher.group(1).toLowerCase()
+ else
+ {
+ return "";
+ }
+}
+
preBuild.dependsOn buildNative