Bug 1412984 - Strip 'vars' debugging from Fennec in "official" audience flavour dimension. r=maliu draft
authorNick Alexander <nalexander@mozilla.com>
Mon, 30 Oct 2017 13:24:21 -0700
changeset 690139 8f3d66ae261036beeea9af5e5474a04a971c9f73
parent 690138 020f60e859be96657b19403c98e955ad95cc777a
child 738508 07d25efaef96eb203d4e3f4e3f8eedb5c9e9598c
push id87231
push usernalexander@mozilla.com
push dateWed, 01 Nov 2017 18:41:52 +0000
reviewersmaliu
bugs1412984
milestone58.0a1
Bug 1412984 - Strip 'vars' debugging from Fennec in "official" audience flavour dimension. r=maliu MozReview-Commit-ID: 6BEn52ARHQS
mobile/android/app/build.gradle
mobile/android/gradle/debug_level.gradle
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -265,19 +265,33 @@ dependencies {
     localCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
     localOldCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
     officialCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
     officialCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
     testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
 
     // With a simple "compile", Gradle will always build these libraries in their default configuration
     // (i.e. release), so we need to explicitly forward our own build configuration here (bug 1385695).
-    debugCompile project(path: ':geckoview', configuration: "debug")
+    //
+    // Official builds compile a hacked up app:Official..Debug, but need the
+    // release versions of the dependencies, in order to not have debugging
+    // information.  It's not yet possible to specify just officialDebug, so we
+    // hack around it here.
+    if (mozconfig.substs.MOZILLA_OFFICIAL) {
+        debugCompile project(path: ':geckoview', configuration: "release")
+    } else {
+        debugCompile project(path: ':geckoview', configuration: "debug")
+    }
     releaseCompile project(path: ':geckoview', configuration: "release")
-    debugCompile project(path: ':thirdparty', configuration: "debug")
+
+    if (mozconfig.substs.MOZILLA_OFFICIAL) {
+        debugCompile project(path: ':thirdparty', configuration: "release")
+    } else {
+        debugCompile project(path: ':thirdparty', configuration: "debug")
+    }
     releaseCompile project(path: ':thirdparty', configuration: "release")
 
     testCompile 'junit:junit:4.12'
     testCompile 'org.robolectric:robolectric:3.1.2'
     testCompile 'org.simpleframework:simple-http:6.0.1'
     testCompile 'org.mockito:mockito-core:1.10.19'
 
     // Including the Robotium JAR directly can cause issues with dexing.
--- a/mobile/android/gradle/debug_level.gradle
+++ b/mobile/android/gradle/debug_level.gradle
@@ -1,17 +1,20 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
+/* -*- Mode: Groovy; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * 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/. */
 
 // Bug 1353055 - Strip 'vars' debugging information to agree with moz.build.
 ext.configureVariantDebugLevel = { variant ->
     // Like 'debug', 'release', or 'withGeckoBinaries'.
     def buildType = variant.buildType.name
 
+    // For :app, like 'local', 'localOld', or 'official'.  For other projects, null.
+    def audienceDimension = variant.productFlavors[0]?.name
+
     // The default is 'lines,source,vars', which includes debugging information
     // that is quite large: roughly 500kb for Fennec.  Therefore we remove
     // 'vars' unless we're producing a debug build, where it is useful.
-    if (!buildType.equals('debug')) {
+    if (!'debug'.equals(buildType) || 'official'.equals(audienceDimension)) {
         variant.javaCompile.options.debugOptions.debugLevel = 'lines,source'
     }
 }