diff --git a/x/build/build.go b/x/build/build.go index 0b99626ed..10fae033c 100644 --- a/x/build/build.go +++ b/x/build/build.go @@ -21,7 +21,6 @@ import ( "fmt" goast "go/ast" "go/types" - "path" "path/filepath" "github.com/goplus/gop/ast" @@ -31,6 +30,7 @@ import ( "github.com/goplus/gop/token" "github.com/goplus/gox" "github.com/goplus/gox/packages" + "github.com/goplus/mod/modfile" ) type Class = cl.Class @@ -76,7 +76,7 @@ func (p *Package) ToAst() *goast.File { } func ClassKind(fname string) (isProj, ok bool) { - ext := path.Ext(fname) + ext := modfile.ClassExt(fname) switch ext { case ".gmx": return true, true diff --git a/x/build/build_test.go b/x/build/build_test.go index 116776ebe..b09985c55 100644 --- a/x/build/build_test.go +++ b/x/build/build_test.go @@ -44,6 +44,7 @@ func init() { build.RegisterClassFileType(".tspx", "MyGame", []*build.Class{ {Ext: ".tspx", Class: "Sprite"}, }, "github.com/goplus/gop/cl/internal/spx") + build.RegisterClassFileType("_yap.gox", "App", nil, "github.com/goplus/yap") } func gopClTest(t *testing.T, gopcode interface{}, expected string) { @@ -76,6 +77,7 @@ func TestKind(t *testing.T) { testKind(t, "main.gmx", true, true) testKind(t, "Cat.tspx", false, true) testKind(t, "main.tspx", true, true) + testKind(t, "blog_yap.gox", true, true) } func TestGop(t *testing.T) {