Skip to content

[5.9] Cross-compilation: fix bundles not unpacked on installation #6362

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 4 commits into from
Apr 3, 2023

Conversation

MaxDesiatov
Copy link
Contributor

Motivation:

swift experimental-destination install subcommand works with bundle directories, but fails to unpack bundle archives.

rdar://107367895

Modifications:

We should pass an instance of an archiver to the installation function to unpack destination bundle archives if needed. Since withTemporaryDirectory is async, SwiftDestinationTool had to be converted to AsyncParsableCommand and also gain @main attribute for that to work. Additionally, @main attribute requires -parse-as-library passed in CMake.

`swift experimental-destination install` subcommand works with bundle directories, but fails to unpack bundle archives.

We should pass an instance of an archiver to the installation function to unpack destination bundle archives if needed. Since `withTemporaryDirectory` is `async`, `SwiftDestinationTool` had to be converted to `AsyncParsableCommand` and also gain `@main` attribute for that to work. Additionally, `@main` attribute requires `-parse-as-library` passed in CMake.
@MaxDesiatov MaxDesiatov added the swift 5.9 This PR targets the 5.9 branch label Mar 31, 2023
@MaxDesiatov MaxDesiatov self-assigned this Mar 31, 2023
@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci test windows

@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci test windows

@@ -17,8 +17,8 @@ import PackageModel

import struct TSCBasic.AbsolutePath

struct RemoveDestination: DestinationCommand {
static let configuration = CommandConfiguration(
public struct RemoveDestination: DestinationCommand {
Copy link
Contributor

Choose a reason for hiding this comment

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

curious why these need to come public?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clarified in the PR to the main branch, this is due to SwiftDestinationTool referencing this type moving to a different target, while RemoveDestination could stay where it were.

@MaxDesiatov MaxDesiatov requested a review from tomerd April 3, 2023 19:20
@MaxDesiatov MaxDesiatov merged commit c18b8c4 into release/5.9 Apr 3, 2023
@MaxDesiatov MaxDesiatov deleted the maxd/5.9-fix-destination-archive branch April 3, 2023 20:22
MaxDesiatov added a commit that referenced this pull request Apr 4, 2023
`swift experimental-destination` subcommands no longer work and always display help output. This is a regression introduced in #6362 after making `SwiftDestinationTool` conform to  `AsyncParsableCommand` instead of `ParsableCommand` but not updating `swift-package-manager` command sources to call `async` overload of `main()` function on `SwiftDestinationTool`.

rdar://107618266
MaxDesiatov added a commit that referenced this pull request Apr 4, 2023
`swift experimental-destination` subcommands no longer work and always display help output. This is a regression introduced in #6362 after making `SwiftDestinationTool` conform to  `AsyncParsableCommand` instead of `ParsableCommand` but not updating `swift-package-manager` command sources to call `async` overload of `main()` function on `SwiftDestinationTool`.

rdar://107618266
MaxDesiatov added a commit that referenced this pull request Apr 4, 2023
`swift experimental-destination` subcommands no longer work and always display help output. This is a regression introduced in #6362 after making `SwiftDestinationTool` conform to  `AsyncParsableCommand` instead of `ParsableCommand` but not updating `swift-package-manager` command sources to call `async` overload of `main()` function on `SwiftDestinationTool`.

rdar://107618266
MaxDesiatov added a commit that referenced this pull request Apr 4, 2023
`swift experimental-destination` subcommands no longer work and always display help output. This is a regression introduced in #6362 after making `SwiftDestinationTool` conform to  `AsyncParsableCommand` instead of `ParsableCommand` but not updating `swift-package-manager` command sources to call `async` overload of `main()` function on `SwiftDestinationTool`.

rdar://107618266
MaxDesiatov added a commit that referenced this pull request Apr 5, 2023
`swift experimental-destination` subcommands no longer work and always display help output. This is a regression introduced in #6362 after making `SwiftDestinationTool` conform to  `AsyncParsableCommand` instead of `ParsableCommand` but not updating `swift-package-manager` command sources to call `async` overload of `main()` function on `SwiftDestinationTool`.

rdar://107618266
MaxDesiatov added a commit that referenced this pull request Apr 5, 2023
`swift experimental-destination` subcommands no longer work and always display help output. This is a regression introduced in #6362 after making `SwiftDestinationTool` conform to  `AsyncParsableCommand` instead of `ParsableCommand` but not updating `swift-package-manager` command sources to call `async` overload of `main()` function on `SwiftDestinationTool`.

rdar://107618266
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cross-compilation swift 5.9 This PR targets the 5.9 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants