BearND has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/169629

Change subject: Add custom channel and package
......................................................................

Add custom channel and package

Add ability to specify a custom channel and package name (app id)
for channel partners.
Added a new 'custom' flavor that can take a custom
channel and applicationId.

Change-Id: Ia57edb7aa06427a2ce78ddeabf5da6b20e9d7ad7
---
M scripts/make-release.py
M wikipedia/build.gradle
A wikipedia/gradle.properties
A wikipedia/src/custom/AndroidManifest.xml
4 files changed, 42 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/29/169629/1

diff --git a/scripts/make-release.py b/scripts/make-release.py
index 551373b..aa912e0 100755
--- a/scripts/make-release.py
+++ b/scripts/make-release.py
@@ -79,10 +79,10 @@
     sh.git.push('gerrit', tag_name)
 
 
-def make_release(flavors):
+def make_release(flavors, custom_channel, custom_app):
     sh.cd(PATH_PREFIX)
     # ./gradlew -q assembleDevDebug
-    args = [GRADLEW, '-q', 'clean']
+    args = [GRADLEW, '-q', 'clean', '-PcustomChannel=' + custom_channel, 
'-PcustomApplicationId=' + custom_app]
     tasks = ['assemble{0}Release'.format(flavor.title()) for flavor in flavors]
     args += tasks
     subprocess.call(args)
@@ -106,22 +106,21 @@
     #                    help='Do not use manually, only for the automated 
build script',
     #                    action='store_true')
     group.add_argument('--prod',
-                       help='Step 1: Google Play stable. git checkout BUMPTAG 
first!',
+                       help='Step 1: Google Play stable.',
                        action='store_true')
-    # group.add_argument('--releasesprod',
-    #                    help='Step 1: releasesdot stable. git checkout 
BUMPTAG first!',
-    #                    action='store_true')
     group.add_argument('--amazon',
-                       help='Step 1: Amazon stable release. git checkout 
BUMPTAG first!',
+                       help='Step 1: Amazon stable release.',
                        action='store_true')
-    # group.add_argument('--channel',
-    #                    help='Step 1: Alphabetic versionName&channel. '
-    #                         'Usually, git checkout BUMPTAG first. OEMs w/ 
Play')
-    # group.add_argument('--custompackage',
-    #                    help='Step 1: Alphabetic versionName&channel&package; 
OEMs wout/ Play.')
-    parser.add_argument('--push', help='Step 2: push git tag created in step 1 
to gerrit remote.',
+    group.add_argument('--channel',
+                       help='Step 1: Custom versionName&channel. OEMs w/ Play')
+    group.add_argument('--app',
+                       help='Step 1: Custom versionName&channel&applicationId '
+                            '(aka. package name). OEMs wout/ Play.')
+    parser.add_argument('--push', help='Step 2: create&push git tag to gerrit 
remote.',
                         action='store_true')
     args = parser.parse_args()
+    custom_channel = 'ignore'
+    custom_app = 'ignore'
     if args.beta:
         flavors = ['beta']
         targets = flavors
@@ -131,9 +130,15 @@
     elif args.amazon:
         flavors = ['amazon']
         targets = flavors
-    # elif args.channel:
-    #     flavors = [args.channel]
-    #     targets = flavors
+    elif args.channel:
+        flavors = ['custom']
+        targets = [args.channel]
+        custom_channel = args.channel
+    elif args.app:
+        flavors = ['custom']
+        targets = [args.app]
+        custom_channel = args.app
+        custom_app = 'org.wikipedia' + args.app
     else:
         print('Error. Please specify --beta, --prod, or --amazon')
         sys.exit(-1)
@@ -143,7 +148,7 @@
             git_tag(target)
             push_to_gerrit(target)
     else:
-        make_release(flavors)
+        make_release(flavors, custom_channel, custom_app)
         copy_apk(flavors[0], targets[0])
         if flavors[0] == 'prod':
             copy_apk(flavors[1], flavors[1])
diff --git a/wikipedia/build.gradle b/wikipedia/build.gradle
index 790188f..ac6042d 100644
--- a/wikipedia/build.gradle
+++ b/wikipedia/build.gradle
@@ -43,6 +43,12 @@
         amazon {
             versionName "${versionStart}-amazon-${date}"
         }
+        custom {
+            versionName "${versionStart}-${customChannel}-${date}"
+            applicationId getProperty('customApplicationId')
+            // next line is for injecting a custom channel value into the 
custom/AndroidManifest.xml
+            manifestPlaceholders = 
[customChannel:getProperty('customChannel').toString()]
+        }
     }
     sourceSets {
         // Still using old Maven archetype based directory structure and
diff --git a/wikipedia/gradle.properties b/wikipedia/gradle.properties
new file mode 100644
index 0000000..d90ae5b
--- /dev/null
+++ b/wikipedia/gradle.properties
@@ -0,0 +1,3 @@
+# override on command line like this: -PcustomChannel=qpb 
-PcustomApplicationId=org.wikipedia.qpb
+customChannel=zzz
+customApplicationId=org.wikipedia.zzz
\ No newline at end of file
diff --git a/wikipedia/src/custom/AndroidManifest.xml 
b/wikipedia/src/custom/AndroidManifest.xml
new file mode 100644
index 0000000..e9ea8d5
--- /dev/null
+++ b/wikipedia/src/custom/AndroidManifest.xml
@@ -0,0 +1,11 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android";
+    xmlns:tools="http://schemas.android.com/tools";>
+
+    <application>
+        <meta-data
+            android:name="@string/preference_channel"
+            android:value="${customChannel}"
+            tools:replace="android:value" />
+    </application>
+
+</manifest>

-- 
To view, visit https://gerrit.wikimedia.org/r/169629
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia57edb7aa06427a2ce78ddeabf5da6b20e9d7ad7
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: BearND <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to