Skip to content

feat: migrate to v2 utility libraries (STEP-2447) - #131

Open
Badlazzor wants to merge 1 commit into
masterfrom
feat/step-2447-v2-deps
Open

feat: migrate to v2 utility libraries (STEP-2447)#131
Badlazzor wants to merge 1 commit into
masterfrom
feat/step-2447-v2-deps

Conversation

@Badlazzor

@Badlazzor Badlazzor commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Drop direct v1 go-utils (command, errorutil, log, pathutil, retry) and go-steputils/commandhelper imports from the step.
  • Thread a go-utils/v2 log.Logger through runGradleTask, findArtifacts, findDeployPth, createDeployPth, and failf.
  • Use v2 command.Factory for the gradle invocation, v2 fileutil.FileManager for artifact copies, and v2 pathutil.PathChecker for existence probes.
  • Replace commandhelper.RunAndExportOutput with an inline helper backed by export.Exporter.ExportStringToFileOutputAndReturnLastNLines.
  • Inline the 10-attempt / 1s wait retry loop that v1 retry.Times().Wait().Try() provided.
  • errors.As(err, *command.ExitStatusError) replaces errorutil.IsExitStatusError.

Parent milestone: STEP-2381
Ticket: STEP-2447

Notes

  • v1 go-utils retained as // indirect: the v2 export package still transitively pulls ziputil from v1 go-utils. Direct require block is v2-only.
  • v1 go-steputils fully removed from go.mod — nothing depends on it anymore now that commandhelper is gone.
  • cmd.PrintableCommandArgs(): v1 exposed a package-level command.PrintableCommandArgs(false, cmdSlice) we could call before building the cmd. v2 exposes it only as a method on the constructed command, so the Donef("$ %s", ...) log line moved to after cmdFactory.Create(...). The output is what the wrap layer actually invokes — arguably more accurate.
  • fileutil.CopyFile overwrite semantics: v1 command.CopyFile uses cp -f behind the scenes (always overwrites). Matched with &fileutil.CopyOptions{Overwrite: true}. In practice findDeployPth already avoids collisions.
  • wrap.DetectParams.Logger: passing the logger enables optional Debugf on skip paths inside wrap.Detect. No-op unless debug logging is enabled (this step has no verbose flag); kept for symmetry with the v2 pattern.
  • No new unit tests (Milestone 6, out of scope). Test_findArtifacts and TestResolveGradlewPath continue to pass.

Test plan

  • go build ./... passes (verified locally).
  • go test -race ./... passes (verified locally).
  • go vet ./... clean (verified locally).
  • Grep gate: no direct v1 go-utils / go-steputils imports in step source (verified locally).
  • go.mod: v2 libs only in the direct require block; v1 go-utils demoted to // indirect; v1 go-steputils removed.
  • Step CI (check, e2e) passes on Bitrise CI.

🤖 Generated with Claude Code

Drop direct v1 `go-utils` (command, errorutil, log, pathutil, retry) and
`go-steputils/commandhelper` imports. Thread a `go-utils/v2` `log.Logger`
through `runGradleTask`, `findArtifacts`, `findDeployPth`, `createDeployPth`,
and `failf`. Use v2 `command.Factory` for gradle invocation, v2 `fileutil.FileManager`
for artifact copies (Overwrite: true to match v1 `cp -f`), and v2 `pathutil.PathChecker`
for existence probes. Replace `commandhelper.RunAndExportOutput` with an inline
helper backed by `export.Exporter.ExportStringToFileOutputAndReturnLastNLines`.
Inline the 10-attempt / 1s wait retry loop that v1 `retry.Times().Wait().Try()`
provided. `errors.As(err, *command.ExitStatusError)` replaces `errorutil.IsExitStatusError`.

Parent milestone: STEP-2381

Notes:
- v1 `go-utils` remains `// indirect` — v2 `export` transitively pulls `ziputil` from it.
- v1 `go-steputils` fully removed from `go.mod` — nothing depends on it anymore.
- No new unit tests (Milestone 6, out of scope). Existing `Test_findArtifacts`
  and `TestResolveGradlewPath` continue to pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Badlazzor
Badlazzor requested a review from a team July 24, 2026 13:50
@Badlazzor
Badlazzor marked this pull request as ready for review July 24, 2026 13:50
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.

2 participants