@@ -59,16 +59,16 @@ class TargetSourcesBuilderTests: XCTestCase {
59
59
observabilityScope: observability. topScope
60
60
)
61
61
62
- let contents = builder. computeContents ( ) . map { $0 . pathString } . sorted ( )
62
+ let contents = builder. computeContents ( ) . sorted ( )
63
63
64
64
XCTAssertEqual ( contents, [
65
- " /Bar.swift " ,
66
- " /Foo.swift " ,
67
- " /Hello.something/hello.txt " ,
68
- " /file " ,
69
- " /path/to/somefile.txt " ,
70
- " /some/path.swift " ,
71
- " /some/path/toBeCopied " ,
65
+ AbsolutePath ( " /Bar.swift " ) ,
66
+ AbsolutePath ( " /Foo.swift " ) ,
67
+ AbsolutePath ( " /Hello.something/hello.txt " ) ,
68
+ AbsolutePath ( " /file " ) ,
69
+ AbsolutePath ( " /path/to/somefile.txt " ) ,
70
+ AbsolutePath ( " /some/path.swift " ) ,
71
+ AbsolutePath ( " /some/path/toBeCopied " ) ,
72
72
] )
73
73
74
74
XCTAssertNoDiagnostics ( observability. diagnostics)
@@ -103,11 +103,11 @@ class TargetSourcesBuilderTests: XCTestCase {
103
103
observabilityScope: observability. topScope
104
104
)
105
105
106
- let contents = builder. computeContents ( ) . map { $0 . pathString } . sorted ( )
106
+ let contents = builder. computeContents ( ) . sorted ( )
107
107
108
108
XCTAssertEqual ( contents, [
109
- " /some.thing " ,
110
- " /some/hello.swift " ,
109
+ AbsolutePath ( " /some.thing " ) ,
110
+ AbsolutePath ( " /some/hello.swift " ) ,
111
111
] )
112
112
113
113
XCTAssertNoDiagnostics ( observability. diagnostics)
@@ -142,17 +142,19 @@ class TargetSourcesBuilderTests: XCTestCase {
142
142
observabilityScope: observability. topScope
143
143
)
144
144
145
- let contents = builder. computeContents ( ) . map { $0 . pathString } . sorted ( )
145
+ let contents = builder. computeContents ( ) . sorted ( )
146
146
147
147
XCTAssertEqual ( contents, [
148
- " /some.thing/hello.txt " ,
149
- " /some/hello.swift " ,
148
+ AbsolutePath ( " /some.thing/hello.txt " ) ,
149
+ AbsolutePath ( " /some/hello.swift " ) ,
150
150
] )
151
151
152
152
XCTAssertNoDiagnostics ( observability. diagnostics)
153
153
}
154
154
155
155
func testSpecialDirectoryWithExt_5_6( ) throws {
156
+ let root = AbsolutePath . root
157
+
156
158
let target = try TargetDescription (
157
159
name: " Foo " ,
158
160
path: nil ,
@@ -164,8 +166,8 @@ class TargetSourcesBuilderTests: XCTestCase {
164
166
165
167
let fs = InMemoryFileSystem ( )
166
168
fs. createEmptyFiles ( at: . root, files: [
167
- " / some.xcassets/ hello.txt" ,
168
- " / some/ hello.swift" ,
169
+ root . appending ( components : " some.xcassets " , " hello.txt " ) . pathString ,
170
+ root . appending ( components : " some " , " hello.swift " ) . pathString
169
171
] )
170
172
171
173
let observability = ObservabilitySystem . makeForTesting ( )
@@ -181,11 +183,11 @@ class TargetSourcesBuilderTests: XCTestCase {
181
183
observabilityScope: observability. topScope
182
184
)
183
185
184
- let contents = builder. computeContents ( ) . map { $0 . pathString } . sorted ( )
186
+ let contents = builder. computeContents ( ) . sorted ( )
185
187
186
188
XCTAssertEqual ( contents, [
187
- " / some.xcassets" ,
188
- " / some/ hello.swift"
189
+ root . appending ( components : " some.xcassets " ) ,
190
+ root . appending ( components : " some " , " hello.swift " ) ,
189
191
] )
190
192
191
193
XCTAssertNoDiagnostics ( observability. diagnostics)
@@ -242,9 +244,9 @@ class TargetSourcesBuilderTests: XCTestCase {
242
244
)
243
245
244
246
let files = [
245
- " /Foo.swift " ,
246
- " /Bar.swift " ,
247
- " /Baz.something "
247
+ AbsolutePath ( " /Foo.swift " ) . pathString ,
248
+ AbsolutePath ( " /Bar.swift " ) . pathString ,
249
+ AbsolutePath ( " /Baz.something " ) . pathString ,
248
250
]
249
251
250
252
let fs = InMemoryFileSystem ( )
@@ -282,8 +284,8 @@ class TargetSourcesBuilderTests: XCTestCase {
282
284
testDiagnostics ( diagnostics, problemsOnly: false ) { result in
283
285
var diagnosticsFound = [ Basics . Diagnostic? ] ( )
284
286
diagnosticsFound. append ( result. check ( diagnostic: " multiple resources named 'foo.txt' in target 'Foo' " , severity: . error) )
285
- diagnosticsFound. append ( result. checkUnordered ( diagnostic: " found 'Resources/ foo.txt' " , severity: . info) )
286
- diagnosticsFound. append ( result. checkUnordered ( diagnostic: " found 'Resources/ Sub/ foo.txt' " , severity: . info) )
287
+ diagnosticsFound. append ( result. checkUnordered ( diagnostic: " found ' \( RelativePath ( " Resources " ) . appending ( components : " foo.txt " ) ) ' " , severity: . info) )
288
+ diagnosticsFound. append ( result. checkUnordered ( diagnostic: " found ' \( RelativePath ( " Resources " ) . appending ( components : " Sub " , " foo.txt " ) ) ' " , severity: . info) )
287
289
288
290
for diagnostic in diagnosticsFound {
289
291
XCTAssertEqual ( diagnostic? . metadata? . packageIdentity, identity)
@@ -311,8 +313,8 @@ class TargetSourcesBuilderTests: XCTestCase {
311
313
testDiagnostics ( diagnostics, problemsOnly: false ) { result in
312
314
var diagnosticsFound = [ Basics . Diagnostic? ] ( )
313
315
diagnosticsFound. append ( result. check ( diagnostic: " multiple resources named 'foo.txt' in target 'Foo' " , severity: . error) )
314
- diagnosticsFound. append ( result. checkUnordered ( diagnostic: " found 'Processed/ foo.txt' " , severity: . info) )
315
- diagnosticsFound. append ( result. checkUnordered ( diagnostic: " found 'Copied/ foo.txt' " , severity: . info) )
316
+ diagnosticsFound. append ( result. checkUnordered ( diagnostic: " found ' \( RelativePath ( " Processed " ) . appending ( components : " foo.txt " ) ) ' " , severity: . info) )
317
+ diagnosticsFound. append ( result. checkUnordered ( diagnostic: " found ' \( RelativePath ( " Copied " ) . appending ( components : " foo.txt " ) ) ' " , severity: . info) )
316
318
317
319
for diagnostic in diagnosticsFound {
318
320
XCTAssertEqual ( diagnostic? . metadata? . packageIdentity, identity)
@@ -358,8 +360,8 @@ class TargetSourcesBuilderTests: XCTestCase {
358
360
testDiagnostics ( diagnostics, problemsOnly: false ) { result in
359
361
var diagnosticsFound = [ Basics . Diagnostic? ] ( )
360
362
diagnosticsFound. append ( result. check ( diagnostic: " multiple resources named 'Copy' in target 'Foo' " , severity: . error) )
361
- diagnosticsFound. append ( result. checkUnordered ( diagnostic: " found 'A/ Copy' " , severity: . info) )
362
- diagnosticsFound. append ( result. checkUnordered ( diagnostic: " found 'B/ Copy' " , severity: . info) )
363
+ diagnosticsFound. append ( result. checkUnordered ( diagnostic: " found ' \( RelativePath ( " A " ) . appending ( components : " Copy " ) ) ' " , severity: . info) )
364
+ diagnosticsFound. append ( result. checkUnordered ( diagnostic: " found ' \( RelativePath ( " B " ) . appending ( components : " Copy " ) ) ' " , severity: . info) )
363
365
364
366
for diagnostic in diagnosticsFound {
365
367
XCTAssertEqual ( diagnostic? . metadata? . packageIdentity, identity)
@@ -386,9 +388,9 @@ class TargetSourcesBuilderTests: XCTestCase {
386
388
build ( target: target, toolsVersion: . v5_3, fs: fs) { _, _, _, _, identity, kind, path, diagnostics in
387
389
testDiagnostics ( diagnostics, problemsOnly: false ) { result in
388
390
var diagnosticsFound = [ Basics . Diagnostic? ] ( )
389
- diagnosticsFound. append ( result. check ( diagnostic: " multiple resources named 'en.lproj/ foo.txt' in target 'Foo' " , severity: . error) )
390
- diagnosticsFound. append ( result. checkUnordered ( diagnostic: " found 'A/ en.lproj/ foo.txt' " , severity: . info) )
391
- diagnosticsFound. append ( result. checkUnordered ( diagnostic: " found 'B/ EN.lproj/ foo.txt' " , severity: . info) )
391
+ diagnosticsFound. append ( result. check ( diagnostic: " multiple resources named ' \( RelativePath ( " en.lproj " ) . appending ( components : " foo.txt " ) ) ' in target 'Foo' " , severity: . error) )
392
+ diagnosticsFound. append ( result. checkUnordered ( diagnostic: " found ' \( RelativePath ( " A " ) . appending ( components : " en.lproj " , " foo.txt " ) ) ' " , severity: . info) )
393
+ diagnosticsFound. append ( result. checkUnordered ( diagnostic: " found ' \( RelativePath ( " B " ) . appending ( components : " EN.lproj " , " foo.txt " ) ) ' " , severity: . info) )
392
394
393
395
for diagnostic in diagnosticsFound {
394
396
XCTAssertEqual ( diagnostic? . metadata? . packageIdentity, identity)
@@ -415,7 +417,7 @@ class TargetSourcesBuilderTests: XCTestCase {
415
417
build ( target: target, toolsVersion: . v5_3, fs: fs) { _, _, _, _, identity, kind, path, diagnostics in
416
418
testDiagnostics ( diagnostics) { result in
417
419
let diagnostic = result. check (
418
- diagnostic: " resource 'B/ en.lproj' in target 'Foo' conflicts with other localization directories " ,
420
+ diagnostic: " resource ' \( RelativePath ( " B " ) . appending ( components : " en.lproj " ) ) ' in target 'Foo' conflicts with other localization directories " ,
419
421
severity: . error
420
422
)
421
423
XCTAssertEqual ( diagnostic? . metadata? . packageIdentity, identity)
@@ -453,7 +455,7 @@ class TargetSourcesBuilderTests: XCTestCase {
453
455
build ( target: target, toolsVersion: . v5_3, fs: fs) { _, _, _, _, identity, kind, path, diagnostics in
454
456
testDiagnostics ( diagnostics) { result in
455
457
let diagnostic = result. check (
456
- diagnostic: " localization directory 'Processed/ en.lproj' in target 'Foo' contains sub-directories, which is forbidden " ,
458
+ diagnostic: " localization directory ' \( RelativePath ( " Processed " ) . appending ( components : " en.lproj " ) ) ' in target 'Foo' contains sub-directories, which is forbidden " ,
457
459
severity: . error
458
460
)
459
461
XCTAssertEqual ( diagnostic? . metadata? . packageIdentity, identity)
@@ -476,7 +478,7 @@ class TargetSourcesBuilderTests: XCTestCase {
476
478
testDiagnostics ( diagnostics) { result in
477
479
let diagnostic = result. check (
478
480
diagnostic: . contains( """
479
- resource 'Resources/ en.lproj/ Localizable.strings' in target 'Foo' is in a localization directory \
481
+ resource ' \( RelativePath ( " Resources " ) . appending ( components : " en.lproj " , " Localizable.strings " ) ) ' in target 'Foo' is in a localization directory \
480
482
and has an explicit localization declaration
481
483
""" ) ,
482
484
severity: . error
@@ -629,7 +631,7 @@ class TargetSourcesBuilderTests: XCTestCase {
629
631
build ( target: target, toolsVersion: . v5_3, fs: fs) { _, _, _, _, identity, kind, path, diagnostics in
630
632
testDiagnostics ( diagnostics) { result in
631
633
let diagnostic = result. check (
632
- diagnostic: . contains( " resource 'Resources/ Processed/ Info.plist' in target 'Foo' is forbidden " ) ,
634
+ diagnostic: . contains( " resource ' \( RelativePath ( " Resources " ) . appending ( components : " Processed " , " Info.plist " ) ) ' in target 'Foo' is forbidden " ) ,
633
635
severity: . error
634
636
)
635
637
XCTAssertEqual ( diagnostic? . metadata? . packageIdentity, identity)
@@ -651,7 +653,7 @@ class TargetSourcesBuilderTests: XCTestCase {
651
653
build ( target: target, toolsVersion: . v5_3, fs: fs) { _, _, _, _, identity, kind, path, diagnostics in
652
654
testDiagnostics ( diagnostics) { result in
653
655
let diagnostic = result. check (
654
- diagnostic: . contains( " resource 'Resources/ Copied/ Info.plist' in target 'Foo' is forbidden " ) ,
656
+ diagnostic: . contains( " resource ' \( RelativePath ( " Resources " ) . appending ( components : " Copied " , " Info.plist " ) ) ' in target 'Foo' is forbidden " ) ,
655
657
severity: . error
656
658
)
657
659
XCTAssertEqual ( diagnostic? . metadata? . packageIdentity, identity)
@@ -697,8 +699,8 @@ class TargetSourcesBuilderTests: XCTestCase {
697
699
698
700
testDiagnostics ( observability. diagnostics) { result in
699
701
var diagnosticsFound = [ Basics . Diagnostic? ] ( )
700
- diagnosticsFound. append ( result. checkUnordered ( diagnostic: " Invalid Exclude '/fileOutsideRoot.py': File not found. " , severity: . warning) )
701
- diagnosticsFound. append ( result. checkUnordered ( diagnostic: " Invalid Exclude '/fakeDir': File not found. " , severity: . warning) )
702
+ diagnosticsFound. append ( result. checkUnordered ( diagnostic: " Invalid Exclude ' \( AbsolutePath ( " /fileOutsideRoot.py " ) ) ': File not found. " , severity: . warning) )
703
+ diagnosticsFound. append ( result. checkUnordered ( diagnostic: " Invalid Exclude ' \( AbsolutePath ( " /fakeDir " ) ) ': File not found. " , severity: . warning) )
702
704
703
705
for diagnostic in diagnosticsFound {
704
706
XCTAssertEqual ( diagnostic? . metadata? . packageIdentity, builder. packageIdentity)
@@ -831,9 +833,9 @@ class TargetSourcesBuilderTests: XCTestCase {
831
833
832
834
testDiagnostics ( observability. diagnostics) { result in
833
835
var diagnosticsFound = [ Basics . Diagnostic? ] ( )
834
- diagnosticsFound. append ( result. checkUnordered ( diagnostic: " Invalid Source '/InvalidPackage.swift': File not found. " , severity: . warning) )
835
- diagnosticsFound. append ( result. checkUnordered ( diagnostic: " Invalid Source '/DoesNotExist.swift': File not found. " , severity: . warning) )
836
- diagnosticsFound. append ( result. checkUnordered ( diagnostic: " Invalid Source '/Tests/InvalidPackageTests/InvalidPackageTests.swift': File not found. " , severity: . warning) )
836
+ diagnosticsFound. append ( result. checkUnordered ( diagnostic: " Invalid Source ' \( AbsolutePath ( " /InvalidPackage.swift " ) ) ': File not found. " , severity: . warning) )
837
+ diagnosticsFound. append ( result. checkUnordered ( diagnostic: " Invalid Source ' \( AbsolutePath ( " /DoesNotExist.swift " ) ) ': File not found. " , severity: . warning) )
838
+ diagnosticsFound. append ( result. checkUnordered ( diagnostic: " Invalid Source ' \( AbsolutePath ( " /Tests/InvalidPackageTests/InvalidPackageTests.swift " ) ) ': File not found. " , severity: . warning) )
837
839
838
840
for diagnostic in diagnosticsFound {
839
841
XCTAssertEqual ( diagnostic? . metadata? . packageIdentity, builder. packageIdentity)
0 commit comments