Bug 1415778 - Part 3: Fix up Gradle. r=jchen
authorNick Alexander <nalexander@mozilla.com>
Thu, 09 Nov 2017 09:44:40 -0800
changeset 391801 e4807befdc6a47767c4fb3e6573061588593ea0d
parent 391800 721a4ebc14c49da057bcddaaf337b1759dc3a58f
child 391802 bf0e4dd83b3bf933d40fe16629d489c7599c347b
push id55343
push usernalexander@mozilla.com
push dateTue, 14 Nov 2017 21:06:47 +0000
treeherderautoland@e4807befdc6a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen
bugs1415778
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1415778 - Part 3: Fix up Gradle. r=jchen This patch makes the :geckoview Gradle project only use o.m.geckoview.BuildConfig, and makes the :app Gradle project use all of the preprocessed code coming from the moz.build system. Eventually, we'll reduce that set of preprocessed code to only o.m.gecko.BuildConfig, which will then be produced by Gradle. MozReview-Commit-ID: Dnkde7axyZL
mobile/android/app/build.gradle
mobile/android/geckoview/build.gradle
mobile/android/geckoview/proguard-rules.txt
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurface.java
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -308,21 +308,17 @@ task checkstyle(type: Checkstyle) {
     // TODO: This ignores our pre-processed resources.
     include '**/*.java'
     // TODO: classpath should probably be something.
     classpath = files()
 }
 
 task syncPreprocessedCode(type: Sync, dependsOn: rootProject.generateCodeAndResources) {
     into("${project.buildDir}/generated/source/preprocessed_code")
-    from("${topobjdir}/mobile/android/base/generated/preprocessed") {
-        // All other preprocessed code is included in the geckoview project.
-        include '**/AdjustConstants.java'
-        include '**/MmaConstants.java'
-    }
+    from("${topobjdir}/mobile/android/base/generated/preprocessed")
 }
 
 // The localization system uses the moz.build preprocessor to interpolate a .dtd
 // file of XML entity definitions into an XML file of elements referencing those
 // entities.  (Each locale produces its own .dtd file, backstopped by the en-US
 // .dtd file in tree.)  Android Studio (and IntelliJ) don't handle these inline
 // entities smoothly.  This filter merely expands the entities in place, making
 // them appear properly throughout the IDE.  Be aware that this assumes that the
--- a/mobile/android/geckoview/build.gradle
+++ b/mobile/android/geckoview/build.gradle
@@ -139,46 +139,32 @@ android {
                     exclude 'org/mozilla/gecko/media/Utils.java'
                 }
 
                 if (mozconfig.substs.MOZ_WEBRTC) {
                     srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/base/java/src"
                     srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/modules/audio_device/android/java/src"
                     srcDir "${topsrcdir}/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src"
                 }
-
-                // TODO: don't use AppConstants.
-                srcDir "${project.buildDir}/generated/source/preprocessed_code" // See syncPreprocessedCode.
             }
 
             assets {
             }
         }
     }
 }
 
 dependencies {
     compile "com.android.support:support-v4:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
     compile "com.android.support:palette-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
 }
 
-task syncPreprocessedCode(type: Sync, dependsOn: rootProject.generateCodeAndResources) {
-    into("${project.buildDir}/generated/source/preprocessed_code")
-    from("${topobjdir}/mobile/android/base/generated/preprocessed") {
-        // These constants files are included in the main app project.
-        exclude '**/AdjustConstants.java'
-        exclude '**/MmaConstants.java'
-    }
-}
-
 apply from: "${topsrcdir}/mobile/android/gradle/with_gecko_binaries.gradle"
 
 android.libraryVariants.all { variant ->
-    variant.preBuild.dependsOn syncPreprocessedCode
-
     // Like 'debug', 'release', or 'withGeckoBinaries'.
     def buildType = variant.buildType.name
 
     // It would be most natural for :geckoview to always include the Gecko
     // binaries, but that's difficult; see the notes in
     // mobile/android/gradle/with_gecko_binaries.gradle.  Instead :app uses
     // :geckoview:release and handles it's own Gecko binary inclusion.
     if (buildType.equals('withGeckoBinaries')) {
--- a/mobile/android/geckoview/proguard-rules.txt
+++ b/mobile/android/geckoview/proguard-rules.txt
@@ -81,23 +81,16 @@
 # through introspection.
 
 -keepclassmembers class **.R$* {
   public static <fields>;
 }
 
 # GeckoView specific rules.
 
-# Keep classes, and all their contents, compiled before annotation.*.
--keep class org.mozilla.gecko.AppConstants {
-    *;
-}
--keep class org.mozilla.gecko.AppConstants$Versions {
-    *;
-}
 -keep class org.mozilla.gecko.SysInfo {
     *;
 }
 
 # Keep the annotation.
 -keep @interface org.mozilla.gecko.annotation.JNITarget
 
 # Keep classes tagged with the annotation.
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
@@ -71,17 +71,16 @@ import android.hardware.SensorManager;
 import android.location.Criteria;
 import android.location.Location;
 import android.location.LocationListener;
 import android.location.LocationManager;
 import android.media.AudioManager;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
 import android.net.Uri;
-import android.os.Build;
 import android.os.Bundle;
 import android.os.Environment;
 import android.os.Looper;
 import android.os.ParcelFileDescriptor;
 import android.os.PowerManager;
 import android.os.SystemClock;
 import android.os.Vibrator;
 import android.provider.Settings;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurface.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurface.java
@@ -2,17 +2,16 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.gfx;
 
 import android.graphics.SurfaceTexture;
 
-import android.os.Build;
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.view.Surface;
 import android.util.Log;
 
 import java.util.HashMap;
 
 import org.mozilla.gecko.annotation.WrapForJNI;