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

Unified Diff: tools/gn/functions_target.cc

Issue 1386783003: [GN]: Support for loadable modules (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unit tests Created 5 years, 2 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
Index: tools/gn/functions_target.cc
diff --git a/tools/gn/functions_target.cc b/tools/gn/functions_target.cc
index fbac2d2bfe26c606d013a6820f401e23ba45bf48..0413e6565263ceee9bfd16ec705db55d1cdc79cb 100644
--- a/tools/gn/functions_target.cc
+++ b/tools/gn/functions_target.cc
@@ -19,7 +19,8 @@
" Deps: data_deps, deps, public_deps\n"
#define GENERAL_TARGET_VARS \
" General: check_includes, configs, data, inputs, output_name,\n" \
- " output_extension, public, sources, testonly, visibility\n"
+ " output_extension, public, sources, testonly, visibility,\n" \
+ " darwin_bundle\n"
namespace functions {
@@ -355,6 +356,35 @@ Value RunGroup(Scope* scope,
block, err);
}
+// loadable_module -------------------------------------------------------------
+
+const char kLoadableModule[] = "loadable_module";
+const char kLoadableModule_HelpShort[] =
+ "loadable_module: Declare a loadable module target.";
+const char kLoadableModule_Help[] =
+ "loadable_module: Declare a loadable module target.\n"
+ "\n"
brettw 2015/10/13 23:13:32 Can you add a paragraph at the top here about how
Bons 2015/10/13 23:30:52 Done.
+ " A loadable module will be specified on the linker line for targets\n"
+ " listing the loadable module in its \"deps\". If you don't want this\n"
+ " (if you don't need to dynamically load the library at runtime), then\n"
+ " you should use a \"shared_library\" target type instead.\n"
+ "\n"
+ "Variables\n"
+ "\n"
+ CONFIG_VALUES_VARS_HELP
+ DEPS_VARS
+ DEPENDENT_CONFIG_VARS
+ GENERAL_TARGET_VARS;
+
+Value RunLoadableModule(Scope* scope,
+ const FunctionCallNode* function,
+ const std::vector<Value>& args,
+ BlockNode* block,
+ Err* err) {
+ return ExecuteGenericTarget(functions::kLoadableModule, scope, function, args,
+ block, err);
+}
+
// shared_library --------------------------------------------------------------
const char kSharedLibrary[] = "shared_library";
@@ -366,7 +396,8 @@ const char kSharedLibrary_Help[] =
" A shared library will be specified on the linker line for targets\n"
" listing the shared library in its \"deps\". If you don't want this\n"
" (say you dynamically load the library at runtime), then you should\n"
- " depend on the shared library via \"data_deps\" instead.\n"
+ " depend on the shared library via \"data_deps\" or, on Darwin\n"
brettw 2015/10/13 23:13:33 I'd remove "on Darwin platforms" since this should
+ " platforms, use a \"loadable_module\" target type instead.\n"
"\n"
"Variables\n"
"\n"
@@ -501,8 +532,7 @@ Value RunTarget(Scope* scope,
BlockNode* block,
Err* err) {
if (args.size() != 2) {
- *err = Err(function, "Expected two arguments.",
- "Dude, try \"gn help target\".");
+ *err = Err(function, "Expected two arguments. Try \"gn help target\".");
brettw 2015/10/13 23:13:33 I think the old one with two string args is better
Bons 2015/10/13 23:30:52 Ah that was a mistake. I was just trying to remove
return Value();
}

Powered by Google App Engine
This is Rietveld 408576698