Index: build/config/mac/rules.gni |
diff --git a/build/config/mac/rules.gni b/build/config/mac/rules.gni |
index 4a910d8b8f76a0517bcc337f8304831e946d743b..cdb12d9a69026a1b3b508ef88e275fff5ae15f49 100644 |
--- a/build/config/mac/rules.gni |
+++ b/build/config/mac/rules.gni |
@@ -278,3 +278,58 @@ template("mac_app_bundle") { |
bundle_executable_dir = "$bundle_root_dir/MacOS" |
} |
} |
+ |
+# Template to package a loadable_module into a .plugin bundle. |
+# |
+# This takes no extra arguments that differ from a loadable_module. |
+template("mac_plugin_bundle") { |
+ assert(defined(invoker.deps), |
+ "Dependencies must be specified for $target_name") |
+ |
+ _target_name = target_name |
+ _loadable_module_target = _target_name + "_loadable_module" |
+ _loadable_module_bundle_data = _loadable_module_target + "_bundle_data" |
+ |
+ loadable_module(_loadable_module_target) { |
+ visibility = [ ":$_loadable_module_bundle_data" ] |
+ forward_variables_from(invoker, |
+ "*", |
+ [ |
+ "assert_no_deps", |
+ "data_deps", |
+ "output_name", |
+ "visibility", |
+ ]) |
+ } |
+ |
+ bundle_data(_loadable_module_bundle_data) { |
+ visibility = [ ":$_target_name" ] |
+ sources = [ |
+ "$root_out_dir/${_loadable_module_target}.so", |
+ ] |
+ outputs = [ |
+ "{{bundle_executable_dir}}/$_target_name", |
+ ] |
+ public_deps = [ |
+ ":$_loadable_module_target", |
+ ] |
+ } |
+ |
+ create_bundle(_target_name) { |
+ forward_variables_from(invoker, |
+ [ |
+ "data_deps", |
+ "deps", |
+ "public_deps", |
+ "testonly", |
+ "visibility", |
+ ]) |
+ if (!defined(deps)) { |
+ deps = [] |
+ } |
+ deps += [ ":$_loadable_module_bundle_data" ] |
+ |
+ bundle_root_dir = "$root_out_dir/$_target_name.plugin/Contents" |
+ bundle_executable_dir = "$bundle_root_dir/MacOS" |
+ } |
+} |