Don't invalidate Swift module on a build failure

Originator:twiomood
Number:rdar://51113246 Date Originated:May 24 2019, 10:57 AM
Status:Open Resolved:
Product:Developer Tools / Xcode Product Version:10.2.1
Classification:Performance Reproducible:Always
 
Summary:
When editing swift source files, if no change is made to the public API, an incremental build of that module and dependent modules is quick. But if an edit is made that causes a build failure, the next successful build will rebuild dependent modules. 

Steps to Reproduce:
- Download and unpack the attached source attached here as a convenience, or download it from GitHub <https://github.com/omnigroup/OmniGroup> as of d714561.
- Open OmniGroup/Workspaces/OmniFrameworks.xcworkspace
- Select the Mac Frameworks scheme and My Mac, and build
- Open OBLogger.swift
- Make a valid, non-API changing edit. For example, duplicate the one line in `OBLogS`.
- Build again
- Switch to the Report navigator and show all messages from the build. Note that only one file was compiled (a few other things were copied)
- Insert an invalid line in `OBLogS`; I just added "x"
- Build again and hit the expected failure
- Remove the invalid line and build again
- Switch to the Report navigator and show all messages from the build.
- Note that many, many files are built.

In particular, note these extra build steps have happened:

  Copy OmniBase.swiftdoc
  Copy OmniBase.swiftmodule
  Copy OmniBase-Swift.h

Expected Results:
- Building after the failure should only build the edited file, and since it has no API changes, the dependent modules should not be rebuilt.

Actual Results:
- Building after the failure rebuilds the world.

Version/Build:
Xcode 10.2.1 (10E1001)

Configuration:
macOS 10.14.5 (18F132)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!