Skip to content

implement archiving for registry publishing #6118

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
Feb 8, 2023

Conversation

tomerd
Copy link
Contributor

@tomerd tomerd commented Feb 4, 2023

motivation: progress on registry publishing implementation

changes:

  • implement compression using ZipArchiver
  • implement code flow to archive package for publishing per spec
  • add tests

@tomerd
Copy link
Contributor Author

tomerd commented Feb 4, 2023

@swift-ci smoke test

@tomerd
Copy link
Contributor Author

tomerd commented Feb 4, 2023

@yim-lee

@tomerd tomerd requested a review from yim-lee February 4, 2023 08:27
@tomerd
Copy link
Contributor Author

tomerd commented Feb 6, 2023

@yim-lee @neonichu ptal

"Commands",
"Workspace",
"PackageModel",
"PackageRegistryTool",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should there be a PackageRegistryToolTests module?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PackageRegistryToolTests are under CommandTests module even before this PR. is there a concern?

)
}

// include metadata from non-standard location in the archive
Copy link
Contributor

Choose a reason for hiding this comment

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

This is doing more than what the spec says--custom metadata file location is used for in-request metadata only; it doesn't say SwiftPM would copy from custom metadata file location to the archive.

I don't have a strong opinion, just need to update the proposal accordingly.

Copy link
Contributor Author

@tomerd tomerd Feb 7, 2023

Choose a reason for hiding this comment

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

thanks for pointing this out. this feels like the more intuitive behavior to me.

@tomerd tomerd self-assigned this Feb 7, 2023
@tomerd tomerd force-pushed the feature/publsh-api-2 branch 2 times, most recently from e4df9f7 to 55c0ed4 Compare February 7, 2023 17:46
motivation: progress on registry publishing implementationn

changes:
* implement compression using ZipArchiver
* implement code flow to archive package for publishing per spec
* add tests
@tomerd
Copy link
Contributor Author

tomerd commented Feb 7, 2023

@swift-ci smoke test

@tomerd tomerd force-pushed the feature/publsh-api-2 branch from 075750e to 76f203a Compare February 7, 2023 18:58
@tomerd
Copy link
Contributor Author

tomerd commented Feb 7, 2023

@swift-ci smoke test

@tomerd
Copy link
Contributor Author

tomerd commented Feb 7, 2023

@yim-lee this has been updated per feedback

@tomerd
Copy link
Contributor Author

tomerd commented Feb 7, 2023

requires swiftlang/swift-docker#329

#if os(Windows)
let process = TSCBasic.Process(
// FIXME: are these the right arguments?
arguments: ["tar.exe", "-a", "-c", "-f", destinationPath.pathString, directory.basename],
Copy link
Contributor

Choose a reason for hiding this comment

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

Can tar really produce ZIP archives on Windows? That seems quite surprising to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should add a precondition on destinationPath here? -a detects the archive format from path extension (and sadly that’s the only option to create a zip archive for tar.exe). We may want to make sure we’re actually creating a zip archive.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah that's nice, wish the macOS/Linux tar did the same :)

@@ -88,18 +88,18 @@ extension SwiftPackageRegistryTool {

// compute and validate registry URL
guard let registryURL = self.registryURL ?? configuration.configuration.defaultRegistry?.url else {
throw ConfigurationError.unknownRegistry
throw ValidationError.unknownRegistry
Copy link
Contributor

Choose a reason for hiding this comment

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

ValidationError will print command usage/help, which doesn't seem appropriate here? (same for the other changes in this file)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not ArgumentParser's ValidationError so should be okay?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see. Should we call it something different? Seems a little confusing especially in the context of the implementation of a CLI tool, so both ValidationError types will be visible.

@tomerd
Copy link
Contributor Author

tomerd commented Feb 8, 2023

@swift-ci smoke test linux

@tomerd tomerd enabled auto-merge (squash) February 8, 2023 02:03
@tomerd tomerd disabled auto-merge February 8, 2023 02:03
@tomerd tomerd enabled auto-merge (squash) February 8, 2023 02:03
@tomerd tomerd merged commit 2975732 into swiftlang:main Feb 8, 2023
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.

5 participants