Ejemplo n.º 1
0
def _fix_gen_source_path(path):
  """Fixes a generated source path that make_to_ninja can not expand correctly.

  |path| is something like '/<somewhere>/arc/out/target/common/make_to_ninja/
  out/target/product/generic_x86/obj/GYP/shared_intermediates/templates/org/
  chromium/base/ActivityState.java'. This strips a long full path prefix before
  'GYP/...', and make it replaced under the build dir as e.g., 'out/target/
  common/obj/GYP/shared_intermediates/templates/org/chromium/base/
  ActivityState.java'.
  """
  return os.path.join(build_common.get_target_common_dir(), 'obj/GYP',
                      *_get_path_components_following_mark(path, 'GYP'))
Ejemplo n.º 2
0
def _generate_lint_test_ninjas():
    n = ninja_generator.NinjaGenerator('analyze_diffs_test')
    script = 'src/build/analyze_diffs.py'
    n.rule('analyze_diffs_test_fail',
           command=('if %s --under_test $in > $output_path 2>&1; then '
                    '  echo "Expected failure, but there was none"; exit 1; '
                    'else '
                    '  if ! diff $output_path $in.fail > $out; then '
                    '    echo "Differences from expected errors:"; '
                    '    cat $out; '
                    '    rm -f $out; '
                    '    echo "To update: cp $output_path $in.fail"; '
                    '    exit 1; '
                    '  fi; '
                    'fi' % script),
           description='analyze_diffs_test_fail $in')
    n.rule('analyze_diffs_test_success',
           command=('if ! %s --under_test $in > $output_path 2>&1; then '
                    '  echo "Unexpected failure"; cat $output_path; exit 1; '
                    'elif [ -s $output_path ]; then '
                    '  echo "Succeeded but had unexpected output:"; '
                    '  cat $output_path; '
                    '  exit 1; '
                    'else '
                    '  touch $out; '
                    'fi' % script),
           description='analyze_diffs_test_success $in')
    all_mods = build_common.find_all_files([staging.TESTS_MODS_PATH],
                                           include_tests=True)
    out_dir = os.path.join(build_common.get_target_common_dir(),
                           'analyze_diff_tests')
    for f in all_mods:
        no_ext = os.path.splitext(f)[0]
        no_ext_relative = os.path.relpath(no_ext, staging.TESTS_MODS_PATH)
        out_path = os.path.join(out_dir, no_ext_relative)
        output_path = out_path + '.output'
        results_path = out_path + '.results'
        variables = {'output_path': output_path}

        rule = None
        if f.endswith('.fail'):
            rule = 'analyze_diffs_test_fail'
        elif f.endswith('.success'):
            rule = 'analyze_diffs_test_success'
        if rule is not None:
            n.build(results_path,
                    rule,
                    no_ext,
                    variables=variables,
                    implicit=[script],
                    use_staging=False)
Ejemplo n.º 3
0
def _generate_lint_test_ninjas():
  n = ninja_generator.NinjaGenerator('analyze_diffs_test')
  script = 'src/build/analyze_diffs.py'
  n.rule('analyze_diffs_test_fail',
         command=('if %s --under_test $in > $output_path 2>&1; then '
                  '  echo "Expected failure, but there was none"; exit 1; '
                  'else '
                  '  if ! diff $output_path $in.fail > $out; then '
                  '    echo "Differences from expected errors:"; '
                  '    cat $out; '
                  '    rm -f $out; '
                  '    echo "To update: cp $output_path $in.fail"; '
                  '    exit 1; '
                  '  fi; '
                  'fi' % script),
         description='analyze_diffs_test_fail $in')
  n.rule('analyze_diffs_test_success',
         command=('if ! %s --under_test $in > $output_path 2>&1; then '
                  '  echo "Unexpected failure"; cat $output_path; exit 1; '
                  'elif [ -s $output_path ]; then '
                  '  echo "Succeeded but had unexpected output:"; '
                  '  cat $output_path; '
                  '  exit 1; '
                  'else '
                  '  touch $out; '
                  'fi' % script),
         description='analyze_diffs_test_success $in')
  all_mods = build_common.find_all_files([staging.TESTS_MODS_PATH],
                                         include_tests=True)
  out_dir = os.path.join(build_common.get_target_common_dir(),
                         'analyze_diff_tests')
  for f in all_mods:
    no_ext = os.path.splitext(f)[0]
    no_ext_relative = os.path.relpath(no_ext, staging.TESTS_MODS_PATH)
    out_path = os.path.join(out_dir, no_ext_relative)
    output_path = out_path + '.output'
    results_path = out_path + '.results'
    variables = {'output_path': output_path}

    rule = None
    if f.endswith('.fail'):
      rule = 'analyze_diffs_test_fail'
    elif f.endswith('.success'):
      rule = 'analyze_diffs_test_success'
    if rule is not None:
      n.build(results_path, rule, no_ext, variables=variables,
              implicit=[script], use_staging=False)
