Skip to content

Commit 8f35f75

Browse files
committed
fixup
1 parent 164ea53 commit 8f35f75

File tree

3 files changed

+3
-45
lines changed

3 files changed

+3
-45
lines changed

Sources/PackageLoading/Diagnostics.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,6 @@ extension Basics.Diagnostic {
127127
localized variants will never be chosen
128128
""")
129129
}
130-
131-
static func missingDefaultLocalizationResource(
132-
resource: String,
133-
targetName: String,
134-
defaultLocalization: String
135-
) -> Self {
136-
.warning("""
137-
resource '\(resource)' in target '\(targetName)' is missing the default localization \
138-
'\(defaultLocalization)'; the default localization is used as a fallback when no other localization matches
139-
""")
140-
}
141130
}
142131

143132
extension ObservabilityMetadata {

Sources/PackageLoading/TargetSourcesBuilder.swift

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ public struct TargetSourcesBuilder {
172172
diagnoseConflictingResources(in: resources)
173173
diagnoseCopyConflictsWithLocalizationDirectories(in: resources)
174174
diagnoseLocalizedAndUnlocalizedVariants(in: resources)
175-
diagnoseMissingDevelopmentRegionResource(in: resources)
176175
diagnoseInfoPlistConflicts(in: resources)
177176
diagnoseInvalidResource(in: target.resources)
178177

@@ -322,30 +321,6 @@ public struct TargetSourcesBuilder {
322321
}
323322
}
324323

325-
private func diagnoseMissingDevelopmentRegionResource(in resources: [Resource]) {
326-
// We can't diagnose anything here without a default localization set.
327-
guard let defaultLocalization = self.defaultLocalization else {
328-
return
329-
}
330-
331-
// rdar://86297221
332-
// There is no need to validate for english, because the string key is already in english
333-
if self.defaultLocalization == "en" {
334-
return
335-
}
336-
337-
let localizedResources = resources.lazy.filter({ $0.localization != nil && $0.localization != "Base" })
338-
let resourcesByBasename = Dictionary(grouping: localizedResources, by: { $0.path.basename })
339-
for (basename, resources) in resourcesByBasename {
340-
if !resources.contains(where: { $0.localization == defaultLocalization }) {
341-
self.observabilityScope.emit(.missingDefaultLocalizationResource(
342-
resource: basename,
343-
targetName: target.name,
344-
defaultLocalization: defaultLocalization))
345-
}
346-
}
347-
}
348-
349324
private func diagnoseInfoPlistConflicts(in resources: [Resource]) {
350325
for resource in resources {
351326
if resource.destination == RelativePath("Info.plist") {

Tests/PackageLoadingTests/TargetSourcesBuilderTests.swift

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,8 @@ class TargetSourcesBuilderTests: XCTestCase {
490490
}
491491
}
492492

493+
// rdar://86297221
494+
// There is no need to validate localization exists for default localization
493495
func testMissingDefaultLocalization() throws {
494496
let target = try TargetDescription(name: "Foo", resources: [
495497
.init(rule: .process(localization: .none), path: "Resources"),
@@ -509,15 +511,7 @@ class TargetSourcesBuilderTests: XCTestCase {
509511

510512
do {
511513
build(target: target, defaultLocalization: "fr", toolsVersion: .v5_3, fs: fs) { _, _, _, _, identity, kind, path, diagnostics in
512-
testDiagnostics(diagnostics) { result in
513-
let diagnostic = result.check(
514-
diagnostic: .contains("resource 'Icon.png' in target 'Foo' is missing the default localization 'fr'"),
515-
severity: .warning
516-
)
517-
XCTAssertEqual(diagnostic?.metadata?.packageIdentity, identity)
518-
XCTAssertEqual(diagnostic?.metadata?.packageKind, kind)
519-
XCTAssertEqual(diagnostic?.metadata?.targetName, target.name)
520-
}
514+
XCTAssertNoDiagnostics(diagnostics)
521515
}
522516
}
523517

0 commit comments

Comments
 (0)