Bug 1119520 - Post: Use Gradle's manifest placeholders to produce Robocop manifest. r?sebastian
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.
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -7,16 +7,21 @@ android {
buildToolsVersion "23.0.1"
defaultConfig {
targetSdkVersion 22
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
}
lintOptions {
@@ -54,17 +59,17 @@ android {
}
sourceSets {
main {
manifest.srcFile "${topobjdir}/mobile/android/base/AndroidManifest.xml"
}
androidTest {
- manifest.srcFile "${topobjdir}/mobile/android/tests/browser/robocop/AndroidManifest.xml"
+ manifest.srcFile "robocop_AndroidManifest.xml.in"
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/robocop_AndroidManifest.xml.in
@@ -0,0 +1,59 @@
+<?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"
+ android:debuggable="true">
+
+ <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>