|
@@ -123,4 +123,64 @@ android {
|
|
|
exclude 'META-INF/LICENSE.txt'
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+ signingConfigs {
|
|
|
+ release {
|
|
|
+ if (System.env.OC_RELEASE_KEYSTORE) {
|
|
|
+ storeFile file(System.env.OC_RELEASE_KEYSTORE) // use an absolute path
|
|
|
+ storePassword System.env.OC_RELEASE_KEYSTORE_PASSWORD
|
|
|
+ keyAlias System.env.OC_RELEASE_KEY_ALIAS
|
|
|
+ keyPassword System.env.OC_RELEASE_KEY_PASSWORD
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ buildTypes {
|
|
|
+ release {
|
|
|
+ signingConfig signingConfigs.release
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ applicationVariants.all { variant ->
|
|
|
+ def appName = System.env.OC_APP_NAME
|
|
|
+ setOutputFileName(variant, appName, project)
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// Updates output file names of a given variant to format
|
|
|
+// [appName].[variant.versionName].[OC_BUILD_NUMBER]-[variant.name].apk.
|
|
|
+//
|
|
|
+// OC_BUILD_NUMBER is an environment variable read directly in this method. If undefined, it's not added.
|
|
|
+//
|
|
|
+// @param variant Build variant instance which output file name will be updated.
|
|
|
+// @param appName String to use as first part of the new file name. May be undefined, the original
|
|
|
+// project.archivesBaseName property will be used instead.
|
|
|
+// @param callerProject Caller project.
|
|
|
+
|
|
|
+def setOutputFileName(variant, appName, callerProject) {
|
|
|
+ logger.info("Setting new name for output of variant $variant.name")
|
|
|
+
|
|
|
+ def originalFile = variant.outputs[0].outputFile;
|
|
|
+ def originalName = originalFile.name;
|
|
|
+ logger.info("$variant.name: originalName is $originalName")
|
|
|
+
|
|
|
+ def newName = ""
|
|
|
+
|
|
|
+ if (appName) {
|
|
|
+ newName += appName
|
|
|
+ } else {
|
|
|
+ newName += callerProject.archivesBaseName
|
|
|
+ }
|
|
|
+
|
|
|
+ newName += "_$variant.versionName"
|
|
|
+
|
|
|
+ def buildNumber = System.env.OC_BUILD_NUMBER
|
|
|
+ if (buildNumber) {
|
|
|
+ newName += ".$buildNumber"
|
|
|
+ }
|
|
|
+
|
|
|
+ newName += originalName.substring(callerProject.archivesBaseName.length())
|
|
|
+
|
|
|
+ logger.info("$variant.name: newName is $newName")
|
|
|
+ variant.outputs[0].outputFile = new File(originalFile.parent, newName)
|
|
|
+}
|