Skip to content

Commit 50961cd

Browse files
duccioRoberto Sora
authored and
Roberto Sora
committed
Add --libraries flag to compile command (#436)
1 parent 103dd8d commit 50961cd

File tree

4 files changed

+41
-27
lines changed

4 files changed

+41
-27
lines changed

Diff for: cli/compile/compile.go

+4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ var (
4747
port string // Upload port, e.g.: COM10 or /dev/ttyACM0.
4848
verify bool // Upload, verify uploaded binary after the upload.
4949
exportFile string // The compiled binary is written to this file
50+
libraries []string // List of custom libraries paths separated by commas. Or can be used multiple times for multiple libraries paths.
5051
)
5152

5253
// NewCommand created a new `compile` command
@@ -77,6 +78,8 @@ func NewCommand() *cobra.Command {
7778
command.Flags().StringVarP(&port, "port", "p", "", "Upload port, e.g.: COM10 or /dev/ttyACM0")
7879
command.Flags().BoolVarP(&verify, "verify", "t", false, "Verify uploaded binary after the upload.")
7980
command.Flags().StringVar(&vidPid, "vid-pid", "", "When specified, VID/PID specific build properties are used, if boards supports them.")
81+
command.Flags().StringSliceVar(&libraries, "libraries", []string{},
82+
"List of custom libraries paths separated by commas. Or can be used multiple times for multiple libraries paths.")
8083

8184
return command
8285
}
@@ -109,6 +112,7 @@ func run(cmd *cobra.Command, args []string) {
109112
Quiet: quiet,
110113
VidPid: vidPid,
111114
ExportFile: exportFile,
115+
Libraries: libraries,
112116
}, os.Stdout, os.Stderr, viper.GetString("logging.level") == "debug")
113117

114118
if err != nil {

Diff for: commands/compile/compile.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W
9090
builderCtx.HardwareDirs = configuration.HardwareDirectories()
9191
builderCtx.BuiltInToolsDirs = configuration.BundleToolsDirectories()
9292

93-
builderCtx.OtherLibrariesDirs = paths.NewPathList()
93+
builderCtx.OtherLibrariesDirs = paths.NewPathList(req.GetLibraries()...)
9494
builderCtx.OtherLibrariesDirs.Add(configuration.LibrariesDir())
9595

9696
if req.GetBuildPath() != "" {

Diff for: rpc/commands/compile.pb.go

+35-26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: rpc/commands/compile.proto

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ message CompileReq {
3636
string vidPid = 12; // VID/PID specific build properties.
3737
string exportFile = 13; // The compiled binary is written to this file
3838
int32 jobs = 14; // The max number of concurrent compiler instances to run (as make -jx)
39+
repeated string libraries = 15; // List of custom libraries paths separated by commas. Or can be used multiple times for multiple libraries paths.
3940
}
4041

4142
message CompileResp {

0 commit comments

Comments
 (0)