Skip to content

Commit e80cb0e

Browse files
committed
Make sure info.plists and entitlements are only parsed when the generators for those files are actually enabled
1 parent 6b3224b commit e80cb0e

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Sources/RswiftCore/RswiftCore.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,7 @@ public struct RswiftCore {
3939
let ignoreFile = (try? IgnoreFile(ignoreFileURL: callInformation.rswiftIgnoreURL)) ?? IgnoreFile()
4040

4141
let buildConfigurations = try xcodeproj.buildConfigurations(forTarget: callInformation.targetName)
42-
let infoPlists = buildConfigurations.compactMap {
43-
return loadPropertyList(name: $0.name, path: $0.infoPlistPath, callInformation: callInformation)
44-
}
45-
let entitlements = buildConfigurations.compactMap {
46-
return loadPropertyList(name: $0.name, path: $0.entitlementsPath, callInformation: callInformation)
47-
}
48-
42+
4943
let resourceURLs = try xcodeproj.resourcePaths(forTarget: callInformation.targetName)
5044
.map { path in path.url(with: callInformation.urlForSourceTreeFolder) }
5145
.compactMap { $0 }
@@ -86,9 +80,19 @@ public struct RswiftCore {
8680
structGenerators.append(AccessibilityIdentifierStructGenerator(nibs: resources.nibs, storyboards: resources.storyboards))
8781
}
8882
if callInformation.generators.contains(.info) {
83+
84+
let infoPlists = buildConfigurations.compactMap {
85+
return loadPropertyList(name: $0.name, path: $0.infoPlistPath, callInformation: callInformation)
86+
}
87+
8988
structGenerators.append(PropertyListGenerator(name: "info", plists: infoPlists, toplevelKeysWhitelist: infoPlistWhitelist))
9089
}
9190
if callInformation.generators.contains(.entitlements) {
91+
92+
let entitlements = buildConfigurations.compactMap {
93+
return loadPropertyList(name: $0.name, path: $0.entitlementsPath, callInformation: callInformation)
94+
}
95+
9296
structGenerators.append(PropertyListGenerator(name: "entitlements", plists: entitlements, toplevelKeysWhitelist: nil))
9397
}
9498

0 commit comments

Comments
 (0)