Skip to content

Commit

Permalink
chore: bump kcl version to the stable version v0.5.x and use the `kcl…
Browse files Browse the repository at this point in the history
…-lang.io/kcl-go` package path (#364)

* chore: bump kcl version to v0.5.0-beta.1

* chore: bump kcl related repo package path to kcl-lang.io

* chore: bump kcl repo package path to kcl-lang.io.

* test: fix wrong test suites.

* chore: bump kclvm-go to kcl-go

* chore: bump kcl version to v0.5.0
  • Loading branch information
Peefy authored Jul 14, 2023
1 parent 5f6e0f9 commit 4952f4d
Show file tree
Hide file tree
Showing 18 changed files with 57 additions and 60 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
run: |
go generate ./pkg/version > version.txt
echo "kusion_version=$(cat version.txt | grep releaseVersion | cut -d ':' -f 2 | awk '$1=$1')" >> $GITHUB_OUTPUT
echo "kclvmgo_version=$(cat version.txt | grep kclvmgoVersion | cut -d ':' -f 2 | awk '$1=$1')" >> $GITHUB_OUTPUT
echo "kclgo_version=$(cat version.txt | grep kclGoVersion | cut -d ':' -f 2 | awk '$1=$1')" >> $GITHUB_OUTPUT
echo "kclplugin_version=$(cat version.txt | grep kclPluginVersion | cut -d ':' -f 2 | awk '$1=$1')" >> $GITHUB_OUTPUT
rm version.txt
# <--- Login, build and push image to Docker Hub --->
Expand All @@ -82,5 +82,5 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.KUSIONSTACK_BOT_TOKEN }}
KUSION_VERSION: ${{ steps.get_version.outputs.kusion_version }}
KCLVM_GO_VERSION: ${{ steps.get_version.outputs.kclvmgo_version }}
KCL_GO_VERSION: ${{ steps.get_version.outputs.kclgo_version }}
KCL_PLUGIN_VERSION: ${{ steps.get_version.outputs.kclplugin_version }}
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ issues:
- "ifElseChain: rewrite if-else to switch statement"
- "S1000: should use for range instead of for { select {} }"
- "SA4004: the surrounding loop is unconditionally terminated"
- "copylocks: call of c\\.Post copies lock value: kusionstack\\.io/kclvm-go/pkg/spec/gpyrpc\\.Ping_Args contains google\\.golang\\.org/protobuf/internal/impl\\.MessageState contains sync\\.Mutex"
- "copylocks: call of c\\.Post copies lock value: kcl-lang\\.io/kcl-go/pkg/spec/gpyrpc\\.Ping_Args contains google\\.golang\\.org/protobuf/internal/impl\\.MessageState contains sync\\.Mutex"
6 changes: 2 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ release:
* `kusionstack/kusion:{{ .Env.KUSION_VERSION }}`
## Dependent version
* [kclvm-go](https://github.com/KusionStack/kclvm-go): `{{ .Env.KCLVM_GO_VERSION }}`
* [kcl-plugin](https://github.com/KusionStack/kcl-plugin): `{{ .Env.KCL_PLUGIN_VERSION }}`
* [kcl-go](https://github.com/kcl-lang/kcl-go): `{{ .Env.KCL_GO_VERSION }}`
* [kcl-plugin](https://github.com/kcl-lang/kcl-plugin): `{{ .Env.KCL_PLUGIN_VERSION }}`
dockers:
- use: buildx
Expand Down Expand Up @@ -100,8 +100,6 @@ brews:
description: "Codify and deliver intentions to Kubernetes and Clouds"
license: "Apache License"
skip_upload: false
dependencies:
- name: kclvm
test: |
system "#{bin}/kusion version"
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ require (
k8s.io/client-go v0.27.1
k8s.io/component-base v0.27.1
k8s.io/kubectl v0.27.1
kusionstack.io/kcl-plugin v0.4.4
kusionstack.io/kclvm-go v0.5.0-alpha.3
kcl-lang.io/kcl-go v0.5.0
kcl-lang.io/kcl-plugin v0.5.0
sigs.k8s.io/controller-runtime v0.12.3
sigs.k8s.io/kustomize/kyaml v0.14.1
sigs.k8s.io/yaml v1.3.0
Expand Down Expand Up @@ -239,7 +239,7 @@ require (
k8s.io/klog/v2 v2.90.1 // indirect
k8s.io/kube-openapi v0.0.0-20230327201221-f5883ff37f0c // indirect
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
kusionstack.io/kclvm-artifact-go v0.5.0-alpha.3 // indirect
kcl-lang.io/kcl-artifact-go v0.5.0 // indirect
lukechampine.com/frand v1.4.2 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1355,12 +1355,12 @@ k8s.io/kubectl v0.27.1 h1:9T5c5KdpburYiW8XKQSH0Uly1kMNE90aGSnbYUZNdcA=
k8s.io/kubectl v0.27.1/go.mod h1:QsAkSmrRsKTPlAFzF8kODGDl4p35BIwQnc9XFhkcsy8=
k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY=
k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
kusionstack.io/kcl-plugin v0.4.4 h1:Ke6SMbZ33qaR0mTCaZSVmVop+8Hk8UQK217z7ml97z8=
kusionstack.io/kcl-plugin v0.4.4/go.mod h1:VgB7qXVbDGWFOh/qb/yXf75+UrliP5EPXOQUDqBCdAQ=
kusionstack.io/kclvm-artifact-go v0.5.0-alpha.3 h1:sirVOSHHmkgWdBY74luH9jNucL6ebF9L0KUTJ/r3b5Q=
kusionstack.io/kclvm-artifact-go v0.5.0-alpha.3/go.mod h1:WI+NvDeMqu1AduJT119X7q8KQdYmKfv4Nq4OvZ1tAsI=
kusionstack.io/kclvm-go v0.5.0-alpha.3 h1:aNsrTUYR4VC3gToR5WFzdCfTEGTi36/+uMitqNhx0Uw=
kusionstack.io/kclvm-go v0.5.0-alpha.3/go.mod h1:bnY9JNrCG2Cdc/CYLxxDSfB9dYmVcpXZ9SfyQxSf8/w=
kcl-lang.io/kcl-artifact-go v0.5.0 h1:zaIUamQjdrW+imLZCnrl7g2QuhCNuYCCvoPFFkikgLM=
kcl-lang.io/kcl-artifact-go v0.5.0/go.mod h1:c07mqi9Hu2UjPW7lYfHhAAWOlZiB7lo7Vkr4jL5ov/M=
kcl-lang.io/kcl-go v0.5.0 h1:t9gBcUDQoEa894l0xZ7wKFoC4Nj3EOLvEb4mSiPN0EM=
kcl-lang.io/kcl-go v0.5.0/go.mod h1:gdDthKp2sx6LWfTuIcw50K1RTOQhzBtFGz6dMO7R25Q=
kcl-lang.io/kcl-plugin v0.5.0 h1:eoh6y4l81rwA8yhJXU4hN7YmJeTUNB1nfYCP9OffSxc=
kcl-lang.io/kcl-plugin v0.5.0/go.mod h1:QnZ5OLcyBw5nOnHpChRHtvBq8wvjwiHu/ZZ8j1dfz48=
lukechampine.com/frand v1.4.2 h1:RzFIpOvkMXuPMBb9maa4ND4wjBn71E1Jpf8BzJHMaVw=
lukechampine.com/frand v1.4.2/go.mod h1:4S/TM2ZgrKejMcKMbeLjISpJMO+/eZ1zu3vYX9dtj3s=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
Expand Down
2 changes: 1 addition & 1 deletion kusion.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"time"

_ "kusionstack.io/kcl-plugin"
_ "kcl-lang.io/kcl-plugin"

"kusionstack.io/kusion/pkg/cmd"
"kusionstack.io/kusion/pkg/util/pretty"
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/deps/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"sort"
"strings"

kcl "kusionstack.io/kclvm-go"
"kusionstack.io/kclvm-go/pkg/tools/list"
kcl "kcl-lang.io/kcl-go"
"kcl-lang.io/kcl-go/pkg/tools/list"

"kusionstack.io/kusion/pkg/projectstack"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/engine/kcl.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package engine
import (
"encoding/json"

kcl "kusionstack.io/kclvm-go"
kcl "kcl-lang.io/kcl-go"

"kusionstack.io/kusion/pkg/engine/models"
"kusionstack.io/kusion/pkg/log"
Expand Down
26 changes: 13 additions & 13 deletions pkg/generator/kcl/kcl_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"path/filepath"
"strings"

"kusionstack.io/kclvm-go"
"kusionstack.io/kclvm-go/pkg/spec/gpyrpc"
"kcl-lang.io/kcl-go/pkg/spec/gpyrpc"

kcl "kcl-lang.io/kcl-go"
"kusionstack.io/kusion/pkg/engine"
"kusionstack.io/kusion/pkg/engine/models"
"kusionstack.io/kusion/pkg/generator"
Expand Down Expand Up @@ -68,7 +68,7 @@ func Run(o *generator.Options, stack *projectstack.Stack) (*CompileResult, error
log.Debugf("Compile options: %s", jsonutil.MustMarshal2PrettyString(optList))

// call kcl run
result, err := kclvm.RunFiles(o.Filenames, optList...)
result, err := kcl.RunFiles(o.Filenames, optList...)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -130,14 +130,14 @@ func readCRDs(workDir string) ([]interface{}, error) {
return visitor.Visit()
}

func BuildOptions(workDir string, settings, arguments, overrides []string, disableNone, overrideAST bool) ([]kclvm.Option, error) {
optList := []kclvm.Option{}
func BuildOptions(workDir string, settings, arguments, overrides []string, disableNone, overrideAST bool) ([]kcl.Option, error) {
optList := []kcl.Option{}
// build settings option
for _, setting := range settings {
if workDir != "" {
setting = filepath.Join(workDir, setting)
}
opt := kclvm.WithSettings(setting)
opt := kcl.WithSettings(setting)
if opt.Err != nil {
return nil, opt.Err
}
Expand All @@ -147,7 +147,7 @@ func BuildOptions(workDir string, settings, arguments, overrides []string, disab

// build arguments option
for _, arg := range arguments {
opt := kclvm.WithOptions(arg)
opt := kcl.WithOptions(arg)
if opt.Err != nil {
return nil, opt.Err
}
Expand All @@ -156,31 +156,31 @@ func BuildOptions(workDir string, settings, arguments, overrides []string, disab
}

// build overrides option
opt := kclvm.WithOverrides(overrides...)
opt := kcl.WithOverrides(overrides...)
if opt.Err != nil {
return nil, opt.Err
}

optList = append(optList, opt)

// build disable none option
opt = kclvm.WithDisableNone(disableNone)
opt = kcl.WithDisableNone(disableNone)
if opt.Err != nil {
return nil, opt.Err
}

optList = append(optList, opt)

// open PrintOverride option
opt = kclvm.WithPrintOverridesAST(overrideAST)
opt = kcl.WithPrintOverridesAST(overrideAST)
if opt.Err != nil {
return nil, opt.Err
}

optList = append(optList, opt)

// build workDir option
opt = kclvm.WithWorkDir(workDir)
opt = kcl.WithWorkDir(workDir)
if opt.Err != nil {
return nil, opt.Err
}
Expand All @@ -204,7 +204,7 @@ func normResult(resp *gpyrpc.ExecProgram_Result) (*CompileResult, error) {
return nil, fmt.Errorf("normResult: invalid result: %s", resp.JsonResult)
}

var kclResults []kclvm.KCLResult
var kclResults []kcl.KCLResult
for _, m := range mList {
if len(m) != 0 {
kclResults = append(kclResults, m)
Expand Down Expand Up @@ -243,7 +243,7 @@ func genKclArgs(args map[string]string, settings []string) string {
}

func Overwrite(fileName string, overrides []string) (bool, error) {
return kclvm.OverrideFile(fileName, overrides, []string{})
return kcl.OverrideFile(fileName, overrides, []string{})
}

// Get kcl cli path
Expand Down
7 changes: 3 additions & 4 deletions pkg/generator/kcl/kcl_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import (

"bou.ke/monkey"
"github.com/stretchr/testify/assert"
kcl "kusionstack.io/kclvm-go"
k2 "kusionstack.io/kclvm-go/pkg/kcl"
"kusionstack.io/kclvm-go/pkg/spec/gpyrpc"
kcl "kcl-lang.io/kcl-go"
"kcl-lang.io/kcl-go/pkg/spec/gpyrpc"

"kusionstack.io/kusion/pkg/engine/models"
"kusionstack.io/kusion/pkg/generator"
Expand Down Expand Up @@ -162,7 +161,7 @@ func Test_normResult(t *testing.T) {
},
},
want: &CompileResult{
Documents: []k2.KCLResult{map[string]interface{}{"a": "b"}},
Documents: []kcl.KCLResult{map[string]interface{}{"a": "b"}},
},
wantErr: false,
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/generator/kcl/rest/model.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package rest

import (
"kusionstack.io/kclvm-go/pkg/spec/gpyrpc"
"kcl-lang.io/kcl-go/pkg/spec/gpyrpc"
)

type Result struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/generator/kcl/rest/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/pkg/errors"

"kusionstack.io/kclvm-go/pkg/spec/gpyrpc"
"kcl-lang.io/kcl-go/pkg/spec/gpyrpc"

"kusionstack.io/kusion/pkg/log"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/generator/kcl/type.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package kcl

import (
kcl "kusionstack.io/kclvm-go"
kcl "kcl-lang.io/kcl-go"
)

// The result of a KCL compilation
Expand Down
2 changes: 1 addition & 1 deletion pkg/generator/kcl/type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"testing"

kcl "kusionstack.io/kclvm-go"
kcl "kcl-lang.io/kcl-go"
)

func TestCompileResult_RawYAML(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions pkg/version/scripts/gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"os"

_ "kusionstack.io/kcl-plugin"
_ "kusionstack.io/kclvm-go"
_ "kcl-lang.io/kcl-go"
_ "kcl-lang.io/kcl-plugin"

"kusionstack.io/kusion/pkg/log"
"kusionstack.io/kusion/pkg/version"
Expand Down Expand Up @@ -58,7 +58,7 @@ func init() {
BuildTime: %q,
},
Dependency: &DependencyVersion{
KclvmgoVersion: %q,
KclGoVersion: %q,
KclPluginVersion: %q,
},
}
Expand All @@ -74,7 +74,7 @@ func init() {
v.BuildInfo.NumCPU,
v.BuildInfo.Compiler,
v.BuildInfo.BuildTime,
v.Dependency.KclvmgoVersion,
v.Dependency.KclGoVersion,
v.Dependency.KclPluginVersion,
)
}
22 changes: 11 additions & 11 deletions pkg/version/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (

goversion "github.com/hashicorp/go-version"
"gopkg.in/yaml.v3"
_ "kusionstack.io/kcl-plugin"
_ "kcl-lang.io/kcl-plugin"

git "kusionstack.io/kusion/pkg/util/gitutil"
)

const (
KclvmgoModulePath = "kusionstack.io/kclvm-go"
KclPluginsModulePath = "kusionstack.io/kcl-plugin"
KclGoModulePath = "kcl-lang.io/kcl-go"
KclPluginModulePath = "kcl-lang.io/kcl-plugin"
)

var info = NewMainOrDefaultVersionInfo()
Expand Down Expand Up @@ -58,7 +58,7 @@ func NewDefaultVersionInfo() *Info {
BuildTime: time.Now().Format("2006-01-02 15:04:05"),
},
Dependency: &DependencyVersion{
KclvmgoVersion: "",
KclGoVersion: "",
KclPluginVersion: "",
},
}
Expand Down Expand Up @@ -99,7 +99,7 @@ type BuildInfo struct {
}

type DependencyVersion struct {
KclvmgoVersion string `json:"kclvmgoVersion,omitempty" yaml:"kclvmgoVersion,omitempty"`
KclGoVersion string `json:"kclGoVersion,omitempty" yaml:"kclGoVersion,omitempty"`
KclPluginVersion string `json:"kclPluginVersion,omitempty" yaml:"kclPluginVersion,omitempty"`
}

Expand All @@ -111,7 +111,7 @@ func NewInfo() (*Info, error) {
latestTag string
gitVersion *goversion.Version
releaseVersion string
kclvmgoVersion string
KclGoVersion string
kclPluginsVersion string
isDirty bool
gitTreeState string
Expand Down Expand Up @@ -160,12 +160,12 @@ func NewInfo() (*Info, error) {
// Get dependency version
if bi, ok := debug.ReadBuildInfo(); ok {
for _, v := range bi.Deps {
if v.Path == KclvmgoModulePath {
kclvmgoVersion = v.Version
if v.Path == KclGoModulePath {
KclGoVersion = v.Version
if v.Replace != nil {
kclvmgoVersion = v.Replace.Version
KclGoVersion = v.Replace.Version
}
} else if v.Path == KclPluginsModulePath {
} else if v.Path == KclPluginModulePath {
kclPluginsVersion = v.Version
if v.Replace != nil {
kclPluginsVersion = v.Replace.Version
Expand All @@ -190,7 +190,7 @@ func NewInfo() (*Info, error) {
BuildTime: time.Now().Format("2006-01-02 15:04:05"),
},
Dependency: &DependencyVersion{
KclvmgoVersion: kclvmgoVersion,
KclGoVersion: KclGoVersion,
KclPluginVersion: kclPluginsVersion,
},
}, nil
Expand Down
6 changes: 3 additions & 3 deletions pkg/version/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestKusionVersionNormal(t *testing.T) {
"buildTime": "2006-01-02 15:04:05"
},
"dependency": {
"kclvmgoVersion": "stable",
"kclGoVersion": "stable",
"kclPluginVersion": "stable"
}
}`
Expand Down Expand Up @@ -163,7 +163,7 @@ func TestKusionVersionNotHeadTag(t *testing.T) {
"buildTime": "2006-01-02 15:04:05"
},
"dependency": {
"kclvmgoVersion": "stable",
"kclGoVersion": "stable",
"kclPluginVersion": "stable"
}
}`
Expand Down Expand Up @@ -206,7 +206,7 @@ func mockGit() {

func mockDependency() {
monkey.Patch(debug.ReadBuildInfo, func() (*debug.BuildInfo, bool) {
return &debug.BuildInfo{Deps: []*debug.Module{{Path: KclvmgoModulePath, Version: "stable"}, {Path: KclPluginsModulePath, Version: "stable"}}}, true
return &debug.BuildInfo{Deps: []*debug.Module{{Path: KclGoModulePath, Version: "stable"}, {Path: KclPluginModulePath, Version: "stable"}}}, true
})
}

Expand Down
Loading

0 comments on commit 4952f4d

Please sign in to comment.