-
-
Notifications
You must be signed in to change notification settings - Fork 392
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
Deprecate compile --build-properties flag in favor of new featureful --build-property flag #1044
Conversation
legacy/builder/types/context.go
Outdated
ctx.CustomBuildProperties = strings.Split(opts.Get("customBuildProperties"), ",") | ||
ctx.OptimizationFlags = opts.Get("compiler.optimization_flags") | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove this one? Is this function unused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, completely unused. I was digging around trying to understand how to fix the issue and stumbled upon it, noticed it wasn't used and decided to delete since I was there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked, it's used in the arduino-builder
, so we need it: https://github.com/arduino/arduino-builder/blob/642e2cd708dd024e658067d383387691f7e79abd/main.go#L244
cli/compile/compile.go
Outdated
command.Flags().StringSliceVar(&buildProperties, "build-properties", []string{}, | ||
"List of custom build properties separated by commas. Or can be used multiple times for multiple properties.") | ||
command.Flags().StringArrayVar(&buildProperties, "build-properties", []string{}, | ||
"List of custom build properties separated by spaces. Or can be used multiple times for multiple properties.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since if you want to change multiple properties you now need to repeat the flag multiple times I think that the correct description is something along the line of:
"List of custom build properties separated by spaces. Or can be used multiple times for multiple properties.") | |
"Override a build property with a custom value. Can be used multiple times for multiple properties.") |
I've updated the PR with some changes, I marked the |
This took a while to test, had to look hard for a way to break it but haven't found it yet. |
This is a first people! Marking it on the calendar! 📆 I'll be waiting for a review by @cmaglie anyway before merging. 😄 |
Also would love some feedback from @obra, @bxparks and @artynet. |
I’ll do my best to give it a workout today. Does arduino-cli have a written policy about what “deprecation” means? Some projects, for example, have a policy of deprecations warning for two releases before failing with a message that the facility was removed for another n releases. Some projects explicitly state that every .0 is fair game for breakage. |
Thanks, appreciate it. :)
We're working on it, we're exploring different alternatives. |
I can respect that answer :) My background comes from managing Perl's backwards-compatibility policy, which is, roughly "do not break on a user unless it is unavoidable." Being that focused on not hurting users comes with a huge maintenance burden that can calcify a project if such a policy is applied to early. Is there a place that it would be useful for me to comment about what I as a consumer of the tool (and as someone who's been responsible for writing such policies) might want? It's 100% ok if the answer is "feedback is not useful right now" |
Exactly this :) Being the CLI still in alpha and in very heavy development, we are running fast to stabilize the APIs and implement all the features we think are needed. We are trying to avoid to enforce a structured Deprecation policy ATM to not slow down the development. However we recognize that the project gained traction, and we have users that rely on the CLI in their projects. We don't want to let our users down :) so I started to modify slightly our contribution guidelines here #1039 and our internal release documents in order to start managing the project breaking changes in the easiest way possible. It would be great to get your feedback on the PR 👍 |
Let me clarify that having a structured deprecation policy is a milestone in our roadmap for the Maybe my previous message was a bit misleading on this specific point. 😄 |
@obra, I'm so happy to see you again in this repository :) |
@rsora Is the internal release document something that can't be made public? Poking at 0.13.. there's nowhere I see in the help or the online docs that arduino-cli is an alpha release. Ditto https://arduino.github.io/arduino-cli/latest Now, most advanced users can probably figure out that 0.13 isn't a "release product" version number. But it looks like older alphas had 'alpha' in the filename or version. In terms of something "lightweight" for deprecation policy before 1.0, maybe something like this would be enough? "arduino-cli is a powerful tool that many people depend on, but it is still pre-release software. We are still hard at work making sure that arduino-cli 1.0 will be a tool that you can trust long into the future. Because of this, we may make backwards-incompatible changes at any time, but promise to do so only after careful deliberation." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a note to check the examples on the help
For the rest LGTM
cli/compile/compile.go
Outdated
" " + os.Args[0] + " compile -b arduino:avr:uno /home/user/Arduino/MySketch\n" + | ||
" " + os.Args[0] + " compile -b arduino:avr:uno --build-property=\"build.extra_flags=\\\"-DMY_DEFINE=\\\"hello world\\\"\\\"\" /home/user/Arduino/MySketch\n" + | ||
" " + os.Args[0] + " compile -b arduino:avr:uno --build-property=\"build.extra_flags=-DPIN=2 \\\"-DMY_DEFINE=\\\"hello world\\\"\\\"\" /home/user/Arduino/MySketch\n" + | ||
" " + os.Args[0] + " compile -b arduino:avr:uno --build-property=build.extra_flags=-DPIN=2 --build-property=\"compiler.cpp.extra_flags=\\\"-DSSID=\\\"hello world\\\"\\\"\"-DMY_DEFINE=\"hello world\"' /home/user/Arduino/MySketch\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure that this last example is correct? on the help is displayed as:
./arduino-cli compile -b arduino:avr:uno --build-property=build.extra_flags=-DPIN=2 --build-property="compiler.cpp.extra_flags=\"-DSSID=\"hello world\"\""-DMY_DEFINE="hello world"' /home/user/Arduino/MySketch
and it doesn't look right to me...
To simplify your life you may use the golang verbatim string operator (backtick) so the help strings will not require triple quoting:
`--build-property="build.extra_flags=\"-DMY_DEFINE=\"hello world\"\"" /home/user/Arduino/MySketch`
another small improvement may be to drop the (optional) =
sign after --build-property
so instead of:
--build-property="build.extra_flags=\"-DMY_DEFINE=\"hello world\"\""
we may write
--build-property "build.extra_flags=\"-DMY_DEFINE=\"hello world\"\""
that is slightly clearer IMHO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right! The last example is plainly wrong, I'll fix it.
Somehow I always forget about the backtick. 🤦
Hello, thank you for working on this issue. This is the main blocker that prevents me from using the ArduinoCLI. Is there a reference or documentation that explains the tokenization and parsing rules for the expression on the right side of the
It seems like nested-double-quoting only works around a single
Remarks: The I am still of the opinion that exposing the Another comment: Some of the Edit: Fix typos and grammar. |
By the way, I used the following const char STRING[3] = SSID; // will trigger a compiler warning if SSID is > 2 characters
#ifdef MY_DEFINE
#warning MY_DEFINE
#endif
void setup() { }
void loop() { } |
Glad to help. :)
There's no documentation right now about it, we'll see to add something. The tokenization is actually done in two places, first by the
That was actually a mistake by my side, there was an extra define that should have not been there, the current 4th example is this one:
This can be avoided by wrapping each define in quotes like this:
This is necessary because the second step that I was talking about above splits the tokens if they're not wrapped.
This is actually the correct way to use this flag.
Same as above, you must wrap each define.
This is an interesting case that I didn't think about, I'll see if it's possible to implement it.
I've not investigated the addition of the
I don't know about this, probably someone with more knowledge about this can give a better answer about it. :) |
f68c808
to
e3507b4
Compare
Force pushed to resolve conflicts, merging after checks are sucessful. |
Please check if the PR fulfills these requirements
before creating one)
our contributing guidelines
Deprecate
--build-properties
flag incompile
command and add a new--build-property
flagThe following commands would all fail because of quotes (
"
) in them.The
--build-property
is introduced to substitute in the future the--build-properties
flag, it supports the use of quotes but has a different syntax.Different build flags can't be specified using the same
--build-property
flag, nor you can specify the same build flag on separate--build-property
otherwise they'll get overridden.These are some examples.
No.
Fixes Can't include quoted strings in --build-properties args #1037, Build flags set in my
boards.txt
file not used in the compilation command #210 and probably also using multiple linking flags when overriding a build property #532 and Provide dedicated sets of "extra flags" properties for platform developers and users #846.See how to contribute