Bug 1348114 - Use correct default path for Robocop APK when building with Gradle. r?nalexander draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Thu, 16 Mar 2017 22:22:25 +0100
changeset 501710 bf7bc035ecae27f5af97c69d5a265a94b82b3b1a
parent 501708 b67660c18dfbee6eaa1f07b776ebe52744fb8db4
child 549978 759c0606bbc98b2eded3ebf840e8b26bbb7ca77f
push id50089
push usermozilla@buttercookie.de
push dateMon, 20 Mar 2017 21:11:55 +0000
reviewersnalexander
bugs1348114
milestone55.0a1
Bug 1348114 - Use correct default path for Robocop APK when building with Gradle. r?nalexander ./mach robocop calls through to mochitest_options.py to validate the passed command line options, so it's not necessary to define a default Robocop APK path from two different places. MozReview-Commit-ID: 8CryDqOKDBF
testing/mochitest/mach_commands.py
testing/mochitest/mochitest_options.py
--- a/testing/mochitest/mach_commands.py
+++ b/testing/mochitest/mach_commands.py
@@ -427,21 +427,16 @@ class RobocopCommands(MachCommandBase):
     def run_robocop(self, serve=False, **kwargs):
         if serve:
             kwargs['autorun'] = False
 
         if not kwargs.get('robocopIni'):
             kwargs['robocopIni'] = os.path.join(self.topobjdir, '_tests', 'testing',
                                                 'mochitest', 'robocop.ini')
 
-        if not kwargs.get('robocopApk'):
-            kwargs['robocopApk'] = os.path.join(self.topobjdir, 'mobile', 'android',
-                                                'tests', 'browser', 'robocop',
-                                                'robocop-debug.apk')
-
         from mozbuild.controller.building import BuildDriver
         self._ensure_state_subdir_exists('.')
 
         test_paths = kwargs['test_paths']
         kwargs['test_paths'] = []
 
         from mozbuild.testing import TestResolver
         resolver = self._spawn(TestResolver)
--- a/testing/mochitest/mochitest_options.py
+++ b/testing/mochitest/mochitest_options.py
@@ -1021,19 +1021,25 @@ class AndroidArguments(ArgumentContainer
         if options.robocopIni != "":
             if not os.path.exists(options.robocopIni):
                 parser.error(
                     "Unable to find specified robocop .ini manifest '%s'" %
                     options.robocopIni)
             options.robocopIni = os.path.abspath(options.robocopIni)
 
             if not options.robocopApk and build_obj:
-                options.robocopApk = os.path.join(build_obj.topobjdir, 'mobile', 'android',
-                                                  'tests', 'browser',
-                                                  'robocop', 'robocop-debug.apk')
+                if build_obj.substs.get('MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE'):
+                    options.robocopApk = os.path.join(build_obj.topobjdir, 'gradle', 'build',
+                                                      'mobile', 'android', 'app', 'outputs', 'apk',
+                                                      'app-automation-debug-androidTest-'
+                                                      'unaligned.apk')
+                else:
+                    options.robocopApk = os.path.join(build_obj.topobjdir, 'mobile', 'android',
+                                                      'tests', 'browser',
+                                                      'robocop', 'robocop-debug.apk')
 
         if options.robocopApk != "":
             if not os.path.exists(options.robocopApk):
                 parser.error(
                     "Unable to find robocop APK '%s'" %
                     options.robocopApk)
             options.robocopApk = os.path.abspath(options.robocopApk)