Skip to content

Commit 4247f48

Browse files
committed
Save compilation database inside build path
1 parent 27e01e8 commit 4247f48

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

commands/compile/compile.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W
116116
builderCtx.PackageManager = pm
117117
builderCtx.FQBN = fqbn
118118
builderCtx.SketchLocation = sketch.FullPath
119-
builderCtx.CompilationDatabase = bldr.NewCompilationDatabase(
120-
sketch.FullPath.Join("compile_commands.json"),
121-
)
122119

123120
// FIXME: This will be redundant when arduino-builder will be part of the cli
124121
builderCtx.HardwareDirs = configuration.HardwareDirectories(configuration.Settings)
@@ -132,10 +129,12 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W
132129
} else {
133130
builderCtx.BuildPath = paths.New(req.GetBuildPath())
134131
}
135-
136132
if err = builderCtx.BuildPath.MkdirAll(); err != nil {
137133
return nil, fmt.Errorf("cannot create build directory: %s", err)
138134
}
135+
builderCtx.CompilationDatabase = bldr.NewCompilationDatabase(
136+
builderCtx.BuildPath.Join("compile_commands.json"),
137+
)
139138

140139
builderCtx.Verbose = req.GetVerbose()
141140

0 commit comments

Comments
 (0)