summaryrefslogtreecommitdiffstats
path: root/ios
diff options
context:
space:
mode:
authorsdefresne <sdefresne@chromium.org>2016-03-25 10:02:22 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-25 17:03:35 +0000
commit1e41193fc7ff4a618757d3e369464f9f3faf56b2 (patch)
tree636a87ecd4e7e5b2beea789d7d74c12ba549cee6 /ios
parenta40c06f32958adf0ab2380cacbf32d0abc925247 (diff)
downloadchromium_src-1e41193fc7ff4a618757d3e369464f9f3faf56b2.zip
chromium_src-1e41193fc7ff4a618757d3e369464f9f3faf56b2.tar.gz
chromium_src-1e41193fc7ff4a618757d3e369464f9f3faf56b2.tar.bz2
[iOS] Update js_compile.gni to create bundle_data target.
This ensure that the files required by applications depending on the target will have data copied into the application bundle. BUG=297668,546283 Review URL: https://codereview.chromium.org/1812603002 Cr-Commit-Position: refs/heads/master@{#383292}
Diffstat (limited to 'ios')
-rw-r--r--ios/web/BUILD.gn2
-rw-r--r--ios/web/js_compile.gni142
2 files changed, 77 insertions, 67 deletions
diff --git a/ios/web/BUILD.gn b/ios/web/BUILD.gn
index fcec097..15fe030 100644
--- a/ios/web/BUILD.gn
+++ b/ios/web/BUILD.gn
@@ -456,7 +456,7 @@ js_compile_bundle("web_bundle") {
}
js_compile_checked("js_resources") {
- deps = [
+ public_deps = [
":web_bundle",
]
diff --git a/ios/web/js_compile.gni b/ios/web/js_compile.gni
index a8c7071..317d446 100644
--- a/ios/web/js_compile.gni
+++ b/ios/web/js_compile.gni
@@ -39,38 +39,46 @@ template("js_compile_bundle") {
assert(defined(invoker.closure_entry_point),
"Need closure_entry_point in $target_name for generated js file.")
- java_action(target_name) {
- forward_variables_from(invoker,
- [
- "deps",
- "visibility",
- ])
+ _target_name = target_name
+ compile_js_target_name = target_name + "_compile_js"
+ java_action(compile_js_target_name) {
+ visibility = [ ":$_target_name" ]
script = closure_compiler_path
sources = invoker.sources
outputs = [
- "$target_gen_dir/$target_name.js",
+ "$target_gen_dir/$_target_name.js",
]
args = [
"--compilation_level",
"SIMPLE_OPTIMIZATIONS",
"--js_output_file",
- rebase_path("$target_gen_dir/$target_name.js", root_build_dir),
+ rebase_path("$target_gen_dir/$_target_name.js", root_build_dir),
"--only_closure_dependencies",
"--closure_entry_point",
invoker.closure_entry_point,
"--js",
] + rebase_path(sources, root_build_dir)
+ }
+
+ bundle_data(target_name) {
+ forward_variables_from(invoker,
+ [
+ "data_deps",
+ "deps",
+ "public_deps",
+ "visibility",
+ ])
- # TODO(crbug.com/546283): add the generated bundle to the list of files to
- # move in the application bundle, equivalent to the following gyp code:
- #
- # "link_settings": {
- # "mac_bundle_resources": [
- # "<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_NAME).js",
- # ],
- # },
+ if (!defined(public_deps)) {
+ public_deps = []
+ }
+ public_deps += [ ":$compile_js_target_name" ]
+ sources = get_target_outputs(":$compile_js_target_name")
+ outputs = [
+ "{{bundle_resources_dir}}/{{source_file_part}}",
+ ]
}
}
@@ -94,13 +102,11 @@ template("js_compile_checked") {
"Need sources in $target_name listing the js files.")
if (compile_javascript) {
- java_action_foreach(target_name) {
- forward_variables_from(invoker,
- [
- "deps",
- "visibility",
- ])
+ _target_name = target_name
+ compile_js_target_name = target_name + "_compile_js"
+ java_action_foreach(compile_js_target_name) {
+ visibility = [ ":$_target_name" ]
script = closure_compiler_path
sources = invoker.sources
outputs = [
@@ -136,37 +142,40 @@ template("js_compile_checked") {
"--js_output_file",
rebase_path("$target_gen_dir/{{source_file_part}}", root_build_dir),
]
+ }
- # TODO(crbug.com/546283): add the generated bundle to the list of files
- # to move in the application bundle, equivalent to the following gyp code:
- #
- # "link_settings": {
- # "mac_bundle_resources": [
- # "<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_NAME).js",
- # ],
- # },
+ bundle_data(target_name) {
+ forward_variables_from(invoker,
+ [
+ "data_deps",
+ "deps",
+ "public_deps",
+ "visibility",
+ ])
+
+ if (!defined(public_deps)) {
+ public_deps = []
+ }
+ public_deps += [ ":$compile_js_target_name" ]
+ sources = get_target_outputs(":$compile_js_target_name")
+ outputs = [
+ "{{bundle_resources_dir}}/{{source_file_part}}",
+ ]
}
} else {
- copy(target_name) {
+ bundle_data(target_name) {
forward_variables_from(invoker,
[
+ "data_deps",
"deps",
+ "public_deps",
"visibility",
])
sources = invoker.sources
outputs = [
- "$target_gen_dir/{{source_file_part}}",
+ "{{bundle_resources_dir}}/{{source_file_part}}",
]
-
- # TODO(crbug.com/546283): add the generated bundle to the list of files
- # to move in the application bundle, equivalent to the following gyp code:
- #
- # "link_settings": {
- # "mac_bundle_resources": [
- # "<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_NAME).js",
- # ],
- # },
}
}
}
@@ -191,13 +200,11 @@ template("js_compile_unchecked") {
"Need sources in $target_name listing the js files.")
if (compile_javascript) {
- java_action_foreach(target_name) {
- forward_variables_from(invoker,
- [
- "deps",
- "visibility",
- ])
+ _target_name = target_name
+ compile_js_target_name = target_name + "_compile_js"
+ java_action_foreach(compile_js_target_name) {
+ visibility = [ ":$_target_name" ]
script = closure_compiler_path
sources = invoker.sources
outputs = [
@@ -212,37 +219,40 @@ template("js_compile_unchecked") {
"--js_output_file",
rebase_path("$target_gen_dir/{{source_file_part}}", root_build_dir),
]
+ }
- # TODO(crbug.com/546283): add the generated bundle to the list of files
- # to move in the application bundle, equivalent to the following gyp code:
- #
- # "link_settings": {
- # "mac_bundle_resources": [
- # "<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_NAME).js",
- # ],
- # },
+ bundle_data(target_name) {
+ forward_variables_from(invoker,
+ [
+ "data_deps",
+ "deps",
+ "public_deps",
+ "visibility",
+ ])
+
+ if (!defined(public_deps)) {
+ public_deps = []
+ }
+ public_deps += [ ":$compile_js_target_name" ]
+ sources = get_target_outputs(":$compile_js_target_name")
+ outputs = [
+ "{{bundle_resources_dir}}/{{source_file_part}}",
+ ]
}
} else {
- copy(target_name) {
+ bundle_data(target_name) {
forward_variables_from(invoker,
[
+ "data_deps",
"deps",
+ "public_deps",
"visibility",
])
sources = invoker.sources
outputs = [
- "$target_gen_dir/{{source_file_part}}",
+ "{{bundle_resources_dir}}/{{source_file_part}}",
]
-
- # TODO(crbug.com/546283): add the generated bundle to the list of files
- # to move in the application bundle, equivalent to the following gyp code:
- #
- # "link_settings": {
- # "mac_bundle_resources": [
- # "<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_NAME).js",
- # ],
- # },
}
}
}