PR #2138: Exclude Windows-specific CCTZ source files in podspec Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/2138 ## Summary - This PR excludes Windows-specific CCTZ source files (`absl/time/internal/cctz/src/*_win.cc`) in the generated `abseil.podspec`. ## Description - The CCTZ time zone library in Abseil contains platform-specific source files like `absl/time/internal/cctz/src/time_zone_name_win.cc` intended only for Windows builds. When consuming Abseil via CocoaPods on Apple platforms (iOS, macOS, tvOS, watchOS, visionOS), these Windows-specific files are unnecessary and cause build errors. ## End-to-End Build Test - Tested integration with CocoaPods client project (`gRPC Sample` on iOS Simulator `arm64` and `x86_64`). - `xcodebuild -project Pods.xcodeproj -target abseil` passed with **`** BUILD SUCCEEDED **`**. Merge 47d77a572d5271747d3b3fecba4786ed1b469520 into b7adf83dccc73cd897fa6938978d96dce63a5d52 Merging this change closes #2138 PiperOrigin-RevId: 974534125 Change-Id: Ief81630244067bb3e385511324b1fffd986adea6
diff --git a/absl/abseil.podspec.gen.py b/absl/abseil.podspec.gen.py index e19f951..73eb9de 100755 --- a/absl/abseil.podspec.gen.py +++ b/absl/abseil.podspec.gen.py
@@ -49,6 +49,7 @@ s.tvos.deployment_target = '12.0' s.watchos.deployment_target = '4.0' s.visionos.deployment_target = '1.0' + s.exclude_files = [ 'absl/time/internal/cctz/src/*_win.cc' ] s.subspec 'xcprivacy' do |ss| ss.resource_bundles = { ss.module_name => 'PrivacyInfo.xcprivacy', @@ -189,7 +190,11 @@ # Since CocoaPods treats header_files a bit differently from bazel, # this won't generate a header_files field so that all source_files # are considered as header files. - srcs = sorted(set(rule.hdrs + rule.textual_hdrs + rule.srcs)) + srcs = [ + s + for s in sorted(set(rule.hdrs + rule.textual_hdrs + rule.srcs)) + if not s.endswith("_win.cc") + ] write_indented_list( f, "{indent}{var}.source_files = ".format(indent=indent, var=spec_var), srcs)