Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Expose golangfqbn package for public use#2768

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
cmaglie merged 6 commits intoarduino:masterfromcmaglie:extract_fqbn_package
Dec 11, 2024

Conversation

@cmaglie
Copy link
Member

@cmagliecmaglie commentedNov 28, 2024
edited
Loading

Please check if the PR fulfills these requirements

Seehow to contribute

  • The PR has no duplicates (please search among thePull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • configuration.schema.json updated if new parameters are added.

What kind of change does this PR introduce?

This is a tentative design for exporting some of the internals of the Arduino CLI for reuse in other projects.

What is the current behavior?

TheFQBN struct is not exported.

What is the new behavior?

TheFQBN struct is exported through a publicfqbn package.

Does this PR introduce a breaking change, and istitled accordingly?

Other information

Importing the newly createdfqbn package as-is would cause a small dependency hell:

require (github.com/arduino/go-paths-helper v1.12.1 // indirectgithub.com/arduino/go-properties-orderedmap v1.8.1 // indirectgithub.com/leonelquinteros/gotext v1.7.0 // indirectgithub.com/sirupsen/logrus v1.9.3 // indirectgolang.org/x/sys v0.27.0 // indirect)

I also suspect that the Arduino CLI locales are bundled as part of the dependencies. To reduce this burden I've isolated thei18n.Tr function from the rest of the locales handling, and moved those latter functions to thelocales package. I've also replaced thegotext.Po instance with an interface with only theGet method required fori18n to work properly.
If the translations are not used in the importing project, a thin wrapper is used instead ofgotext.Po.
This change has reduced the dependencies to the minimum:

require (github.com/arduino/go-paths-helper v1.12.1 // indirectgithub.com/arduino/go-properties-orderedmap v1.8.1 // indirect)

and also reduced the executable size by 300KB (that I suppose are the locales that are no longer bundled).

Because it may turn out useful for other projects.
@cmagliecmaglie added type: enhancementProposed improvement topic: codeRelated to content of the project itself labelsNov 28, 2024
@cmagliecmaglie self-assigned thisNov 28, 2024
@codecov
Copy link

codecovbot commentedNov 28, 2024
edited
Loading

Codecov Report

Attention: Patch coverage is82.14286% with15 lines in your changes missing coverage. Please review.

Project coverage is 67.57%. Comparing base(a9597d6) to head(ea29e02).
Report is 6 commits behind head on master.

Files with missing linesPatch %Lines
internal/locales/i18n.go61.53%4 Missing and 1 partial⚠️
internal/cli/board/list.go0.00%4 Missing⚠️
commands/service_upload.go50.00%2 Missing⚠️
commands/instances.go0.00%1 Missing⚠️
...al/arduino/cores/packagemanager/package_manager.go90.00%1 Missing⚠️
internal/i18n/i18n.go83.33%1 Missing⚠️
internal/locales/detect_windows.go0.00%1 Missing⚠️
Additional details and impacted files
@@            Coverage Diff             @@##           master    #2768      +/-   ##==========================================+ Coverage   67.54%   67.57%   +0.03%==========================================  Files         237      238       +1       Lines       22362    22362              ==========================================+ Hits        15104    15111       +7+ Misses       6066     6062       -4+ Partials     1192     1189       -3
FlagCoverage Δ
unit67.57% <82.14%> (+0.03%)⬆️

Flags with carried forward coverage won't be shown.Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

This changes allows to make a clean i18n package (without dependency ona specific implementation of the translation package) that, in turn,allows to export packages that internally use i18n with the minimaldependency load.
@cmagliecmaglie marked this pull request as ready for reviewDecember 2, 2024 14:00
Copy link
Contributor

@alessio-peruginialessio-perugini left a comment

Choose a reason for hiding this comment

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

super

@cmagliecmaglie linked an issueDec 4, 2024 that may beclosed by this pull request
3 tasks
@cmagliecmaglie merged commit84fc413 intoarduino:masterDec 11, 2024
106 checks passed
@cmagliecmaglie deleted the extract_fqbn_package branchDecember 11, 2024 16:06
@dankeboy36
Copy link
Contributor

Hello, will this package get a public doc similar to what exists, for example, for arduino/go-paths-helper:https://pkg.go.dev/github.com/arduino/go-paths-helper?

I want to reference this new official implementation from my library. However, I could not find anything related to FQBN here:https://pkg.go.dev/search?q=arduino&m=package. Does it take some time to get published? I do not know how this works.

Thanks, and keep up the great work 💪

@alessio-perugini
Copy link
Contributor

@dankeboy36 👋 it will become available once we tag the next release. If you want to see it right now you have to navigate the following URL:
https://pkg.go.dev/github.com/arduino/arduino-cli@master
At the bottom once you click for the fqbn pkg it will redirect you to:
https://pkg.go.dev/github.com/arduino/arduino-cli@v1.1.2-0.20241211160613-84fc413ad815/pkg/fqbn

dankeboy36 reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@MatteoPologrutoMatteoPologrutoAwaiting requested review from MatteoPologruto

1 more reviewer

@alessio-peruginialessio-peruginialessio-perugini approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

@cmagliecmaglie

Labels

topic: codeRelated to content of the project itselftype: enhancementProposed improvement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Expose a golang package to handle FQBNs

3 participants

@cmaglie@dankeboy36@alessio-perugini

[8]ページ先頭

©2009-2025 Movatter.jp