Esempio n. 1
0
def _set_up_internal_repo():
    if OPTIONS.internal_apks_source_is_internal():
        # Checkout internal/ repository if needed, and sync internal/third_party/*
        # to internal/build/DEPS.*.  The files needs to be re-staged and is done
        # in staging.create_staging.
        subprocess.check_call('src/build/sync_arc_int.py')

    # Create a symlink to the integration_test definition directory, either in the
    # internal repository checkout or in the downloaded archive.
    # It is used to determine the definitions loaded in run_integration_tests.py
    # without relying on OPTIONS. Otherwise, run_integration_tests_test may fail
    # due to the mismatch between the expectations and the actual test apk since
    # it always runs under the default OPTIONS.
    if OPTIONS.internal_apks_source_is_internal():
        test_dir = 'internal/integration_tests'
    else:
        test_dir = 'out/internal-apks/integration_tests'

    symlink_location = 'out/internal-apks-integration-tests'
    if not os.path.islink(symlink_location) and os.path.isdir(
            symlink_location):
        # TODO(crbug.com/517306): This is a short-term fix for making bots green.
        # Remove once we implement a more proper solution (like, isolating the
        # test bundle extraction directory from the checkout, or stop running
        # ./configure on test-only builders.)
        #
        # 'Test only' bots extracts a directory structure from test-bundle zip, so
        # in that case we don't need to create a symlink.
        print 'WARNING: A directory exists at %s.' % symlink_location
        print 'WARNING: If not on test-only bot, gms test expectation may be stale.'
    else:
        # Otherwise, (re)create the link.
        file_util.create_link(symlink_location, test_dir, overwrite=True)
Esempio n. 2
0
def _set_up_internal_repo():
  if OPTIONS.internal_apks_source_is_internal():
    # Checkout internal/ repository if needed, and sync internal/third_party/*
    # to internal/build/DEPS.*.  The files needs to be re-staged and is done
    # in staging.create_staging.
    subprocess.check_call('src/build/sync_arc_int.py')

  # Create a symlink to the integration_test definition directory, either in the
  # internal repository checkout or in the downloaded archive.
  # It is used to determine the definitions loaded in run_integration_tests.py
  # without relying on OPTIONS. Otherwise, run_integration_tests_test may fail
  # due to the mismatch between the expectations and the actual test apk since
  # it always runs under the default OPTIONS.
  if OPTIONS.internal_apks_source_is_internal():
    test_dir = 'internal/integration_tests'
  else:
    test_dir = 'out/internal-apks/integration_tests'

  symlink_location = 'out/internal-apks-integration-tests'
  if not os.path.islink(symlink_location) and os.path.isdir(symlink_location):
    # TODO(crbug.com/517306): This is a short-term fix for making bots green.
    # Remove once we implement a more proper solution (like, isolating the
    # test bundle extraction directory from the checkout, or stop running
    # ./configure on test-only builders.)
    #
    # 'Test only' bots extracts a directory structure from test-bundle zip, so
    # in that case we don't need to create a symlink.
    print 'WARNING: A directory exists at %s.' % symlink_location
    print 'WARNING: If not on test-only bot, gms test expectation may be stale.'
  else:
    # Otherwise, (re)create the link.
    file_util.create_link(symlink_location, test_dir, overwrite=True)
Esempio n. 3
0
    def build_gms_core_or_use_prebuilt(self):
        if OPTIONS.enable_art_aot():
            # Rule for pre-optimizing gms-core apk.
            boot_image_dir = os.path.join(build_common.get_android_fs_root(),
                                          'system/framework',
                                          build_common.get_art_isa())
            self.rule(
                'gms_core_apk_preoptimize',
                'src/build/gms_core_apk_preoptimize.py --input $in --output $out',
                description='Preoptimizing gmscore sub apks contained in $in')
            self.build(GmsCoreNinjaGenerator._APK_PATH,
                       'gms_core_apk_preoptimize',
                       GmsCoreNinjaGenerator._ORIGINAL_APK_PATH,
                       implicit=[
                           toolchain.get_tool('java', 'dex2oat'),
                           os.path.join(boot_image_dir, 'boot.art'),
                           os.path.join(boot_image_dir, 'boot.oat')
                       ])

        if not OPTIONS.internal_apks_source_is_internal():
            return

        flags = '--eng' if OPTIONS.is_debug_code_enabled() else ''
        build_log = os.path.join('out/gms-core-build/build.log')
        command = ('internal/build/build.py gms-core %s > %s 2>&1 || '
                   '(cat %s; exit 1)') % (flags, build_log, build_log)

        if OPTIONS.internal_apks_source() == 'internal-dev':
            # Only for local development.  play-services.apk dependes on jars below to
            # build, just to use ARC specific feature like ArcMessageBridge and
            # Tracing.  This dependency is a must-have for a clean build.  But this
            # dependency can cause unrelated framework change to trigger rebuild of
            # play-services.apk, which is very slow.  With this option, eng will self
            # manages the dependency, which is almost always satisfied.
            jars = []
        else:
            # Simply make these jars the dependencies of gms-core-build, which
            # references ArcMessage and ArcMessageBridge in the jar.  Note that these
            # jars changes often and is like to cause unnecessary rebuild of gms-core,
            # which is very slow.  We may think about a way to minimize the
            # dependency.
            #
            # See also: internal/mods/gms-core/vendor/unbundled_google/packages/ \
            #     OneUp/package/Android.mk
            #     OneUp/package/generate_package.mk
            jars = [
                build_common.get_build_path_for_jar('arc-services-framework',
                                                    subpath='classes.jar'),
                build_common.get_build_path_for_jar('framework',
                                                    subpath='classes.jar'),
            ]

        self.build(GmsCoreNinjaGenerator._ALL_OUTPUTS,
                   'run_shell_command',
                   implicit=['src/build/DEPS.arc-int'] + jars,
                   variables={'command': command})
