Skip to content

Commit

Permalink
chore: bump kcl version to v0.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Peefy committed Aug 10, 2023
1 parent c7c379b commit c12a92f
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 16 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ You can use KCL to
- [Install Go 1.19+](https://go.dev/dl/)

```bash
$ go run ./cmds/kcl-go
$ go run ./cmds/kcl-go run hello.k
go run ./cmds/kcl-go run hello.k
name: kcl
age: 1
two: 2
Expand Down
6 changes: 3 additions & 3 deletions cmds/kcl-go/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2021 The KCL Authors. All rights reserved.
// Copyright 2023 The KCL Authors. All rights reserved.

// Kusion Configuration Language (KCL) is a declarative configuration language
// inspired by Python3 designed for Cloud-Native scenes used in Kusion.
// KCL is a declarative configuration language
// inspired by Python3 designed for Cloud-Native scenes.
package main

import "kcl-lang.io/kcl-go/cmds/kcl-go/command"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
google.golang.org/grpc v1.53.0
google.golang.org/protobuf v1.28.1
gopkg.in/yaml.v3 v3.0.1
kcl-lang.io/kcl-artifact-go v0.5.1
kcl-lang.io/kcl-artifact-go v0.5.3
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
kcl-lang.io/kcl-artifact-go v0.5.1 h1:1OIeb1xdq72XIvd9mftBvqFJbzbEkPjGtdeiQizUFj8=
kcl-lang.io/kcl-artifact-go v0.5.1/go.mod h1:c07mqi9Hu2UjPW7lYfHhAAWOlZiB7lo7Vkr4jL5ov/M=
kcl-lang.io/kcl-artifact-go v0.5.3 h1:5MNz4mLypUS62UkMcpm3tiUjvyNJNGI9hguSrbbEH0I=
kcl-lang.io/kcl-artifact-go v0.5.3/go.mod h1:c07mqi9Hu2UjPW7lYfHhAAWOlZiB7lo7Vkr4jL5ov/M=
43 changes: 39 additions & 4 deletions kclvm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,14 @@ func TestFormatCode(t *testing.T) {
}

func TestGetSchemaType(t *testing.T) {
result, err := kcl.GetSchemaType("test.k", "schema Person:\n name: str", "")
result, err := kcl.GetSchemaType("test.k", "@info(\"v\", k=\"v\")\nschema Person:\n name: str", "")
if err != nil {
t.Fatal(err)
}
assert2.Equal(t, []*gpyrpc.KclType{
{
Filename: "test.k",
PkgPath: "__main__",
Type: "schema",
SchemaName: "Person",
Properties: map[string]*gpyrpc.KclType{
Expand All @@ -208,19 +210,35 @@ func TestGetSchemaType(t *testing.T) {
Required: []string{},
UnionTypes: []*gpyrpc.KclType{},
Decorators: []*gpyrpc.Decorator{},
Examples: map[string]*gpyrpc.Example{},
},
},
Required: []string{"name"},
UnionTypes: []*gpyrpc.KclType{},
Decorators: []*gpyrpc.Decorator{},
Decorators: []*gpyrpc.Decorator{
{
Name: "info",
Arguments: []string{"\"v\""},
Keywords: map[string]string{
"k": "\"v\"",
},
},
},
Examples: map[string]*gpyrpc.Example{},
},
}, result)
result, err = kcl.GetSchemaType("./testdata/main.k", "", "Person")
p, err := filepath.Abs("./testdata/main.k")
if err != nil {
t.Fatal(err)
}
result, err = kcl.GetSchemaType(p, "", "Person")
if err != nil {
t.Fatal(err)
}
assert2.Equal(t, []*gpyrpc.KclType{
{
Filename: p,
PkgPath: "__main__",
Type: "schema",
SchemaName: "Person",
Properties: map[string]*gpyrpc.KclType{
Expand All @@ -232,6 +250,7 @@ func TestGetSchemaType(t *testing.T) {
Required: []string{},
UnionTypes: []*gpyrpc.KclType{},
Decorators: []*gpyrpc.Decorator{},
Examples: map[string]*gpyrpc.Example{},
},
"age": {
Type: "int",
Expand All @@ -241,11 +260,13 @@ func TestGetSchemaType(t *testing.T) {
Required: []string{},
UnionTypes: []*gpyrpc.KclType{},
Decorators: []*gpyrpc.Decorator{},
Examples: map[string]*gpyrpc.Example{},
},
},
Required: []string{"name", "age"},
UnionTypes: []*gpyrpc.KclType{},
Decorators: []*gpyrpc.Decorator{},
Examples: map[string]*gpyrpc.Example{},
},
}, result)
}
Expand All @@ -257,6 +278,8 @@ func TestGetSchemaTypeMapping(t *testing.T) {
}
assert2.Equal(t, map[string]*gpyrpc.KclType{
"Person": {
Filename: "test.k",
PkgPath: "__main__",
Type: "schema",
SchemaName: "Person",
Properties: map[string]*gpyrpc.KclType{
Expand All @@ -267,19 +290,28 @@ func TestGetSchemaTypeMapping(t *testing.T) {
Required: []string{},
UnionTypes: []*gpyrpc.KclType{},
Decorators: []*gpyrpc.Decorator{},
Examples: map[string]*gpyrpc.Example{},
},
},
Required: []string{"name"},
UnionTypes: []*gpyrpc.KclType{},
Decorators: []*gpyrpc.Decorator{},
Examples: map[string]*gpyrpc.Example{},
},
}, result)
result, err = kcl.GetSchemaTypeMapping("./testdata/main.k", "", "Person")

p, err := filepath.Abs("./testdata/main.k")
if err != nil {
t.Fatal(err)
}
result, err = kcl.GetSchemaTypeMapping(p, "", "Person")
if err != nil {
t.Fatal(err)
}
assert2.Equal(t, map[string]*gpyrpc.KclType{
"Person": {
Filename: p,
PkgPath: "__main__",
Type: "schema",
SchemaName: "Person",
Properties: map[string]*gpyrpc.KclType{
Expand All @@ -291,6 +323,7 @@ func TestGetSchemaTypeMapping(t *testing.T) {
Required: []string{},
UnionTypes: []*gpyrpc.KclType{},
Decorators: []*gpyrpc.Decorator{},
Examples: map[string]*gpyrpc.Example{},
},
"age": {
Type: "int",
Expand All @@ -300,11 +333,13 @@ func TestGetSchemaTypeMapping(t *testing.T) {
Required: []string{},
UnionTypes: []*gpyrpc.KclType{},
Decorators: []*gpyrpc.Decorator{},
Examples: map[string]*gpyrpc.Example{},
},
},
Required: []string{"name", "age"},
UnionTypes: []*gpyrpc.KclType{},
Decorators: []*gpyrpc.Decorator{},
Examples: map[string]*gpyrpc.Example{},
},
}, result)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/kcl/api.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2021 The KCL Authors. All rights reserved.

// Package kcl defines the top-level interface for the Kusion Configuration Language (KCL).
// Package kcl defines the top-level interface for KCL.
package kcl

import (
Expand Down
2 changes: 1 addition & 1 deletion pkg/tools/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ It can also be schemas, schema attributes and so on. Supporting on listing these
*/
package list

// ListDepFiles return the depend files from the given path. It will scan and parse the kusion applications within the workdir,
// ListDepFiles return the depend files from the given path. It will scan and parse the applications within the workdir,
// then list depend files of the applications.
func ListDepFiles(workDir string, opt *Option) (files []string, err error) {
if opt == nil {
Expand Down
6 changes: 4 additions & 2 deletions scripts/kclvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ const (
)

const (
KclvmAbiVersion KclvmVersionType = KclvmVersionType_v0_5_1
KclvmVersionType_latest = KclvmVersionType_v0_5_1
KclvmAbiVersion KclvmVersionType = KclvmVersionType_v0_5_3
KclvmVersionType_latest = KclvmVersionType_v0_5_3

KclvmVersionType_v0_5_3 KclvmVersionType = "v0.5.3"
KclvmVersionType_v0_5_2 KclvmVersionType = "v0.5.2"
KclvmVersionType_v0_5_1 KclvmVersionType = "v0.5.1"
KclvmVersionType_v0_5_0 KclvmVersionType = "v0.5.0"
KclvmVersionType_v0_5_0_beta_1 KclvmVersionType = "v0.5.0-beta.1"
Expand Down

0 comments on commit c12a92f

Please sign in to comment.