swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.72k stars 1.34k forks source link

Don’t reload package manifest when a header is added #7691

Closed MaxDesiatov closed 3 months ago

MaxDesiatov commented 3 months ago

Currently, any new header file causes a package reload. This means that while background indexing is writing header files into the index build directory, the package will get reloaded, which is unnecessary.

MaxDesiatov commented 3 months ago

@swift-ci test

MaxDesiatov commented 3 months ago

@swift-ci test

MaxDesiatov commented 3 months ago

@swift-ci test windows

MaxDesiatov commented 3 months ago

Is there any way in SwiftPM to figure out whether a file is in a Sources/Tests folder of an existing target or the build plugin equivalent of these? Such a check would fix the scenario described above.

There's a complication as there can be files generated by plugins in the build directory, and we don't know which files until we run those plugins.

ahoppen commented 3 months ago

I just drafted an implementation that relies on directories in the build plan instead of file extensions, which also avoids the issue of .swift files created in locations that don’t affect the build, which I described above

https://github.com/apple/swift-package-manager/pull/7699