Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to setup command allowing it to run without installed tool… #313

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/cbuild/commands/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func setUpProject(cmd *cobra.Command, args []string) error {
useContextSet, _ := cmd.Flags().GetBool("context-set")
frozenPacks, _ := cmd.Flags().GetBool("frozen-packs")
useCbuildgen, _ := cmd.Flags().GetBool("cbuildgen")
noDatabase, _ := cmd.Flags().GetBool("no-database")

useCbuild2CMake := true
if useCbuildgen {
Expand Down Expand Up @@ -99,6 +100,7 @@ func setUpProject(cmd *cobra.Command, args []string) error {
Toolchain: toolchain,
FrozenPacks: frozenPacks,
UseCbuild2CMake: useCbuild2CMake,
NoDatabase: noDatabase,
}

configs, err := utils.GetInstallConfigs()
Expand Down Expand Up @@ -152,4 +154,5 @@ func init() {
SetUpCmd.Flags().StringP("log", "", "", "Save output messages in a log file")
SetUpCmd.Flags().StringP("toolchain", "", "", "Input toolchain to be used")
SetUpCmd.Flags().BoolP("cbuildgen", "", false, "Generate legacy *.cprj files and use cbuildgen backend")
SetUpCmd.Flags().BoolP("no-database", "", false, "Skip the generation of compile_commands.json files")
}
6 changes: 6 additions & 0 deletions pkg/builder/cbuildidx/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ func (b CbuildIdxBuilder) build() error {
return nil
}

// no CMake orchestration needed
if b.Options.NoDatabase {
log.Info("setup finished successfully!")
return nil
}

if vars.CmakeBin == "" {
err = errutils.New(errutils.ErrBinaryNotFound, "cmake", "")
return err
Expand Down
6 changes: 6 additions & 0 deletions pkg/builder/cproject/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ func (b CprjBuilder) build() error {
}
}

// no CMake orchestration needed
if b.Options.NoDatabase {
log.Info("setup finished successfully!")
return nil
}

args = []string{"cmake", b.InputFile, "--outdir=" + dirs.OutDir, "--intdir=" + dirs.IntDir}
if b.Options.Quiet {
args = append(args, "--quiet")
Expand Down
1 change: 1 addition & 0 deletions pkg/builder/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type Options struct {
UseContextSet bool
FrozenPacks bool
UseCbuild2CMake bool
NoDatabase bool
}

type InternalVars struct {
Expand Down