From 1d7a64d34226d3be8a348a8fa00f006ff3c48e4b Mon Sep 17 00:00:00 2001 From: zongz Date: Tue, 5 Sep 2023 16:59:14 +0800 Subject: [PATCH] feat: 'kpm run' supports compile single kcl file --- go.mod | 1 + go.sum | 2 + pkg/api/kpm_run.go | 21 +- pkg/api/kpm_run_test.go | 4 +- pkg/cmd/cmd_run.go | 41 ++-- pkg/constants/constants.go | 12 ++ pkg/reporter/reporter.go | 1 + pkg/runner/entry.go | 199 ++++++++++++++++++ pkg/runner/entry_test.go | 60 ++++++ pkg/runner/testdata/test_find_mod/kcl.mod | 5 + .../testdata/test_find_mod/kcl.mod.lock | 0 pkg/runner/testdata/test_find_mod/main.k | 1 + pkg/runner/testdata/test_find_mod/sub/main.k | 0 pkg/utils/utils.go | 28 ++- pkg/utils/utils_test.go | 25 +++ .../test_suite.stderr | 2 +- .../test_suite.stderr | 2 +- .../run_with_no_args/test_suite.stderr | 2 +- .../test_kpm_run_file_with_sub/test_suite.env | 2 + .../test_suite.input | 1 + .../test_suite.stderr | 0 .../test_suite.stdout | 1 + .../test_suite.env | 2 + .../test_suite.input | 1 + .../test_suite.stderr | 0 .../test_suite.stdout | 2 + .../test_suite.env | 2 + .../test_suite.input | 1 + .../test_suite.stderr | 2 + .../test_suite.stdout | 0 .../test_suite.env | 2 + .../test_suite.input | 1 + .../test_suite.stderr | 0 .../test_suite.stdout | 2 + .../test_suite.env | 2 + .../test_suite.input | 1 + .../test_suite.stderr | 0 .../test_suite.stdout | 2 + .../test_suite.env | 2 + .../test_suite.input | 1 + .../test_suite.stderr | 0 .../test_suite.stdout | 2 + .../test_suite.env | 2 + .../test_suite.input | 1 + .../test_suite.stderr | 2 + .../test_suite.stdout | 0 .../test_suite.env | 2 + .../test_suite.input | 1 + .../test_suite.stderr | 2 + .../test_suite.stdout | 0 .../test_kpm_run_with_one_dir/test_suite.env | 2 + .../test_suite.input | 1 + .../test_suite.stderr | 0 .../test_suite.stdout | 2 + .../test_suite.env | 2 + .../test_suite.input | 1 + .../test_suite.stderr | 0 .../test_suite.stdout | 1 + .../test_suite.env | 2 + .../test_suite.input | 1 + .../test_suite.stderr | 0 .../test_suite.stdout | 1 + .../test_suite.env | 2 + .../test_suite.input | 1 + .../test_suite.stderr | 0 .../test_suite.stdout | 1 + .../test_suite.env | 2 + .../test_suite.input | 1 + .../test_suite.stderr | 0 .../test_suite.stdout | 1 + .../test_kpm_run_file_with_sub/main.k | 3 + .../test_kpm_run_file_with_sub/sub/main.k | 1 + .../test_kpm_run_with_multi_kfile/main.k | 1 + .../test_kpm_run_with_multi_kfile/main1.k | 1 + .../test_kpm_run_with_multi_kfile_1/main.k | 1 + .../sub/main1.k | 1 + .../test_kpm_run_with_multi_kfile_2/kcl.mod | 5 + .../kcl.mod.lock | 0 .../test_kpm_run_with_multi_kfile_2/main.k | 1 + .../sub/main1.k | 1 + .../test_kpm_run_with_multi_kfile_3/kcl.mod | 5 + .../kcl.mod.lock | 0 .../test_kpm_run_with_multi_kfile_3/main.k | 1 + .../test_kpm_run_with_multi_kfile_3/main1.k | 1 + .../test_kpm_run_with_multi_kfile_4/kcl.mod | 5 + .../kcl.mod.lock | 0 .../test_kpm_run_with_multi_kfile_4/main.k | 1 + .../test_kpm_run_with_multi_kfile_4/main1.k | 1 + .../test_kpm_run_with_multi_pkg/kcl1/kcl.mod | 5 + .../kcl1/kcl.mod.lock | 0 .../test_kpm_run_with_multi_pkg/kcl1/main.k | 1 + .../test_kpm_run_with_multi_pkg/kcl2/kcl.mod | 5 + .../kcl2/kcl.mod.lock | 0 .../test_kpm_run_with_multi_pkg/kcl2/main.k | 1 + .../kcl1/kcl.mod | 5 + .../kcl1/kcl.mod.lock | 0 .../test_kpm_run_with_multi_pkg_1/kcl1/main.k | 1 + .../kcl2/kcl.mod | 5 + .../kcl2/kcl.mod.lock | 0 .../test_kpm_run_with_multi_pkg_1/kcl2/main.k | 1 + .../test_kpm_run_with_one_dir/sub/main.k | 1 + .../test_kpm_run_with_one_dir/sub/main1.k | 1 + .../test_kpm_run_with_one_kfile/main.k | 1 + .../test_kpm_run_with_one_kfile_1/kcl.mod | 5 + .../kcl.mod.lock | 0 .../test_kpm_run_with_one_kfile_1/main.k | 1 + .../test_kpm_run_with_one_kfile_1/main1.k | 1 + .../test_kpm_run_with_one_kfile_2/kcl.mod | 9 + .../kcl.mod.lock | 0 .../test_kpm_run_with_one_kfile_2/main.k | 1 + .../test_kpm_run_with_one_kfile_2/main1.k | 1 + .../test_kpm_run_with_one_kfile_entry/kcl.mod | 9 + .../kcl.mod.lock | 0 .../test_kpm_run_with_one_kfile_entry/main.k | 1 + .../test_kpm_run_with_one_kfile_entry/main1.k | 1 + 115 files changed, 531 insertions(+), 20 deletions(-) create mode 100644 pkg/constants/constants.go create mode 100644 pkg/runner/entry.go create mode 100644 pkg/runner/entry_test.go create mode 100644 pkg/runner/testdata/test_find_mod/kcl.mod create mode 100644 pkg/runner/testdata/test_find_mod/kcl.mod.lock create mode 100644 pkg/runner/testdata/test_find_mod/main.k create mode 100644 pkg/runner/testdata/test_find_mod/sub/main.k create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_file_with_sub/test_suite.env create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_file_with_sub/test_suite.input create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_file_with_sub/test_suite.stderr create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_file_with_sub/test_suite.stdout create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile/test_suite.env create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile/test_suite.input create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile/test_suite.stderr create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile/test_suite.stdout create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_1/test_suite.env create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_1/test_suite.input create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_1/test_suite.stderr create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_1/test_suite.stdout create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_2/test_suite.env create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_2/test_suite.input create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_2/test_suite.stderr create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_2/test_suite.stdout create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_3/test_suite.env create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_3/test_suite.input create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_3/test_suite.stderr create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_3/test_suite.stdout create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_4/test_suite.env create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_4/test_suite.input create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_4/test_suite.stderr create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_4/test_suite.stdout create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg/test_suite.env create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg/test_suite.input create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg/test_suite.stderr create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg/test_suite.stdout create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg_1/test_suite.env create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg_1/test_suite.input create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg_1/test_suite.stderr create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg_1/test_suite.stdout create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_dir/test_suite.env create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_dir/test_suite.input create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_dir/test_suite.stderr create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_dir/test_suite.stdout create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile/test_suite.env create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile/test_suite.input create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile/test_suite.stderr create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile/test_suite.stdout create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_1/test_suite.env create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_1/test_suite.input create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_1/test_suite.stderr create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_1/test_suite.stdout create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_2/test_suite.env create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_2/test_suite.input create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_2/test_suite.stderr create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_2/test_suite.stdout create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_entry/test_suite.env create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_entry/test_suite.input create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_entry/test_suite.stderr create mode 100644 test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_entry/test_suite.stdout create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_file_with_sub/main.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_file_with_sub/sub/main.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile/main.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile/main1.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_1/main.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_1/sub/main1.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_2/kcl.mod create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_2/kcl.mod.lock create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_2/main.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_2/sub/main1.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_3/kcl.mod create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_3/kcl.mod.lock create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_3/main.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_3/main1.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_4/kcl.mod create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_4/kcl.mod.lock create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_4/main.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_4/main1.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl1/kcl.mod create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl1/kcl.mod.lock create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl1/main.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl2/kcl.mod create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl2/kcl.mod.lock create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl2/main.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl1/kcl.mod create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl1/kcl.mod.lock create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl1/main.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl2/kcl.mod create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl2/kcl.mod.lock create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl2/main.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_one_dir/sub/main.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_one_dir/sub/main1.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile/main.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_1/kcl.mod create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_1/kcl.mod.lock create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_1/main.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_1/main1.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_2/kcl.mod create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_2/kcl.mod.lock create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_2/main.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_2/main1.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_entry/kcl.mod create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_entry/kcl.mod.lock create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_entry/main.k create mode 100644 test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_entry/main1.k diff --git a/go.mod b/go.mod index 1cc50606..6693106f 100644 --- a/go.mod +++ b/go.mod @@ -87,6 +87,7 @@ require ( github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/go-git/go-git/v5 v5.6.1 github.com/gofrs/flock v0.8.1 + github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 github.com/hashicorp/go-version v1.6.0 github.com/moby/term v0.0.0-20221205130635-1aeaba878587 github.com/onsi/ginkgo/v2 v2.9.2 diff --git a/go.sum b/go.sum index 4693f289..0e6f79d2 100644 --- a/go.sum +++ b/go.sum @@ -154,6 +154,8 @@ github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14j github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= 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/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= diff --git a/pkg/api/kpm_run.go b/pkg/api/kpm_run.go index f374b154..f19ca09f 100644 --- a/pkg/api/kpm_run.go +++ b/pkg/api/kpm_run.go @@ -1,6 +1,7 @@ package api import ( + "fmt" "os" "path/filepath" "strings" @@ -66,6 +67,24 @@ func RunPkgInPath(opts *opt.CompileOptions) (string, error) { return compileResult.GetRawYamlResult(), nil } +// CompileWithOpts will compile the kcl program without kcl package. +func CompileWithOpts(opts *opt.CompileOptions) (*kcl.KCLResultList, error) { + if len(opts.Entries()) > 0 { + for _, entry := range opts.Entries() { + if filepath.IsAbs(entry) { + opts.Merge(kcl.WithKFilenames(entry)) + } else { + opts.Merge(kcl.WithKFilenames(filepath.Join(opts.PkgPath(), entry))) + } + } + } else { + // no entry + opts.Merge(kcl.WithKFilenames(opts.PkgPath())) + } + opts.Merge(kcl.WithWorkDir(opts.PkgPath())) + return kcl.RunWithOpts(*opts.Option) +} + // absTarPath checks whether path 'tarPath' exists and whether path 'tarPath' ends with '.tar' // And after checking, absTarPath return the abs path for 'tarPath'. func absTarPath(tarPath string) (string, error) { @@ -110,7 +129,7 @@ func RunPkgWithOpt(opts *opt.CompileOptions) (*kcl.KCLResultList, error) { kclPkg, err := pkg.LoadKclPkg(pkgPath) if err != nil { - return nil, errors.FailedToLoadPackage + return nil, fmt.Errorf("kpm: failed to load package, please check the package path '%s' is valid", pkgPath) } kclPkg.SetVendorMode(opts.IsVendor()) diff --git a/pkg/api/kpm_run_test.go b/pkg/api/kpm_run_test.go index a314dbbb..ccfe0278 100644 --- a/pkg/api/kpm_run_test.go +++ b/pkg/api/kpm_run_test.go @@ -8,7 +8,6 @@ import ( "github.com/stretchr/testify/assert" "kcl-lang.io/kcl-go/pkg/kcl" - "kcl-lang.io/kpm/pkg/errors" "kcl-lang.io/kpm/pkg/opt" "kcl-lang.io/kpm/pkg/utils" ) @@ -84,10 +83,11 @@ func TestRunPkgInPathInvalidPath(t *testing.T) { func TestRunPkgInPathInvalidPkg(t *testing.T) { pkgPath := getTestDir("test_run_pkg_in_path") opts := opt.DefaultCompileOptions() + opts.SetPkgPath(pkgPath) opts.Merge(kcl.WithKFilenames(filepath.Join(pkgPath, "invalid_pkg", "not_exist.k"))) result, err := RunPkgInPath(opts) assert.NotEqual(t, err, nil) - assert.Equal(t, err, errors.FailedToLoadPackage) + assert.Equal(t, err.Error(), fmt.Sprintf("kpm: failed to load package, please check the package path '%s' is valid", pkgPath)) assert.Equal(t, result, "") } diff --git a/pkg/cmd/cmd_run.go b/pkg/cmd/cmd_run.go index 7985b72d..fa1daad2 100644 --- a/pkg/cmd/cmd_run.go +++ b/pkg/cmd/cmd_run.go @@ -8,8 +8,8 @@ import ( "github.com/urfave/cli/v2" "kcl-lang.io/kcl-go/pkg/kcl" "kcl-lang.io/kpm/pkg/api" - "kcl-lang.io/kpm/pkg/errors" "kcl-lang.io/kpm/pkg/opt" + "kcl-lang.io/kpm/pkg/runner" ) // NewRunCmd new a Command for `kpm run`. @@ -79,29 +79,44 @@ func NewRunCmd() *cli.Command { func KpmRun(c *cli.Context) error { kclOpts := CompileOptionFromCli(c) - pkgWillBeCompiled := c.Args().First() + runEntry, errEvent := runner.FindRunEntryFrom(c.Args().Slice()) + if errEvent != nil { + return errEvent + } + // 'kpm run' compile the current package undor '$pwd'. - if len(pkgWillBeCompiled) == 0 { - compileResult, err := api.RunPkg(kclOpts) + if runEntry.IsEmpty() { + compileResult, err := api.RunCurrentPkg(kclOpts) if err != nil { return err } - fmt.Println(compileResult) + fmt.Println(compileResult.GetRawYamlResult()) } else { - // 'kpm run ' compile the kcl package from the . - kclOpts.SetPkgPath(pkgWillBeCompiled) - compileResult, err := api.RunPkgInPath(kclOpts) - if err == errors.FailedToLoadPackage { - compileResult, err = api.RunTar(pkgWillBeCompiled, kclOpts) - if err == errors.InvalidKclPacakgeTar { - compileResult, err = api.RunOci(pkgWillBeCompiled, c.String(FLAG_TAG), kclOpts) + var compileResult *kcl.KCLResultList + var err error + // 'kpm run' compile the package from the local file system. + if runEntry.IsLocalFile() { + kclOpts.SetPkgPath(runEntry.PackageSource()) + kclOpts.ExtendEntries(runEntry.EntryFiles()) + if runEntry.IsFakePackage() { + // If there is only kcl file without kcl package, + compileResult, err = api.CompileWithOpts(kclOpts) + } else { + // Else compile the kcl pacakge. + compileResult, err = api.RunPkgWithOpt(kclOpts) } + } else if runEntry.IsTar() { + // 'kpm run' compile the package from the kcl pakcage tar. + compileResult, err = api.RunTarPkg(runEntry.PackageSource(), kclOpts) + } else { + // 'kpm run' compile the package from the OCI reference or url. + compileResult, err = api.RunOciPkg(runEntry.PackageSource(), c.String(FLAG_TAG), kclOpts) } if err != nil { return err } - fmt.Println(compileResult) + fmt.Println(compileResult.GetRawYamlResult()) } return nil } diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go new file mode 100644 index 00000000..e2ff5b68 --- /dev/null +++ b/pkg/constants/constants.go @@ -0,0 +1,12 @@ +package constants + +const ( + KFilePathSuffix = ".k" + TarPathSuffix = ".tar" + OciScheme = "oci" + FileEntry = "file" + UrlEntry = "url" + RefEntry = "ref" + TarEntry = "tar" + KCL_MOD = "kcl.mod" +) diff --git a/pkg/reporter/reporter.go b/pkg/reporter/reporter.go index 14ff8916..8df2c680 100644 --- a/pkg/reporter/reporter.go +++ b/pkg/reporter/reporter.go @@ -93,6 +93,7 @@ const ( AddItselfAsDep PkgTagExists DependencyNotFound + KclModNotFound CompileFailed ) diff --git a/pkg/runner/entry.go b/pkg/runner/entry.go new file mode 100644 index 00000000..2c5f21e5 --- /dev/null +++ b/pkg/runner/entry.go @@ -0,0 +1,199 @@ +package runner + +import ( + "fmt" + "os" + "path/filepath" + "sort" + + "github.com/golang-collections/collections/set" + "kcl-lang.io/kpm/pkg/constants" + "kcl-lang.io/kpm/pkg/errors" + "kcl-lang.io/kpm/pkg/reporter" + "kcl-lang.io/kpm/pkg/utils" +) + +// Entry is the entry of 'kpm run'. +type Entry struct { + // The package source of the entry, filepath, tar path, url or ref. + packageSource string + // The start files for one compilation. + entryFiles []string + // The kind of the entry, file, tar, url or ref. + kind string + // If the entry is a fake package, + // which means the entry only contains kcl files without kcl.mod. + isFakePackage bool +} + +// SetKind will set the kind of the entry. +func (e *Entry) SetKind(kind string) { + e.kind = kind +} + +// Kind will return the kind of the entry. +func (e *Entry) Kind() string { + return e.kind +} + +// IsLocalFile will return true if the entry is a local file. +func (e *Entry) IsLocalFile() bool { + return e.kind == constants.FileEntry +} + +// IsUrl will return true if the entry is a url. +func (e *Entry) IsUrl() bool { + return e.kind == constants.UrlEntry +} + +// IsRef will return true if the entry is a ref. +func (e *Entry) IsRef() bool { + return e.kind == constants.RefEntry +} + +// IsTar will return true if the entry is a tar. +func (e *Entry) IsTar() bool { + return e.kind == constants.TarEntry +} + +// IsEmpty will return true if the entry is empty. +func (e *Entry) IsEmpty() bool { + return len(e.packageSource) == 0 +} + +// PackageSource will return the package source of the entry. +func (e *Entry) PackageSource() string { + return e.packageSource +} + +// EntryFiles will return the entry files of the entry. +func (e *Entry) EntryFiles() []string { + return e.entryFiles +} + +// SetPackageSource will set the package source of the entry. +func (e *Entry) SetPackageSource(packageSource string) { + e.packageSource = packageSource +} + +// SetIsFakePackage will set the 'isFakePackage' flag. +func (e *Entry) SetIsFakePackage(isFakePackage bool) { + e.isFakePackage = isFakePackage +} + +// IsFakePackage will return the 'isFakePackage' flag. +func (e *Entry) IsFakePackage() bool { + return e.isFakePackage +} + +// AddEntryFile will add a entry file to the entry. +func (e *Entry) AddEntryFile(entrySource string) { + e.entryFiles = append(e.entryFiles, entrySource) +} + +// FindRunEntryFrom will find the entry of the compilation from the entry sources. +func FindRunEntryFrom(sources []string) (*Entry, *reporter.KpmEvent) { + entry := Entry{} + // modPathSet is used to check if there are multiple packages to be compiled at the same time. + // It is a set of the package source so that the same package source will only be added once. + var modPathSet = set.New() + for _, source := range sources { + // If the entry is a local file but not a tar file, + if utils.DirExists(source) && !utils.IsTar(source) { + // Find the 'kcl.mod' + modPath, err := FindModRootFrom(source) + if err != (*reporter.KpmEvent)(nil) { + // If the 'kcl.mod' is not found, + if err.Type() == reporter.KclModNotFound { + if utils.IsKfile(source) { + // If the entry is a kcl file, the parent dir of the kcl file will be package path. + modPath = filepath.Dir(source) + } else { + // If the entry is a dir, the dir will be package path. + modPath = source + } + } else { + return nil, err + } + } + entry.SetPackageSource(modPath) + entry.AddEntryFile(source) + entry.SetKind(constants.FileEntry) + entry.SetIsFakePackage(!utils.DirExists(filepath.Join(modPath, constants.KCL_MOD))) + absModPath, bugerr := filepath.Abs(modPath) + if bugerr != nil { + return nil, reporter.NewErrorEvent(reporter.Bug, bugerr, errors.InternalBug.Error()) + } + modPathSet.Insert(absModPath) + } else if utils.IsURL(source) || utils.IsRef(source) || utils.IsTar(source) { + modPathSet.Insert(source) + entry.SetPackageSource(source) + entry.SetKind(GetSourceKindFrom(source)) + } + } + + // kpm only allows one package to be compiled at a time. + if modPathSet.Len() > 1 { + // sort the mod paths to make the error message more readable. + var modPaths []string + setModPathsMethod := func(modpath interface{}) { + p, ok := modpath.(string) + if !ok { + modPaths = append(modPaths, "") + } else { + modPaths = append(modPaths, p) + } + } + modPathSet.Do(setModPathsMethod) + sort.Strings(modPaths) + return nil, reporter.NewErrorEvent( + reporter.CompileFailed, + fmt.Errorf("cannot compile multiple packages %s at the same time", modPaths), + "only allows one package to be compiled at a time", + ) + } + + return &entry, nil +} + +// GetSourceKindFrom will return the kind of the source. +func GetSourceKindFrom(source string) string { + if utils.DirExists(source) && !utils.IsTar(source) { + return constants.FileEntry + } else if utils.IsTar(source) { + return constants.TarEntry + } else if utils.IsURL(source) { + return constants.UrlEntry + } else if utils.IsRef(source) { + return constants.RefEntry + } + return "" +} + +// FindModRootFrom will find the kcl.mod path from the start path. +func FindModRootFrom(startPath string) (string, *reporter.KpmEvent) { + info, err := os.Stat(startPath) + if err != nil { + return "", reporter.NewErrorEvent(reporter.CompileFailed, fmt.Errorf("failed to access path '%s'", startPath)) + } + var start string + // If the start path is a kcl file, find from the parent dir of the kcl file. + if utils.IsKfile(startPath) { + start = filepath.Dir(startPath) + } else if info.IsDir() { + // If the start path is a dir, find from the start path. + start = startPath + } else { + return "", reporter.NewErrorEvent(reporter.CompileFailed, fmt.Errorf("invalid file path '%s'", startPath)) + } + + if _, err := os.Stat(filepath.Join(start, constants.KCL_MOD)); err == nil { + return start, nil + } else { + parent := filepath.Dir(startPath) + if parent == startPath { + return "", reporter.NewErrorEvent(reporter.KclModNotFound, fmt.Errorf("cannot find kcl.mod in '%s'", startPath)) + } + return FindModRootFrom(filepath.Dir(startPath)) + } +} diff --git a/pkg/runner/entry_test.go b/pkg/runner/entry_test.go new file mode 100644 index 00000000..a4b654c5 --- /dev/null +++ b/pkg/runner/entry_test.go @@ -0,0 +1,60 @@ +package runner + +import ( + "path/filepath" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "kcl-lang.io/kpm/pkg/constants" + "kcl-lang.io/kpm/pkg/reporter" +) + +func TestFindModRootFrom(t *testing.T) { + // find root from local file + absPath, err := filepath.Abs("./testdata_external/external/main.k") + assert.Equal(t, err, nil) + root, err := FindModRootFrom(absPath) + assert.Equal(t, err, (*reporter.KpmEvent)(nil)) + assert.Equal(t, root, filepath.Dir(absPath)) + + // find root from dir + absPath, err = filepath.Abs("./testdata_external/external/") + assert.Equal(t, err, nil) + root, err = FindModRootFrom(absPath) + assert.Equal(t, err, (*reporter.KpmEvent)(nil)) + assert.Equal(t, root, absPath) + + // find root from kfile parent + absPath, err = filepath.Abs("./testdata/test_find_mod/sub/main.k") + assert.Equal(t, err, nil) + root, err = FindModRootFrom(absPath) + assert.Equal(t, err, (*reporter.KpmEvent)(nil)) + assert.Equal(t, root, filepath.Dir(filepath.Dir(absPath))) + + // find root from kfile parent + absPath, err = filepath.Abs("./testdata/test_find_mod/sub") + assert.Equal(t, err, nil) + root, err = FindModRootFrom(absPath) + assert.Equal(t, err, (*reporter.KpmEvent)(nil)) + assert.Equal(t, root, filepath.Dir(absPath)) +} + +func TestGetSourceKindFrom(t *testing.T) { + assert.Equal(t, GetSourceKindFrom("./testdata_external/external/main.k"), constants.FileEntry) + assert.Equal(t, GetSourceKindFrom("main.tar"), constants.TarEntry) + assert.Equal(t, GetSourceKindFrom("oci://test_url"), constants.UrlEntry) + assert.Equal(t, GetSourceKindFrom("test_ref:0.0.1"), constants.RefEntry) + assert.Equal(t, GetSourceKindFrom("invalid input"), "") +} + +func TestFindRunEntryFrom(t *testing.T) { + res, err := FindRunEntryFrom([]string{"./testdata_external/external/main.k", "./testdata_external/external"}) + assert.Equal(t, err, (*reporter.KpmEvent)(nil)) + assert.Equal(t, res.packageSource, "./testdata_external/external") + + res, err = FindRunEntryFrom([]string{"./testdata_external/external/main.k", "./testdata_external/external", "./testdata/test_find_mod/sub/main.k"}) + assert.Equal(t, err.Type(), reporter.CompileFailed) + assert.Equal(t, strings.Contains(err.Error(), "cannot compile multiple packages"), true) + assert.Equal(t, res, (*Entry)(nil)) +} diff --git a/pkg/runner/testdata/test_find_mod/kcl.mod b/pkg/runner/testdata/test_find_mod/kcl.mod new file mode 100644 index 00000000..98829c84 --- /dev/null +++ b/pkg/runner/testdata/test_find_mod/kcl.mod @@ -0,0 +1,5 @@ +[package] +name = "test_find_mod" +edition = "0.0.1" +version = "0.0.1" + diff --git a/pkg/runner/testdata/test_find_mod/kcl.mod.lock b/pkg/runner/testdata/test_find_mod/kcl.mod.lock new file mode 100644 index 00000000..e69de29b diff --git a/pkg/runner/testdata/test_find_mod/main.k b/pkg/runner/testdata/test_find_mod/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/pkg/runner/testdata/test_find_mod/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/pkg/runner/testdata/test_find_mod/sub/main.k b/pkg/runner/testdata/test_find_mod/sub/main.k new file mode 100644 index 00000000..e69de29b diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index cbb3480d..aca6c492 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -8,13 +8,16 @@ import ( "fmt" "io" "log" + "net/url" "os" "path/filepath" "strings" goerrors "errors" + "github.com/docker/distribution/reference" "github.com/moby/term" + "kcl-lang.io/kpm/pkg/constants" "kcl-lang.io/kpm/pkg/errors" "kcl-lang.io/kpm/pkg/reporter" ) @@ -223,9 +226,10 @@ func UnTarDir(tarPath string, destDir string) error { return nil } +// DirExists will check whether the directory 'path' exists. func DirExists(path string) bool { _, err := os.Stat(path) - return !os.IsNotExist(err) + return err == nil } // DefaultKpmHome create the '.kpm' in the user home and return the path of ".kpm". @@ -368,3 +372,25 @@ func JoinPath(base, elem string) string { elem = strings.TrimPrefix(elem, "/") return base + "/" + elem } + +// IsUrl will check whether the string 'str' is a url. +func IsURL(str string) bool { + u, err := url.Parse(str) + return err == nil && u.Scheme != "" && u.Host != "" +} + +// IsRef will check whether the string 'str' is a reference. +func IsRef(str string) bool { + _, err := reference.ParseNormalizedNamed(str) + return err == nil +} + +// IsTar will check whether the string 'str' is a tar path. +func IsTar(str string) bool { + return strings.HasSuffix(str, constants.TarPathSuffix) +} + +// IsKfile will check whether the string 'str' is a k file path. +func IsKfile(str string) bool { + return strings.HasSuffix(str, constants.KFilePathSuffix) +} diff --git a/pkg/utils/utils_test.go b/pkg/utils/utils_test.go index 1ee145b4..138edc3b 100644 --- a/pkg/utils/utils_test.go +++ b/pkg/utils/utils_test.go @@ -130,3 +130,28 @@ func TestJoinPath(t *testing.T) { assert.Equal(t, JoinPath("base/", ""), "base/") assert.Equal(t, JoinPath("base", ""), "base/") } + +func TestIsUrl(t *testing.T) { + assert.Equal(t, IsURL("invalid url"), false) + assert.Equal(t, IsURL("https://url/xxx"), true) + assert.Equal(t, IsURL("https://url"), true) + assert.Equal(t, IsURL("https://"), false) +} + +func TestIsRef(t *testing.T) { + assert.Equal(t, IsRef("invalid ref"), false) + assert.Equal(t, IsRef("ghcr.io/xxx/xxx"), true) + assert.Equal(t, IsRef("ghcr.io/xxx"), true) + assert.Equal(t, IsRef("ghcr.io/xxx:0.0.1"), true) + assert.Equal(t, IsRef("ghcr.io/"), false) +} + +func TestIsTar(t *testing.T) { + assert.Equal(t, IsTar("invalid tar"), false) + assert.Equal(t, IsTar("xxx.tar"), true) +} + +func TestIsKfile(t *testing.T) { + assert.Equal(t, IsKfile("invalid kfile"), false) + assert.Equal(t, IsKfile("xxx.k"), true) +} diff --git a/test/e2e/test_suites/kpm/exec_outside_pkg/run_tar_with_exist_not_tar/test_suite.stderr b/test/e2e/test_suites/kpm/exec_outside_pkg/run_tar_with_exist_not_tar/test_suite.stderr index 448f0265..19b8ba4d 100644 --- a/test/e2e/test_suites/kpm/exec_outside_pkg/run_tar_with_exist_not_tar/test_suite.stderr +++ b/test/e2e/test_suites/kpm/exec_outside_pkg/run_tar_with_exist_not_tar/test_suite.stderr @@ -1 +1 @@ -kpm: failed to select latest version from 'localhost:5001/exist_but_not_tar'. +kpm: invalid file path 'exist_but_not_tar' \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/exec_outside_pkg/run_tar_with_noargs_input/test_suite.stderr b/test/e2e/test_suites/kpm/exec_outside_pkg/run_tar_with_noargs_input/test_suite.stderr index eaf6b116..8a2629fe 100644 --- a/test/e2e/test_suites/kpm/exec_outside_pkg/run_tar_with_noargs_input/test_suite.stderr +++ b/test/e2e/test_suites/kpm/exec_outside_pkg/run_tar_with_noargs_input/test_suite.stderr @@ -1 +1 @@ -kpm: failed to load package, please check the package path is valid. +kpm: failed to load package, please check the package path '' is valid diff --git a/test/e2e/test_suites/kpm/exec_outside_pkg/run_with_no_args/test_suite.stderr b/test/e2e/test_suites/kpm/exec_outside_pkg/run_with_no_args/test_suite.stderr index eaf6b116..8a2629fe 100644 --- a/test/e2e/test_suites/kpm/exec_outside_pkg/run_with_no_args/test_suite.stderr +++ b/test/e2e/test_suites/kpm/exec_outside_pkg/run_with_no_args/test_suite.stderr @@ -1 +1 @@ -kpm: failed to load package, please check the package path is valid. +kpm: failed to load package, please check the package path '' is valid diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_file_with_sub/test_suite.env b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_file_with_sub/test_suite.env new file mode 100644 index 00000000..4c789529 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_file_with_sub/test_suite.env @@ -0,0 +1,2 @@ +KPM_HOME="" +KCLVM_VENDOR_HOME="" \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_file_with_sub/test_suite.input b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_file_with_sub/test_suite.input new file mode 100644 index 00000000..5669d1ff --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_file_with_sub/test_suite.input @@ -0,0 +1 @@ +kpm run ./main.k \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_file_with_sub/test_suite.stderr b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_file_with_sub/test_suite.stderr new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_file_with_sub/test_suite.stdout b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_file_with_sub/test_suite.stdout new file mode 100644 index 00000000..9dfc208d --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_file_with_sub/test_suite.stdout @@ -0,0 +1 @@ +a: 2 diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile/test_suite.env b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile/test_suite.env new file mode 100644 index 00000000..4c789529 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile/test_suite.env @@ -0,0 +1,2 @@ +KPM_HOME="" +KCLVM_VENDOR_HOME="" \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile/test_suite.input b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile/test_suite.input new file mode 100644 index 00000000..2deb78a1 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile/test_suite.input @@ -0,0 +1 @@ +kpm run main.k main1.k \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile/test_suite.stderr b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile/test_suite.stderr new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile/test_suite.stdout b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile/test_suite.stdout new file mode 100644 index 00000000..08c34573 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile/test_suite.stdout @@ -0,0 +1,2 @@ +The_first_kcl_program: Hello World! +The_first_kcl_program1: Hello World! diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_1/test_suite.env b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_1/test_suite.env new file mode 100644 index 00000000..4c789529 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_1/test_suite.env @@ -0,0 +1,2 @@ +KPM_HOME="" +KCLVM_VENDOR_HOME="" \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_1/test_suite.input b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_1/test_suite.input new file mode 100644 index 00000000..96625628 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_1/test_suite.input @@ -0,0 +1 @@ +kpm run main.k sub/main1.k \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_1/test_suite.stderr b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_1/test_suite.stderr new file mode 100644 index 00000000..b6d684a8 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_1/test_suite.stderr @@ -0,0 +1,2 @@ +kpm: only allows one package to be compiled at a time +kpm: cannot compile multiple packages [/test_kpm_run_with_multi_kfile_1 /test_kpm_run_with_multi_kfile_1/sub] at the same time diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_1/test_suite.stdout b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_1/test_suite.stdout new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_2/test_suite.env b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_2/test_suite.env new file mode 100644 index 00000000..4c789529 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_2/test_suite.env @@ -0,0 +1,2 @@ +KPM_HOME="" +KCLVM_VENDOR_HOME="" \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_2/test_suite.input b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_2/test_suite.input new file mode 100644 index 00000000..96625628 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_2/test_suite.input @@ -0,0 +1 @@ +kpm run main.k sub/main1.k \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_2/test_suite.stderr b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_2/test_suite.stderr new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_2/test_suite.stdout b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_2/test_suite.stdout new file mode 100644 index 00000000..08c34573 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_2/test_suite.stdout @@ -0,0 +1,2 @@ +The_first_kcl_program: Hello World! +The_first_kcl_program1: Hello World! diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_3/test_suite.env b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_3/test_suite.env new file mode 100644 index 00000000..4c789529 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_3/test_suite.env @@ -0,0 +1,2 @@ +KPM_HOME="" +KCLVM_VENDOR_HOME="" \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_3/test_suite.input b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_3/test_suite.input new file mode 100644 index 00000000..b02e55a1 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_3/test_suite.input @@ -0,0 +1 @@ +kpm run \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_3/test_suite.stderr b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_3/test_suite.stderr new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_3/test_suite.stdout b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_3/test_suite.stdout new file mode 100644 index 00000000..08c34573 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_3/test_suite.stdout @@ -0,0 +1,2 @@ +The_first_kcl_program: Hello World! +The_first_kcl_program1: Hello World! diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_4/test_suite.env b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_4/test_suite.env new file mode 100644 index 00000000..4c789529 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_4/test_suite.env @@ -0,0 +1,2 @@ +KPM_HOME="" +KCLVM_VENDOR_HOME="" \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_4/test_suite.input b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_4/test_suite.input new file mode 100644 index 00000000..2deb78a1 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_4/test_suite.input @@ -0,0 +1 @@ +kpm run main.k main1.k \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_4/test_suite.stderr b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_4/test_suite.stderr new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_4/test_suite.stdout b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_4/test_suite.stdout new file mode 100644 index 00000000..08c34573 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_kfile_4/test_suite.stdout @@ -0,0 +1,2 @@ +The_first_kcl_program: Hello World! +The_first_kcl_program1: Hello World! diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg/test_suite.env b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg/test_suite.env new file mode 100644 index 00000000..4c789529 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg/test_suite.env @@ -0,0 +1,2 @@ +KPM_HOME="" +KCLVM_VENDOR_HOME="" \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg/test_suite.input b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg/test_suite.input new file mode 100644 index 00000000..3802c7c4 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg/test_suite.input @@ -0,0 +1 @@ +kpm run kcl1/main.k kcl2/main.k \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg/test_suite.stderr b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg/test_suite.stderr new file mode 100644 index 00000000..40747ed9 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg/test_suite.stderr @@ -0,0 +1,2 @@ +kpm: only allows one package to be compiled at a time +kpm: cannot compile multiple packages [/test_kpm_run_with_multi_pkg/kcl1 /test_kpm_run_with_multi_pkg/kcl2] at the same time diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg/test_suite.stdout b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg/test_suite.stdout new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg_1/test_suite.env b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg_1/test_suite.env new file mode 100644 index 00000000..4c789529 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg_1/test_suite.env @@ -0,0 +1,2 @@ +KPM_HOME="" +KCLVM_VENDOR_HOME="" \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg_1/test_suite.input b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg_1/test_suite.input new file mode 100644 index 00000000..b62f468b --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg_1/test_suite.input @@ -0,0 +1 @@ +kpm run kcl1/main.k kcl2/main.k oci://kcl-lang/kcl \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg_1/test_suite.stderr b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg_1/test_suite.stderr new file mode 100644 index 00000000..d5de4b9b --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg_1/test_suite.stderr @@ -0,0 +1,2 @@ +kpm: only allows one package to be compiled at a time +kpm: cannot compile multiple packages [/test_kpm_run_with_multi_pkg_1/kcl1 /test_kpm_run_with_multi_pkg_1/kcl2 oci://kcl-lang/kcl] at the same time diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg_1/test_suite.stdout b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_multi_pkg_1/test_suite.stdout new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_dir/test_suite.env b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_dir/test_suite.env new file mode 100644 index 00000000..4c789529 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_dir/test_suite.env @@ -0,0 +1,2 @@ +KPM_HOME="" +KCLVM_VENDOR_HOME="" \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_dir/test_suite.input b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_dir/test_suite.input new file mode 100644 index 00000000..d0751d2c --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_dir/test_suite.input @@ -0,0 +1 @@ +kpm run /sub \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_dir/test_suite.stderr b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_dir/test_suite.stderr new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_dir/test_suite.stdout b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_dir/test_suite.stdout new file mode 100644 index 00000000..08c34573 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_dir/test_suite.stdout @@ -0,0 +1,2 @@ +The_first_kcl_program: Hello World! +The_first_kcl_program1: Hello World! diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile/test_suite.env b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile/test_suite.env new file mode 100644 index 00000000..4c789529 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile/test_suite.env @@ -0,0 +1,2 @@ +KPM_HOME="" +KCLVM_VENDOR_HOME="" \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile/test_suite.input b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile/test_suite.input new file mode 100644 index 00000000..5669d1ff --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile/test_suite.input @@ -0,0 +1 @@ +kpm run ./main.k \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile/test_suite.stderr b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile/test_suite.stderr new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile/test_suite.stdout b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile/test_suite.stdout new file mode 100644 index 00000000..d2dcf2aa --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile/test_suite.stdout @@ -0,0 +1 @@ +The_first_kcl_program: Hello World! diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_1/test_suite.env b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_1/test_suite.env new file mode 100644 index 00000000..4c789529 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_1/test_suite.env @@ -0,0 +1,2 @@ +KPM_HOME="" +KCLVM_VENDOR_HOME="" \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_1/test_suite.input b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_1/test_suite.input new file mode 100644 index 00000000..5669d1ff --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_1/test_suite.input @@ -0,0 +1 @@ +kpm run ./main.k \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_1/test_suite.stderr b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_1/test_suite.stderr new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_1/test_suite.stdout b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_1/test_suite.stdout new file mode 100644 index 00000000..d2dcf2aa --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_1/test_suite.stdout @@ -0,0 +1 @@ +The_first_kcl_program: Hello World! diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_2/test_suite.env b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_2/test_suite.env new file mode 100644 index 00000000..4c789529 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_2/test_suite.env @@ -0,0 +1,2 @@ +KPM_HOME="" +KCLVM_VENDOR_HOME="" \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_2/test_suite.input b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_2/test_suite.input new file mode 100644 index 00000000..5669d1ff --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_2/test_suite.input @@ -0,0 +1 @@ +kpm run ./main.k \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_2/test_suite.stderr b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_2/test_suite.stderr new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_2/test_suite.stdout b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_2/test_suite.stdout new file mode 100644 index 00000000..d2dcf2aa --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_2/test_suite.stdout @@ -0,0 +1 @@ +The_first_kcl_program: Hello World! diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_entry/test_suite.env b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_entry/test_suite.env new file mode 100644 index 00000000..4c789529 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_entry/test_suite.env @@ -0,0 +1,2 @@ +KPM_HOME="" +KCLVM_VENDOR_HOME="" \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_entry/test_suite.input b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_entry/test_suite.input new file mode 100644 index 00000000..b02e55a1 --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_entry/test_suite.input @@ -0,0 +1 @@ +kpm run \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_entry/test_suite.stderr b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_entry/test_suite.stderr new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_entry/test_suite.stdout b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_entry/test_suite.stdout new file mode 100644 index 00000000..2e1a14be --- /dev/null +++ b/test/e2e/test_suites/kpm/kpm_run/test_kpm_run_with_one_kfile_entry/test_suite.stdout @@ -0,0 +1 @@ +The_first_kcl_program1: Hello World! diff --git a/test/e2e/test_suites/test_data/test_kpm_run_file_with_sub/main.k b/test/e2e/test_suites/test_data/test_kpm_run_file_with_sub/main.k new file mode 100644 index 00000000..717bd4e0 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_file_with_sub/main.k @@ -0,0 +1,3 @@ +import sub + +a = sub.sub \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_file_with_sub/sub/main.k b/test/e2e/test_suites/test_data/test_kpm_run_file_with_sub/sub/main.k new file mode 100644 index 00000000..2ec23c33 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_file_with_sub/sub/main.k @@ -0,0 +1 @@ +sub = 2 \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile/main.k b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile/main1.k b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile/main1.k new file mode 100644 index 00000000..ceee1cc3 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile/main1.k @@ -0,0 +1 @@ +The_first_kcl_program1 = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_1/main.k b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_1/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_1/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_1/sub/main1.k b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_1/sub/main1.k new file mode 100644 index 00000000..ceee1cc3 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_1/sub/main1.k @@ -0,0 +1 @@ +The_first_kcl_program1 = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_2/kcl.mod b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_2/kcl.mod new file mode 100644 index 00000000..6f025e12 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_2/kcl.mod @@ -0,0 +1,5 @@ +[package] +name = "test_kpm_run_with_multi_kfile_2" +edition = "0.0.1" +version = "0.0.1" + diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_2/kcl.mod.lock b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_2/kcl.mod.lock new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_2/main.k b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_2/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_2/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_2/sub/main1.k b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_2/sub/main1.k new file mode 100644 index 00000000..ceee1cc3 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_2/sub/main1.k @@ -0,0 +1 @@ +The_first_kcl_program1 = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_3/kcl.mod b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_3/kcl.mod new file mode 100644 index 00000000..6f025e12 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_3/kcl.mod @@ -0,0 +1,5 @@ +[package] +name = "test_kpm_run_with_multi_kfile_2" +edition = "0.0.1" +version = "0.0.1" + diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_3/kcl.mod.lock b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_3/kcl.mod.lock new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_3/main.k b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_3/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_3/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_3/main1.k b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_3/main1.k new file mode 100644 index 00000000..ceee1cc3 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_3/main1.k @@ -0,0 +1 @@ +The_first_kcl_program1 = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_4/kcl.mod b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_4/kcl.mod new file mode 100644 index 00000000..6f025e12 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_4/kcl.mod @@ -0,0 +1,5 @@ +[package] +name = "test_kpm_run_with_multi_kfile_2" +edition = "0.0.1" +version = "0.0.1" + diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_4/kcl.mod.lock b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_4/kcl.mod.lock new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_4/main.k b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_4/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_4/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_4/main1.k b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_4/main1.k new file mode 100644 index 00000000..ceee1cc3 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_kfile_4/main1.k @@ -0,0 +1 @@ +The_first_kcl_program1 = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl1/kcl.mod b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl1/kcl.mod new file mode 100644 index 00000000..ab572545 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl1/kcl.mod @@ -0,0 +1,5 @@ +[package] +name = "kcl1" +edition = "0.0.1" +version = "0.0.1" + diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl1/kcl.mod.lock b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl1/kcl.mod.lock new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl1/main.k b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl1/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl1/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl2/kcl.mod b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl2/kcl.mod new file mode 100644 index 00000000..5fb058ac --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl2/kcl.mod @@ -0,0 +1,5 @@ +[package] +name = "kcl2" +edition = "0.0.1" +version = "0.0.1" + diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl2/kcl.mod.lock b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl2/kcl.mod.lock new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl2/main.k b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl2/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg/kcl2/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl1/kcl.mod b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl1/kcl.mod new file mode 100644 index 00000000..ab572545 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl1/kcl.mod @@ -0,0 +1,5 @@ +[package] +name = "kcl1" +edition = "0.0.1" +version = "0.0.1" + diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl1/kcl.mod.lock b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl1/kcl.mod.lock new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl1/main.k b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl1/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl1/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl2/kcl.mod b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl2/kcl.mod new file mode 100644 index 00000000..5fb058ac --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl2/kcl.mod @@ -0,0 +1,5 @@ +[package] +name = "kcl2" +edition = "0.0.1" +version = "0.0.1" + diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl2/kcl.mod.lock b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl2/kcl.mod.lock new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl2/main.k b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl2/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_multi_pkg_1/kcl2/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_one_dir/sub/main.k b/test/e2e/test_suites/test_data/test_kpm_run_with_one_dir/sub/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_one_dir/sub/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_one_dir/sub/main1.k b/test/e2e/test_suites/test_data/test_kpm_run_with_one_dir/sub/main1.k new file mode 100644 index 00000000..ceee1cc3 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_one_dir/sub/main1.k @@ -0,0 +1 @@ +The_first_kcl_program1 = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile/main.k b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_1/kcl.mod b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_1/kcl.mod new file mode 100644 index 00000000..cc2f9aeb --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_1/kcl.mod @@ -0,0 +1,5 @@ +[package] +name = "test_kpm_run_with_one_kfile_1" +edition = "0.0.1" +version = "0.0.1" + diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_1/kcl.mod.lock b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_1/kcl.mod.lock new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_1/main.k b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_1/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_1/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_1/main1.k b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_1/main1.k new file mode 100644 index 00000000..ceee1cc3 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_1/main1.k @@ -0,0 +1 @@ +The_first_kcl_program1 = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_2/kcl.mod b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_2/kcl.mod new file mode 100644 index 00000000..09b9f2c1 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_2/kcl.mod @@ -0,0 +1,9 @@ +[package] +name = "test_kpm_run_with_one_kfile_1" +edition = "0.0.1" +version = "0.0.1" + +[profile] +entries = [ + "main1.k", +] diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_2/kcl.mod.lock b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_2/kcl.mod.lock new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_2/main.k b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_2/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_2/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_2/main1.k b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_2/main1.k new file mode 100644 index 00000000..ceee1cc3 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_2/main1.k @@ -0,0 +1 @@ +The_first_kcl_program1 = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_entry/kcl.mod b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_entry/kcl.mod new file mode 100644 index 00000000..09b9f2c1 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_entry/kcl.mod @@ -0,0 +1,9 @@ +[package] +name = "test_kpm_run_with_one_kfile_1" +edition = "0.0.1" +version = "0.0.1" + +[profile] +entries = [ + "main1.k", +] diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_entry/kcl.mod.lock b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_entry/kcl.mod.lock new file mode 100644 index 00000000..e69de29b diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_entry/main.k b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_entry/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_entry/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_entry/main1.k b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_entry/main1.k new file mode 100644 index 00000000..ceee1cc3 --- /dev/null +++ b/test/e2e/test_suites/test_data/test_kpm_run_with_one_kfile_entry/main1.k @@ -0,0 +1 @@ +The_first_kcl_program1 = 'Hello World!' \ No newline at end of file