diff options
| author | cjhopman <cjhopman@chromium.org> | 2015-05-12 15:23:49 -0700 | 
|---|---|---|
| committer | Commit bot <commit-bot@chromium.org> | 2015-05-12 22:24:01 +0000 | 
| commit | d4910aba370e4e5d55477b4b857c707d07526f7b (patch) | |
| tree | 0690b910befea42b8a37008f3eb07628f4a0608c | |
| parent | d5c5a7e8785b283e9731c77a79fa59ec5bd65849 (diff) | |
| download | chromium_src-d4910aba370e4e5d55477b4b857c707d07526f7b.zip chromium_src-d4910aba370e4e5d55477b4b857c707d07526f7b.tar.gz chromium_src-d4910aba370e4e5d55477b4b857c707d07526f7b.tar.bz2 | |
Don't include tested apks resources in test apk
This restricts the test apk's resources to just be those not already
included in the tested apk. Because GN apk targets typically don't
include java of their own, this requires supporting javac+jar for the
case where there is no java files.
Fixes deps so that chrome_shell_test_apk actually builds.
TBR=nyquist,dalecurtis,cbentzel
BUG=359249
Review URL: https://codereview.chromium.org/1127233005
Cr-Commit-Position: refs/heads/master@{#329510}
| -rwxr-xr-x | build/android/gyp/jar.py | 24 | ||||
| -rwxr-xr-x | build/android/gyp/jar_toc.py | 6 | ||||
| -rwxr-xr-x | build/android/gyp/javac.py | 11 | ||||
| -rwxr-xr-x | build/android/gyp/write_build_config.py | 54 | ||||
| -rw-r--r-- | chrome/android/BUILD.gn | 2 | ||||
| -rw-r--r-- | components/invalidation/BUILD.gn | 5 | ||||
| -rw-r--r-- | media/BUILD.gn | 1 | ||||
| -rw-r--r-- | net/BUILD.gn | 5 | ||||
| -rw-r--r-- | net/android/BUILD.gn | 3 | 
9 files changed, 70 insertions, 41 deletions
| diff --git a/build/android/gyp/jar.py b/build/android/gyp/jar.py index 17f968c..48abf5e 100755 --- a/build/android/gyp/jar.py +++ b/build/android/gyp/jar.py @@ -27,16 +27,20 @@ def Jar(class_files, classes_dir, jar_path, manifest_file=None):      jar_cmd.append(os.path.abspath(manifest_file))    jar_cmd.extend(class_files_rel) -  record_path = '%s.md5.stamp' % jar_path -  md5_check.CallAndRecordIfStale( -      lambda: build_utils.CheckOutput(jar_cmd, cwd=jar_cwd), -      record_path=record_path, -      input_paths=class_files, -      input_strings=jar_cmd, -      force=not os.path.exists(jar_path), -      ) - -  build_utils.Touch(jar_path, fail_if_missing=True) +  with build_utils.TempDir() as temp_dir: +    empty_file = os.path.join(temp_dir, '.empty') +    build_utils.Touch(empty_file) +    jar_cmd.append(os.path.relpath(empty_file, jar_cwd)) +    record_path = '%s.md5.stamp' % jar_path +    md5_check.CallAndRecordIfStale( +        lambda: build_utils.CheckOutput(jar_cmd, cwd=jar_cwd), +        record_path=record_path, +        input_paths=class_files, +        input_strings=jar_cmd, +        force=not os.path.exists(jar_path), +        ) + +    build_utils.Touch(jar_path, fail_if_missing=True)  def JarDirectory(classes_dir, excluded_classes, jar_path, manifest_file=None): diff --git a/build/android/gyp/jar_toc.py b/build/android/gyp/jar_toc.py index 3cafd6e..6d81008 100755 --- a/build/android/gyp/jar_toc.py +++ b/build/android/gyp/jar_toc.py @@ -72,8 +72,10 @@ def ExtractToc(disassembled_classes):  def UpdateToc(jar_path, toc_path):    classes = GetClassesInZipFile(zipfile.ZipFile(jar_path)) -  javap_output = CallJavap(classpath=jar_path, classes=classes) -  toc = ExtractToc(javap_output) +  toc = '' +  if len(classes) != 0: +    javap_output = CallJavap(classpath=jar_path, classes=classes) +    toc = ExtractToc(javap_output)    with open(toc_path, 'w') as tocfile:      tocfile.write(toc) diff --git a/build/android/gyp/javac.py b/build/android/gyp/javac.py index a0fcda8..e36fd43 100755 --- a/build/android/gyp/javac.py +++ b/build/android/gyp/javac.py @@ -236,11 +236,12 @@ def main(argv):              break        java_files = filtered_java_files -    DoJavac( -        classpath, -        classes_dir, -        options.chromium_code, -        java_files) +    if len(java_files) != 0: +      DoJavac( +          classpath, +          classes_dir, +          options.chromium_code, +          java_files)      if options.jar_path:        if options.main_class or options.manifest_entry: diff --git a/build/android/gyp/write_build_config.py b/build/android/gyp/write_build_config.py index 0f3bfad..8507a95 100755 --- a/build/android/gyp/write_build_config.py +++ b/build/android/gyp/write_build_config.py @@ -79,9 +79,32 @@ def DepsOfType(wanted_type, configs):  def GetAllDepsConfigsInOrder(deps_config_paths): -  def Deps(path): +  def GetDeps(path):      return set(GetDepConfig(path)['deps_configs']) -  return build_utils.GetSortedTransitiveDependencies(deps_config_paths, Deps) +  return build_utils.GetSortedTransitiveDependencies(deps_config_paths, GetDeps) + + +class Deps(object): +  def __init__(self, direct_deps_config_paths): +    self.all_deps_config_paths = GetAllDepsConfigsInOrder( +        direct_deps_config_paths) +    self.direct_deps_configs = [ +        GetDepConfig(p) for p in direct_deps_config_paths] +    self.all_deps_configs = [ +        GetDepConfig(p) for p in self.all_deps_config_paths] + +  def All(self, wanted_type=None): +    if type is None: +      return self.all_deps_configs +    return DepsOfType(wanted_type, self.all_deps_configs) + +  def Direct(self, wanted_type=None): +    if wanted_type is None: +      return self.direct_deps_configs +    return DepsOfType(wanted_type, self.direct_deps_configs) + +  def AllConfigPaths(self): +    return self.all_deps_config_paths  def main(argv): @@ -166,20 +189,23 @@ def main(argv):    direct_deps_config_paths = [        c for c in possible_deps_config_paths if not c in unknown_deps] -  all_deps_config_paths = GetAllDepsConfigsInOrder(direct_deps_config_paths) - -  direct_deps_configs = [GetDepConfig(p) for p in direct_deps_config_paths] -  all_deps_configs = [GetDepConfig(p) for p in all_deps_config_paths] -  direct_library_deps = DepsOfType('java_library', direct_deps_configs) -  all_library_deps = DepsOfType('java_library', all_deps_configs) +  deps = Deps(direct_deps_config_paths) +  direct_library_deps = deps.Direct('java_library') +  all_library_deps = deps.All('java_library') -  direct_resources_deps = DepsOfType('android_resources', direct_deps_configs) -  all_resources_deps = DepsOfType('android_resources', all_deps_configs) +  direct_resources_deps = deps.Direct('android_resources') +  all_resources_deps = deps.All('android_resources')    # Resources should be ordered with the highest-level dependency first so that    # overrides are done correctly.    all_resources_deps.reverse() +  if options.type == 'android_apk' and options.tested_apk_config: +    tested_apk_deps = Deps([options.tested_apk_config]) +    tested_apk_resources_deps = tested_apk_deps.All('android_resources') +    all_resources_deps = [ +        d for d in all_resources_deps if not d in tested_apk_resources_deps] +    # Initialize some common config.    config = {      'deps_info': { @@ -265,10 +291,8 @@ def main(argv):    # An instrumentation test apk should exclude the dex files that are in the apk    # under test.    if options.type == 'android_apk' and options.tested_apk_config: -    tested_apk_config_paths = GetAllDepsConfigsInOrder( -        [options.tested_apk_config]) -    tested_apk_configs = [GetDepConfig(p) for p in tested_apk_config_paths] -    tested_apk_library_deps = DepsOfType('java_library', tested_apk_configs) +    tested_apk_deps = Deps([options.tested_apk_config]) +    tested_apk_library_deps = tested_apk_deps.All('java_library')      tested_apk_deps_dex_files = [c['dex_path'] for c in tested_apk_library_deps]      deps_dex_files = [          p for p in deps_dex_files if not p in tested_apk_deps_dex_files] @@ -325,7 +349,7 @@ def main(argv):    if options.depfile:      build_utils.WriteDepfile(          options.depfile, -        all_deps_config_paths + build_utils.GetPythonDependencies()) +        deps.AllConfigPaths() + build_utils.GetPythonDependencies())  if __name__ == '__main__': diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index a429b7c..f66c4bb 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn @@ -106,6 +106,7 @@ android_library("chrome_java") {      "//third_party/cacheinvalidation:cacheinvalidation_proto_java",      "//third_party/jsr-305:jsr_305_javalib",      "//media/base/android:media_java", +    "//media/midi:midi_java",      "//ui/android:ui_java",      "//ui/android:ui_java_resources",      google_play_services_library, @@ -405,6 +406,7 @@ android_library("chrome_javatests") {      "//components/bookmarks/common/android:bookmarks_java",      "//components/dom_distiller/android:dom_distiller_core_java",      "//components/invalidation:java", +    "//components/invalidation:javatests",      "//components/navigation_interception/android:navigation_interception_java",      "//components/precache/android:precache_java",      "//components/precache/android:precache_javatests", diff --git a/components/invalidation/BUILD.gn b/components/invalidation/BUILD.gn index a3f835b..e361dae 100644 --- a/components/invalidation/BUILD.gn +++ b/components/invalidation/BUILD.gn @@ -115,10 +115,7 @@ group("unittests") {      ":test_support",    ]    if (is_android) { -    deps += [ -      ":javatests", -      ":jni_headers", -    ] +    deps += [ ":jni_headers" ]    }  } diff --git a/media/BUILD.gn b/media/BUILD.gn index 16098af..b01ad89b 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -321,7 +321,6 @@ component("media") {      ]      deps += [        "//media/base/android", -      "//media/base/android:media_java",        "//media/base/android:media_jni_headers",        "//media/base/android:video_capture_jni_headers",      ] diff --git a/net/BUILD.gn b/net/BUILD.gn index f3955ca..70f5999 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn @@ -1350,10 +1350,7 @@ if (!is_android && !is_mac) {          # sense.          "dns/dns_config_service_posix_unittest.cc",        ] -      deps += [ -        ":net_javatests",  # FIXME(brettw) -        ":net_test_jni_headers", -      ] +      deps += [ ":net_test_jni_headers" ]      }      if (v8_use_external_startup_data) { diff --git a/net/android/BUILD.gn b/net/android/BUILD.gn index 89cc6b3..358e1f7 100644 --- a/net/android/BUILD.gn +++ b/net/android/BUILD.gn @@ -28,6 +28,9 @@ android_aidl("remote_android_keystore_aidl") {  android_library("net_java_test_support") {    DEPRECATED_java_in_dir = "../test/android/javatests/src" +  deps = [ +    "//base:base_java", +  ]    srcjar_deps = [ ":net_java_test_support_enums_srcjar" ]  } | 
