Skip to content

PackageModel: add struct BuildFlags, reduce reliance on TSC #5837

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
Oct 25, 2022

Conversation

MaxDesiatov
Copy link
Contributor

@MaxDesiatov MaxDesiatov commented Oct 24, 2022

Motivation:

We're relying on BuildFlags from TSC for passing flags in some places, but there are also cases where flags are passed as separate properties, such as extraCFlags, extraCXXFlags etc. BuildFlags is quite useful, as it allows grouping of these properties instead of passing them around separately. In most if not all cases they need to be passed all at once anyway. This apparently already let to issues, where Destination didn't have its own linker flags property, also see #5793. We also had issues with inconsistent naming of these properties. Unifying everything under BuildFlags could prevent such issues from happening.

Modifications:

Adding BuildFlags to PackageModel, mostly a copy of the declaration in TSC, but with a cleaned up initializer arguments naming. Modified uses of build tools flags to use this new struct instead of passing arounds properties separately.

Result:

Reduced reliance on TSC, unified use of BuildFlags across the codebase.

@MaxDesiatov

This comment was marked as outdated.

@MaxDesiatov
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Contributor

@tomerd tomerd left a comment

Choose a reason for hiding this comment

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

nice cleanup, thanks.

should we also deprecate the TSC structure?

@MaxDesiatov
Copy link
Contributor Author

swiftlang/sourcekit-lsp#659
@swift-ci please smoke test

@MaxDesiatov MaxDesiatov merged commit f94e5f8 into main Oct 25, 2022
@MaxDesiatov MaxDesiatov deleted the maxd/build-flags branch October 25, 2022 18:32
MaxDesiatov added a commit to swiftlang/swift-tools-support-core that referenced this pull request Oct 25, 2022
MaxDesiatov added a commit that referenced this pull request Nov 15, 2022
Currently, `destination.json` files only support absolute paths, which makes it hard to move cross-compilation sysroots between directories and copying them to different machines.

This change support for relative paths in v2 scheme of `destination.json` files. The path is then normalized relative to the location of `destination.json` file. 

`struct DestinationInfo` is renamed to `DestinationInfoV1`. New `struct DestinationInfoV2` is added to handle the new version that supports relative paths. This is also used as an opportunity to make the schema more consistent with manifests for artifact bundles, in which properties use `camelCase` instead of `dash-case` naming. Also new in schema version 2 are `linkerFlags` and renaming of `extraCPPFlags` to `extraCXXFlags`, to follow up on #5827 and #5837.
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