Skip to content

Deprecate compile --build-properties flag in favor of new featureful --build-property flag #1044

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

Merged
merged 5 commits into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Deprecate --build-properties flag in favor of --build-property
  • Loading branch information
silvanocerza committed Nov 5, 2020
commit 1f7d7f8a9d1835d82c742c9960fadb2b51d2c3cc
24 changes: 16 additions & 8 deletions cli/compile/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ var (
// NewCommand created a new `compile` command
func NewCommand() *cobra.Command {
command := &cobra.Command{
Use: "compile",
Short: "Compiles Arduino sketches.",
Long: "Compiles Arduino sketches.",
Example: " " + os.Args[0] + " compile -b arduino:avr:uno /home/user/Arduino/MySketch",
Args: cobra.MaximumNArgs(1),
Run: run,
Use: "compile",
Short: "Compiles Arduino sketches.",
Long: "Compiles Arduino sketches.",
Example: "" +
" " + 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",
Args: cobra.MaximumNArgs(1),
Run: run,
}

command.Flags().StringVarP(&fqbn, "fqbn", "b", "", "Fully Qualified Board Name, e.g.: arduino:avr:uno")
Expand All @@ -72,8 +76,10 @@ func NewCommand() *cobra.Command {
command.Flags().StringVarP(&exportDir, "output-dir", "", "", "Save build artifacts in this directory.")
command.Flags().StringVar(&buildPath, "build-path", "",
"Path where to save compiled files. If omitted, a directory will be created in the default temporary path of your OS.")
command.Flags().StringArrayVar(&buildProperties, "build-properties", []string{},
"List of custom build properties separated by spaces. Or can be used multiple times for multiple properties.")
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-property", []string{},
"Override a build property with a custom value. Can be used multiple times for multiple properties.")
command.Flags().StringVar(&warnings, "warnings", "none",
`Optional, can be "none", "default", "more" and "all". Defaults to "none". Used to tell gcc which warning level to use (-W flag).`)
command.Flags().BoolVarP(&verbose, "verbose", "v", false, "Optional, turns on verbose mode.")
Expand All @@ -95,6 +101,8 @@ func NewCommand() *cobra.Command {

configuration.Settings.BindPFlag("sketch.always_export_binaries", command.Flags().Lookup("export-binaries"))

command.Flags().MarkDeprecated("build-properties", "please use --build-property instead.")

return command
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ const int DEFAULT_PIN = PIN;
const String DEFAULT_SSID = SSID;

void setup() {
Serial.begin(9600);
Serial.println(DEFAULT_PIN);
Serial.println(DEFAULT_SSID);
}

void loop() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

const int MY_FIRST_PIN = FIRST_PIN;
const int MY_SECOND_PIN = SECOND_PIN;

void setup() {
Serial.begin(9600);
Serial.println(MY_FIRST_PIN);
Serial.println(MY_SECOND_PIN);
}

void loop() {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

const int FOO = MY_DEFINE;

void setup() {
Serial.begin(9600);
Serial.println(FOO);
}

void loop() {
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
const String FOO = MY_DEFINE;

void setup() {
Serial.begin(9600);
Serial.println(FOO);
}

void loop() {
Expand Down