-
Notifications
You must be signed in to change notification settings - Fork 1.4k
PackageModel: relative paths for cross-compilation destinations #5812
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
Conversation
if isRelative { | ||
return directory.appending(RelativePath(string)) | ||
} else { | ||
return AbsolutePath(string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use AbsolutePath(validating:)
103ed52
to
d678992
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason we cannot add it in v1 scheme? Supporting relative paths looks like a pure addition.
This PR is still a draft, there highly likely will be incompatible changes in future commits. |
d678992
to
b5ae29e
Compare
// Check schema version. | ||
guard version.version == 1 else { | ||
if version.version == 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use switch?
return directory.appending(RelativePath(string)) | ||
} else { | ||
return try AbsolutePath(validating: string) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc the absolute path constructor already takes care of it? @neonichu ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yah, init(validating:, relativeTo:)
should do the same thing, I believe
b42b666
to
29f73b4
Compare
This comment was marked as outdated.
This comment was marked as outdated.
c5ad2a6
to
ae196db
Compare
@swift-ci please smoke test |
ae196db
to
07efc00
Compare
f9da45f
to
8e3c204
Compare
@swift-ci please test |
This introduces support for relative paths in v2 scheme of `destination.json` files. The path is then normalized relative to the location of `destination.json` files. As a result, it makes it easier for moving cross-compilation sysroots between different directories on the same filesystem, or even between different machines.
02c9ff2
to
b997076
Compare
@swift-ci please smoke test |
@swift-ci please smoke test |
@MaxDesiatov is this ready to be merged? |
After double-checking, it seems both PRs don't overlap on specific lines, although |
Depends on #5871.
This introduces support for relative paths in v2 scheme of
destination.json
files. The path is then normalized relative to the location ofdestination.json
file.Motivation:
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.Modifications:
struct DestinationInfo
is renamed toDestinationInfoV1
. Newstruct 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 usecamelCase
instead ofdash-case
naming. Also new in schema version 2 arelinkerFlags
and renaming ofextraCPPFlags
toextraCXXFlags
, to follow up on #5827 and #5837.Added tests to verify that both schema versions are parsed correctly and that relative paths in V2 are correctly expanded to absolute paths.
Result:
New version of
destination.json
files can be supplied as a--destination
option passed toswift build
.As a result, it's to move cross-compilation sysroots and their corresponding
destination.json
files between different directories on the same filesystem, or even between different machines.