diff --git a/lib/Driver/Compilation.cpp b/lib/Driver/Compilation.cpp index 7da9429f4d2..e77fd765eb5 100644 --- a/lib/Driver/Compilation.cpp +++ b/lib/Driver/Compilation.cpp @@ -143,6 +143,7 @@ int Compilation::performJobsInList(const JobList &JL, PerformJobsState &State) { // always have to run the job, but it doesn't affect any other jobs. If // there should be one but it's not present or can't be loaded, we have to // run all the jobs. + // FIXME: We can probably do better here! Job::Condition Condition = Job::Condition::Always; StringRef DependenciesFile = Cmd->getOutput().getAdditionalOutputForType(types::TY_SwiftDeps); @@ -369,8 +370,10 @@ int Compilation::performJobsInList(const JobList &JL, PerformJobsState &State) { if (!State.ScheduledCommands.count(Cmd)) continue; - - State.UnfinishedCommands.insert({Cmd, DepGraph.isMarked(Cmd)}); + bool isCascading = true; + if (getIncrementalBuildEnabled()) + isCascading = DepGraph.isMarked(Cmd); + State.UnfinishedCommands.insert({Cmd, isCascading}); } } diff --git a/test/Driver/Dependencies/fail-new.swift b/test/Driver/Dependencies/fail-new.swift new file mode 100644 index 00000000000..2157d0a1e80 --- /dev/null +++ b/test/Driver/Dependencies/fail-new.swift @@ -0,0 +1,32 @@ +/// bad ==> main | bad --> other + +// RUN: rm -rf %t && cp -r %S/Inputs/fail-simple/ %t +// RUN: touch -t 201401240005 %t/* + +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck %s +// CHECK: Handled main.swift +// CHECK: Handled bad.swift +// CHECK-NOT: Handled other.swift + +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck %s + +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-OKAY %s +// CHECK-OKAY: Handled main.swift +// CHECK-OKAY: Handled bad.swift +// CHECK-OKAY: Handled other.swift + +// RUN: rm %t/bad.o +// RUN: rm %t/bad.swiftdeps +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck %s + +// RUN: rm %t/*.o +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-OKAY %s +// RUN: rm %t/main.o +// RUN: rm %t/main.swiftdeps +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck %s + +// RUN: rm %t/*.o +// RUN: cd %t && %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck -check-prefix=CHECK-OKAY %s +// RUN: rm %t/other.o +// RUN: rm %t/other.swiftdeps +// RUN: cd %t && not %swiftc_driver -c -driver-use-frontend-path %S/Inputs/update-dependencies-bad.py -output-file-map %t/output.json -incremental ./main.swift ./bad.swift ./other.swift -module-name main -j1 -v 2>&1 | FileCheck %s