Skip to content

PrebuiltModuleGen: dedupe prebuilt module jobs #1972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nkcsgexi
Copy link
Contributor

This prevents issues that we can find same module in multiple different locations.

rdar://158615938

@nkcsgexi
Copy link
Contributor Author

@swift-ci please test

@nkcsgexi nkcsgexi requested a review from artemcm August 19, 2025 18:21
var seen: Set<String> = []
var result: [Job] = []
for job in jobs {
assert(job.outputs.count == 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be worthwhile to also assert on job kind being an emit module from interface here.

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 actually changed the fix of deduping to an earlier step. Mind taking another look?

var result: [Job] = []
for job in jobs {
assert(job.outputs.count == 1)
let key = job.outputs.first!.file.absolutePath!.pathString
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of file, it should be sufficient to have the hash set operate on fileHandle, as those will map to the same underlying absolute path string, and it won't be necessary to do .absolutePath!.pathString.

@@ -772,6 +772,21 @@ extension Driver {
return allJobs
}

/// Dedupe jobs by output paths
func dedupeJobs(_ jobs: [Job]) -> [Job] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: something like dedupeCompileSwiftModuleFromInterfaceJobs would be a more-descriptive name

…ules.

We collect these Swift module names from the outputs of dependency scanning. However,
we've noticed dupes in the output, leading to build system reporting fatal errors. As a fix,
we dedupe the module names before generating prebuilt module cache.

rdar://158615938
@nkcsgexi
Copy link
Contributor Author

@swift-ci please smoke test

@nkcsgexi nkcsgexi changed the title PrebuiltModuleGen: dedupe prebuilt module jobs by output paths PrebuiltModuleGen: dedupe prebuilt module jobs Aug 21, 2025
@nkcsgexi
Copy link
Contributor Author

@swift-ci please smoke test

@nkcsgexi nkcsgexi enabled auto-merge August 21, 2025 20:53
@nkcsgexi
Copy link
Contributor Author

@swift-ci please smoke test

1 similar comment
@nkcsgexi
Copy link
Contributor Author

@swift-ci please smoke test

@nkcsgexi
Copy link
Contributor Author

@swift-ci please test

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