Skip to content

Promote -swift-module-file= to a driver flag#2104

Open
artemcm wants to merge 1 commit intoswiftlang:mainfrom
artemcm:SwiftModuleFileDriverFlag
Open

Promote -swift-module-file= to a driver flag#2104
artemcm wants to merge 1 commit intoswiftlang:mainfrom
artemcm:SwiftModuleFileDriverFlag

Conversation

@artemcm
Copy link
Contributor

@artemcm artemcm commented Mar 12, 2026

Companion change to:
swiftlang/swift#87823

@artemcm
Copy link
Contributor Author

artemcm commented Mar 12, 2026

@swift-ci test

Copy link
Contributor

@cachemeifyoucan cachemeifyoucan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to be a lot more complicated for explicit module build.

For explicit module build, the flag should be only passed to scanner, and the scanner will plan the build and return the dependency graph with the module file passed as part of it. That is the only way for caching build to be supported.

I don't know if this matters for implicit build, but implicit build can just pass the flag to frontend.

@artemcm artemcm force-pushed the SwiftModuleFileDriverFlag branch from 1800a62 to 4ca5b2c Compare March 12, 2026 17:34
@artemcm
Copy link
Contributor Author

artemcm commented Mar 12, 2026

@swift-ci test

@artemcm
Copy link
Contributor Author

artemcm commented Mar 12, 2026

For explicit module build, the flag should be only passed to scanner, and the scanner will plan the build and return the dependency graph with the module file passed as part of it. That is the only way for caching build to be supported.

I don't know if this matters for implicit build, but implicit build can just pass the flag to frontend.

Good catch. Done.

Copy link
Contributor

@cachemeifyoucan cachemeifyoucan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test for explicit module build?


// For explicitly-built modules, only forward -swift-module-file= to the scanning action,
// for implicitly-built modules, forward it to all compilation tasks.
if (isPlanJobForExplicitModule && kind == .scanDependencies) || !isPlanJobForExplicitModule {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is isPlanJobForExplicitModule always true when kind == .scanDependencies?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect it to be, yes.

@artemcm
Copy link
Contributor Author

artemcm commented Mar 12, 2026

Can we add a test for explicit module build?

There already is a test for explicit module build. What do you have in mind that's not covered there?

@cachemeifyoucan
Copy link
Contributor

There already is a test for explicit module build. What do you have in mind that's not covered there?

I want to see scanner returns the correct result when you pass -swift-module-file to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants