diff --git a/go.mod b/go.mod index 5a4f0ee82..9dff024ba 100644 --- a/go.mod +++ b/go.mod @@ -62,7 +62,7 @@ require ( k8s.io/utils v0.0.0-20230726121419-3b25d923346b kcl-lang.io/kcl-go v0.6.0-alpha.1 kcl-lang.io/kcl-plugin v0.5.0 - kcl-lang.io/kpm v0.3.5 + kcl-lang.io/kpm v0.3.6 kusionstack.io/kube-api v0.0.0-20230817144216-4714955f3801 sigs.k8s.io/controller-runtime v0.15.1 sigs.k8s.io/kustomize/kyaml v0.14.1 @@ -150,6 +150,7 @@ require ( github.com/gofrs/flock v0.8.1 // indirect github.com/gofrs/uuid v4.2.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 // indirect github.com/golang-jwt/jwt/v4 v4.4.2 // indirect github.com/golang/glog v1.1.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect diff --git a/go.sum b/go.sum index 06d329bb3..9477c6617 100644 --- a/go.sum +++ b/go.sum @@ -387,6 +387,8 @@ github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 h1:zN2lZNZRflqFyxVaTIU61KNKQ9C0055u9CAfpmqUvo4= +github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3/go.mod h1:nPpo7qLxd6XL3hWJG/O60sR8ZKfMCiIoNap5GvD12KU= github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -1475,8 +1477,8 @@ kcl-lang.io/kcl-go v0.6.0-alpha.1 h1:BhMQ2GNRp9AccWxB2QydvZF6g6iVlPkkSSPa+RAdYx0 kcl-lang.io/kcl-go v0.6.0-alpha.1/go.mod h1:tHMTzp0dtah8Hn6h6UfnwbrEv737+TKf0xjIJkUkuaU= kcl-lang.io/kcl-plugin v0.5.0 h1:eoh6y4l81rwA8yhJXU4hN7YmJeTUNB1nfYCP9OffSxc= kcl-lang.io/kcl-plugin v0.5.0/go.mod h1:QnZ5OLcyBw5nOnHpChRHtvBq8wvjwiHu/ZZ8j1dfz48= -kcl-lang.io/kpm v0.3.5 h1:KEf4k9USbVolxDeszNDJCn8vt9nmKcRr0Icv77so6Z8= -kcl-lang.io/kpm v0.3.5/go.mod h1:zs+MeqK8VsrKaJcrGIQSy2gBssbRj5td+TM2Vwx2XBE= +kcl-lang.io/kpm v0.3.6 h1:iprev+h4d1PmWMTEQhMT33NLFRxIQ7KB703r4GeOlLc= +kcl-lang.io/kpm v0.3.6/go.mod h1:4mFfj1q7QAu3286xeCCQi+Sr37HkJk1GJC5ZGlSa46U= kusionstack.io/kube-api v0.0.0-20230817144216-4714955f3801 h1:rWNki+bYgDqEgia/t8Vfk681NqTV0EbTXc8+JnkvZyM= kusionstack.io/kube-api v0.0.0-20230817144216-4714955f3801/go.mod h1:QIQrH+MK9xuV+mXCAkk6DN8z6b8oyf4XN0VRccmHH/k= lukechampine.com/frand v1.4.2 h1:RzFIpOvkMXuPMBb9maa4ND4wjBn71E1Jpf8BzJHMaVw= diff --git a/pkg/generator/kcl/kcl_generator.go b/pkg/generator/kcl/kcl_generator.go index 25043de0c..47374ee7f 100644 --- a/pkg/generator/kcl/kcl_generator.go +++ b/pkg/generator/kcl/kcl_generator.go @@ -15,6 +15,7 @@ import ( "kcl-lang.io/kcl-go/pkg/spec/gpyrpc" "kcl-lang.io/kpm/pkg/api" "kcl-lang.io/kpm/pkg/opt" + "kusionstack.io/kusion/pkg/engine" "kusionstack.io/kusion/pkg/generator" "kusionstack.io/kusion/pkg/generator/kcl/rest" @@ -72,9 +73,11 @@ func Run(o *generator.Options, stack *projectstack.Stack) (*CompileResult, error var result *kcl.KCLResultList if o.IsKclPkg { - result, err = api.RunCurrentPkg(&opt.CompileOptions{ - Option: kclpkg.NewOption().Merge(optList...), - }) + result, err = api.RunPkgWithOpt( + &opt.CompileOptions{ + Option: kclpkg.NewOption().Merge(optList...), + }, + ) } else { // call kcl run log.Debug("The current directory is not a KCL Package, use kcl run instead")