From ee4ce2df2f57b07e523bfb4d4728543d73b5a009 Mon Sep 17 00:00:00 2001 From: Chatura Atapattu Date: Fri, 22 Jul 2022 15:19:12 -0700 Subject: [PATCH] Use an SDKRoot based Foundation framework Summary: When building `igios-no-extensions` with buck2 on linux, we the following analysis error: ``` When running analysis for `fbsource//fbobjc/Apps/Instagram/Instagram:InstagramNoExtensions (fbsource//tools/build_defs/config/platform/apple:Instagram-125ae32099392ce8)` Caused by: 0: When running analysis for `fbsource//fbobjc/Apps/Instagram/Instagram:InstagramARVRFrameworkDylibFramework (fbsource//tools/build_defs/config/platform/apple:Instagram-125ae32099392ce8)` 1: When running analysis for `fbsource//fbobjc/Apps/Instagram/Instagram:InstagramDependencyPoolForLinkGroupsFramework (fbsource//tools/build_defs/config/platform/apple:Instagram-125ae32099392ce8)` 2: When running analysis for `fbsource//fbobjc/Libraries/FBReactKit:RCTNetInfo (fbsource//tools/build_defs/config/platform/apple:Instagram-125ae32099392ce8)` 3: When running analysis for `fbsource//xplat/js/RKJSModules/Libraries/NetInfo:FBReactNativeNetInfoSpecApple (fbsource//tools/build_defs/config/platform/apple:Instagram-125ae32099392ce8)` 4: When running analysis for `fbsource//xplat/js/react-native-github:RCTTypeSafety (fbsource//tools/build_defs/config/platform/apple:Instagram-125ae32099392ce8)` 5: Traceback (most recent call last): * fbcode/buck2/prelude/apple/apple_library.bzl:48, in constructor_params, swift_providers = apple_library_rule_constructor_params_a... * fbcode/buck2/prelude/apple/apple_library.bzl:111, in apple_library_rule_constructor_params_and_swift_providers args = [cmd_args(get_framework_search_path_flags(ctx))], * fbcode/buck2/prelude/apple/apple_frameworks.bzl:46, in get_framework_search_path_flags return _get_framework_search_path_flags(_get_non_sdk_framework_directories(ct... * fbcode/buck2/prelude/apple/apple_frameworks.bzl:59, in _get_non_sdk_framework_directories return dedupe(filter(None, [_non_sdk_framework_directory(ctx, x) for x in fra... * fbcode/buck2/prelude/apple/apple_frameworks.bzl:95, in _non_sdk_framework_directory expanded_framework_path = _expand_sdk_framework_path(ctx, framework_path) * fbcode/buck2/prelude/apple/apple_frameworks.bzl:81, in _expand_sdk_framework_path expanded_path = expanded_path.replace(path_variable, path_value) error: Type of parameter `new` doesn't match, expected `str`, actual `artifact` --> fbcode/buck2/prelude/apple/apple_frameworks.bzl:81:25 | 81 | expanded_path = expanded_path.replace(path_variable, path_value) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ``` This is related to running on Linux with buck2 and how we get the framework paths for linux/pika toolchains for non SDK frameworks. However, Foundation is an SDK framework, and updating it to be as such allows us to build, both with buck1 and buck2. Differential Revision: D38080376 fbshipit-source-id: b226c3511e3312d0bf0ddb792dbe4ca99768cad1 --- BUCK | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUCK b/BUCK index 7780ff8e1f6650..d9ee7b3fc65c7b 100644 --- a/BUCK +++ b/BUCK @@ -600,7 +600,7 @@ rn_apple_library( contacts = ["oncall+react_native@xmail.facebook.com"], extension_api_only = True, frameworks = [ - "$PLATFORM_DIR/Developer/Library/Frameworks/Foundation.framework", + "Foundation", ], inherited_buck_flags = get_static_library_ios_flags(), labels = [