kindsys: Make kind generators run in Windows (#58794)

This commit is contained in:
Yuri Tseretyan 2022-11-16 09:21:11 -05:00 committed by GitHub
parent 5d73f7f8e8
commit 332630c2e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 14 deletions

View File

@ -12,10 +12,10 @@ import (
"os"
"path/filepath"
"sort"
"strings"
"cuelang.org/go/cue/errors"
"github.com/grafana/codejen"
"github.com/grafana/grafana/pkg/codegen"
"github.com/grafana/grafana/pkg/cuectx"
"github.com/grafana/grafana/pkg/kindsys"
@ -57,8 +57,7 @@ func main() {
fmt.Fprintf(os.Stderr, "could not get working directory: %s", err)
os.Exit(1)
}
grootp := strings.Split(cwd, sep)
groot := filepath.Join(sep, filepath.Join(grootp[:len(grootp)-1]...))
groot := filepath.Dir(cwd)
rt := cuectx.GrafanaThemaRuntime()
var all []*codegen.DeclForGen

View File

@ -8,10 +8,11 @@ import (
"cuelang.org/go/cue"
"cuelang.org/go/cue/errors"
"github.com/grafana/grafana"
"github.com/grafana/grafana/pkg/cuectx"
"github.com/grafana/thema"
tload "github.com/grafana/thema/load"
"github.com/grafana/grafana"
"github.com/grafana/grafana/pkg/cuectx"
)
// CoreStructuredDeclParentPath is the path, relative to the repository root, where
@ -54,15 +55,7 @@ func doLoadFrameworkCUE(ctx *cue.Context) (cue.Value, error) {
var v cue.Value
var err error
absolutePath := prefix
if !filepath.IsAbs(absolutePath) {
absolutePath, err = filepath.Abs(absolutePath)
if err != nil {
return v, err
}
}
bi, err := tload.InstancesWithThema(grafana.CueSchemaFS, absolutePath)
bi, err := tload.InstancesWithThema(grafana.CueSchemaFS, prefix)
if err != nil {
return v, err
}