Esempio n. 4
0
  def build_gms_core_or_use_prebuilt(self):
    if OPTIONS.enable_art_aot():
      # Rule for pre-optimizing gms-core apk.
      boot_image_dir = os.path.join(build_common.get_android_fs_root(),
                                    'system/framework',
                                    build_common.get_art_isa())
      self.rule(
          'gms_core_apk_preoptimize',
          'src/build/gms_core_apk_preoptimize.py --input $in --output $out',
          description='Preoptimizing gmscore sub apks contained in $in')
      self.build(GmsCoreNinjaGenerator._APK_PATH,
                 'gms_core_apk_preoptimize',
                 GmsCoreNinjaGenerator._ORIGINAL_APK_PATH,
                 implicit=[toolchain.get_tool('java', 'dex2oat'),
                           os.path.join(boot_image_dir, 'boot.art'),
                           os.path.join(boot_image_dir, 'boot.oat')])

    if not OPTIONS.internal_apks_source_is_internal():
      return

    flags = '--eng' if OPTIONS.is_debug_code_enabled() else ''
    build_log = os.path.join('out/gms-core-build/build.log')
    command = ('internal/build/build.py gms-core %s > %s 2>&1 || '
               '(cat %s; exit 1)') % (flags, build_log, build_log)

    if OPTIONS.internal_apks_source() == 'internal-dev':
      # Only for local development.  play-services.apk dependes on jars below to
      # build, just to use ARC specific feature like ArcMessageBridge and
      # Tracing.  This dependency is a must-have for a clean build.  But this
      # dependency can cause unrelated framework change to trigger rebuild of
      # play-services.apk, which is very slow.  With this option, eng will self
      # manages the dependency, which is almost always satisfied.
      jars = []
    else:
      # Simply make these jars the dependencies of gms-core-build, which
      # references ArcMessage and ArcMessageBridge in the jar.  Note that these
      # jars changes often and is like to cause unnecessary rebuild of gms-core,
      # which is very slow.  We may think about a way to minimize the
      # dependency.
      #
      # See also: internal/mods/gms-core/vendor/unbundled_google/packages/ \
      #     OneUp/package/Android.mk
      #     OneUp/package/generate_package.mk
      jars = [
          build_common.get_build_path_for_jar('arc-services-framework',
                                              subpath='classes.jar'),
          build_common.get_build_path_for_jar('framework',
                                              subpath='classes.jar'),
      ]

    self.build(GmsCoreNinjaGenerator._ALL_OUTPUTS,
               'run_shell_command',
               implicit=['src/build/DEPS.arc-int'] + jars,
               variables={'command': command})
Esempio n. 5
0
    def load(self):
        """Loads all config.py files in the project."""
        search_root_list = [
            os.path.join('mods', 'android'),
            os.path.join('mods', 'chromium-ppapi'),
            os.path.join('mods', 'examples'),
            os.path.join('mods', 'graphics_translation'),
            'src',
        ]
        if OPTIONS.internal_apks_source_is_internal():
            search_root_list.append('internal')

        config_file_list = []
        for search_root in search_root_list:
            config_file_list.extend(_find_config_py(search_root))

        self._config_modules = _load_internal(config_file_list)
Esempio n. 6
0
  def load(self):
    """Loads all config.py files in the project."""
    search_root_list = [
        os.path.join('mods', 'android'),
        os.path.join('mods', 'chromium-ppapi'),
        os.path.join('mods', 'examples'),
        os.path.join('mods', 'graphics_translation'),
        'src',
    ]
    if OPTIONS.internal_apks_source_is_internal():
      search_root_list.append('internal')

    config_file_list = []
    for search_root in search_root_list:
      config_file_list.extend(_find_config_py(search_root))

    self._config_modules = _load_internal(config_file_list)
