From 539e8ec316c06864085de5002d46122fa39d516b Mon Sep 17 00:00:00 2001 From: Danny Weinberg Date: Mon, 27 Jan 2020 14:36:12 -0800 Subject: [PATCH] Handle header patterns that start with "**/" Some podspecs just include all files under their directory (eg [RCTText](https://github.com/facebook/react-native/blob/0.61-stable/Libraries/Text/React-RCTText.podspec#L30)). This breaks PodToBUILD both during generation (it passed an empty string to `fileManager.subpathsOfDirectory`, which threw an error) and at runtime (it double included the `pod_support` headers, which caused Bazel to fail). This fixes both of those issues. --- .../Calabash.podspec.json.goldmaster | 3 +++ .../GoldMaster/CardIO.podspec.json.goldmaster | 3 +++ .../ColorCube.podspec.json.goldmaster | 3 +++ .../FBSDKCoreKit.podspec.json.goldmaster | 6 +++-- .../FBSDKLoginKit.podspec.json.goldmaster | 3 +++ ...KMessengerShareKit.podspec.json.goldmaster | 3 +++ .../FBSDKShareKit.podspec.json.goldmaster | 6 ++++- .../FLAnimatedImage.podspec.json.goldmaster | 3 +++ .../GoldMaster/FLEX.podspec.json.goldmaster | 3 +++ .../GoldMaster/Folly.podspec.json.goldmaster | 3 +++ .../GoogleAppIndexing.podspec.json.goldmaster | 3 +++ .../IBActionSheet.podspec.json.goldmaster | 3 +++ .../KVOController.podspec.json.goldmaster | 3 +++ .../Masonry.podspec.json.goldmaster | 3 +++ ...ePasswordExtension.podspec.json.goldmaster | 3 ++- .../PINOperation.podspec.json.goldmaster | 3 +++ .../PaymentKit.podspec.json.goldmaster | 3 +++ .../RadarKit.podspec.json.goldmaster | 3 +++ .../React.0.9.0.podspec.json.goldmaster | 3 +++ .../SFHFKeychainUtils.podspec.json.goldmaster | 3 +++ ...ResizableView+Pion.podspec.json.goldmaster | 3 +++ ...TextViewController.podspec.json.goldmaster | 3 +++ .../Smartling.podspec.json.goldmaster | 3 +++ .../GoldMaster/Stripe.podspec.json.goldmaster | 3 +++ .../Texture.podspec.json.goldmaster | 3 +++ ...wLeftAlignedLayout.podspec.json.goldmaster | 3 +++ .../GoldMaster/Weixin.podspec.json.goldmaster | 3 +++ .../ZipArchive.podspec.json.goldmaster | 3 +++ ...t-for-react-native.podspec.json.goldmaster | 3 +++ .../GoldMaster/glog.podspec.json.goldmaster | 1 + .../GoldMaster/iRate.podspec.json.goldmaster | 3 +++ .../kingpin.podspec.json.goldmaster | 3 +++ .../GoldMaster/pop.podspec.json.goldmaster | 3 +++ ...-ios-player-helper.podspec.json.goldmaster | 6 +++-- Sources/PodToBUILD/GlobUtils.swift | 6 ++++- Sources/PodToBUILD/ObjcLibrary.swift | 22 +++++++++++++++---- 36 files changed, 126 insertions(+), 11 deletions(-) diff --git a/IntegrationTests/GoldMaster/Calabash.podspec.json.goldmaster b/IntegrationTests/GoldMaster/Calabash.podspec.json.goldmaster index 621bd46e..0883b06a 100644 --- a/IntegrationTests/GoldMaster/Calabash.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/Calabash.podspec.json.goldmaster @@ -161,6 +161,9 @@ filegroup( "calabash.framework/Versions/A/Headers/*.hpp", "calabash.framework/Versions/A/Headers/*.hxx" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ) + [ ":Calabash_cxx_hdrs" diff --git a/IntegrationTests/GoldMaster/CardIO.podspec.json.goldmaster b/IntegrationTests/GoldMaster/CardIO.podspec.json.goldmaster index d92f3b12..42893714 100644 --- a/IntegrationTests/GoldMaster/CardIO.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/CardIO.podspec.json.goldmaster @@ -27,6 +27,9 @@ filegroup( [ "CardIO/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/ColorCube.podspec.json.goldmaster b/IntegrationTests/GoldMaster/ColorCube.podspec.json.goldmaster index ec92c918..e49ca376 100644 --- a/IntegrationTests/GoldMaster/ColorCube.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/ColorCube.podspec.json.goldmaster @@ -27,6 +27,9 @@ filegroup( [ "ColorCube/ColorCube/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/FBSDKCoreKit.podspec.json.goldmaster b/IntegrationTests/GoldMaster/FBSDKCoreKit.podspec.json.goldmaster index 0d254b80..64ad70be 100644 --- a/IntegrationTests/GoldMaster/FBSDKCoreKit.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/FBSDKCoreKit.podspec.json.goldmaster @@ -47,7 +47,8 @@ filegroup( "FBSDKCoreKit/FBSDKCoreKit/FBSDKDeviceViewControllerBase.h", "FBSDKCoreKit/FBSDKCoreKit/Internal/Device/**/*.h", "FBSDKCoreKit/FBSDKCoreKit/Internal/Device/**/*.hpp", - "FBSDKCoreKit/FBSDKCoreKit/Internal/Device/**/*.hxx" + "FBSDKCoreKit/FBSDKCoreKit/Internal/Device/**/*.hxx", + "pod_support/Headers/Public/**/*" ], exclude_directories = 1 ), @@ -82,7 +83,8 @@ filegroup( "FBSDKCoreKit/FBSDKCoreKit/Internal/UI/FBSDKMaleSilhouetteIcon.h", "FBSDKCoreKit/FBSDKCoreKit/Internal/WebDialog/**/*.h", "FBSDKCoreKit/FBSDKCoreKit/Internal/WebDialog/**/*.hpp", - "FBSDKCoreKit/FBSDKCoreKit/Internal/WebDialog/**/*.hxx" + "FBSDKCoreKit/FBSDKCoreKit/Internal/WebDialog/**/*.hxx", + "pod_support/Headers/Public/**/*" ], exclude_directories = 1 ) diff --git a/IntegrationTests/GoldMaster/FBSDKLoginKit.podspec.json.goldmaster b/IntegrationTests/GoldMaster/FBSDKLoginKit.podspec.json.goldmaster index b443677b..2ca47232 100644 --- a/IntegrationTests/GoldMaster/FBSDKLoginKit.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/FBSDKLoginKit.podspec.json.goldmaster @@ -27,6 +27,9 @@ filegroup( [ "FBSDKLoginKit/FBSDKLoginKit/**/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/FBSDKMessengerShareKit.podspec.json.goldmaster b/IntegrationTests/GoldMaster/FBSDKMessengerShareKit.podspec.json.goldmaster index f338b4e9..00bdf2e4 100644 --- a/IntegrationTests/GoldMaster/FBSDKMessengerShareKit.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/FBSDKMessengerShareKit.podspec.json.goldmaster @@ -30,6 +30,9 @@ filegroup( "FBSDKMessengerShareKit/**/*.hxx", "FBSDKMessengerShareKit/FBSDKMessengerShareKit/**/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/FBSDKShareKit.podspec.json.goldmaster b/IntegrationTests/GoldMaster/FBSDKShareKit.podspec.json.goldmaster index b4c7b5bc..7008d6f6 100644 --- a/IntegrationTests/GoldMaster/FBSDKShareKit.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/FBSDKShareKit.podspec.json.goldmaster @@ -46,7 +46,8 @@ filegroup( ], exclude = [ "FBSDKShareKit/FBSDKShareKit/FBSDKDeviceShareButton.h", - "FBSDKShareKit/FBSDKShareKit/FBSDKDeviceShareViewController.h" + "FBSDKShareKit/FBSDKShareKit/FBSDKDeviceShareViewController.h", + "pod_support/Headers/Public/**/*" ], exclude_directories = 1 ), @@ -80,6 +81,9 @@ filegroup( "FBSDKShareKit/FBSDKShareKit/Internal/FBSDKShareUtility.h", "FBSDKShareKit/FBSDKShareKit/Internal/FBSDKVideoUploader.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ) } diff --git a/IntegrationTests/GoldMaster/FLAnimatedImage.podspec.json.goldmaster b/IntegrationTests/GoldMaster/FLAnimatedImage.podspec.json.goldmaster index 3a10d3a8..143c668a 100644 --- a/IntegrationTests/GoldMaster/FLAnimatedImage.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/FLAnimatedImage.podspec.json.goldmaster @@ -27,6 +27,9 @@ filegroup( [ "FLAnimatedImage/**/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/FLEX.podspec.json.goldmaster b/IntegrationTests/GoldMaster/FLEX.podspec.json.goldmaster index af47cdf4..2051d29e 100644 --- a/IntegrationTests/GoldMaster/FLEX.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/FLEX.podspec.json.goldmaster @@ -27,6 +27,9 @@ filegroup( [ "Classes/**/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/Folly.podspec.json.goldmaster b/IntegrationTests/GoldMaster/Folly.podspec.json.goldmaster index 169975d7..523fa81c 100644 --- a/IntegrationTests/GoldMaster/Folly.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/Folly.podspec.json.goldmaster @@ -29,6 +29,9 @@ filegroup( "folly/detail/*.h", "folly/portability/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/GoogleAppIndexing.podspec.json.goldmaster b/IntegrationTests/GoldMaster/GoogleAppIndexing.podspec.json.goldmaster index 326aa345..27a7e4cf 100644 --- a/IntegrationTests/GoldMaster/GoogleAppIndexing.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/GoogleAppIndexing.podspec.json.goldmaster @@ -31,6 +31,9 @@ filegroup( "Changelog/**/*.hpp", "Changelog/**/*.hxx" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/IBActionSheet.podspec.json.goldmaster b/IntegrationTests/GoldMaster/IBActionSheet.podspec.json.goldmaster index 11b98f97..46569809 100644 --- a/IntegrationTests/GoldMaster/IBActionSheet.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/IBActionSheet.podspec.json.goldmaster @@ -27,6 +27,9 @@ filegroup( [ "IBActionSheetSample/IBActionSheetSample/IBActionSheet.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/KVOController.podspec.json.goldmaster b/IntegrationTests/GoldMaster/KVOController.podspec.json.goldmaster index fc2d493d..88bb05fe 100644 --- a/IntegrationTests/GoldMaster/KVOController.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/KVOController.podspec.json.goldmaster @@ -27,6 +27,9 @@ filegroup( [ "FBKVOController/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/Masonry.podspec.json.goldmaster b/IntegrationTests/GoldMaster/Masonry.podspec.json.goldmaster index c2da384d..2fdfea93 100644 --- a/IntegrationTests/GoldMaster/Masonry.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/Masonry.podspec.json.goldmaster @@ -45,6 +45,9 @@ filegroup( [ "Masonry/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/OnePasswordExtension.podspec.json.goldmaster b/IntegrationTests/GoldMaster/OnePasswordExtension.podspec.json.goldmaster index 5f72e5ec..62a23aa7 100644 --- a/IntegrationTests/GoldMaster/OnePasswordExtension.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/OnePasswordExtension.podspec.json.goldmaster @@ -31,7 +31,8 @@ filegroup( exclude = [ "Demos/**/*.h", "Demos/**/*.hpp", - "Demos/**/*.hxx" + "Demos/**/*.hxx", + "pod_support/Headers/Public/**/*" ], exclude_directories = 1 ), diff --git a/IntegrationTests/GoldMaster/PINOperation.podspec.json.goldmaster b/IntegrationTests/GoldMaster/PINOperation.podspec.json.goldmaster index 297b36c0..9dacf8c0 100644 --- a/IntegrationTests/GoldMaster/PINOperation.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/PINOperation.podspec.json.goldmaster @@ -117,6 +117,9 @@ filegroup( [ "Source/**/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ) + [ ":PINOperation_cxx_hdrs" diff --git a/IntegrationTests/GoldMaster/PaymentKit.podspec.json.goldmaster b/IntegrationTests/GoldMaster/PaymentKit.podspec.json.goldmaster index 8847e1a8..eeee4bca 100644 --- a/IntegrationTests/GoldMaster/PaymentKit.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/PaymentKit.podspec.json.goldmaster @@ -27,6 +27,9 @@ filegroup( [ "PaymentKit/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/RadarKit.podspec.json.goldmaster b/IntegrationTests/GoldMaster/RadarKit.podspec.json.goldmaster index be14b0b6..f5dcb35e 100644 --- a/IntegrationTests/GoldMaster/RadarKit.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/RadarKit.podspec.json.goldmaster @@ -27,6 +27,9 @@ filegroup( [ "RadarKit/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/React.0.9.0.podspec.json.goldmaster b/IntegrationTests/GoldMaster/React.0.9.0.podspec.json.goldmaster index 5f557388..15e5eefc 100644 --- a/IntegrationTests/GoldMaster/React.0.9.0.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/React.0.9.0.podspec.json.goldmaster @@ -41,6 +41,9 @@ filegroup( "react-native-cli/**/*.hpp", "react-native-cli/**/*.hxx" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ) + [ ":Core_hdrs" diff --git a/IntegrationTests/GoldMaster/SFHFKeychainUtils.podspec.json.goldmaster b/IntegrationTests/GoldMaster/SFHFKeychainUtils.podspec.json.goldmaster index 3a6cbcf7..0c4c565e 100644 --- a/IntegrationTests/GoldMaster/SFHFKeychainUtils.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/SFHFKeychainUtils.podspec.json.goldmaster @@ -147,6 +147,9 @@ filegroup( "security/**/*.hpp", "security/**/*.hxx" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ) + [ ":SFHFKeychainUtils_cxx_hdrs" diff --git a/IntegrationTests/GoldMaster/SPUserResizableView+Pion.podspec.json.goldmaster b/IntegrationTests/GoldMaster/SPUserResizableView+Pion.podspec.json.goldmaster index 6fa89c59..18b09dbe 100644 --- a/IntegrationTests/GoldMaster/SPUserResizableView+Pion.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/SPUserResizableView+Pion.podspec.json.goldmaster @@ -27,6 +27,9 @@ filegroup( [ "SPUserResizableView/SPUserResizableView.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/SlackTextViewController.podspec.json.goldmaster b/IntegrationTests/GoldMaster/SlackTextViewController.podspec.json.goldmaster index 81a9c0b3..94ffb77a 100644 --- a/IntegrationTests/GoldMaster/SlackTextViewController.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/SlackTextViewController.podspec.json.goldmaster @@ -27,6 +27,9 @@ filegroup( [ "Source/**/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/Smartling.podspec.json.goldmaster b/IntegrationTests/GoldMaster/Smartling.podspec.json.goldmaster index c9d42476..ceef3c8f 100644 --- a/IntegrationTests/GoldMaster/Smartling.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/Smartling.podspec.json.goldmaster @@ -27,6 +27,9 @@ filegroup( [ "*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/Stripe.podspec.json.goldmaster b/IntegrationTests/GoldMaster/Stripe.podspec.json.goldmaster index d57e52c4..a66dd6f4 100644 --- a/IntegrationTests/GoldMaster/Stripe.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/Stripe.podspec.json.goldmaster @@ -35,6 +35,9 @@ filegroup( "Stripe/*.h", "Stripe/PublicHeaders/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/Texture.podspec.json.goldmaster b/IntegrationTests/GoldMaster/Texture.podspec.json.goldmaster index 57866ece..30c72e49 100644 --- a/IntegrationTests/GoldMaster/Texture.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/Texture.podspec.json.goldmaster @@ -29,6 +29,9 @@ filegroup( "AsyncDisplayKit/**/*.hpp", "AsyncDisplayKit/**/*.hxx" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ) + [ ":PINRemoteImage_hdrs", diff --git a/IntegrationTests/GoldMaster/UICollectionViewLeftAlignedLayout.podspec.json.goldmaster b/IntegrationTests/GoldMaster/UICollectionViewLeftAlignedLayout.podspec.json.goldmaster index e40493d0..9af88509 100644 --- a/IntegrationTests/GoldMaster/UICollectionViewLeftAlignedLayout.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/UICollectionViewLeftAlignedLayout.podspec.json.goldmaster @@ -136,6 +136,9 @@ filegroup( "UICollectionViewLeftAlignedLayout/**/*.hpp", "UICollectionViewLeftAlignedLayout/**/*.hxx" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ) + [ ":UICollectionViewLeftAlignedLayout_cxx_hdrs" diff --git a/IntegrationTests/GoldMaster/Weixin.podspec.json.goldmaster b/IntegrationTests/GoldMaster/Weixin.podspec.json.goldmaster index fe0aa579..9fd5438a 100644 --- a/IntegrationTests/GoldMaster/Weixin.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/Weixin.podspec.json.goldmaster @@ -27,6 +27,9 @@ filegroup( [ "SDK1.6.2/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/ZipArchive.podspec.json.goldmaster b/IntegrationTests/GoldMaster/ZipArchive.podspec.json.goldmaster index a4b035c1..546ebc50 100644 --- a/IntegrationTests/GoldMaster/ZipArchive.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/ZipArchive.podspec.json.goldmaster @@ -32,6 +32,9 @@ filegroup( "minizip/unzip.h", "minizip/zip.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/boost-for-react-native.podspec.json.goldmaster b/IntegrationTests/GoldMaster/boost-for-react-native.podspec.json.goldmaster index eac2e8f8..a9859fac 100644 --- a/IntegrationTests/GoldMaster/boost-for-react-native.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/boost-for-react-native.podspec.json.goldmaster @@ -29,6 +29,9 @@ filegroup( "boost/**/*.hpp", "boost/**/*.hxx" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/glog.podspec.json.goldmaster b/IntegrationTests/GoldMaster/glog.podspec.json.goldmaster index ed3d578a..f912915a 100644 --- a/IntegrationTests/GoldMaster/glog.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/glog.podspec.json.goldmaster @@ -33,6 +33,7 @@ filegroup( "src/glog/*.h" ], exclude = [ + "pod_support/Headers/Public/**/*", "src/windows/**/*.h", "src/windows/**/*.hpp", "src/windows/**/*.hxx" diff --git a/IntegrationTests/GoldMaster/iRate.podspec.json.goldmaster b/IntegrationTests/GoldMaster/iRate.podspec.json.goldmaster index 93c8b4d6..4b92101a 100644 --- a/IntegrationTests/GoldMaster/iRate.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/iRate.podspec.json.goldmaster @@ -28,6 +28,9 @@ filegroup( [ "iRate/iRate.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/kingpin.podspec.json.goldmaster b/IntegrationTests/GoldMaster/kingpin.podspec.json.goldmaster index 56623cc1..c6a6f9ee 100644 --- a/IntegrationTests/GoldMaster/kingpin.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/kingpin.podspec.json.goldmaster @@ -27,6 +27,9 @@ filegroup( [ "kingpin/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ), visibility = [ diff --git a/IntegrationTests/GoldMaster/pop.podspec.json.goldmaster b/IntegrationTests/GoldMaster/pop.podspec.json.goldmaster index 63293967..85e31b66 100644 --- a/IntegrationTests/GoldMaster/pop.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/pop.podspec.json.goldmaster @@ -121,6 +121,9 @@ filegroup( [ "pop/**/*.h" ], + exclude = [ + "pod_support/Headers/Public/**/*" + ], exclude_directories = 1 ) + [ ":pop_cxx_hdrs" diff --git a/IntegrationTests/GoldMaster/youtube-ios-player-helper.podspec.json.goldmaster b/IntegrationTests/GoldMaster/youtube-ios-player-helper.podspec.json.goldmaster index bd08b623..ad7f2cee 100644 --- a/IntegrationTests/GoldMaster/youtube-ios-player-helper.podspec.json.goldmaster +++ b/IntegrationTests/GoldMaster/youtube-ios-player-helper.podspec.json.goldmaster @@ -230,7 +230,8 @@ filegroup( exclude = [ "Classes/osx/**/*.h", "Classes/osx/**/*.hpp", - "Classes/osx/**/*.hxx" + "Classes/osx/**/*.hxx", + "pod_support/Headers/Public/**/*" ], exclude_directories = 1 ), @@ -243,7 +244,8 @@ filegroup( exclude = [ "Classes/ios/**/*.h", "Classes/ios/**/*.hpp", - "Classes/ios/**/*.hxx" + "Classes/ios/**/*.hxx", + "pod_support/Headers/Public/**/*" ], exclude_directories = 1 ) diff --git a/Sources/PodToBUILD/GlobUtils.swift b/Sources/PodToBUILD/GlobUtils.swift index ab995a43..e54fbb55 100644 --- a/Sources/PodToBUILD/GlobUtils.swift +++ b/Sources/PodToBUILD/GlobUtils.swift @@ -121,13 +121,17 @@ public class Glob: Collection { var results = [String]() var parts = pattern.components(separatedBy: "**") - let firstPart = parts.removeFirst() + var firstPart = parts.removeFirst() var lastPart = parts.joined(separator: "**") let fileManager = FileManager.default var directories: [String] + if firstPart.isEmpty { + firstPart = "." + } + do { directories = try fileManager.subpathsOfDirectory(atPath: firstPart).compactMap { subpath in let fullPath = NSString(string: firstPart).appendingPathComponent(subpath) diff --git a/Sources/PodToBUILD/ObjcLibrary.swift b/Sources/PodToBUILD/ObjcLibrary.swift index 05058a91..4268b656 100644 --- a/Sources/PodToBUILD/ObjcLibrary.swift +++ b/Sources/PodToBUILD/ObjcLibrary.swift @@ -466,12 +466,26 @@ public struct ObjcLibrary: BazelTarget, UserConfigurable, SourceExcludable { return target is ObjcLibrary }.map { ($0 + "_hdrs").toSkylark() } } - - let podSupportHeaders = GlobNode(include: AttrSet>(basic: [PodSupportSystemPublicHeaderDir + "**/*"]), - exclude: AttrSet>.empty).toSkylark() + + let podSupportHeadersGlob = Set([PodSupportSystemPublicHeaderDir + "**/*"]) + let podSupportHeaders = GlobNode( + include: AttrSet>(basic: podSupportHeadersGlob), + exclude: AttrSet>.empty + ).toSkylark() + + // We need to explicitly exclude the pod support headers in case the headers include a bare `**/*` which would + // cause the pod support headers to be doubly included. + let headersWithoutPodSupport = GlobNode( + include: headers.include, + exclude: AttrSet( + basic: (headers.exclude.basic ?? Set()).union(podSupportHeadersGlob), + multi: headers.exclude.multi + ) + ) + if lib.isTopLevelTarget { var exposedHeaders: SkylarkNode = podSupportHeaders .+. - headers.toSkylark() .+. depHdrs.toSkylark() + headersWithoutPodSupport.toSkylark() .+. depHdrs.toSkylark() inlineSkylark.append(.functionCall( name: "filegroup", arguments: [