Skip to content

Commit

Permalink
fix: compile with -w flag in kpm mode (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
SparkYuan committed Sep 14, 2023
1 parent 7bf3c1b commit a722c0c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
9 changes: 6 additions & 3 deletions pkg/generator/kcl/kcl_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit a722c0c

Please sign in to comment.