Skip to content

[Dependency Scanning] Make dependency scanner cache specific to a given target triple. #39326

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

Merged
merged 2 commits into from
Sep 21, 2021

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Sep 15, 2021

In order to do so, first refactor the dependency kinds to model the main modules of individual scanning actions as separate dependency kind: SwiftSource. These kinds of modules differ from SwiftTextual modules in that they do not have an interface and have source-files. It is cleaner to enforce this distinction with types, instead of checking for interface optionality everywhere, as we did prior to this change.

Then, make GlobalModuleDependenciesCache aware of the current scanning action's target triple and only resolve cached dependencies that came from scanning actions with the same target triple.

This change means that the GlobalModuleDependenciesCache must be configured with a specific target triple for every scanning action, and it will only resolve previously-found dependencies from previous scannig actions using the exact same triple only.

Furthermore, the GlobalModuleDependenciesCache now separately tracks source-file-based module dependencies as those represent main Swift modules of previous scanning actions, and we must be able to resolve those regardless of the target triple.

This change is largely required due to the introduction of the -clang-target optimization which means that the driver is no longer re-scanning Clang modules against different target sets in a given module's build graph.

Resolves rdar://83105455

…`SwiftSource`

These kinds of modules differ from `SwiftTextual` modules in that they do not have an interface and have source-files.
It is cleaner to enforce this distinction with types, instead of checking for interface optionality everywhere.
@artemcm artemcm requested a review from nkcsgexi September 15, 2021 21:29
@@ -49,6 +49,8 @@ typedef struct {
} swiftscan_string_set_t;

typedef enum {
// This dependency info encodes two ModuleDependencyKind types:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now, preserve the format used by libSwiftScan. Once we teach the clients about the new dependency kind, we can then add it here.

@artemcm
Copy link
Contributor Author

artemcm commented Sep 15, 2021

Existing scanner tests ensure we do not regress on current functionality.
Cross-triple test will be added in the swift-driver repository.

@artemcm
Copy link
Contributor Author

artemcm commented Sep 15, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 36cfa4964619c83384a6ad06db27d055693f4130

@artemcm
Copy link
Contributor Author

artemcm commented Sep 15, 2021

@swift-ci please test

Copy link
Contributor

@nkcsgexi nkcsgexi left a comment

Choose a reason for hiding this comment

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

Having a separate dependency kind for source file seems reasonable to me. Only minor nitpicks.

…he current scanning action's target triple

And only resolve cached dependencies that came from scanning actions with the same target triple.

This change means that the `GlobalModuleDependenciesCache` must be configured with a specific target triple for every scannig action, and it will only resolve previously-found dependencies from previous scannig actions using the exact same triple.

Furthermore, the `GlobalModuleDependenciesCache` separately tracks source-file-based module dependencies as those represent main Swift modules of previous scanning actions, and we must be able to resolve those regardless of the target triple.

Resolves rdar://83105455
@artemcm
Copy link
Contributor Author

artemcm commented Sep 20, 2021

@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.

3 participants