Skip to content

fix(checksum): support artifact bundle index files - #10373

Open
agisilaos wants to merge 1 commit into
swiftlang:mainfrom
agisilaos:fix/artifactbundleindex-checksum-9219
Open

fix(checksum): support artifact bundle index files#10373
agisilaos wants to merge 1 commit into
swiftlang:mainfrom
agisilaos:fix/artifactbundleindex-checksum-9219

Conversation

@agisilaos

Copy link
Copy Markdown
Contributor

Fixes: #9219

Summary

Allow swift package compute-checksum to compute checksums for .artifactbundleindex files.

SwiftPM already accepts artifact bundle index URLs for remote binary targets and validates downloaded indices using the checksum of their exact bytes. However, the command used to produce that checksum only accepted extractable archive formats.

Changes

  • Recognize .artifactbundleindex as a checksum-only binary artifact format.
  • Keep artifact bundle indices separate from archive extraction support.
  • Include .artifactbundleindex in unsupported-file-type diagnostics.
  • Sort the supported-extension list for deterministic diagnostics.
  • Add unit coverage verifying that the exact index bytes are hashed.
  • Add command-level regression coverage for swift package compute-checksum.
  • Document supported index files and exact-byte checksum semantics.

Alternatives considered

Adding .artifactbundleindex to UniversalArchiver was rejected because artifact bundle indices are JSON files and cannot be extracted.

Special-casing the extension directly in the command was also considered. Keeping the behavior in the shared binary-artifact checksum helper avoids duplicating checksum logic and keeps the helper aligned with all supported binary artifact files.

Notes

The index contents are hashed exactly as written. SwiftPM does not parse, normalize, or re-encode the JSON before computing the checksum.

Archive validation and extraction behavior remain unchanged.

Testing

  • swift test --skip-build --filter 'WorkspaceTests.testArtifactChecksum|SwiftPMTests.packageComputeChecksumArtifactBundleIndex'
  • SwiftFormat lint on all changed Swift ranges
  • Generated the PackageManagerDocs documentation successfully with DocC
  • git diff --check

What changed:
- Accept .artifactbundleindex files as checksum-only binary artifacts.
- Add unit and CLI regression coverage and document exact-byte hashing.

Why:
- Artifact bundle indices require a checksum for manifest use, but compute-checksum only accepted extractable archive formats.

Alternatives considered:
- Adding artifactbundleindex to UniversalArchiver was rejected because index files are JSON and cannot be extracted.
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.

swift package compute-checksum doesn't support artifactbundleindex

1 participant