This is an automated email from the ASF dual-hosted git repository.

nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 8ffe7b55c11d917ff20489b3d5274fba3122a79c
Author: lburgazzoli <lburgazz...@gmail.com>
AuthorDate: Thu Sep 20 18:18:57 2018 +0200

    fix findings
---
 pkg/apis/camel/v1alpha1/types.go                 | 14 ++++--------
 pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go | 28 +++++-------------------
 pkg/build/build_types.go                         | 10 ++++++---
 pkg/stub/action/context/build.go                 |  7 +++++-
 pkg/util/maven/maven.go                          |  6 ++---
 5 files changed, 26 insertions(+), 39 deletions(-)

diff --git a/pkg/apis/camel/v1alpha1/types.go b/pkg/apis/camel/v1alpha1/types.go
index 4dc5a0a..80ebe59 100644
--- a/pkg/apis/camel/v1alpha1/types.go
+++ b/pkg/apis/camel/v1alpha1/types.go
@@ -125,21 +125,15 @@ type IntegrationContext struct {
 // IntegrationContextSpec --
 type IntegrationContextSpec struct {
        Dependencies  []string            `json:"dependencies,omitempty"`
-       Classpath     []ClasspathEntry    `json:"classpath,omitempty"`
        Configuration []ConfigurationSpec `json:"configuration,omitempty"`
 }
 
 // IntegrationContextStatus --
 type IntegrationContextStatus struct {
-       Phase  IntegrationContextPhase `json:"phase,omitempty"`
-       Image  string                  `json:"image,omitempty"`
-       Digest string                  `json:"digest,omitempty"`
-}
-
-// ClasspathEntry --
-type ClasspathEntry struct {
-       ID       string `json:"id" yaml:"id"`
-       Location string `json:"location,omitempty" yaml:"location,omitempty"`
+       Phase     IntegrationContextPhase `json:"phase,omitempty"`
+       Image     string                  `json:"image,omitempty"`
+       Digest    string                  `json:"digest,omitempty"`
+       Classpath []string                `json:"classpath,omitempty"`
 }
 
 // IntegrationContextPhase --
diff --git a/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go 
b/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go
index 9f88f0e..0784edc 100644
--- a/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go
@@ -26,22 +26,6 @@ import (
 )
 
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, 
writing into out. in must be non-nil.
-func (in *ClasspathEntry) DeepCopyInto(out *ClasspathEntry) {
-       *out = *in
-       return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new ClasspathEntry.
-func (in *ClasspathEntry) DeepCopy() *ClasspathEntry {
-       if in == nil {
-               return nil
-       }
-       out := new(ClasspathEntry)
-       in.DeepCopyInto(out)
-       return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, 
writing into out. in must be non-nil.
 func (in *ConfigurationSpec) DeepCopyInto(out *ConfigurationSpec) {
        *out = *in
        return
@@ -91,7 +75,7 @@ func (in *IntegrationContext) DeepCopyInto(out 
*IntegrationContext) {
        out.TypeMeta = in.TypeMeta
        in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
        in.Spec.DeepCopyInto(&out.Spec)
-       out.Status = in.Status
+       in.Status.DeepCopyInto(&out.Status)
        return
 }
 
@@ -154,11 +138,6 @@ func (in *IntegrationContextSpec) DeepCopyInto(out 
*IntegrationContextSpec) {
                *out = make([]string, len(*in))
                copy(*out, *in)
        }
-       if in.Classpath != nil {
-               in, out := &in.Classpath, &out.Classpath
-               *out = make([]ClasspathEntry, len(*in))
-               copy(*out, *in)
-       }
        if in.Configuration != nil {
                in, out := &in.Configuration, &out.Configuration
                *out = make([]ConfigurationSpec, len(*in))
@@ -180,6 +159,11 @@ func (in *IntegrationContextSpec) DeepCopy() 
*IntegrationContextSpec {
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, 
writing into out. in must be non-nil.
 func (in *IntegrationContextStatus) DeepCopyInto(out 
*IntegrationContextStatus) {
        *out = *in
+       if in.Classpath != nil {
+               in, out := &in.Classpath, &out.Classpath
+               *out = make([]string, len(*in))
+               copy(*out, *in)
+       }
        return
 }
 
diff --git a/pkg/build/build_types.go b/pkg/build/build_types.go
index ef48312..dc7c787 100644
--- a/pkg/build/build_types.go
+++ b/pkg/build/build_types.go
@@ -17,8 +17,6 @@ limitations under the License.
 
 package build
 
-import "github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
-
 // Request represent a request to build a specific code
 type Request struct {
        Identifier   Identifier
@@ -45,7 +43,13 @@ type Result struct {
        Status    Status
        Image     string
        Error     error
-       Classpath []v1alpha1.ClasspathEntry
+       Classpath []ClasspathEntry
+}
+
+// ClasspathEntry --
+type ClasspathEntry struct {
+       ID       string `json:"id" yaml:"id"`
+       Location string `json:"location,omitempty" yaml:"location,omitempty"`
 }
 
 // Builder is supertype of all builders
diff --git a/pkg/stub/action/context/build.go b/pkg/stub/action/context/build.go
index 6d06b22..9d5d3b1 100644
--- a/pkg/stub/action/context/build.go
+++ b/pkg/stub/action/context/build.go
@@ -73,7 +73,12 @@ func (action *integrationContextBuildAction) Handle(context 
*v1alpha1.Integratio
                target := context.DeepCopy()
                target.Status.Image = buildResult.Image
                target.Status.Phase = v1alpha1.IntegrationContextPhaseReady
-               target.Spec.Classpath = buildResult.Classpath
+
+               target.Status.Classpath = make([]string, 
len(buildResult.Classpath))
+               for i, entry := range buildResult.Classpath {
+                       target.Status.Classpath[i] = entry.ID
+               }
+
                if err := sdk.Update(target); err != nil {
                        return err
                }
diff --git a/pkg/util/maven/maven.go b/pkg/util/maven/maven.go
index 6b9224e..66a0cd1 100644
--- a/pkg/util/maven/maven.go
+++ b/pkg/util/maven/maven.go
@@ -32,7 +32,7 @@ import (
 
        "github.com/apache/camel-k/version"
 
-       "github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
+       "github.com/apache/camel-k/pkg/build"
        "gopkg.in/yaml.v1"
 
        "github.com/pkg/errors"
@@ -47,7 +47,7 @@ const (
 // BuildResult --
 type BuildResult struct {
        TarFilePath string
-       Classpath   []v1alpha1.ClasspathEntry
+       Classpath   []build.ClasspathEntry
 }
 
 // Process takes a project description and returns a binary tar with the built 
artifacts
@@ -95,7 +95,7 @@ func runMavenBuild(buildDir string, result *BuildResult) 
error {
                return err
        }
 
-       cp := make(map[string][]v1alpha1.ClasspathEntry)
+       cp := make(map[string][]build.ClasspathEntry)
        if err := yaml.Unmarshal(content, &cp); err != nil {
                return err
        }

Reply via email to