Skip to content

Commit 57926ca

Browse files
authored
Fix GoogleUtilities zip file structure (#12418)
1 parent 0b9af70 commit 57926ca

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

ReleaseTooling/Sources/Utils/FileManager+Utils.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public extension FileManager {
2828
/// All folders with a `.bundle` extension.
2929
case bundles
3030

31+
/// All folders with a `.bundle` extension excluding privacy manifest bundles.
32+
case nonPrivacyBundles
33+
3134
/// A directory with an optional name. If name is `nil`, all directories will be matched.
3235
case directories(name: String?)
3336

@@ -186,6 +189,13 @@ public extension FileManager {
186189
if fileURL.pathExtension == "bundle" {
187190
matches.append(fileURL)
188191
}
192+
case .nonPrivacyBundles:
193+
// The only thing of interest is the path extension being ".bundle", but not a privacy
194+
// bundle.
195+
if fileURL.pathExtension == "bundle",
196+
!fileURL.lastPathComponent.hasSuffix("_Privacy.bundle") {
197+
matches.append(fileURL)
198+
}
189199
case .headers:
190200
if fileURL.pathExtension == "h" {
191201
matches.append(fileURL)

ReleaseTooling/Sources/ZipBuilder/ResourcesManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extension ResourcesManager {
3030
static func directoryContainsResources(_ dir: URL) throws -> Bool {
3131
// First search for any .bundle files.
3232
let fileManager = FileManager.default
33-
let bundles = try fileManager.recursivelySearch(for: .bundles, in: dir)
33+
let bundles = try fileManager.recursivelySearch(for: .nonPrivacyBundles, in: dir)
3434

3535
// Stop searching if there were any bundles found.
3636
if !bundles.isEmpty { return true }
@@ -168,7 +168,7 @@ extension ResourcesManager {
168168
to resourceDir: URL,
169169
keepOriginal: Bool = false) throws -> [URL] {
170170
let fileManager = FileManager.default
171-
let allBundles = try fileManager.recursivelySearch(for: .bundles, in: dir)
171+
let allBundles = try fileManager.recursivelySearch(for: .nonPrivacyBundles, in: dir)
172172

173173
// If no bundles are found, return an empty array since nothing was done (but there wasn't an
174174
// error).

0 commit comments

Comments
 (0)