Repository navigation
Conversation
A `swift_library` can have a directory (tree artifact) in `srcs`, e.g. generated sources. rules_swift 4.2.0 compiles its files individually, but generating a project failed with "Failed to expand directory": - `WriteTargetBuildSettings` reuses the `SwiftCompile` action's `Args`, which expand the directory, without having it as an input. The target's directory `srcs` are now inputs of that action. - The generated directories filelist and the generated xcfilelist expand `srcs` too. They now list a directory itself, since its files aren't known until it's built. Signed-off-by: Ernesto Cambuston <e.cambuston@gmail.com>
Contributor
|
It might make sense to generalize this support, rather than doing this just for Swift, seeing as |
Contributor
Author
|
Good call to check. I tried
So only the Swift |
aaronsky
approved these changes
Nov 19, 2026
aaronsky
left a comment
Contributor
There was a problem hiding this comment.
Approving to unblock CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
swift_librarycan have a directory (tree artifact) insrcs, e.g. a directory of generated sources. rules_swift 4.2.0 compiles its files individually, but generating a project with one fails:Three actions expand the directory without having it as an input:
WriteTargetBuildSettingsreuses theSwiftCompileaction'sArgs, which expand the directory. The target's directorysrcsare now passed along with theArgs(swift_directories) and are inputs of the action. They're taken from the target'ssrcsrather than from theSwiftCompileaction's inputs, so no transitive inputs are flattened. Targets without directories get the same action as before.WriteGeneratedDirectoriesFilelistand the generated xcfilelist mapsrcsto paths. They now useexpand_directories = Falseand list a directory itself, since its files aren't known until it's built.Tests:
write_generated_directories_filelist(no tests until now) and twowrite_target_build_settingscases. They fail without the fix;//test/...passes. The mockArgs.use_param_filenow acceptsuse_always.xcodebuild; without this changebazel run //:xcodeprojfails as above.