Files
tasks/common/testing/mocksdk/generate.sh
Stephan BehnkeandGitHub de8f1551f9 Use locally installed protoc plugins (#8325)
## What changed?

~Enforce `temporal/cmd/tools/protogen` to set the PATH to point to the
locally installed tools in `.bin`.~

Enforce `temporal/cmd/tools/protogen` to use locally installed protoc
plugins.

## Why?

Without this, it will use whatever is on the PATH; which might not be
the same as in `.bin`.

## How did you test it?
- [ ] built
- [x] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)

Without this change, I get different `.pb.go` files emitted as my global
proto-gen-go is used.
2025-09-15 20:15:00 +00:00

21 lines
964 B
Bash
Executable File

#!/bin/sh
# These mocks need to be manually fixed up after generation because gomock
# uses the types in the internal package instead of the public type aliases.
mockgen -package "$GOPACKAGE" go.temporal.io/sdk/client Client | \
sed -e 's,internal,client,g' \
> client_mock.go
mockgen -package "$GOPACKAGE" go.temporal.io/sdk/worker Worker | \
sed -e 's,internal.RegisterWorkflowOptions,workflow.RegisterOptions,g' \
-e 's,internal.RegisterActivityOptions,activity.RegisterOptions,g' \
-e 's,internal.DynamicRegisterWorkflowOptions,workflow.DynamicRegisterOptions,g' \
-e 's,internal.DynamicRegisterActivityOptions,activity.DynamicRegisterOptions,g' \
-e 's,internal "go.temporal.io/sdk/internal",activity "go.temporal.io/sdk/activity"\n\tworkflow "go.temporal.io/sdk/workflow",' \
> worker_mock.go
mockgen -package "$GOPACKAGE" go.temporal.io/sdk/client WorkflowRun | \
sed -e 's,internal,client,g' \
> workflowrun_mock.go