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

Unified Diff: ios/web/js_compile.gni

Issue 1452593002: Add support for building "ios_chrome_unittests" with gn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ui_gfx
Patch Set: Created 5 years, 1 month 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
« ios/chrome/browser/BUILD.gn ('K') | « ios/public/test/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/js_compile.gni
diff --git a/ios/web/js_compile.gni b/ios/web/js_compile.gni
index 6c9590af12af909a3d4445127d863b366ef1febe..a8c70713650d415cb574bc2b4546a7ed9234798c 100644
--- a/ios/web/js_compile.gni
+++ b/ios/web/js_compile.gni
@@ -30,7 +30,8 @@ closure_compiler_path = "//third_party/closure_compiler/compiler/compiler.jar"
# Generates a single JavaScript bundle file that can be put in the application
# bundle.
#
-# TODO(eugenebut): this should uses the same error flags as js_compile_checked.
+# TODO(crbug.com/487804): once all errors have been fixed, sync with the flags
+# from third_party/closure_compiler/closure_args.gni.
template("js_compile_bundle") {
assert(defined(invoker.sources),
"Need sources in $target_name listing the js files.")
@@ -86,8 +87,8 @@ template("js_compile_bundle") {
# visibility (optional)
# Visibility restrictions.
#
-# TODO(eugenebut): use flags from third_party/closure_compiler/closure_args.gni
-# once they are the same.
+# TODO(crbug.com/487804): once all errors have been fixed, sync with the flags
+# from third_party/closure_compiler/closure_args.gni.
template("js_compile_checked") {
assert(defined(invoker.sources),
"Need sources in $target_name listing the js files.")
@@ -106,8 +107,8 @@ template("js_compile_checked") {
"$target_gen_dir/{{source_file_part}}",
]
- # TODO(eugenebut): need to enable the following compilation checks once
- # the corresponding errors have been fixed:
+ # TODO(crbug.com/487804): need to enable the following compilation checks
+ # once the corresponding errors have been fixed:
# --jscomp_error=checkTypes
# --jscomp_error=checkVars
# --jscomp_error=missingProperties
@@ -169,3 +170,79 @@ template("js_compile_checked") {
}
}
}
+
+# Defines a target that compile JavaScript files without error checking using
+# the closure compiler.
+#
+# Variables
+# sources:
+# List of JavaScript files to compile.
+#
+# deps (optional)
+# List of targets required by this target.
+#
+# visibility (optional)
+# Visibility restrictions.
+#
+# TODO(crbug.com/487804): once all errors have been fixed, remove this template
+# and port all code to use js_compile_checked instead.
+template("js_compile_unchecked") {
+ assert(defined(invoker.sources),
+ "Need sources in $target_name listing the js files.")
+
+ if (compile_javascript) {
+ java_action_foreach(target_name) {
+ forward_variables_from(invoker,
+ [
+ "deps",
+ "visibility",
+ ])
+
+ script = closure_compiler_path
+ sources = invoker.sources
+ outputs = [
+ "$target_gen_dir/{{source_file_part}}",
+ ]
+
+ args = [
+ "--compilation_level",
+ "SIMPLE_OPTIMIZATIONS",
+ "--js",
+ "{{source}}",
+ "--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",
+ # ],
+ # },
+ }
+ } else {
+ copy(target_name) {
+ forward_variables_from(invoker,
+ [
+ "deps",
+ "visibility",
+ ])
+
+ sources = invoker.sources
+ outputs = [
+ "$target_gen_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",
+ # ],
+ # },
+ }
+ }
+}
« ios/chrome/browser/BUILD.gn ('K') | « ios/public/test/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698