Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: components/cronet/android/BUILD.gn

Issue 2347233002: Add src_files to src_jar GN template (Closed)
Patch Set: Added source_deps that packages sources from the deps .sources files. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/cronet/tools/jar_src.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/android/BUILD.gn
diff --git a/components/cronet/android/BUILD.gn b/components/cronet/android/BUILD.gn
index b9ff617d5dc00928f9d3119a9ac052617e3c2228..0fb8c0771292e628f6e67062164424d2f9471565 100644
--- a/components/cronet/android/BUILD.gn
+++ b/components/cronet/android/BUILD.gn
@@ -811,7 +811,8 @@ action("repackage_extracted_jars") {
template("jar_src") {
action(target_name) {
- _rebased_src_dirs = rebase_path(invoker.src_dirs, root_build_dir)
+ _rebased_src_search_dirs =
+ rebase_path(invoker.src_search_dirs, root_build_dir)
script = "//components/cronet/tools/jar_src.py"
depfile = "$target_gen_dir/$target_name.d"
@@ -819,44 +820,104 @@ template("jar_src") {
invoker.jar_path,
]
args = [
- "--src-dir=${_rebased_src_dirs}",
+ "--src-search-dirs=${_rebased_src_search_dirs}",
"--jar-path",
rebase_path(invoker.jar_path, root_build_dir),
"--depfile",
rebase_path(depfile, root_build_dir),
]
+ deps = []
+ if (defined(invoker.deps)) {
+ deps += invoker.deps
+ }
+
+ _src_jars = []
+
+ # Add src jar files that explicitly listed in "src_jars".
if (defined(invoker.src_jars)) {
inputs = invoker.src_jars
_rebased_src_jars = rebase_path(invoker.src_jars, root_build_dir)
- args += [ "--src-jar=${_rebased_src_jars}" ]
+ _src_jars += _rebased_src_jars
}
- deps = [
- ":effective_connection_type_java",
- ]
+
+ # Add src jars that are implicitly listed through "srcjar_deps".
+ if (defined(invoker.srcjar_deps)) {
+ foreach(_srcjar_dep, invoker.srcjar_deps) {
+ _dep_gen_dir = get_label_info(_srcjar_dep, "target_gen_dir")
+ _dep_name = get_label_info(_srcjar_dep, "name")
+ _src_jars += rebase_path([ "$_dep_gen_dir/$_dep_name.srcjar" ])
+ deps += [ _srcjar_dep ]
+ }
+ }
+
+ # Create the list of all source files. These are files that are explicitly given in
+ # "src_files" and files that are implicitly found through "source_deps".
+ _src_files = []
+ if (defined(invoker.src_files)) {
+ _src_files += invoker.src_files
+ }
+
+ # Add source files referenced by "source_deps".
+ if (defined(invoker.source_deps)) {
+ foreach(_source_dep, invoker.source_deps) {
+ _sources = []
+ _dep_dir = get_label_info(_source_dep, "dir")
+ _dep_gen_dir = get_label_info(_source_dep, "target_gen_dir")
+ _dep_name = get_label_info(_source_dep, "name")
+ _source_file = "$_dep_gen_dir/$_dep_name.sources"
agrieve 2016/09/21 00:33:45 You should also add these files to the action's in
kapishnikov 2016/09/21 17:45:56 Done.
+ _sources = rebase_path(read_file(_source_file, "list lines"),
agrieve 2016/09/21 00:33:45 The bot is failing because GN makes no ordering gu
kapishnikov 2016/09/21 17:45:56 Done. Moved the ".sources" parsing to the python s
+ _dep_dir,
+ root_build_dir)
+ _src_files += _sources
+ }
+ }
+ args += [ "--src-jar=${_src_jars}" ]
+ args += [ "--src-files=${_src_files}" ]
}
}
jar_src("jar_cronet_api_source") {
- src_dirs = [ "api/src" ]
+ src_search_dirs = [ "api/src" ]
# Include generated Java files which should be a part of the API.
- src_jars = [ "$root_gen_dir/components/cronet/android/effective_connection_type_java.srcjar" ]
+ srcjar_deps = [ ":effective_connection_type_java" ]
+ source_deps = [ ":cronet_api" ]
jar_path = "$_package_dir/cronet_api-src.jar"
}
-jar_src("jar_cronet_sample_source") {
- src_dirs = [ "sample" ]
- jar_path = "$_package_dir/cronet-sample-src.jar"
+zip("jar_cronet_sample_source") {
+ inputs = [
+ "sample/AndroidManifest.xml",
+ "sample/javatests/AndroidManifest.xml",
+ "sample/javatests/proguard.cfg",
+ "sample/javatests/src/org/chromium/cronet_sample_apk/Criteria.java",
+ "sample/javatests/src/org/chromium/cronet_sample_apk/CronetSampleTest.java",
+ "sample/README",
+ "sample/res/layout/activity_main.xml",
+ "sample/res/layout/dialog_url.xml",
+ "sample/res/values/dimens.xml",
+ "sample/res/values/strings.xml",
+ "sample/src/org/chromium/cronet_sample_apk/CronetSampleActivity.java",
+ "sample/src/org/chromium/cronet_sample_apk/CronetSampleApplication.java",
+ ]
+ output = "$_package_dir/cronet-sample-src.jar"
+ base_dir = "sample"
}
jar_src("jar_cronet_other_source") {
- src_dirs = [
+ src_search_dirs = [
"//base/android/java/src",
"//components/cronet/android/java/src",
"//net/android/java/src",
"//url/android/java/src",
]
+ source_deps = [
+ ":cronet_java",
+ "//base:base_java",
+ "//net/android:net_java",
+ "//url:url_java",
+ ]
jar_path = "$_package_dir/cronet-src.jar"
}
« no previous file with comments | « no previous file | components/cronet/tools/jar_src.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698