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

Unified Diff: build/config/mac/rules.gni

Issue 1842563006: DO NOT SUBMIT. Experimental Mac GN Framework support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Binary bundle data Created 4 years, 8 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 | build/toolchain/mac/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/mac/rules.gni
diff --git a/build/config/mac/rules.gni b/build/config/mac/rules.gni
index 32f3d99914d43f1bb0a161a2943faa95813522a8..7750d8ef6f4b4d6150144d289b115f55808eb9eb 100644
--- a/build/config/mac/rules.gni
+++ b/build/config/mac/rules.gni
@@ -210,3 +210,131 @@ template("mac_app") {
]
}
}
+
+template("mac_framework") {
+ assert(defined(invoker.deps),
+ "Dependencies must be specified for $target_name")
+ assert(defined(invoker.info_plist),
+ "The Info.plist file must be specified for $target_name")
+
+ _target_name = target_name
+ _output_name = target_name
+ if (defined(invoker.output_name)) {
+ _output_name = invoker.output_name
+ }
+ _framework_name = _output_name + ".framework"
+ _framework_version = ""
+ if (defined(invoker.framework_version)) {
+ _framework_version = invoker.framework_version
+ }
+ _framework_target = _output_name + "_framework"
+
+ _shared_library_target = target_name + "_shared_library"
+ _shared_library_bundle_data = _shared_library_target + "_bundle_data"
+
+ shared_library(_shared_library_target) {
+ visibility = [ ":$_shared_library_bundle_data" ]
+ forward_variables_from(invoker,
+ "*",
+ [
+ "assert_no_deps",
+ "data_deps",
+ "info_plist",
+ "output_name",
+ "visibility",
+ ])
+ output_name = rebase_path("$target_out_dir/$_output_name", root_build_dir)
+ }
+
+ bundle_data(_shared_library_bundle_data) {
+ visibility = [ ":$_framework_target" ]
+ forward_variables_from(invoker, [ "testonly" ])
+ sources = [
+ "$target_out_dir/lib$_output_name.dylib",
+ ]
+ outputs = [
+ "{{bundle_executable_dir}}/$_output_name",
+ ]
+ public_deps = [
+ ":$_shared_library_target",
+ ]
+ }
+
+ _info_plist_target = target_name + "_info_plist"
+ _info_plist_bundle_data = _info_plist_target + "_bundle_data"
+
+ bundle_data(_info_plist_bundle_data) {
+ visibility = [ ":$_framework_target" ]
+ forward_variables_from(invoker, [ "testonly" ])
+ sources = [
+ invoker.info_plist,
+ ]
+ outputs = [
+ "{{bundle_root_dir}}/Info.plist",
+ ]
+ binary_compress = false
+ }
+
+ _package_target = target_name + "_package"
+
+ create_bundle(_framework_target) {
+ visibility = [ ":$_package_target" ]
+ forward_variables_from(invoker,
+ [
+ "data_deps",
+ "deps",
+ "public_deps",
+ "testonly",
+ "visibility",
+ ])
+
+ if (!defined(deps)) {
+ deps = []
+ }
+ deps += [
+ ":$_info_plist_bundle_data",
+ ":$_shared_library_bundle_data",
+ ]
+
+ bundle_root_dir = "$root_out_dir/$_framework_name"
+ if (_framework_version != "") {
+ bundle_root_dir += "/Versions/$_framework_version"
+ }
+ bundle_resources_dir = "$bundle_root_dir/Resources"
+ bundle_executable_dir = "$bundle_root_dir"
+ }
+
+ if (_framework_version != "") {
+ action(_package_target) {
+ visibility = [ ":$_target_name" ]
+ forward_variables_from(invoker, [ "testonly" ])
+ script = "$root_out_dir/gyp-mac-tool"
+ outputs = [
+ "$root_out_dir/$_framework_name/Versions/Current",
+ ]
+ args = [
+ "package-framework",
+ "$_framework_name",
+ "$_framework_version",
+ ]
+ deps = [
+ ":$_framework_target",
+ ]
+ }
+ } else {
+ group(_package_target) {
+ visibility = [ ":$_target_name" ]
+ forward_variables_from(invoker, [ "testonly" ])
+ deps = [
+ ":$_framework_target",
+ ]
+ }
+ }
+
+ group(_target_name) {
+ forward_variables_from(invoker, [ "visbility", "testonly" ])
+ deps = [
+ ":$_package_target",
+ ]
+ }
+}
« no previous file with comments | « no previous file | build/toolchain/mac/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698