Ejemplo n.º 4
0
def _generate_webview_package():
  # We modified package.mk to generate the intermediate .jar since it does not
  # use any of the normal mechanisms to produce the final package. We perform
  # those steps manually:
  resource_subdirectories = ['res']
  gen_resource_dirs = [
      ('android_gen_sources/GYP/shared_intermediates/'
       'android_webview_jarjar_content_resources/jarjar_res'),
      ('android_gen_sources/GYP/shared_intermediates/'
       'android_webview_jarjar_ui_resources/jarjar_res'),
      ('android_gen_sources/GYP/ui_strings_grd_intermediates/'
       'ui_strings_grd/res_grit'),
      ('android_gen_sources/GYP/content_strings_grd_intermediates/'
       'content_strings_grd/res_grit')
  ]
  for gen_resource_dir in gen_resource_dirs:
    resource_subdirectories.append(
        os.path.relpath(
            os.path.join(build_common.get_target_common_dir(),
                         gen_resource_dir),
            staging.as_staging('android/frameworks/webview/chromium')))
  n = ninja_generator.ApkNinjaGenerator(
      'webview',
      base_path='android/frameworks/webview/chromium',
      install_path='/system/framework',
      aapt_flags=[
          '--shared-lib',
          '--auto-add-overlay',
          '--extra-packages',
          'com.android.webview.chromium:org.chromium.content:org.chromium.ui'],
      resource_subdirectories=resource_subdirectories)
  # This package is about adding Android resources to the webview_library.
  # Since the resources are built from pre-generated soruce files, we need to
  # explicitly include the right NOTICE file.
  n.add_notice_sources([
      staging.as_staging('android/frameworks/webview/chromium/NOTICE')])

  n.add_extracted_jar_contents('webview_library')

  n.package()
  n.install()
Ejemplo n.º 5
0
def _filter_ldflags_for_libwebviewchromium(vars):
  if OPTIONS.is_bare_metal_build() or OPTIONS.is_nacl_build():
    # We need to pass in --no-keep-memory or ld runs out of memory linking.
    vars.get_ldflags().append('-Wl,--no-keep-memory')
  # --no-undefined allows undefined symbols to be present in the linked .so
  # without errors, which is what we want so they are resolved at runtime.
  vars.get_ldflags().remove('-Wl,--no-undefined')

  # TODO(crbug.com/489972): Suppress warnings caused by hidden skia symbols.
  vars.get_ldflags().remove('-Wl,--fatal-warnings')

  for idx, flag in enumerate(vars.get_ldflags()):
    if 'android_exports.lst' in flag:
      version_script = os.path.join(build_common.get_target_common_dir(),
                                    'android_gen_sources/GYP',
                                    'shared_intermediates/android_exports.lst')
      vars.get_ldflags()[idx] = '-Wl,--version-script=' + version_script

  if OPTIONS.is_nacl_build():
    # This causes libdl.so to be dropped for some reason, even when it provides
    # the reference to the required dlerror function. Remove it.
    vars.get_ldflags().remove('-Wl,--as-needed')
Ejemplo n.º 6
0
 def get_work_root():
   """Returns the root directory of working files."""
   return os.path.join(build_common.get_target_common_dir(), 'art_tests')
Ejemplo n.º 7
0
def _get_generated_sources_path():
  root = build_common.get_target_common_dir()
  return os.path.join(root, 'graphics_translation_gen_sources')
Ejemplo n.º 8
0
def _get_generated_sources_path():
    root = build_common.get_target_common_dir()
    return os.path.join(root, 'graphics_translation_gen_sources')