Skip to content

Commit d78e71e

Browse files
committed
(tech debt) Disable profiles if compiling with --libraries/--library
1 parent 9229bff commit d78e71e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

Diff for: cli/compile/compile.go

+11
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,17 @@ func NewCommand() *cobra.Command {
142142
func runCompileCommand(cmd *cobra.Command, args []string) {
143143
logrus.Info("Executing `arduino-cli compile`")
144144

145+
if profileArg.Get() != "" {
146+
if len(libraries) > 0 {
147+
feedback.Errorf(tr("You cannot use the %s flag while compiling with a profile.", "--libraries"))
148+
os.Exit(errorcodes.ErrBadArgument)
149+
}
150+
if len(library) > 0 {
151+
feedback.Errorf(tr("You cannot use the %s flag while compiling with a profile.", "--library"))
152+
os.Exit(errorcodes.ErrBadArgument)
153+
}
154+
}
155+
145156
path := ""
146157
if len(args) > 0 {
147158
path = args[0]

Diff for: commands/compile/compile.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,13 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
150150
builderCtx.HardwareDirs = configuration.HardwareDirectories(configuration.Settings)
151151
builderCtx.BuiltInToolsDirs = configuration.BundleToolsDirectories(configuration.Settings)
152152

153+
// FIXME: This will be redundant when arduino-builder will be part of the cli
153154
builderCtx.OtherLibrariesDirs = paths.NewPathList(req.GetLibraries()...)
154155
builderCtx.OtherLibrariesDirs.Add(configuration.LibrariesDir(configuration.Settings))
155-
156156
builderCtx.LibraryDirs = paths.NewPathList(req.Library...)
157-
157+
if len(builderCtx.OtherLibrariesDirs) > 0 || len(builderCtx.LibraryDirs) > 0 {
158+
builderCtx.LibrariesManager = nil // let the builder rebuild the library manager
159+
}
158160
if req.GetBuildPath() == "" {
159161
builderCtx.BuildPath = sk.BuildPath
160162
} else {

0 commit comments

Comments
 (0)