kindsys: Fix CUE code generation on Windows (#62812)
* fix Windows paths * fix remaining paths issues * clean up multiple use of Dir() * fix headers in generated files
This commit is contained in:
@@ -33,7 +33,7 @@ func (psr *declParser) Parse(root fs.FS) ([]*PluginDecl, error) {
|
||||
|
||||
decls := make([]*PluginDecl, 0)
|
||||
for _, plugin := range plugins {
|
||||
path := filepath.Dir(plugin)
|
||||
path := filepath.ToSlash(filepath.Dir(plugin))
|
||||
base := filepath.Base(path)
|
||||
if skip, ok := psr.skip[base]; ok && skip {
|
||||
continue
|
||||
|
||||
@@ -235,7 +235,7 @@ func ParsePluginFS(fsys fs.FS, rt *thema.Runtime) (ParsedPlugin, error) {
|
||||
}
|
||||
|
||||
func ensureCueMod(fsys fs.FS, pdef plugindef.PluginDef) (fs.FS, error) {
|
||||
if modf, err := fs.ReadFile(fsys, filepath.Join("cue.mod", "module.cue")); err != nil {
|
||||
if modf, err := fs.ReadFile(fsys, "cue.mod/module.cue"); err != nil {
|
||||
if !errors.Is(err, fs.ErrNotExist) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"cuelang.org/go/cue/cuecontext"
|
||||
"github.com/dave/dst"
|
||||
@@ -40,8 +39,8 @@ func main() {
|
||||
fmt.Fprintf(os.Stderr, "could not get working directory: %s", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
grootp := strings.Split(cwd, string(os.PathSeparator))
|
||||
groot := filepath.Join(string(os.PathSeparator), filepath.Join(grootp[:len(grootp)-3]...))
|
||||
|
||||
groot := filepath.Clean(filepath.Join(cwd, "../../.."))
|
||||
|
||||
jfs := elsedie(jl.GenerateFS(lin))("plugindef jenny pipeline failed")
|
||||
if _, set := os.LookupEnv("CODEGEN_VERIFY"); set {
|
||||
|
||||
Reference in New Issue
Block a user