EasyP

Generator

Select consumer projects, generate protobuf code, and export descriptor sets in EasyP v1.

easyp generate selects the closest easyp.gen.yaml in the current directory or an ancestor within the workspace. It compiles the selected modules and runs that project's plugins. Module identities, roots, and dependency versions come from protobuf.mod and protobuf.lock.

Configure a module

# protobuf.mod
module github.com/acme/contracts
roots proto
require github.com/acme/shared v1.2.0
# easyp.gen.yaml
version: v1
plugins:
  - name: go
    out: ./gen/go
    opts:
      paths: source_relative
  - name: go-grpc
    out: ./gen/go
    opts:
      paths: source_relative
options:
  go:
    package_prefix: github.com/acme/contracts/gen/go
easyp mod tidy
easyp generate

If generate.modules is omitted, EasyP selects the nearest protobuf.mod beside or above the generator file within the workspace; without a manifest, the project directory is the source root. Explicit entries select local module identities, workspace-relative module paths, or dependencies resolved through the consumer manifest and lock. generate.packages optionally selects exact protobuf package names; empty selects all module sources.

Select projects

# Closest project only
easyp generate
# Exactly these two projects
easyp generate --project backend --project frontend
# Explicit recursive selection beneath the invocation directory
easyp generate --all
# Explicit workspace boundary, useful in a non-Git tree
easyp generate --workspace ../.. --project ..

--project is repeatable and cannot be combined with --all. Recursive discovery skips hidden directories, easyp_vendor, node_modules, and nested Git repositories. Select a project in a skipped directory explicitly. Automatic selection rejects a symlink configuration file; an explicit project selection is required to use it. Choosing --all authorizes plugins in the discovered projects, including command plugins.

The nearest Git repository, including a worktree with a .git file, supplies the workspace boundary. Without Git, enclosing EasyP configuration and manifest files establish the boundary; --workspace sets it explicitly. Project paths and descriptor destinations are relative to the invocation directory. Plugin output paths are relative to the selected generation file. The command has no --path or --root flag.

Named generation configs

Keep profiles such as private.easyp.gen.yaml and public.easyp.gen.yaml beside the same protobuf.mod, then select one file with --gen-config:

easyp generate --gen-config private.easyp.gen.yaml
easyp generate --gen-config public.easyp.gen.yaml
# The selected profile can also export descriptors.
easyp generate --gen-config public.easyp.gen.yaml --descriptor_set_out build/public.pb

The flag accepts one relative or absolute file path inside the workspace. Relative paths start at the invocation directory; --workspace can set the boundary explicitly. The file uses the native version: v1 generation format. Missing, empty or invalid selections fail without falling back to easyp.gen.yaml.

Do not combine --gen-config with --project or --all. Automatic selection and --all still discover only standard easyp.gen.yaml files. The global --config/--cfg flag selects a policy file and does not select a generation profile.

Colocated profiles keep the same source, module and output path rules; no directory relocation or extra ../ is needed. Plugin outputs remain relative to the selected file's directory. Options inherit from standard easyp.gen.yaml files in ancestor directories; a standard file in the same directory is an independent profile and is not inherited. See profiles for one module for complete examples.

Frozen generation

easyp generate --frozen --project backend --project frontend
easyp --frozen generate --all --descriptor_set_out_dir build/descriptors

Each selected local native module must have protobuf.mod and protobuf.lock, including an empty lock without dependencies. An explicit workspace-relative path uses the selected module's files: backend/easyp.gen.yaml with generate.modules: [proto/user] validates proto/user/protobuf.mod and proto/user/protobuf.lock. The generator-only backend directory needs neither file. Frozen rejects all root replacements, even unused ones, and validates the locked direct and transitive graph before any plugin executes. A failure in a later selected project therefore prevents plugins in earlier projects from running. The same preflight applies to both descriptor export modes and pluginless exports.

A dependency selected by identity through generate.modules requires its consumer's manifest and lock; the downloaded dependency does not need its own lock. Unselected projects are ignored. --frozen does not change the existing --gen-config/--project/--all selection and plugin authorization rules.

Exact locked commits may be downloaded into the cache and are hash-verified, including on cache reuse. Manifest and lock files are never rewritten, and dependency HEAD/tags are never resolved. Frozen is explicit, not inferred from CI, and does not make remote plugins offline or pin local plugin executables. See frozen builds.

Export descriptors

easyp generate --project backend --descriptor_set_out build/backend.pb --include_imports
easyp generate --all --descriptor_set_out_dir build/descriptors --include_imports

--descriptor_set_out combines the selected graphs into one binary FileDescriptorSet. Identical descriptors are deduplicated; conflicting definitions under one import path or conflicting symbols cause an error. Managed options remain part of compatibility checks.

--descriptor_set_out_dir writes an independent descriptor set for each selected project/module pair, so different consumers can retain different options or dependency versions. Project paths are mirrored below the destination; filenames contain a sanitized module basename and the first 12 hex digits of the full module identity's SHA-256. External projects use an _external namespace. Existing unrelated files are retained.

The two destination flags are mutually exclusive. --include_imports defaults to false and includes transitive imports in exported files only. Compilation and compatibility validation always use the complete graph.

All requested graphs and export destinations pass preflight before any plugin runs. Configured plugins still run; a pluginless project can also export descriptors. Descriptor files are written after all selected plugin executions succeed, with atomic replacement per file. This does not provide a transaction across arbitrary plugin side effects or filesystem failures.

Plugins and managed options

Each plugin sets exactly one source: name, path, command, or remote. Local binaries and commands run from the invocation directory. Remote plugins require a pinned semantic version; local and bundled plugins reject a separate version field.

Bundled names such as go and go-grpc use a matching protoc-gen-* on PATH when available, otherwise their bundled WASM plugin.

plugins[].with_imports defaults to false. Set it to true for a particular plugin to generate code for transitive imports as well as the selected files. Other plugins still receive dependency descriptors for linking. This setting is independent of descriptor export's --include_imports. Keep Go import paths and output directories aligned: different Go packages must not share one generated directory. Identical shared outputs are deduplicated; conflicting file contents or Go package declarations fail before generated files are written.

options.go.package_prefix changes Go options only. Defaults for other languages and field-option transformations require explicit generate.managed.enabled: true. An inherited Go prefix precedes explicit managed Go overrides; a prefix in the current file has the highest priority. Go disable selectors still apply. See the full configuration reference.

A plain prefix maps a multi-component protobuf package such as common.v1 to <prefix>/common/v1. With explicit paths: source_relative, Go output directories follow the plugin's effective import path under that prefix, including its Mfile.proto mappings. Insertion-point outputs follow the producer's output file. See Go output paths and plugin mappings for marker templates and precedence.

Dependency repositories may use v1 EasyP, older EasyP, Buf v1, or Buf v2 metadata. EasyP reads dependency metadata without executing dependency plugins. Buf source includes/excludes also apply when selecting a dependency or its packages for generation; excluded files cannot be reintroduced as imports. See dependency metadata and filters.

On this page