@@ -35,25 +35,26 @@ import (
35
35
)
36
36
37
37
var (
38
- fqbn string // Fully Qualified Board Name, e.g.: arduino:avr:uno.
39
- showProperties bool // Show all build preferences used instead of compiling.
40
- preprocess bool // Print preprocessed code to stdout.
41
- buildCachePath string // Builds of 'core.a' are saved into this path to be cached and reused.
42
- buildPath string // Path where to save compiled files.
43
- buildProperties []string // List of custom build properties separated by commas. Or can be used multiple times for multiple properties.
44
- warnings string // Used to tell gcc which warning level to use.
45
- verbose bool // Turns on verbose mode.
46
- quiet bool // Suppresses almost every output.
47
- vidPid string // VID/PID specific build properties.
48
- uploadAfterCompile bool // Upload the binary after the compilation.
49
- port string // Upload port, e.g.: COM10 or /dev/ttyACM0.
50
- verify bool // Upload, verify uploaded binary after the upload.
51
- exportDir string // The compiled binary is written to this file
52
- libraries []string // List of custom libraries paths separated by commas. Or can be used multiple times for multiple libraries paths.
53
- optimizeForDebug bool // Optimize compile output for debug, not for release
54
- programmer string // Use the specified programmer to upload
55
- clean bool // Cleanup the build folder and do not use any cached build
56
- exportBinaries bool // Copies compiled binaries to sketch folder when true
38
+ fqbn string // Fully Qualified Board Name, e.g.: arduino:avr:uno.
39
+ showProperties bool // Show all build preferences used instead of compiling.
40
+ preprocess bool // Print preprocessed code to stdout.
41
+ buildCachePath string // Builds of 'core.a' are saved into this path to be cached and reused.
42
+ buildPath string // Path where to save compiled files.
43
+ buildProperties []string // List of custom build properties separated by commas. Or can be used multiple times for multiple properties.
44
+ warnings string // Used to tell gcc which warning level to use.
45
+ verbose bool // Turns on verbose mode.
46
+ quiet bool // Suppresses almost every output.
47
+ vidPid string // VID/PID specific build properties.
48
+ uploadAfterCompile bool // Upload the binary after the compilation.
49
+ port string // Upload port, e.g.: COM10 or /dev/ttyACM0.
50
+ verify bool // Upload, verify uploaded binary after the upload.
51
+ exportDir string // The compiled binary is written to this file
52
+ libraries []string // List of custom libraries paths separated by commas. Or can be used multiple times for multiple libraries paths.
53
+ optimizeForDebug bool // Optimize compile output for debug, not for release
54
+ programmer string // Use the specified programmer to upload
55
+ clean bool // Cleanup the build folder and do not use any cached build
56
+ exportBinaries bool // Copies compiled binaries to sketch folder when true
57
+ compilationDatabaseOnly bool // Only create compilation database without actually compiling
57
58
)
58
59
59
60
// NewCommand created a new `compile` command
@@ -94,6 +95,7 @@ func NewCommand() *cobra.Command {
94
95
"List of custom libraries paths separated by commas. Or can be used multiple times for multiple libraries paths." )
95
96
command .Flags ().BoolVar (& optimizeForDebug , "optimize-for-debug" , false , "Optional, optimize compile output for debugging, rather than for release." )
96
97
command .Flags ().StringVarP (& programmer , "programmer" , "P" , "" , "Optional, use the specified programmer to upload." )
98
+ command .Flags ().BoolVar (& compilationDatabaseOnly , "only-compilation-database" , false , "Just produce the compilation database, without actually compiling." )
97
99
command .Flags ().BoolVar (& clean , "clean" , false , "Optional, cleanup the build folder and do not use any cached build." )
98
100
// We must use the following syntax for this flag since it's also bound to settings, we could use the other one too
99
101
// but it wouldn't make sense since we still must explicitly set the exportBinaries variable by reading from settings.
@@ -127,23 +129,24 @@ func run(cmd *cobra.Command, args []string) {
127
129
exportBinaries = configuration .Settings .GetBool ("sketch.always_export_binaries" )
128
130
129
131
compileReq := & rpc.CompileReq {
130
- Instance : inst ,
131
- Fqbn : fqbn ,
132
- SketchPath : sketchPath .String (),
133
- ShowProperties : showProperties ,
134
- Preprocess : preprocess ,
135
- BuildCachePath : buildCachePath ,
136
- BuildPath : buildPath ,
137
- BuildProperties : buildProperties ,
138
- Warnings : warnings ,
139
- Verbose : verbose ,
140
- Quiet : quiet ,
141
- VidPid : vidPid ,
142
- ExportDir : exportDir ,
143
- Libraries : libraries ,
144
- OptimizeForDebug : optimizeForDebug ,
145
- Clean : clean ,
146
- ExportBinaries : exportBinaries ,
132
+ Instance : inst ,
133
+ Fqbn : fqbn ,
134
+ SketchPath : sketchPath .String (),
135
+ ShowProperties : showProperties ,
136
+ Preprocess : preprocess ,
137
+ BuildCachePath : buildCachePath ,
138
+ BuildPath : buildPath ,
139
+ BuildProperties : buildProperties ,
140
+ Warnings : warnings ,
141
+ Verbose : verbose ,
142
+ Quiet : quiet ,
143
+ VidPid : vidPid ,
144
+ ExportDir : exportDir ,
145
+ Libraries : libraries ,
146
+ OptimizeForDebug : optimizeForDebug ,
147
+ Clean : clean ,
148
+ ExportBinaries : exportBinaries ,
149
+ CreateCompilationDatabaseOnly : compilationDatabaseOnly ,
147
150
}
148
151
compileOut := new (bytes.Buffer )
149
152
compileErr := new (bytes.Buffer )
0 commit comments