Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump kcl lib 078 #220

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions Dockerfile

This file was deleted.

9 changes: 2 additions & 7 deletions examples/kubernetes/main.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
// Copyright 2023 The KCL Authors. All rights reserved.

// Run CGO Mode:
// KCLVM_SERVICE_CLIENT_HANDLER=native KCLVM_PLUGIN_DEBUG=1 go run -tags=kclvm_service_capi .

package main

import (
"fmt"

"kcl-lang.io/kcl-go"
kcl "kcl-lang.io/kcl-go"
_ "kcl-lang.io/kcl-go/pkg/kcl_plugin/hello_plugin"
)

func main() {
yaml := kclvm.MustRun("kubernetes.k", kclvm.WithCode(k_code)).GetRawYamlResult()
yaml := kcl.MustRun("kubernetes.k", kcl.WithCode(k_code)).GetRawYamlResult()
fmt.Println(yaml)
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
google.golang.org/protobuf v1.30.0
gopkg.in/yaml.v3 v3.0.1
kcl-lang.io/kpm v0.6.0
kcl-lang.io/lib v0.7.7
kcl-lang.io/lib v0.7.8
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
kcl-lang.io/kpm v0.6.0 h1:8gHMyV2l/EpZ/w27c3UyybXEBATvAzL81JdAFzdYqWc=
kcl-lang.io/kpm v0.6.0/go.mod h1:s9w+2itB6AcCNjdppZv2Tc9vGhKk/axtJ5XJYaWNR+0=
kcl-lang.io/lib v0.7.7 h1:zz6KO7ZZl74xq8I85102Z/dPdN9c89e0qEk0ZjnOAH8=
kcl-lang.io/lib v0.7.7/go.mod h1:ubsalGXxJaa5II/EsHmsI/tL2EluYHIcW+BwzQPt+uY=
kcl-lang.io/lib v0.7.8 h1:kOYlrFqZkwzCG/CFs63cwbX3pPCNUci1Xvj7zqqnLno=
kcl-lang.io/lib v0.7.8/go.mod h1:ubsalGXxJaa5II/EsHmsI/tL2EluYHIcW+BwzQPt+uY=
oras.land/oras-go v1.2.3 h1:v8PJl+gEAntI1pJ/LCrDgsuk+1PKVavVEPsYIHFE5uY=
oras.land/oras-go v1.2.3/go.mod h1:M/uaPdYklze0Vf3AakfarnpoEckvw0ESbRdN8Z1vdJg=
oras.land/oras-go/v2 v2.3.0 h1:lqX1aXdN+DAmDTKjiDyvq85cIaI4RkIKp/PghWlAGIU=
Expand Down
8 changes: 8 additions & 0 deletions pkg/service/client_kclvm_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ func (p *KclvmServiceClient) ParseProgram(args *gpyrpc.ParseProgram_Args) (resp
return
}

func (p *KclvmServiceClient) LoadPackage(args *gpyrpc.LoadPackage_Args) (resp *gpyrpc.LoadPackage_Result, err error) {
p.Runtime.DoTask(func(c *rpc.Client, stderr io.Reader) {
resp, err = p.getClient(c).LoadPackage(args)
err = p.wrapErr(err, stderr)
})
return
}

func (p *KclvmServiceClient) FormatCode(args *gpyrpc.FormatCode_Args) (resp *gpyrpc.FormatCode_Result, err error) {
p.Runtime.DoTask(func(c *rpc.Client, stderr io.Reader) {
resp, err = p.getClient(c).FormatCode(args)
Expand Down
3 changes: 3 additions & 0 deletions pkg/service/grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func (p *_KclvmServiceImpl) ParseFile(ctx context.Context, args *gpyrpc.ParseFil
func (p *_KclvmServiceImpl) ParseProgram(ctx context.Context, args *gpyrpc.ParseProgram_Args) (*gpyrpc.ParseProgram_Result, error) {
return p.c.ParseProgram(args)
}
func (p *_KclvmServiceImpl) LoadPackage(ctx context.Context, args *gpyrpc.LoadPackage_Args) (*gpyrpc.LoadPackage_Result, error) {
return p.c.LoadPackage(args)
}
func (p *_KclvmServiceImpl) FormatCode(ctx context.Context, args *gpyrpc.FormatCode_Args) (*gpyrpc.FormatCode_Result, error) {
return p.c.FormatCode(args)
}
Expand Down
1 change: 1 addition & 0 deletions pkg/service/kclvm_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type KclvmService interface {
ExecProgram(in *gpyrpc.ExecProgram_Args) (out *gpyrpc.ExecProgram_Result, err error)
ParseFile(in *gpyrpc.ParseFile_Args) (out *gpyrpc.ParseFile_Result, err error)
ParseProgram(in *gpyrpc.ParseProgram_Args) (out *gpyrpc.ParseProgram_Result, err error)
LoadPackage(in *gpyrpc.LoadPackage_Args) (out *gpyrpc.LoadPackage_Result, err error)
FormatCode(in *gpyrpc.FormatCode_Args) (out *gpyrpc.FormatCode_Result, err error)
FormatPath(in *gpyrpc.FormatPath_Args) (out *gpyrpc.FormatPath_Result, err error)
LintPath(in *gpyrpc.LintPath_Args) (out *gpyrpc.LintPath_Result, err error)
Expand Down
9 changes: 9 additions & 0 deletions pkg/service/rest_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func (p *restServer) initHttpRrouter() {
p.router.GET("/api:protorpc/KclvmService.ExecProgram", p.handle_ExecProgram)
p.router.GET("/api:protorpc/KclvmService.ParseFile", p.handle_ParseFile)
p.router.GET("/api:protorpc/KclvmService.ParseProgram", p.handle_ParseProgram)
p.router.GET("/api:protorpc/KclvmService.LoadPackage", p.handle_LoadPackage)
p.router.GET("/api:protorpc/KclvmService.FormatCode", p.handle_FormatCode)
p.router.GET("/api:protorpc/KclvmService.FormatPath", p.handle_FormatPath)
p.router.GET("/api:protorpc/KclvmService.LintPath", p.handle_LintPath)
Expand All @@ -75,6 +76,7 @@ func (p *restServer) initHttpRrouter() {
p.router.POST("/api:protorpc/KclvmService.ExecProgram", p.handle_ExecProgram)
p.router.POST("/api:protorpc/KclvmService.ParseFile", p.handle_ParseFile)
p.router.POST("/api:protorpc/KclvmService.ParseProgram", p.handle_ParseProgram)
p.router.POST("/api:protorpc/KclvmService.LoadPackage", p.handle_LoadPackage)
p.router.POST("/api:protorpc/KclvmService.FormatCode", p.handle_FormatCode)
p.router.POST("/api:protorpc/KclvmService.FormatPath", p.handle_FormatPath)
p.router.POST("/api:protorpc/KclvmService.LintPath", p.handle_LintPath)
Expand Down Expand Up @@ -158,6 +160,13 @@ func (p *restServer) handle_ParseProgram(w http.ResponseWriter, r *http.Request,
})
}

func (p *restServer) handle_LoadPackage(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
var args = new(gpyrpc.LoadPackage_Args)
p.handle(w, r, args, func() (proto.Message, error) {
return p.c.LoadPackage(args)
})
}

func (p *restServer) handle_FormatCode(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
var args = new(gpyrpc.FormatCode_Args)
p.handle(w, r, args, func() (proto.Message, error) {
Expand Down
Loading
Loading