You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2019/12/18 12:34:56 UTC
[camel-k] 11/13: chore(build): Ensure build directory is cleaned-up
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit dbe76a1af698770db31c9b4d7912a25d76c8d4eb
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue Dec 17 18:35:42 2019 +0100
chore(build): Ensure build directory is cleaned-up
---
pkg/builder/builder_steps.go | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/pkg/builder/builder_steps.go b/pkg/builder/builder_steps.go
index 429d9b8..b5e9f1a 100644
--- a/pkg/builder/builder_steps.go
+++ b/pkg/builder/builder_steps.go
@@ -43,6 +43,7 @@ func init() {
}
type steps struct {
+ CleanBuildDir Step
GenerateProjectSettings Step
InjectDependencies Step
SanitizeDependencies Step
@@ -52,6 +53,10 @@ type steps struct {
// Steps --
var Steps = steps{
+ CleanBuildDir: NewStep(
+ ProjectGenerationPhase-1,
+ cleanBuildDir,
+ ),
GenerateProjectSettings: NewStep(
ProjectGenerationPhase+1,
generateProjectSettings,
@@ -76,6 +81,7 @@ var Steps = steps{
// DefaultSteps --
var DefaultSteps = []Step{
+ Steps.CleanBuildDir,
Steps.GenerateProjectSettings,
Steps.InjectDependencies,
Steps.SanitizeDependencies,
@@ -108,6 +114,14 @@ func registerStep(steps ...Step) {
}
}
+func cleanBuildDir(ctx *Context) error {
+ if ctx.Build.BuildDir == "" {
+ return nil
+ }
+
+ return os.RemoveAll(ctx.Build.BuildDir)
+}
+
func generateProjectSettings(ctx *Context) error {
val, err := kubernetes.ResolveValueSource(ctx.C, ctx.Client, ctx.Namespace, &ctx.Build.Maven.Settings)
if err != nil {