Skip to content

Commit

Permalink
Add --update-rte flag to enable the update of RTE folder contents
Browse files Browse the repository at this point in the history
  • Loading branch information
brondani authored Dec 5, 2022
1 parent 5b081db commit 656f5c7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Flags:
-s, --schema Check *.cprj file against CPRJ.xsd schema
-t, --target string Optional CMake target name
-u, --update string Generate *.cprj file for reproducing current build
--update-rte Update the RTE directory and files
-v, --verbose Enable verbose messages from toolchain builds
-V, --version Print version
```
3 changes: 3 additions & 0 deletions cmd/cbuild/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func NewRootCmd() *cobra.Command {
schema, _ := cmd.Flags().GetBool("schema")
packs, _ := cmd.Flags().GetBool("packs")
rebuild, _ := cmd.Flags().GetBool("rebuild")
updateRte, _ := cmd.Flags().GetBool("update-rte")

b := builder.Builder{
Runner: utils.Runner{},
Expand All @@ -109,6 +110,7 @@ func NewRootCmd() *cobra.Command {
Schema: schema,
Packs: packs,
Rebuild: rebuild,
UpdateRte: updateRte,
},
}
err := b.Build()
Expand All @@ -127,6 +129,7 @@ func NewRootCmd() *cobra.Command {
rootCmd.Flags().BoolP("schema", "s", false, "Check *.cprj file against CPRJ.xsd schema")
rootCmd.Flags().BoolP("packs", "p", false, "Download missing software packs with cpackget")
rootCmd.Flags().BoolP("rebuild", "r", false, "Remove intermediate and output directories and rebuild")
rootCmd.Flags().BoolP("update-rte", "", false, "Update the RTE directory and files")
rootCmd.Flags().StringP("intdir", "i", "", "Set directory for intermediate files")
rootCmd.Flags().StringP("outdir", "o", "", "Set directory for output files")
rootCmd.Flags().StringP("update", "u", "", "Generate *.cprj file for reproducing current build")
Expand Down
4 changes: 4 additions & 0 deletions pkg/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type Options struct {
Schema bool
Packs bool
Rebuild bool
UpdateRte bool
}

type BuildDirs struct {
Expand Down Expand Up @@ -276,6 +277,9 @@ func (b Builder) Build() error {
if b.Options.Quiet {
args = append(args, "--quiet")
}
if b.Options.UpdateRte {
args = append(args, "--update-rte")
}
err = b.Runner.ExecuteCommand(vars.cbuildgenBin, b.Options.Quiet, args...)
if err != nil {
log.Error("error executing 'cbuildgen packlist'")
Expand Down
6 changes: 6 additions & 0 deletions pkg/builder/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ func TestBuild(t *testing.T) {
assert.Nil(err)
})

t.Run("test build update rte", func(t *testing.T) {
b.Options.UpdateRte = true
err := b.Build()
assert.Nil(err)
})

t.Run("test build clean target", func(t *testing.T) {
b.Options.Target = "clean"
err := b.Build()
Expand Down

0 comments on commit 656f5c7

Please sign in to comment.