Skip to content

Migrate ziputil from v1 to v2#276

Draft
godrei wants to merge 2 commits into
masterfrom
migrate-ziputil-v2
Draft

Migrate ziputil from v1 to v2#276
godrei wants to merge 2 commits into
masterfrom
migrate-ziputil-v2

Conversation

@godrei

@godrei godrei commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What

Migrates this step from the go-utils v1 ziputil package to the pure-Go v2 ziputil.ZipManager.

  • output injects a minimal DirZipper interface into the exporter and calls ZipManager.ZipDir instead of the package-level ziputil.ZipDir. main.go constructs the ZipManager (reusing the existing pathChecker) and wires it in.
  • Bumps go-utils/v2 and re-vendors.

Why it matters

v1 shelled out to /usr/bin/zip -rTy. v2 reimplements zipping in Go (archive/zip) with its own symlink, permission, mtime, and zip-slip handling. The only production path this step exercises is ZipDir with isContentOnly=true, via ExportSimulatorDiagnostics.

Behavioral note

ExportSimulatorDiagnostics now appends .zip to the destination explicitly. v1's /usr/bin/zip auto-appended .zip when the destination had no extension; the pure-Go v2 writer uses the exact path given, so this keeps the produced artifact name (Simulator.zip) unchanged.

Mock update

The go-utils/v2 bump extends fileutil.FileManager with CopyFileFS, so the generated mocks/FileManager gains that method.

Draft: blocked on the library

go.mod pins go-utils/v2 to a pseudo-version off an unmerged branch:
v2.0.0-alpha.36.0.20260612135825-fa80291d0871

Before this can leave draft:

  1. The ziputil library PR (bitrise-io/go-utils PR 231: Ziputil migration bitrise-io/go-utils#231) must merge and get a real alpha.NN tag.
  2. Repin go.mod to that tag and re-vendor.

Testing

  • go build ./..., go vet ./... green.
  • TZ=UTC go test ./... green.

godrei added 2 commits July 3, 2026 14:59
Replace the v1 ziputil package (shells out to /usr/bin/zip) with the
pure-Go v2 ziputil.ZipManager.

- output: inject a minimal DirZipper interface into the exporter and call
  ZipManager.ZipDir instead of the package-level ziputil.ZipDir.
- ExportSimulatorDiagnostics appends .zip to the destination explicitly.
  v1's /usr/bin/zip auto-appended .zip when the destination had no
  extension; the pure-Go v2 writer uses the exact path, so this keeps the
  produced artifact name unchanged.
- Bump go-utils/v2 to the ziputil-v2 branch and re-vendor. This also
  extends fileutil.FileManager with CopyFileFS, so the generated mock
  gains that method.

The go-utils/v2 pin points at an unmerged branch; it must be repinned to a
released tag once bitrise-io/go-utils PR 231 merges.
Temporary verification pointer. Revert to master once the sample repo
PRs merge:
- sample-apps-ios-simple-objc-with-uitest#4
- sample-swift-project-with-parallel-ui-test#15
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.

1 participant