Esempio n. 7
0
class GmsCoreNinjaGenerator(ninja_generator.ApkNinjaGenerator):
    if OPTIONS.internal_apks_source_is_internal():
        _DIST_DIR = 'out/gms-core-build/dist'
        _ORIGINAL_APK_PATH = 'out/gms-core-build/play_services.apk'
        _NOTICES_OUTPUT_PATH = 'out/gms-core-build/NOTICES.tar.gz'
    else:
        # Use archived build
        _DIST_DIR = 'out/internal-apks'
        _ORIGINAL_APK_PATH = 'out/internal-apks/play_services.apk'
        _NOTICES_OUTPUT_PATH = 'out/internal-apks/play_services_NOTICES.tar.gz'

    if OPTIONS.enable_art_aot():
        _APK_PATH = build_common.get_build_path_for_apk('play_services',
                                                        'optimized.apk',
                                                        is_target=True)
    else:
        _APK_PATH = _ORIGINAL_APK_PATH

    APITEST_APK_PATH = os.path.join(_DIST_DIR, 'GmsCoreApiTests.apk')
    APITEST_SETUP_APK_PATH = os.path.join(_DIST_DIR,
                                          'GmsCoreApiTestsSetup.apk')
    _PROGUARD_MAPPING = os.path.join(_DIST_DIR, 'GmsCore-proguard-mapping.txt')

    # Every build artifact of GMS Core for ninja to generate dependencies.
    _ALL_OUTPUTS = [
        _ORIGINAL_APK_PATH, _NOTICES_OUTPUT_PATH, APITEST_APK_PATH,
        APITEST_SETUP_APK_PATH
    ]
    if not OPTIONS.is_debug_code_enabled():
        _ALL_OUTPUTS.append(_PROGUARD_MAPPING)

    def __init__(self, extra_dex2oat_flags):
        super(GmsCoreNinjaGenerator, self).__init__(
            'play_services',
            install_path='/vendor/play_services',
            canned_classes_apk=GmsCoreNinjaGenerator._APK_PATH,
            extra_dex2oat_flags=extra_dex2oat_flags)

    def build_gms_core_or_use_prebuilt(self):
        if OPTIONS.enable_art_aot():
            # Rule for pre-optimizing gms-core apk.
            boot_image_dir = os.path.join(build_common.get_android_fs_root(),
                                          'system/framework',
                                          build_common.get_art_isa())
            self.rule(
                'gms_core_apk_preoptimize',
                'src/build/gms_core_apk_preoptimize.py --input $in --output $out',
                description='Preoptimizing gmscore sub apks contained in $in')
            self.build(GmsCoreNinjaGenerator._APK_PATH,
                       'gms_core_apk_preoptimize',
                       GmsCoreNinjaGenerator._ORIGINAL_APK_PATH,
                       implicit=[
                           toolchain.get_tool('java', 'dex2oat'),
                           os.path.join(boot_image_dir, 'boot.art'),
                           os.path.join(boot_image_dir, 'boot.oat')
                       ])

        if not OPTIONS.internal_apks_source_is_internal():
            return

        flags = '--eng' if OPTIONS.is_debug_code_enabled() else ''
        build_log = os.path.join('out/gms-core-build/build.log')
        command = ('internal/build/build.py gms-core %s > %s 2>&1 || '
                   '(cat %s; exit 1)') % (flags, build_log, build_log)

        if OPTIONS.internal_apks_source() == 'internal-dev':
            # Only for local development.  play-services.apk dependes on jars below to
            # build, just to use ARC specific feature like ArcMessageBridge and
            # Tracing.  This dependency is a must-have for a clean build.  But this
            # dependency can cause unrelated framework change to trigger rebuild of
            # play-services.apk, which is very slow.  With this option, eng will self
            # manages the dependency, which is almost always satisfied.
            jars = []
        else:
            # Simply make these jars the dependencies of gms-core-build, which
            # references ArcMessage and ArcMessageBridge in the jar.  Note that these
            # jars changes often and is like to cause unnecessary rebuild of gms-core,
            # which is very slow.  We may think about a way to minimize the
            # dependency.
            #
            # See also: internal/mods/gms-core/vendor/unbundled_google/packages/ \
            #     OneUp/package/Android.mk
            #     OneUp/package/generate_package.mk
            jars = [
                build_common.get_build_path_for_jar('arc-services-framework',
                                                    subpath='classes.jar'),
                build_common.get_build_path_for_jar('framework',
                                                    subpath='classes.jar'),
            ]

        self.build(GmsCoreNinjaGenerator._ALL_OUTPUTS,
                   'run_shell_command',
                   implicit=['src/build/DEPS.arc-int'] + jars,
                   variables={'command': command})

    def package_and_install(self):
        self.set_notice_archive(GmsCoreNinjaGenerator._NOTICES_OUTPUT_PATH)
        self.package()
        self.install()