bazel: mac: Copy but don't link the CEF framework (see #3757)
Copy the CEF framework into the app bundle but do not link it. See https://groups.google.com/g/cef-announce/c/Fith0A3kWtw/m/6ds_mJVMCQAJ for background. Use `**kwargs` to pass all other arguments to the actual `macos_application` target declaration.
This commit is contained in:
parent
701c9470f2
commit
b98eac265a
|
@ -5,10 +5,13 @@
|
|||
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
|
||||
load("@build_bazel_rules_apple//apple:macos.bzl", "macos_application")
|
||||
load("//bazel:variables.bzl", "VERSION_PLIST")
|
||||
load("//bazel/mac:variables.bzl", "MACOS_DEPLOYMENT_TARGET", "MACOS_BUNDLE_ID_BASE",
|
||||
load("//bazel/mac:variables.bzl",
|
||||
"MACOS_DEPLOYMENT_TARGET",
|
||||
"MACOS_BUNDLE_ID_BASE",
|
||||
"CEF_FRAMEWORK_NAME",
|
||||
"COMMON_LINKOPTS")
|
||||
|
||||
def _declare_helper_app(name, info_plist, deps, helper_base_name, helper_suffix):
|
||||
def _declare_helper_app(name, info_plist, deps, helper_base_name, helper_suffix, **kwargs):
|
||||
"""
|
||||
Creates a Helper .app target.
|
||||
"""
|
||||
|
@ -43,6 +46,7 @@ def _declare_helper_app(name, info_plist, deps, helper_base_name, helper_suffix)
|
|||
deps = [
|
||||
"@cef//:cef_sandbox",
|
||||
] + deps,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
HELPERS = {
|
||||
|
@ -53,7 +57,7 @@ HELPERS = {
|
|||
"HelperRenderer": "Renderer",
|
||||
}
|
||||
|
||||
def declare_all_helper_apps(name, info_plist, deps):
|
||||
def declare_all_helper_apps(name, info_plist, deps, **kwargs):
|
||||
"""
|
||||
Creates all Helper .app targets.
|
||||
"""
|
||||
|
@ -63,9 +67,10 @@ def declare_all_helper_apps(name, info_plist, deps):
|
|||
deps = deps,
|
||||
helper_base_name = h,
|
||||
helper_suffix = v,
|
||||
**kwargs,
|
||||
) for h, v in HELPERS.items()]
|
||||
|
||||
def declare_main_app(name, info_plist, deps, resources, linkopts=[]):
|
||||
def declare_main_app(name, info_plist, deps, resources, linkopts=[], **kwargs):
|
||||
"""
|
||||
Creates the main .app target.
|
||||
"""
|
||||
|
@ -92,6 +97,7 @@ def declare_main_app(name, info_plist, deps, resources, linkopts=[]):
|
|||
":HelperGPU": "Frameworks",
|
||||
":HelperPlugin": "Frameworks",
|
||||
":HelperRenderer": "Frameworks",
|
||||
"@cef//:cef_framework": "Frameworks/{}.framework".format(CEF_FRAMEWORK_NAME),
|
||||
},
|
||||
bundle_name = name,
|
||||
bundle_id = "{}.{}".format(MACOS_BUNDLE_ID_BASE, name.lower()),
|
||||
|
@ -102,7 +108,6 @@ def declare_main_app(name, info_plist, deps, resources, linkopts=[]):
|
|||
target_compatible_with = [
|
||||
"@platforms//os:macos",
|
||||
],
|
||||
deps = [
|
||||
"@cef//:cef_framework",
|
||||
] + deps,
|
||||
deps = deps,
|
||||
**kwargs,
|
||||
)
|
||||
|
|
|
@ -7,8 +7,8 @@ package(default_visibility = [
|
|||
"//visibility:public",
|
||||
])
|
||||
|
||||
load("@aspect_bazel_lib//lib:copy_directory.bzl", "copy_directory")
|
||||
load("@bazel_skylib//lib:selects.bzl", "selects")
|
||||
load("@build_bazel_rules_apple//apple:apple.bzl", "apple_dynamic_framework_import")
|
||||
load("//bazel:library_helpers.bzl", "declare_cc_library", "declare_objc_library")
|
||||
load("//bazel/win:variables.bzl",
|
||||
WIN_DLLS="DLLS",
|
||||
|
@ -309,10 +309,15 @@ alias(
|
|||
}),
|
||||
)
|
||||
|
||||
apple_dynamic_framework_import(
|
||||
# Copy the CEF framework into the app bundle but do not link it. See
|
||||
# https://groups.google.com/g/cef-announce/c/Fith0A3kWtw/m/6ds_mJVMCQAJ
|
||||
# for background. Use `copy_directory` instead of `filegroup` to remove
|
||||
# the Debug/Release path prefix.
|
||||
copy_directory(
|
||||
name = "cef_framework",
|
||||
framework_imports = select({
|
||||
"@cef//:dbg": glob(["Debug/{}.framework/**".format(CEF_FRAMEWORK_NAME)]),
|
||||
"//conditions:default": glob(["Release/{}.framework/**".format(CEF_FRAMEWORK_NAME)]),
|
||||
src = select({
|
||||
"@cef//:dbg": "Debug/{}.framework".format(CEF_FRAMEWORK_NAME),
|
||||
"//conditions:default": "Release/{}.framework".format(CEF_FRAMEWORK_NAME),
|
||||
}),
|
||||
out = "{}.framework".format(CEF_FRAMEWORK_NAME),
|
||||
)
|
||||
|
|
|
@ -15,3 +15,4 @@ bazel_dep(name = "rules_apple", version = "3.6.0", repo_name = "build_bazel_rule
|
|||
bazel_dep(name = "rules_cc", version = "0.0.9")
|
||||
|
||||
# Add other dependencies here.
|
||||
bazel_dep(name = "aspect_bazel_lib", version = "2.7.9")
|
||||
|
|
Loading…
Reference in New Issue