Skip to content

Commit

Permalink
Fix GoogleUtilities zip file structure (#12418)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 authored Feb 23, 2024
1 parent 0b9af70 commit 57926ca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions ReleaseTooling/Sources/Utils/FileManager+Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public extension FileManager {
/// All folders with a `.bundle` extension.
case bundles

/// All folders with a `.bundle` extension excluding privacy manifest bundles.
case nonPrivacyBundles

/// A directory with an optional name. If name is `nil`, all directories will be matched.
case directories(name: String?)

Expand Down Expand Up @@ -186,6 +189,13 @@ public extension FileManager {
if fileURL.pathExtension == "bundle" {
matches.append(fileURL)
}
case .nonPrivacyBundles:
// The only thing of interest is the path extension being ".bundle", but not a privacy
// bundle.
if fileURL.pathExtension == "bundle",
!fileURL.lastPathComponent.hasSuffix("_Privacy.bundle") {
matches.append(fileURL)
}
case .headers:
if fileURL.pathExtension == "h" {
matches.append(fileURL)
Expand Down
4 changes: 2 additions & 2 deletions ReleaseTooling/Sources/ZipBuilder/ResourcesManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extension ResourcesManager {
static func directoryContainsResources(_ dir: URL) throws -> Bool {
// First search for any .bundle files.
let fileManager = FileManager.default
let bundles = try fileManager.recursivelySearch(for: .bundles, in: dir)
let bundles = try fileManager.recursivelySearch(for: .nonPrivacyBundles, in: dir)

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

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

0 comments on commit 57926ca

Please sign in to comment.