From 0720e1ced708a7f72dcbc389353aa5664fcb3c81 Mon Sep 17 00:00:00 2001 From: Chuck Grindel Date: Sat, 30 Mar 2024 11:55:34 -0600 Subject: [PATCH] fix: add -ObjC to copts for objc_library targets --- swiftpkg/internal/swiftpkg_build_files.bzl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/swiftpkg/internal/swiftpkg_build_files.bzl b/swiftpkg/internal/swiftpkg_build_files.bzl index 4581bae07..1a2f62cee 100644 --- a/swiftpkg/internal/swiftpkg_build_files.bzl +++ b/swiftpkg/internal/swiftpkg_build_files.bzl @@ -314,6 +314,12 @@ def _clang_target_build_file(repository_ctx, pkg_ctx, target): copts.extend(local_includes) + if target.objc_src_info != None: + # As of 2024-03-30, objc_library does not add the `-ObjC` flag during + # compilation. We need to add it for the ObjC resource bundle accessor + # to work properly. + copts.append("-ObjC") + # The `includes` attribute adds includes as -isystem which propagates # to cc_XXX that depend upon the library. Providing includes as -I # only provides the includes for this target.