Skip to content

Conversation

@oshirohugo
Copy link
Contributor

What this PR does / why we need it:

This PR is adding the build manifest step after every backend build. This would simplify the build process for specific architecture and make selecting specific architectures in the plugin-actions easier

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

The drawback is that in the buildAll target the manifest will be built multiple times

@oshirohugo oshirohugo self-assigned this Jan 10, 2025
@oshirohugo oshirohugo requested a review from a team as a code owner January 10, 2025 11:30
@oshirohugo oshirohugo requested review from andresmgot, wbrowne and xnyo and removed request for a team January 10, 2025 11:30
Copy link
Contributor

@xnyo xnyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! 🙌 Just a couple of small comments

build/common.go Outdated
Comment on lines 101 to 102
// TODO: Change to sh.RunWithV once available.
return sh.RunWith(cfg.Env, "go", args...)
err = sh.RunWith(cfg.Env, "go", args...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, unrelated: the comment above specifies "TODO: Change to sh.RunWithV once available.", it is now available, maybe we can kill two birds with one stone? 🙂

Suggested change
// TODO: Change to sh.RunWithV once available.
return sh.RunWith(cfg.Env, "go", args...)
err = sh.RunWith(cfg.Env, "go", args...)
err = sh.RunWithV(cfg.Env, "go", args...)
@xnyo
Copy link
Contributor

xnyo commented Jan 10, 2025

Another comment: if we're worried about performance and we want to make sure that the manifest is generated only once, we can wrap GenerateManifestFile into a sync.OnceValue to ensure it's called only once, like so:

diff --git a/build/common.go b/build/common.go index c104d30..40d0972 100644 --- a/build/common.go +++ b/build/common.go @@ -252,8 +252,7 @@ func (Build) DarwinARM64() error { return buildBackend(newBuildConfig("darwin", "arm64")) } -// GenerateManifestFile generates a manifest file for plugin submissions -func (Build) GenerateManifestFile() error { +var generateManifestOnce = sync.OnceValue(func() error { config := Config{} config, err := beforeBuild(config) if err != nil { @@ -279,6 +278,11 @@ func (Build) GenerateManifestFile() error { return err } return nil +}) + +// GenerateManifestFile generates a manifest file for plugin submissions +func (Build) GenerateManifestFile() error { + return generateManifestOnce() } // Debug builds the debug version for the current platform.

However what we have right now is more readable and not a concern, so unless there are other issues down the line I'd keep it like this

@oshirohugo oshirohugo requested a review from xnyo January 10, 2025 16:04
Copy link
Contributor

@xnyo xnyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@oshirohugo oshirohugo merged commit f932e55 into main Jan 13, 2025
3 checks passed
@oshirohugo oshirohugo deleted the generate-manifest-on-every-backend-build branch January 13, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants