diff options
author | cyBerta <cyberta@riseup.net> | 2017-11-14 15:47:37 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2017-11-14 15:47:37 +0100 |
commit | a19638c3e334454c23dbc93bb7945f6d2ace00de (patch) | |
tree | a9bd733d84480b7fef20c4c566d5a13dba275950 /app | |
parent | 59303f0452ff79bcf57f0cbec472c608916e8bfd (diff) |
recompile native code for ProductionBeta and ProductionRelease builds
Diffstat (limited to 'app')
-rw-r--r-- | app/build.gradle | 36 |
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 |