Loading go-apps/meepctl/cmd/build.go +14 −3 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ type BuildData struct { codecov bool nolint bool noCache bool force bool coreGoApps []string coreJsApps []string sandboxGoApps []string Loading @@ -43,12 +44,15 @@ type BuildData struct { const buildDesc = `AdvantEDGE is composed of a collection of micro-services. Build command generates AdvantEDGE binaries. Multiple targets can be specified (e.g. meepctl build <target1> <target2>...)` Multiple targets can be specified (e.g. meepctl build <target1> <target2>...) Use --force to rebuild targets even when the checksum cache reports no source changes.` const buildExample = ` # Build all components meepctl build all # Build meep-platform-ctrl component only meepctl build meep-platform-ctrl` meepctl build meep-platform-ctrl # Force rebuild of all MEC services (ignore checksum cache) meepctl build all --force` // buildCmd represents the build command var buildCmd = &cobra.Command{ Loading Loading @@ -86,6 +90,7 @@ func init() { buildCmd.Flags().BoolVar(&buildData.codecov, "codecov", false, "Build a code coverage binary (dev. option)") buildCmd.Flags().BoolVar(&buildData.nolint, "nolint", false, "Disable linting") buildCmd.Flags().BoolVar(&buildData.noCache, "no-cache", false, "Build binaries without using checksum cache") buildCmd.Flags().BoolVarP(&buildData.force, "force", "f", false, "Force rebuild even if no source changes were detected") // Add command rootCmd.AddCommand(buildCmd) Loading @@ -112,10 +117,16 @@ func buildRun(cmd *cobra.Command, args []string) { fmt.Println("[arg] targets:", targets) fmt.Println("[flag] codecov:", buildData.codecov) fmt.Println("[flag] nolint:", buildData.nolint) fmt.Println("[flag] no-cache:", buildData.noCache) fmt.Println("[flag] force:", buildData.force) fmt.Println("[flag] verbose:", v) fmt.Println("[flag] time:", t) } if buildData.force { fmt.Println(utils.FormatWarning("Force rebuild enabled: checksum cache will be ignored")) } start := time.Now() for _, target := range targets { if target == "all" { Loading Loading @@ -384,7 +395,7 @@ func checkBuildCache(srcDir string, binFile string, binDir string, gitDir string currentChecksum := "" if err == nil { currentChecksum = strings.TrimSpace(string(outBytes)) if !buildData.noCache && binExists && currentChecksum != "" { if !buildData.noCache && !buildData.force && binExists && currentChecksum != "" { savedChecksumBytes, err := os.ReadFile(checksumFile) if err == nil { savedChecksum := strings.TrimSpace(string(savedChecksumBytes)) Loading Loading
go-apps/meepctl/cmd/build.go +14 −3 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ type BuildData struct { codecov bool nolint bool noCache bool force bool coreGoApps []string coreJsApps []string sandboxGoApps []string Loading @@ -43,12 +44,15 @@ type BuildData struct { const buildDesc = `AdvantEDGE is composed of a collection of micro-services. Build command generates AdvantEDGE binaries. Multiple targets can be specified (e.g. meepctl build <target1> <target2>...)` Multiple targets can be specified (e.g. meepctl build <target1> <target2>...) Use --force to rebuild targets even when the checksum cache reports no source changes.` const buildExample = ` # Build all components meepctl build all # Build meep-platform-ctrl component only meepctl build meep-platform-ctrl` meepctl build meep-platform-ctrl # Force rebuild of all MEC services (ignore checksum cache) meepctl build all --force` // buildCmd represents the build command var buildCmd = &cobra.Command{ Loading Loading @@ -86,6 +90,7 @@ func init() { buildCmd.Flags().BoolVar(&buildData.codecov, "codecov", false, "Build a code coverage binary (dev. option)") buildCmd.Flags().BoolVar(&buildData.nolint, "nolint", false, "Disable linting") buildCmd.Flags().BoolVar(&buildData.noCache, "no-cache", false, "Build binaries without using checksum cache") buildCmd.Flags().BoolVarP(&buildData.force, "force", "f", false, "Force rebuild even if no source changes were detected") // Add command rootCmd.AddCommand(buildCmd) Loading @@ -112,10 +117,16 @@ func buildRun(cmd *cobra.Command, args []string) { fmt.Println("[arg] targets:", targets) fmt.Println("[flag] codecov:", buildData.codecov) fmt.Println("[flag] nolint:", buildData.nolint) fmt.Println("[flag] no-cache:", buildData.noCache) fmt.Println("[flag] force:", buildData.force) fmt.Println("[flag] verbose:", v) fmt.Println("[flag] time:", t) } if buildData.force { fmt.Println(utils.FormatWarning("Force rebuild enabled: checksum cache will be ignored")) } start := time.Now() for _, target := range targets { if target == "all" { Loading Loading @@ -384,7 +395,7 @@ func checkBuildCache(srcDir string, binFile string, binDir string, gitDir string currentChecksum := "" if err == nil { currentChecksum = strings.TrimSpace(string(outBytes)) if !buildData.noCache && binExists && currentChecksum != "" { if !buildData.noCache && !buildData.force && binExists && currentChecksum != "" { savedChecksumBytes, err := os.ReadFile(checksumFile) if err == nil { savedChecksum := strings.TrimSpace(string(savedChecksumBytes)) Loading