Skip to content

Global build vars #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed

Global build vars #226

wants to merge 9 commits into from

Conversation

rsora
Copy link
Contributor

@rsora rsora commented Jun 5, 2019

This PR aims to refactor a group of global variables in a global package in order to inject values at build time and use them in the CLI section of the cli

In order to have the values injected the use of -ldflags param is required in the go build phase otherwise a missing value will be shown (so an update in our CI is mandatory)

i.e. to inject the version value

go build -ldflags "-X github.com/arduino/arduino-cli/global.version=0.3.6-alpha.preview"

@CLAassistant
Copy link

CLAassistant commented Jun 5, 2019

CLA assistant check
All committers have signed the CLA.

@rsora rsora requested review from cmaglie and masci June 5, 2019 15:14
@cmaglie
Copy link
Member

cmaglie commented Jun 5, 2019

I'm not sure about injecting values via ldflags, this is not very idiomatic.

If someone builds the cli from source with go build github.com/arduino/arudino-cli the version information is lost (well, on the other hand hardcoding the version gives only a rough approximation but at least you know from which version you're basing on).

Maybe we can keep the version hardcoded? it could be overriden by the CI anyway, so we get the best of the two approaches.

@rsora rsora force-pushed the global-build-vars branch 2 times, most recently from d125de3 to 0408a77 Compare June 5, 2019 19:32
@rsora rsora requested a review from cmaglie June 5, 2019 19:35
@rsora
Copy link
Contributor Author

rsora commented Jun 5, 2019

@cmaglie in accordance to your idea

keep the version hardcoded? it could be overriden by the CI anyway, so we get the best of the two approaches.

added hardcoded fallback version in 0408a77

@rsora rsora force-pushed the global-build-vars branch 3 times, most recently from 783ebaa to e2c413c Compare June 10, 2019 16:24
@rsora rsora force-pushed the global-build-vars branch from e2c413c to ca62d75 Compare June 11, 2019 10:45
@rsora
Copy link
Contributor Author

rsora commented Jun 13, 2019

PR #227 is built upon this PR with heavy refactoring of the content.

In agreement with the colleagues this PR will be closed

@rsora rsora closed this Jun 13, 2019
@rsora rsora deleted the global-build-vars branch June 13, 2019 09:45
per1234 added a commit that referenced this pull request Aug 9, 2021
Sync "Spell Check" CI workflow with template
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.

3 participants