diff --git a/cli/compile/compile.go b/cli/compile/compile.go index f10d6d52f1e..e748cbae767 100644 --- a/cli/compile/compile.go +++ b/cli/compile/compile.go @@ -49,6 +49,7 @@ var ( port string // Upload port, e.g.: COM10 or /dev/ttyACM0. verify bool // Upload, verify uploaded binary after the upload. exportFile string // The compiled binary is written to this file + libraries []string // List of custom libraries paths separated by commas. Or can be used multiple times for multiple libraries paths. ) // NewCommand created a new `compile` command @@ -79,6 +80,8 @@ func NewCommand() *cobra.Command { command.Flags().StringVarP(&port, "port", "p", "", "Upload port, e.g.: COM10 or /dev/ttyACM0") command.Flags().BoolVarP(&verify, "verify", "t", false, "Verify uploaded binary after the upload.") command.Flags().StringVar(&vidPid, "vid-pid", "", "When specified, VID/PID specific build properties are used, if boards supports them.") + command.Flags().StringSliceVar(&libraries, "libraries", []string{}, + "List of custom libraries paths separated by commas. Or can be used multiple times for multiple libraries paths.") return command } @@ -107,6 +110,7 @@ func run(cmd *cobra.Command, args []string) { Quiet: quiet, VidPid: vidPid, ExportFile: exportFile, + Libraries: libraries, }, os.Stdout, os.Stderr, viper.GetString("logging.level") == "debug") if err != nil { diff --git a/commands/compile/compile.go b/commands/compile/compile.go index b3ea4fe9318..1a2b3e5e5e4 100644 --- a/commands/compile/compile.go +++ b/commands/compile/compile.go @@ -92,7 +92,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W builderCtx.HardwareDirs = configuration.HardwareDirectories() builderCtx.BuiltInToolsDirs = configuration.BundleToolsDirectories() - builderCtx.OtherLibrariesDirs = paths.NewPathList() + builderCtx.OtherLibrariesDirs = paths.NewPathList(req.GetLibraries()...) builderCtx.OtherLibrariesDirs.Add(configuration.LibrariesDir()) if req.GetBuildPath() != "" { diff --git a/rpc/commands/compile.pb.go b/rpc/commands/compile.pb.go index acfb56d8f87..ca07e31f157 100644 --- a/rpc/commands/compile.pb.go +++ b/rpc/commands/compile.pb.go @@ -35,6 +35,7 @@ type CompileReq struct { VidPid string `protobuf:"bytes,12,opt,name=vidPid,proto3" json:"vidPid,omitempty"` ExportFile string `protobuf:"bytes,13,opt,name=exportFile,proto3" json:"exportFile,omitempty"` Jobs int32 `protobuf:"varint,14,opt,name=jobs,proto3" json:"jobs,omitempty"` + Libraries []string `protobuf:"bytes,15,rep,name=libraries,proto3" json:"libraries,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -163,6 +164,13 @@ func (m *CompileReq) GetJobs() int32 { return 0 } +func (m *CompileReq) GetLibraries() []string { + if m != nil { + return m.Libraries + } + return nil +} + type CompileResp struct { OutStream []byte `protobuf:"bytes,1,opt,name=out_stream,json=outStream,proto3" json:"out_stream,omitempty"` ErrStream []byte `protobuf:"bytes,2,opt,name=err_stream,json=errStream,proto3" json:"err_stream,omitempty"` @@ -218,30 +226,31 @@ func init() { func init() { proto.RegisterFile("commands/compile.proto", fileDescriptor_86bc582849c76c3d) } var fileDescriptor_86bc582849c76c3d = []byte{ - // 392 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x8f, 0xd3, 0x30, - 0x10, 0x85, 0x95, 0xed, 0xb6, 0x9b, 0x4c, 0x97, 0x45, 0xb2, 0x60, 0xb1, 0x2a, 0x40, 0xa1, 0x07, - 0x14, 0x09, 0x35, 0x91, 0xe0, 0xcc, 0x85, 0x4a, 0x48, 0x88, 0x4b, 0x15, 0x6e, 0x5c, 0x50, 0xe2, - 0x0c, 0x8d, 0x21, 0xb1, 0x5d, 0xdb, 0x69, 0xf9, 0x97, 0xfc, 0x25, 0x94, 0x49, 0xd3, 0x56, 0x95, - 0x38, 0xc5, 0xf3, 0xbd, 0xe7, 0x67, 0xc7, 0x33, 0xf0, 0x28, 0x74, 0xdb, 0x16, 0xaa, 0x72, 0x99, - 0xd0, 0xad, 0x91, 0x0d, 0xa6, 0xc6, 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 0x9e, 0xcf, 0x89, - 0x0f, 0x05, 0x7b, 0x84, 0xd9, 0x5e, 0x56, 0x1b, 0x59, 0xf1, 0x7b, 0x4a, 0x3a, 0x56, 0xfd, 0x3f, - 0xe3, 0x1f, 0xa3, 0xad, 0xff, 0x2c, 0x1b, 0xe4, 0x4f, 0x86, 0xb7, 0x3b, 0x93, 0xfe, 0xbd, 0x7f, - 0xe9, 0xd2, 0xf1, 0x87, 0x38, 0x48, 0xa6, 0x39, 0xad, 0x97, 0x5f, 0x61, 0x7e, 0x6a, 0xa8, 0x33, - 0xec, 0x15, 0x80, 0xee, 0xfc, 0x0f, 0xe7, 0x2d, 0x16, 0x2d, 0xf5, 0xf4, 0x3e, 0x8f, 0x74, 0xe7, - 0xbf, 0x11, 0xe8, 0x65, 0xb4, 0x76, 0x94, 0x6f, 0x06, 0x19, 0xad, 0x1d, 0xe4, 0x4f, 0xab, 0xef, - 0xef, 0xb6, 0xd2, 0xd7, 0x5d, 0xd9, 0xb7, 0x3d, 0x3b, 0x8e, 0xc1, 0xf8, 0x5d, 0x89, 0x46, 0x66, - 0xd6, 0x88, 0x6c, 0x1c, 0x89, 0x72, 0x46, 0x43, 0xf5, 0xe1, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x14, 0x81, 0xb3, 0x02, 0x9e, 0x02, 0x00, 0x00, + // 405 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x6f, 0xd4, 0x30, + 0x10, 0x85, 0x95, 0x6e, 0x77, 0xbb, 0x99, 0x2d, 0xad, 0x64, 0x41, 0xb1, 0x2a, 0x40, 0xa1, 0x07, + 0x14, 0x09, 0x35, 0x2b, 0xc1, 0x99, 0x0b, 0x95, 0x90, 0x10, 0x97, 0x55, 0xb8, 0x71, 0x41, 0x89, + 0x33, 0x34, 0x86, 0x24, 0xf6, 0x8e, 0x9d, 0x96, 0x3f, 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 0xc6, + 0xe2, 0x1a, 0x96, 0x8f, 0x05, 0x75, 0xba, 0xbb, 0x77, 0x32, 0xe6, 0x98, 0x7d, 0x2d, 0x24, 0x9c, + 0x3d, 0x20, 0x95, 0xc6, 0xa1, 0x04, 0x6e, 0x74, 0x2c, 0xc5, 0x73, 0x98, 0x6f, 0x7b, 0x8d, 0x5e, + 0xae, 0x98, 0x0f, 0x85, 0xb8, 0x82, 0xc5, 0x83, 0xae, 0x36, 0xba, 0x92, 0xe7, 0x9c, 0xb4, 0xab, + 0xc2, 0x99, 0xf1, 0xaf, 0x35, 0xe4, 0xbf, 0xe8, 0x06, 0xe5, 0xb3, 0xe1, 0xee, 0x26, 0x12, 0xee, + 0xfb, 0xb7, 0x29, 0x9d, 0xbc, 0x48, 0xa2, 0x74, 0x9e, 0xf3, 0x7f, 0x38, 0x5f, 0xa3, 0x4b, 0x2a, + 0x28, 0xf4, 0x7e, 0xc9, 0xbd, 0x4f, 0xe0, 0xe6, 0x1b, 0xac, 0xf6, 0xcf, 0xed, 0xac, 0x78, 0x0d, + 0x60, 0x7a, 0xff, 0xd3, 0x79, 0xc2, 0xa2, 0xe5, 0x17, 0x3f, 0xcf, 0x63, 0xd3, 0xfb, 0xef, 0x0c, + 0x82, 0x8c, 0x44, 0xa3, 0x7c, 0x32, 0xc8, 0x48, 0x34, 0xc8, 0x9f, 0x6f, 0x7f, 0xbc, 0xbf, 0xd7, + 0xbe, 0xee, 0xcb, 0x30, 0x14, 0xeb, 0xdd, 0x90, 0x8c, 0xdf, 0x5b, 0xd5, 0xe8, 0x35, 0x59, 0xb5, + 0x1e, 0x07, 0xa6, 0x5c, 0xf0, 0xc8, 0x7d, 0xfc, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x89, 0x00, 0xe4, + 0x1f, 0xbc, 0x02, 0x00, 0x00, } diff --git a/rpc/commands/compile.proto b/rpc/commands/compile.proto index c0441db635f..460ec564a21 100644 --- a/rpc/commands/compile.proto +++ b/rpc/commands/compile.proto @@ -38,6 +38,7 @@ message CompileReq { string vidPid = 12; // VID/PID specific build properties. string exportFile = 13; // The compiled binary is written to this file int32 jobs = 14; // The max number of concurrent compiler instances to run (as make -jx) + repeated string libraries = 15; // List of custom libraries paths separated by commas. Or can be used multiple times for multiple libraries paths. } message CompileResp {