@@ -287,6 +287,22 @@ extension IncrementalCompilationTests {
287
287
tryNoChange ( checkDiagnostics: true )
288
288
}
289
289
}
290
+
291
+ func testSymlinkModification( ) throws {
292
+ // Remap
293
+ // main.swift -> links/main.swift
294
+ // other.swift -> links/other.swift
295
+ for (file, _) in self . inputPathsAndContents {
296
+ try localFileSystem. createDirectory ( tempDir. appending ( component: " links " ) )
297
+ let linkTarget = tempDir. appending ( component: " links " ) . appending ( component: file. basename)
298
+ try localFileSystem. move ( from: file, to: linkTarget)
299
+ try localFileSystem. removeFileTree ( file)
300
+ try localFileSystem. createSymbolicLink ( file, pointingAt: linkTarget, relative: false )
301
+ }
302
+ try tryInitial ( )
303
+ try checkReactionToTouchingSymlinks ( checkDiagnostics: true )
304
+ try checkReactionToTouchingSymlinkTargets ( checkDiagnostics: true )
305
+ }
290
306
}
291
307
292
308
// MARK: - Incremental test stages
@@ -535,6 +551,68 @@ extension IncrementalCompilationTests {
535
551
] ,
536
552
whenAutolinking: autolinkLifecycleExpectations)
537
553
}
554
+
555
+ private func checkReactionToTouchingSymlinks(
556
+ checkDiagnostics: Bool = false ,
557
+ extraArguments: [ String ] = [ ]
558
+ ) throws {
559
+ for (file, _) in self . inputPathsAndContents {
560
+ try localFileSystem. removeFileTree ( file)
561
+ let linkTarget = tempDir. appending ( component: " links " ) . appending ( component: file. basename)
562
+ try localFileSystem. createSymbolicLink ( file, pointingAt: linkTarget, relative: false )
563
+ }
564
+ try doABuild (
565
+ " touch both symlinks; non-propagating " ,
566
+ checkDiagnostics: checkDiagnostics,
567
+ extraArguments: extraArguments,
568
+ expectingRemarks: [
569
+ " Enabling incremental cross-module building " ,
570
+ " Incremental compilation: Read dependency graph " ,
571
+ " Incremental compilation: May skip current input: {compile: main.o <= main.swift} " ,
572
+ " Incremental compilation: May skip current input: {compile: other.o <= other.swift} " ,
573
+ " Incremental compilation: Skipping input: {compile: main.o <= main.swift} " ,
574
+ " Incremental compilation: Skipping input: {compile: other.o <= other.swift} " ,
575
+ " Incremental compilation: Skipping job: Linking theModule " ,
576
+ " Skipped Compiling main.swift " ,
577
+ " Skipped Compiling other.swift " ,
578
+ ] ,
579
+ whenAutolinking: autolinkLifecycleExpectations)
580
+ }
581
+
582
+ private func checkReactionToTouchingSymlinkTargets(
583
+ checkDiagnostics: Bool = false ,
584
+ extraArguments: [ String ] = [ ]
585
+ ) throws {
586
+ for (file, contents) in self . inputPathsAndContents {
587
+ let linkTarget = tempDir. appending ( component: " links " ) . appending ( component: file. basename)
588
+ try ! localFileSystem. writeFileContents ( linkTarget) { $0 <<< contents }
589
+ }
590
+ try doABuild (
591
+ " touch both symlink targets; non-propagating " ,
592
+ checkDiagnostics: checkDiagnostics,
593
+ extraArguments: extraArguments,
594
+ expectingRemarks: [
595
+ " Enabling incremental cross-module building " ,
596
+ " Incremental compilation: Read dependency graph " ,
597
+ " Incremental compilation: Scheduing changed input {compile: main.o <= main.swift} " ,
598
+ " Incremental compilation: Scheduing changed input {compile: other.o <= other.swift} " ,
599
+ " Incremental compilation: Queuing (initial): {compile: main.o <= main.swift} " ,
600
+ " Incremental compilation: Queuing (initial): {compile: other.o <= other.swift} " ,
601
+ " Incremental compilation: not scheduling dependents of main.swift; unknown changes " ,
602
+ " Incremental compilation: not scheduling dependents of other.swift; unknown changes " ,
603
+ " Found 2 batchable jobs " ,
604
+ " Forming into 1 batch " ,
605
+ " Adding {compile: main.swift} to batch 0 " ,
606
+ " Adding {compile: other.swift} to batch 0 " ,
607
+ " Forming batch job from 2 constituents: main.swift, other.swift " ,
608
+ " Starting Compiling main.swift, other.swift " ,
609
+ " Finished Compiling main.swift, other.swift " ,
610
+ " Incremental compilation: Scheduling all post-compile jobs because something was compiled " ,
611
+ " Starting Linking theModule " ,
612
+ " Finished Linking theModule " ,
613
+ ] ,
614
+ whenAutolinking: autolinkLifecycleExpectations)
615
+ }
538
616
}
539
617
540
618
// MARK: - Incremental test perturbation helpers
0 commit comments