Skip to content
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

Add binary type for binary targets to add-target command. #8290

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

grantjbutler
Copy link

Updates the add-target subcommand to allow creating a target that references a remote or local binary artifact.

Motivation:

The add-target command currently accepts a set of arguments that make it seem like it should be able to create a .binaryTarget in the package's manifest. However, when trying to use the command in this way, you'll either get an error because of validation if trying to create a target for a remote binary artifact, or a regular source target will be created if trying to create a target for a local binary artifact. Issue #8277 has the full details.

Modifications:

This PR adds .binary as a new value for the TargetType enum (which is used for parsing the --type argument of the add-target command). This value gets mapped to TargetDescription.TargetKind.binary when actually creating the target in the manifest.

Result:

By specifying --type binary for the add-target command and providing a value for --url or --path, a .binaryTarget will be added to the package's manifest, with the appropriate configuration depending on if the binary artifact is sourced from a remote URL or a local path.

@plemarquand
Copy link
Contributor

@swift-ci please test

"""
)

_ = try await execute(["add-target", "client", "--url", "https://example.com/client.xcframework.zip", "--checksum", "abcdef1234567890", "--type", "binary"], packagePath: path)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to add checksum validation to ensure that the user is inputting a valid SHA-256 checksum? As called out in PackageDescription.Target.checksum

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