Bug 1242284 - Post: Use Gradle's manifest placeholders to produce Robocop manifest. r=sebastian
authorNick Alexander <nalexander@mozilla.com>
Mon, 11 Jan 2016 18:02:34 -0800
changeset 281429 6f30a80e353d48a5c113c11672bcc7a4c3a2601d
parent 281428 cf715a2893acb9a07d74974868301c502f0b5c9d
child 281430 0192fb95f348fec522f30abc19ff084b452feb98
push id17194
push usernalexander@mozilla.com
push dateSun, 24 Jan 2016 21:25:12 +0000
treeherderfx-team@6f30a80e353d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1242284
milestone46.0a1
Bug 1242284 - Post: Use Gradle's manifest placeholders to produce Robocop manifest. r=sebastian DONTBUILD NPOTB This is a convenience, and a look ahead to a Gradle-based future. The reason to do this is that front-end builds don't (really) support testing, so we set --disable-tests. However, this means that mobile/android/tests/browser/robocop doesn't get processed at build time, and that means the Robocop manifest doesn't get preprocessed. Rather than hack generating the Robocop manifest in, let's skate to where the puck is going and just use Gradle where appropriate.
mobile/android/app/build.gradle
mobile/android/app/src/androidTest/AndroidManifest.xml
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -7,16 +7,21 @@ android {
     buildToolsVersion "23.0.1"
 
     defaultConfig {
         targetSdkVersion 23
         minSdkVersion 15 
         applicationId mozconfig.substs.ANDROID_PACKAGE_NAME
         testApplicationId 'org.mozilla.roboexample.test'
         testInstrumentationRunner 'org.mozilla.gecko.FennecInstrumentationTestRunner'
+        manifestPlaceholders = [
+            ANDROID_PACKAGE_NAME: mozconfig.substs.ANDROID_PACKAGE_NAME,
+            MOZ_ANDROID_MIN_SDK_VERSION: mozconfig.substs.MOZ_ANDROID_MIN_SDK_VERSION,
+            MOZ_ANDROID_SHARED_ID: "${mozconfig.substs.ANDROID_PACKAGE_NAME}.sharedID",
+        ]
     }
 
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_7
         targetCompatibility JavaVersion.VERSION_1_7
     }
  
     dexOptions {
@@ -58,17 +63,16 @@ android {
     }
 
     sourceSets {
         main {
             manifest.srcFile "${topobjdir}/mobile/android/base/AndroidManifest.xml"
         }
 
         androidTest {
-            manifest.srcFile "${topobjdir}/mobile/android/tests/browser/robocop/AndroidManifest.xml"
             java {
                 srcDir "${topsrcdir}/mobile/android/tests/browser/robocop/src"
                 srcDir "${topsrcdir}/mobile/android/tests/background/junit3/src"
                 srcDir "${topsrcdir}/mobile/android/tests/browser/junit3/src"
                 srcDir "${topsrcdir}/mobile/android/tests/javaddons/src"
             }
             res {
                 srcDir "${topsrcdir}/mobile/android/tests/browser/robocop/res"
new file mode 100644
--- /dev/null
+++ b/mobile/android/app/src/androidTest/AndroidManifest.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="org.mozilla.roboexample.test"
+    android:sharedUserId="${MOZ_ANDROID_SHARED_ID}"
+    android:versionCode="1"
+    android:versionName="1.0" >
+
+    <uses-sdk android:minSdkVersion="${MOZ_ANDROID_MIN_SDK_VERSION}"
+              android:targetSdkVersion="22"/>
+    <!-- TODO: re-instate maxSdkVersion. -->
+
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+
+    <instrumentation
+        android:name="org.mozilla.gecko.FennecInstrumentationTestRunner"
+        android:targetPackage="${ANDROID_PACKAGE_NAME}" />
+
+    <application
+        android:label="@string/app_name">
+
+        <uses-library android:name="android.test.runner" />
+
+        <!-- Fake handlers to ensure that we have some share intents to show in our share handler list -->
+        <activity android:name="org.mozilla.gecko.RobocopShare1"
+                  android:label="Robocop fake activity">
+
+            <intent-filter android:label="Fake robocop share handler 1">
+                <action android:name="android.intent.action.SEND" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <data android:mimeType="text/*" />
+                <data android:mimeType="image/*" />
+            </intent-filter>
+
+        </activity>
+
+        <activity android:name="org.mozilla.gecko.RobocopShare2"
+                  android:label="Robocop fake activity 2">
+
+            <intent-filter android:label="Fake robocop share handler 2">
+                <action android:name="android.intent.action.SEND" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <data android:mimeType="text/*" />
+                <data android:mimeType="image/*" />
+            </intent-filter>
+
+        </activity>
+
+        <activity android:name="org.mozilla.gecko.LaunchFennecWithConfigurationActivity"
+                  android:label="Robocop Fennec">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </activity>
+
+    </application>
+
+</manifest>