From ca8b874be2c8c52cd7dcb05ff1348469e16c74ba Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Fri, 27 Jun 2025 11:39:52 +0100 Subject: [PATCH] feat(builder/plan): add build variant flag (#137) --- pkg/cli/plan.go | 5 +++++ pkg/plan/create.go | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/pkg/cli/plan.go b/pkg/cli/plan.go index cfae4c2..9843019 100644 --- a/pkg/cli/plan.go +++ b/pkg/cli/plan.go @@ -38,6 +38,10 @@ func planCmd() *cli2.Command { Name: "sha", Usage: "override commit SHA of specified git branch/tag", }, + &cli2.IntFlag{ + Name: "build-variant", + Usage: "build variant to add to the end of the version string", + }, &cli2.StringFlag{ Name: "format", Aliases: []string{"f"}, @@ -90,6 +94,7 @@ func planAction(c *cli2.Context, opts *Options) error { EmacsRepo: c.String("emacs-repo"), Ref: ref, SHAOverride: c.String("sha"), + BuildVariant: c.Int("build-variant"), OutputDir: c.String("output-dir"), TestBuild: c.String("test-build"), TestBuildType: plan.Prerelease, diff --git a/pkg/plan/create.go b/pkg/plan/create.go index 277fab1..3069da3 100644 --- a/pkg/plan/create.go +++ b/pkg/plan/create.go @@ -35,6 +35,7 @@ type Options struct { EmacsRepo string Ref string SHAOverride string + BuildVariant int OutputDir string TestBuild string TestBuildType TestBuildType @@ -95,6 +96,12 @@ func Create(ctx context.Context, opts *Options) (*Plan, error) { //nolint:funlen releaseName = "Emacs." + version } + if opts.BuildVariant != 0 { + variant := strconv.Itoa(opts.BuildVariant) + absoluteVersion += "-" + variant + releaseName += "-" + variant + } + // Attempt to get the macOS SDK version from the environment, if it's not // available, use the version from the system. targetMacOSVersion := osInfo.DistinctSDKVersion()