summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcjhopman <cjhopman@chromium.org>2014-09-09 01:55:54 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-09 08:58:14 +0000
commit394dfd1052e53e64083daef7cc66055557256dcb (patch)
tree732ab90590a2c25f9804404696a521dace44809a
parent92516216d2dc3ce3ab3a56500126dc2dcd54e746 (diff)
downloadchromium_src-394dfd1052e53e64083daef7cc66055557256dcb.zip
chromium_src-394dfd1052e53e64083daef7cc66055557256dcb.tar.gz
chromium_src-394dfd1052e53e64083daef7cc66055557256dcb.tar.bz2
Add content_shell_test_apk and several dependencies
This adds support for android_apk targets without any java included directly in the target (only included through deps). This adds the following targets: //base:base_javatests //content/public/android:content_javatests //content/shell/android:content_shell_test_apk //media/android:media_android_imageformat_list (moved) //media/android:media_java (moved+fixed) BUG=359249 Review URL: https://codereview.chromium.org/525533003 Cr-Commit-Position: refs/heads/master@{#293897}
-rw-r--r--base/BUILD.gn17
-rw-r--r--base/base.gyp45
-rwxr-xr-xbuild/android/gyp/apk_obfuscate.py16
-rwxr-xr-xbuild/android/gyp/create_dist_jar.py36
-rw-r--r--build/android/gyp/util/build_utils.py16
-rwxr-xr-xbuild/android/gyp/write_build_config.py6
-rw-r--r--build/config/android/internal_rules.gni23
-rw-r--r--build/config/android/rules.gni73
-rw-r--r--build/toolchain/android/BUILD.gn2
-rw-r--r--content/content_tests.gypi18
-rw-r--r--content/public/android/BUILD.gn21
-rw-r--r--content/public/test/android/BUILD.gn20
-rw-r--r--content/shell/android/BUILD.gn42
-rw-r--r--media/BUILD.gn79
-rw-r--r--media/base/android/BUILD.gn22
-rw-r--r--media/media.gyp7
16 files changed, 327 insertions, 116 deletions
diff --git a/base/BUILD.gn b/base/BUILD.gn
index c606a54..b1c9f03 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -1338,6 +1338,7 @@ test("base_unittests") {
}
if (is_android) {
+ # GYP: //base.gyp:base_jni_headers
generate_jni("base_jni_headers") {
sources = [
"android/java/src/org/chromium/base/ApplicationStatus.java",
@@ -1363,6 +1364,7 @@ if (is_android) {
jni_package = "base"
}
+ # GYP: //base.gyp:base_java
android_library("base_java") {
srcjar_deps = [
":base_java_application_state",
@@ -1384,6 +1386,16 @@ if (is_android) {
]
}
+ # GYP: //base.gyp:base_javatests
+ android_library("base_javatests") {
+ deps = [
+ ":base_java",
+ ":base_java_test_support",
+ ]
+ DEPRECATED_java_in_dir = "android/javatests/src"
+ }
+
+ # GYP: //base.gyp:base_java_test_support
android_library("base_java_test_support") {
deps = [
":base_java",
@@ -1391,6 +1403,7 @@ if (is_android) {
DEPRECATED_java_in_dir = "test/android/javatests/src"
}
+ # GYP: //base.gyp:base_java_application_state
java_cpp_template("base_java_application_state") {
sources = [
"android/java/src/org/chromium/base/ApplicationState.template",
@@ -1402,6 +1415,7 @@ if (is_android) {
package_name = "org/chromium/base"
}
+ # GYP: //base.gyp:base_java_memory_pressure_level_list
java_cpp_template("base_java_memory_pressure_level_list") {
sources = [
"android/java/src/org/chromium/base/MemoryPressureLevelList.template",
@@ -1413,6 +1427,7 @@ if (is_android) {
package_name = "org/chromium/base"
}
+ # GYP: //base/base.gyp:base_native_libraries_gen
java_cpp_template("base_native_libraries_gen") {
sources = [
"android/java/templates/NativeLibraries.template",
@@ -1420,6 +1435,7 @@ if (is_android) {
package_name = "org/chromium/base/library_loader"
}
+ # GYP: //base.gyp:base_java_unittest_support
android_library("base_java_unittest_support") {
deps = [":base_java"]
java_files = [
@@ -1427,6 +1443,7 @@ if (is_android) {
]
}
+ # GYP: //base.gyp:base_unittests_apk
unittest_apk("base_unittests_apk") {
deps = [
":base_java",
diff --git a/base/base.gyp b/base/base.gyp
index ef7060c..b49109e 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -1231,6 +1231,7 @@
['OS == "android"', {
'targets': [
{
+ # GN: //base:base_jni_headers
'target_name': 'base_jni_headers',
'type': 'none',
'sources': [
@@ -1260,6 +1261,7 @@
'includes': [ '../build/jni_generator.gypi' ],
},
{
+ # TODO(GN)
'target_name': 'base_unittests_jni_headers',
'type': 'none',
'sources': [
@@ -1271,6 +1273,7 @@
'includes': [ '../build/jni_generator.gypi' ],
},
{
+ # GN: //base:base_native_libraries_gen
'target_name': 'base_native_libraries_gen',
'type': 'none',
'sources': [
@@ -1283,6 +1286,7 @@
'includes': [ '../build/android/java_cpp_template.gypi' ],
},
{
+ # GN: //base:base_java
'target_name': 'base_java',
'type': 'none',
'variables': {
@@ -1304,6 +1308,7 @@
],
},
{
+ # GN: //base:base_java_unittest_support
'target_name': 'base_java_unittest_support',
'type': 'none',
'dependencies': [
@@ -1315,6 +1320,7 @@
'includes': [ '../build/java.gypi' ],
},
{
+ # GN: //base:base_java_application_state
'target_name': 'base_java_application_state',
'type': 'none',
# This target is used to auto-generate ApplicationState.java
@@ -1331,6 +1337,7 @@
'includes': [ '../build/android/java_cpp_template.gypi' ],
},
{
+ # GN: //base:base_java_memory_pressure_level_list
'target_name': 'base_java_memory_pressure_level_list',
'type': 'none',
'sources': [
@@ -1343,6 +1350,7 @@
'includes': [ '../build/android/java_cpp_template.gypi' ],
},
{
+ # GN: //base:base_java_test_support
'target_name': 'base_java_test_support',
'type': 'none',
'dependencies': [
@@ -1354,6 +1362,7 @@
'includes': [ '../build/java.gypi' ],
},
{
+ # GN: //base:base_javatests
'target_name': 'base_javatests',
'type': 'none',
'dependencies': [
@@ -1366,6 +1375,7 @@
'includes': [ '../build/java.gypi' ],
},
{
+ # TODO(GN)
'target_name': 'chromium_android_linker',
'type': 'shared_library',
'conditions': [
@@ -1389,12 +1399,8 @@
}],
],
},
-
- ],
- }],
- ['OS == "android"', {
- 'targets': [
{
+ # TODO(GN)
'target_name': 'base_perftests_apk',
'type': 'none',
'dependencies': [
@@ -1405,6 +1411,19 @@
},
'includes': [ '../build/apk_test.gypi' ],
},
+ {
+ # GN: //base:base_unittests_apk
+ 'target_name': 'base_unittests_apk',
+ 'type': 'none',
+ 'dependencies': [
+ 'base_java',
+ 'base_unittests',
+ ],
+ 'variables': {
+ 'test_suite_name': 'base_unittests',
+ },
+ 'includes': [ '../build/apk_test.gypi' ],
+ },
],
}],
['OS == "win"', {
@@ -1423,22 +1442,6 @@
},
],
}],
- ['OS == "android"', {
- 'targets': [
- {
- 'target_name': 'base_unittests_apk',
- 'type': 'none',
- 'dependencies': [
- 'base_java',
- 'base_unittests',
- ],
- 'variables': {
- 'test_suite_name': 'base_unittests',
- },
- 'includes': [ '../build/apk_test.gypi' ],
- },
- ],
- }],
['test_isolation_mode != "noop"', {
'targets': [
{
diff --git a/build/android/gyp/apk_obfuscate.py b/build/android/gyp/apk_obfuscate.py
index b9762cf7..fec70c8 100755
--- a/build/android/gyp/apk_obfuscate.py
+++ b/build/android/gyp/apk_obfuscate.py
@@ -10,11 +10,9 @@ If proguard is not enabled or 'Release' is not in the configuration name,
obfuscation will be a no-op.
"""
-import fnmatch
import optparse
import os
import sys
-import zipfile
from util import build_utils
@@ -86,19 +84,9 @@ def main(argv):
dependency_class_filters = [
'*R.class', '*R$*.class', '*Manifest.class', '*BuildConfig.class']
- def DependencyClassFilter(name):
- for name_filter in dependency_class_filters:
- if fnmatch.fnmatch(name, name_filter):
- return False
- return True
-
if options.testapp:
- with zipfile.ZipFile(options.test_jar_path, 'w') as test_jar:
- for jar in input_jars:
- with zipfile.ZipFile(jar, 'r') as jar_zip:
- for name in filter(DependencyClassFilter, jar_zip.namelist()):
- with jar_zip.open(name) as zip_entry:
- test_jar.writestr(name, zip_entry.read())
+ build_utils.MergeZips(
+ options.test_jar_path, input_jars, dependency_class_filters)
if options.configuration_name == 'Release' and options.proguard_enabled:
proguard_cmd = [
diff --git a/build/android/gyp/create_dist_jar.py b/build/android/gyp/create_dist_jar.py
new file mode 100755
index 0000000..0d31c5d
--- /dev/null
+++ b/build/android/gyp/create_dist_jar.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Merges a list of jars into a single jar."""
+
+import optparse
+import sys
+
+from util import build_utils
+
+def main(args):
+ args = build_utils.ExpandFileArgs(args)
+ parser = optparse.OptionParser()
+ build_utils.AddDepfileOption(parser)
+ parser.add_option('--output', help='Path to output jar.')
+ parser.add_option('--inputs', action='append', help='List of jar inputs.')
+ options, _ = parser.parse_args(args)
+ build_utils.CheckOptions(options, parser, ['output', 'inputs'])
+
+ input_jars = []
+ for inputs_arg in options.inputs:
+ input_jars.extend(build_utils.ParseGypList(inputs_arg))
+
+ build_utils.MergeZips(options.output, input_jars)
+
+ if options.depfile:
+ build_utils.WriteDepfile(
+ options.depfile,
+ input_jars + build_utils.GetPythonDependencies())
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
diff --git a/build/android/gyp/util/build_utils.py b/build/android/gyp/util/build_utils.py
index ddb3cb5..e3a3525 100644
--- a/build/android/gyp/util/build_utils.py
+++ b/build/android/gyp/util/build_utils.py
@@ -232,6 +232,22 @@ def ZipDir(output, base_dir):
outfile.write(path, archive_path)
+def MergeZips(output, inputs, exclude_patterns=None):
+ def Allow(name):
+ if exclude_patterns is not None:
+ for p in exclude_patterns:
+ if fnmatch.fnmatch(name, p):
+ return False
+ return True
+
+ with zipfile.ZipFile(output, 'w') as out_zip:
+ for in_file in inputs:
+ with zipfile.ZipFile(in_file, 'r') as in_zip:
+ for name in in_zip.namelist():
+ if Allow(name):
+ out_zip.writestr(name, in_zip.read(name))
+
+
def PrintWarning(message):
print 'WARNING: ' + message
diff --git a/build/android/gyp/write_build_config.py b/build/android/gyp/write_build_config.py
index 0d7244a..606b234 100755
--- a/build/android/gyp/write_build_config.py
+++ b/build/android/gyp/write_build_config.py
@@ -165,6 +165,12 @@ def main(argv):
dex_deps_files = [c['dex_path'] for c in all_library_deps]
dex_config['dependency_dex_files'] = dex_deps_files
+ config['dist_jar'] = {
+ 'dependency_jars': [
+ c['jar_path'] for c in all_library_deps
+ ]
+ }
+
library_paths = []
java_libraries_list = []
if options.native_libs:
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni
index e075c83..889e8b6 100644
--- a/build/config/android/internal_rules.gni
+++ b/build/config/android/internal_rules.gni
@@ -178,6 +178,10 @@ template("dex") {
inputs = invoker.inputs
}
+ if (defined(invoker.deps)) {
+ deps = invoker.deps
+ }
+
rebased_output = rebase_path(invoker.output, root_build_dir)
args = [
@@ -516,6 +520,11 @@ template("android_java_library") {
assert(defined(invoker.jar_path))
assert(defined(invoker.dex_path))
+ _srcjar_deps = []
+ if (defined(invoker.srcjar_deps)) {
+ _srcjar_deps = invoker.srcjar_deps
+ }
+
_java_files = []
if (defined(invoker.java_files)) {
_java_files = invoker.java_files
@@ -531,6 +540,7 @@ template("android_java_library") {
)
_java_files = rebase_path(_java_files_build_rel, ".", root_build_dir)
}
+ assert(_java_files != [] || _srcjar_deps != [])
_jar_path = invoker.jar_path
_dex_path = invoker.dex_path
@@ -542,6 +552,7 @@ template("android_java_library") {
assert(_android_manifest != "")
_final_deps = []
+ _final_datadeps = []
java_library("${target_name}__java_library") {
jar_path = _jar_path
@@ -550,18 +561,20 @@ template("android_java_library") {
}
build_config = invoker.build_config
java_files = _java_files
+ srcjar_deps = _srcjar_deps
- if (defined(invoker.srcjar_deps)) {
- srcjar_deps = invoker.srcjar_deps
- }
if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) {
proguard_preprocess = invoker.proguard_preprocess
proguard_config = invoker.proguard_config
}
+
+ if (defined(invoker.dist_jar_path)) {
+ dist_jar_path = invoker.dist_jar_path
+ }
}
if (defined(invoker.chromium_code) && invoker.chromium_code) {
- _final_deps += [ ":${target_name}__lint" ]
+ _final_datadeps += [ ":${target_name}__lint" ]
android_lint("${target_name}__lint") {
android_manifest = _android_manifest
jar_path = _jar_path
@@ -578,7 +591,7 @@ template("android_java_library") {
deps = [
":${target_name}__java_library",
":${target_name}__dex",
- ] + _final_deps
+ ] + _final_deps + _final_datadeps
}
}
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
index 510f516..e6df98b 100644
--- a/build/config/android/rules.gni
+++ b/build/config/android/rules.gni
@@ -620,6 +620,11 @@ template("android_apk") {
} else if (defined(invoker.apk_name)) {
_final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk"
}
+ _dist_jar_path_list = process_file_template(
+ [ _final_apk_path ],
+ "$root_build_dir/test.lib.java/{{source_name_part}}.jar"
+ )
+ _dist_jar_path = _dist_jar_path_list[0]
_native_libs = []
if (defined(invoker.native_libs)) {
@@ -627,6 +632,12 @@ template("android_apk") {
_native_libs_dir = base_path + "/libs"
}
+ _has_java = (
+ defined(invoker.java_files)
+ || defined(invoker.DEPRECATED_java_in_dir)
+ || _native_libs != []
+ )
+
_keystore_path = android_default_keystore_path
_keystore_name = android_default_keystore_name
_keystore_password = android_default_keystore_password
@@ -707,25 +718,63 @@ template("android_apk") {
_srcjar_deps += [ ":${_template_name}__native_libraries_java" ]
}
- final_deps += [":${_template_name}__java"]
- android_java_library("${_template_name}__java") {
- android_manifest = invoker.android_manifest
- if (defined(invoker.java_files)) {
- java_files = invoker.java_files
- } else {
- DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir
+ if (_has_java) {
+ final_deps += [ ":${_template_name}__java" ]
+ android_java_library("${_template_name}__java") {
+ android_manifest = invoker.android_manifest
+ if (defined(invoker.java_files)) {
+ java_files = invoker.java_files
+ } else if (defined(invoker.DEPRECATED_java_in_dir)) {
+ DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir
+ } else {
+ assert(_srcjar_deps != [])
+ java_files = []
+ }
+ srcjar_deps = _srcjar_deps
+ dex_path = base_path + ".dex.jar"
+ }
+ } else {
+ assert(_srcjar_deps == [])
+ }
+
+ if (_dist_jar_path != "") {
+ # TODO(cjhopman): This is only ever needed to calculate the list of tests to
+ # run. See build/android/pylib/instrumentation/test_jar.py. We should be
+ # able to just do that calculation at build time instead.
+ action("${_template_name}__create_dist_jar") {
+ script = "//build/android/gyp/create_dist_jar.py"
+ depfile = "$target_gen_dir/$target_name.d"
+ inputs = [ build_config ]
+ outputs = [
+ depfile,
+ _dist_jar_path,
+ ]
+ args = [
+ "--depfile", rebase_path(depfile, root_build_dir),
+ "--output", rebase_path(_dist_jar_path, root_build_dir),
+ "--inputs=@FileArg($_rebased_build_config:dist_jar:dependency_jars)",
+ ]
+ if (_has_java) {
+ inputs += [ jar_path ]
+ _rebased_jar_path = rebase_path([ jar_path ], root_build_dir)
+ args += [
+ "--inputs=$_rebased_jar_path",
+ ]
+ }
}
- srcjar_deps = _srcjar_deps
- dex_path = base_path + ".dex.jar"
}
final_deps += [":${_template_name}__final_dex"]
dex("${_template_name}__final_dex") {
- sources = [jar_path]
- inputs = [build_config]
+ sources = []
+ if (_has_java) {
+ deps = [ ":${_template_name}__java" ]
+ sources += [ jar_path ]
+ }
+ inputs = [ build_config ]
output = final_dex_path
dex_arg_key = "${_rebased_build_config}:apk_dex:dependency_dex_files"
- args = ["--inputs=@FileArg($dex_arg_key)"]
+ args = [ "--inputs=@FileArg($dex_arg_key)" ]
}
if (_native_libs != []) {
diff --git a/build/toolchain/android/BUILD.gn b/build/toolchain/android/BUILD.gn
index 2d1b69a..aaaf97f 100644
--- a/build/toolchain/android/BUILD.gn
+++ b/build/toolchain/android/BUILD.gn
@@ -53,7 +53,7 @@ template("android_gcc_toolchain") {
# the following definition.
soname = "{{target_output_name}}{{output_extension}}"
- stripped_soname = "lib.stripped/${soname}.tmp"
+ stripped_soname = "lib.stripped/${soname}"
temp_stripped_soname = "${stripped_soname}.tmp"
android_strip = "${tool_prefix}strip"
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index df0501a..1e6b386 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -1346,7 +1346,7 @@
'sources!': [
# These tests depend on single process mode, which is disabled
# in official builds.
- 'renderer/browser_render_view_browsertest.cc',
+ 'renderer/browser_render_view_browsertest.cc',
'renderer/dom_serializer_browsertest.cc',
'renderer/resource_fetcher_browsertest.cc',
'renderer/savable_resources_browsertest.cc',
@@ -1544,6 +1544,7 @@
['OS == "android"', {
'targets': [
{
+ # TODO(GN)
'target_name': 'content_gl_tests_apk',
'type': 'none',
'dependencies': [
@@ -1558,6 +1559,7 @@
],
},
{
+ # TODO(GN)
'target_name': 'content_unittests_apk',
'type': 'none',
'dependencies': [
@@ -1570,6 +1572,7 @@
'includes': [ '../build/apk_test.gypi' ],
},
{
+ # TODO(GN)
'target_name': 'content_browsertests_apk',
'type': 'none',
'dependencies': [
@@ -1597,6 +1600,7 @@
'includes': [ '../build/java_apk.gypi' ],
},
{
+ # TODO(GN)
'target_name': 'content_perftests_apk',
'type': 'none',
'dependencies': [
@@ -1609,6 +1613,7 @@
'includes': [ '../build/apk_test.gypi' ],
},
{
+ # TODO(GN)
'target_name': 'chromium_linker_test_apk',
'type': 'none',
'conditions': [
@@ -1642,6 +1647,7 @@
],
},
{
+ # TODO(GN)
'target_name': 'chromium_android_linker_test',
'type': 'shared_library',
'defines!': ['CONTENT_IMPLEMENTATION'],
@@ -1658,6 +1664,7 @@
],
},
{
+ # TODO(GN)
'target_name': 'chromium_android_linker_test_jni_headers',
'type': 'none',
'sources': [
@@ -1669,6 +1676,7 @@
'includes': [ '../build/jni_generator.gypi' ],
},
{
+ # TODO(GN)
'target_name': 'video_decode_accelerator_unittest_apk',
'type': 'none',
'dependencies': [
@@ -1679,11 +1687,8 @@
},
'includes': [ '../build/apk_test.gypi' ],
},
- ],
- }],
- ['OS == "android"', {
- 'targets': [
{
+ # GN: //content/public/test/android:test_support_content_jni_headers
'target_name': 'test_support_content_jni_headers',
'type': 'none',
'sources': [
@@ -1695,6 +1700,7 @@
'includes': [ '../build/jni_generator.gypi' ],
},
{
+ # GN: //content/public/test/android:content_java_test_support
'target_name': 'content_java_test_support',
'type': 'none',
'dependencies': [
@@ -1709,6 +1715,8 @@
'includes': [ '../build/java.gypi' ],
},
{
+ # GN: //content/shell/android:content_shell_test_apk
+ # and //content/public/android:content_javatests
'target_name': 'content_shell_test_apk',
'type': 'none',
'dependencies': [
diff --git a/content/public/android/BUILD.gn b/content/public/android/BUILD.gn
index 0da45cf..0755a18 100644
--- a/content/public/android/BUILD.gn
+++ b/content/public/android/BUILD.gn
@@ -27,7 +27,7 @@ android_library("content_java") {
deps = [
":content_java_resources",
"//base:base_java",
- "//media:media_java",
+ "//media/base/android:media_java",
"//net/android:net_java",
"//ui/android:ui_java",
"//third_party/guava:guava_javalib",
@@ -208,4 +208,23 @@ generate_jar_jni("content_jni_headers") {
]
}
+android_library("content_javatests") {
+ deps = [
+ "//base:base_java",
+ "//base:base_java_test_support",
+ "//content/public/test/android:content_java_test_support",
+ "//content/shell/android:content_shell_java",
+ "//content/shell/android:content_shell_apk_java",
+ "//content/shell/android:content_shell_test_java",
+ "//media/base/android:media_java",
+ "//net/android:net_java",
+ "//net/android:net_java_test_support",
+ "//ui/android:ui_java",
+ ":content_java",
+ ]
+
+ DEPRECATED_java_in_dir = "javatests/src"
+}
+
+
# TODO(GYP): content_icudata
diff --git a/content/public/test/android/BUILD.gn b/content/public/test/android/BUILD.gn
new file mode 100644
index 0000000..01167c8
--- /dev/null
+++ b/content/public/test/android/BUILD.gn
@@ -0,0 +1,20 @@
+import("//build/config/android/config.gni")
+import("//build/config/android/rules.gni")
+
+# GYP: //content/content_tests.gypi:test_support_content_jni_headers
+generate_jni("test_support_content_jni_headers") {
+ jni_package = "content/public/test"
+ sources = [
+ "javatests/src/org/chromium/content/browser/test/NestedSystemMessageHandler.java",
+ ]
+}
+
+# GYP: //content/content_tests.gypi:content_java_test_support
+android_library("content_java_test_support") {
+ deps = [
+ "//base:base_java",
+ "//base:base_java_test_support",
+ "//content/public/android:content_java",
+ ]
+ DEPRECATED_java_in_dir = "javatests"
+}
diff --git a/content/shell/android/BUILD.gn b/content/shell/android/BUILD.gn
index 9605cee..47b3d61 100644
--- a/content/shell/android/BUILD.gn
+++ b/content/shell/android/BUILD.gn
@@ -44,7 +44,7 @@ android_library("content_shell_java") {
deps = [
"//base:base_java",
"//content/public/android:content_java",
- "//media:media_java",
+ "//media/base/android:media_java",
"//net/android:net_java",
"//ui/android:ui_java",
":content_shell_java_resources",
@@ -60,6 +60,19 @@ android_resources("content_shell_apk_resources") {
android_manifest = "shell_apk/AndroidManifest.xml"
}
+android_library("content_shell_apk_java") {
+ deps = [
+ ":content_shell_apk_resources",
+ ":content_shell_java",
+ "//base:base_java",
+ "//content/public/android:content_java",
+ "//media/base/android:media_java",
+ "//net/android:net_java",
+ "//ui/android:ui_java",
+ ]
+ DEPRECATED_java_in_dir = "shell_apk/src"
+}
+
android_apk("content_shell_apk") {
datadeps = [
# "//tools/android/forwarder",
@@ -67,18 +80,18 @@ android_apk("content_shell_apk") {
deps = [
":content_shell_apk_resources",
":content_shell_java",
+ ":content_shell_apk_java",
":libcontent_shell_content_view",
"//base:base_java",
"//content/public/android:content_java",
"//content/public/android:content_java_resources",
- "//media:media_java",
+ "//media/base/android:media_java",
"//net/android:net_java",
#"//third_party/mesa:osmesa_in_lib_dir",
"//ui/android:ui_java",
]
apk_name = "ContentShell"
android_manifest = "shell_apk/AndroidManifest.xml"
- DEPRECATED_java_in_dir = "shell_apk/src"
native_libs = [
"$root_build_dir/lib.stripped/libcontent_shell_content_view.so"
]
@@ -96,3 +109,26 @@ android_apk("content_shell_apk") {
# TODO(GYP)
}
}
+
+android_library("content_shell_test_java") {
+ deps = [
+ ":content_shell_java",
+ ":content_shell_apk_java",
+ "//base:base_java",
+ "//base:base_java_test_support",
+ "//content/public/test/android:content_java_test_support",
+ "//content/shell/android:content_shell_java",
+ "//content/public/android:content_java",
+ ]
+ DEPRECATED_java_in_dir = "javatests/src"
+}
+
+android_apk("content_shell_test_apk") {
+ deps = [
+ "//content/public/android:content_javatests",
+ "//base:base_javatests",
+ "//net/android:net_javatests",
+ ]
+ apk_name = "ContentShellTest"
+ android_manifest = "javatests/AndroidManifest.xml"
+}
diff --git a/media/BUILD.gn b/media/BUILD.gn
index 2835e90..3764aee 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -298,7 +298,7 @@ component("media") {
"//media/base/android:video_capture_jni_headers",
]
if (!is_android_webview_build) {
- deps += [ ":media_java" ]
+ deps += [ "//media/base/android:media_java" ]
}
}
@@ -483,7 +483,30 @@ test("media_unittests") {
"formats/webm/webm_webvtt_parser_unittest.cc",
]
- if (!is_android) {
+ deps = [
+ ":media",
+ ":test_support",
+ "//base/allocator",
+ "//base/test:test_support",
+ "//media/audio:unittests",
+ "//media/audio:test_support",
+ "//media/base:unittests",
+ "//media/base:test_support",
+ "//skia", # Direct dependency required to inherit config.
+ "//testing/gmock",
+ "//testing/gtest",
+ "//third_party/widevine/cdm:version_h",
+ "//ui/gfx:test_support",
+ "//url",
+ ]
+
+ if (is_android) {
+ deps += [
+ "//media/base/android",
+ # TODO(GYP)
+ #"//testing/android:native_test_native_code"
+ ]
+ } else {
sources += [
"ffmpeg/ffmpeg_common_unittest.cc",
"filters/audio_decoder_unittest.cc",
@@ -496,12 +519,6 @@ test("media_unittests") {
"filters/pipeline_integration_test.cc",
"filters/pipeline_integration_test_base.cc",
]
- } else {
-# TODO(ajwong): Blocked on android.
-# deps += [
-# ":player_android",
-# "//testing/android:native_test_native_code"
-# ]
}
if (cpu_arch != "arm" && is_chromeos && use_x11) {
@@ -552,32 +569,6 @@ test("media_unittests") {
configs += [ ":media_config" ]
-# TODO(ajwong): This was in the original gyp, but it seems silly.
-# ['os_posix==1 and OS!="mac"', {
-# 'conditions': [
-# ['use_allocator!="none"', {
-# 'dependencies': [
-# '../base/allocator/allocator.gyp:allocator',
-# ],
-# }],
-# ],
-# }],
- deps = [
- ":media",
- ":test_support",
- "//base/test:test_support",
- "//media/audio:unittests",
- "//media/audio:test_support",
- "//media/base:unittests",
- "//media/base:test_support",
- "//skia", # Direct dependency required to inherit config.
- "//testing/gmock",
- "//testing/gtest",
- # TODO(dalecurtis): Port the rest of Widevine stuff.
- "//third_party/widevine/cdm:version_h",
- "//ui/gfx:test_support",
- "//url",
- ]
if (media_use_ffmpeg) {
deps += [
"//third_party/ffmpeg", # Direct dependency required to inherit config.
@@ -734,23 +725,3 @@ if (use_x11) {
]
}
}
-
-if (is_android) {
- import("//build/config/android/rules.gni")
- android_library("media_java") {
- srcjar_deps = [
- ":media_android_imageformat_list",
- ]
- java_files = []
- }
-
- java_cpp_template("media_android_imageformat_list") {
- sources = [
- "base/android/java/src/org/chromium/media/ImageFormat.template",
- ]
- inputs = [
- "video/capture/android/imageformat_list.h"
- ]
- package_name = "org/chromium/media"
- }
-}
diff --git a/media/base/android/BUILD.gn b/media/base/android/BUILD.gn
index f5d6f42..c179931 100644
--- a/media/base/android/BUILD.gn
+++ b/media/base/android/BUILD.gn
@@ -90,3 +90,25 @@ generate_jni("video_capture_jni_headers") {
]
jni_package = "media"
}
+
+java_cpp_template("media_android_imageformat_list") {
+ package_name = "org/chromium/media"
+ sources = [
+ "java/src/org/chromium/media/ImageFormat.template",
+ ]
+ inputs = [
+ "//media/video/capture/android/imageformat_list.h"
+ ]
+}
+
+android_library("media_java") {
+ deps = [
+ "//base:base_java",
+ ]
+
+ srcjar_deps = [
+ ":media_android_imageformat_list",
+ ]
+
+ DEPRECATED_java_in_dir = "java/src"
+}
diff --git a/media/media.gyp b/media/media.gyp
index 5fb0366..355312e 100644
--- a/media/media.gyp
+++ b/media/media.gyp
@@ -1620,6 +1620,7 @@
['OS=="android"', {
'targets': [
{
+ # TODO(GN)
'target_name': 'media_unittests_apk',
'type': 'none',
'dependencies': [
@@ -1632,6 +1633,7 @@
'includes': ['../build/apk_test.gypi'],
},
{
+ # TODO(GN)
'target_name': 'media_perftests_apk',
'type': 'none',
'dependencies': [
@@ -1644,6 +1646,7 @@
'includes': ['../build/apk_test.gypi'],
},
{
+ # GN: //media/base/android:media_android_jni_headers
'target_name': 'media_android_jni_headers',
'type': 'none',
'sources': [
@@ -1663,6 +1666,7 @@
'includes': ['../build/jni_generator.gypi'],
},
{
+ # GN: //media/base/android:video_capture_android_jni_headers
'target_name': 'video_capture_android_jni_headers',
'type': 'none',
'sources': [
@@ -1675,6 +1679,7 @@
'includes': ['../build/jni_generator.gypi'],
},
{
+ # GN: //media/base/android:android
'target_name': 'player_android',
'type': 'static_library',
'sources': [
@@ -1720,6 +1725,7 @@
],
},
{
+ # GN: //media/base/android:media_java
'target_name': 'media_java',
'type': 'none',
'dependencies': [
@@ -1735,6 +1741,7 @@
'includes': ['../build/java.gypi'],
},
{
+ # GN: //media/base/android:media_android_imageformat_list
'target_name': 'media_android_imageformat_list',
'type': 'none',
'sources': [