Skip to content

Commit

Permalink
Merge pull request #264 from visualfc/gopbuild
Browse files Browse the repository at this point in the history
gopbuild: use modfile.ClassExt
  • Loading branch information
visualfc authored Jan 24, 2024
2 parents ae77c07 + d5ed1e3 commit 220c124
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ require (
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00
github.com/goplus/gop v1.1.9
github.com/goplus/gox v1.12.8
github.com/goplus/mod v0.12.1
github.com/goplus/reflectx v1.2.1
github.com/modern-go/reflect2 v1.0.2
github.com/peterh/liner v1.2.2
github.com/qiniu/x v1.13.1
github.com/qiniu/x v1.13.2
github.com/visualfc/funcval v0.1.4
github.com/visualfc/gid v0.1.0
github.com/visualfc/goembed v0.3.2
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ github.com/goplus/gox v1.12.1/go.mod h1:wymoQJ7ydd42cTlaXb4wNbvn4LlKjR+j8PZehI7v
github.com/goplus/gox v1.12.8 h1:xXpsGbNIIDmykOQwI/kDcoA3cOX5ISvLPlU5RiPtyZY=
github.com/goplus/gox v1.12.8/go.mod h1:MOJnwqA8/rSUkn0vsayHFK7TD/3XQrdexMTqdzR70X0=
github.com/goplus/mod v0.11.5/go.mod h1:NDC5E+XOT8vcJCMjqKhLDJHTHX7lyVN4Vbfi2U7dBhs=
github.com/goplus/mod v0.11.8 h1:90Kbg+MJhrdsonNGXYx3HUcW4IbBlRHYpIMssJaMMxM=
github.com/goplus/mod v0.11.8/go.mod h1:yl2QncBKTdXk+8UaNsdo4u2zSpGEJYA5JKjgD3K2h00=
github.com/goplus/mod v0.12.1 h1:4M1py5liQ/bfxPPXcmVbYn3JAjfcDpTANtih5omFI6c=
github.com/goplus/mod v0.12.1/go.mod h1:ZtlS9wHOcAVxZ/zq7WLdKVes1HG/8Yn3KNuWZGcpeTs=
github.com/goplus/reflectx v1.2.1 h1:y3Bq7cmP/zO++VFpZetC3zljVM3LkGivh2GgUJLu4wI=
github.com/goplus/reflectx v1.2.1/go.mod h1:wHOS9ilbB4zrecI0W1dMmkW9JMcpXV7VjALVbNU9xfM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
Expand All @@ -28,8 +29,9 @@ github.com/peterh/liner v1.2.2/go.mod h1:xFwJyiKIXJZUKItq5dGHZSTBRAuG/CpeNpWLyiN
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/qiniu/x v1.13.0/go.mod h1:INZ2TSWSJVWO/RuELQROERcslBwVgFG7MkTfEdaQz9E=
github.com/qiniu/x v1.13.1 h1:hi7tkXFq6BWGbBpMoLV7kvA2elop69j6Kl7TlxnFAiU=
github.com/qiniu/x v1.13.1/go.mod h1:INZ2TSWSJVWO/RuELQROERcslBwVgFG7MkTfEdaQz9E=
github.com/qiniu/x v1.13.2 h1:mgWOfB9Rpk6AEtlBoObZVxH+b2FHSntYrxc4KX5Ta98=
github.com/qiniu/x v1.13.2/go.mod h1:INZ2TSWSJVWO/RuELQROERcslBwVgFG7MkTfEdaQz9E=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand Down
25 changes: 16 additions & 9 deletions gopbuild/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"fmt"
goast "go/ast"
"go/types"
"path"
"path/filepath"

"github.com/goplus/gop/ast"
Expand All @@ -35,6 +34,7 @@ import (
"github.com/goplus/gop/token"
"github.com/goplus/gox"
"github.com/goplus/igop"
"github.com/goplus/mod/modfile"

_ "github.com/goplus/igop/pkg/bufio"
_ "github.com/goplus/igop/pkg/fmt"
Expand Down Expand Up @@ -147,17 +147,24 @@ type Context struct {
}

func ClassKind(fname string) (isProj, ok bool) {
ext := path.Ext(fname)
if c, ok := projects[ext]; ok {
for _, w := range c.Works {
if w.Ext == ext {
if ext != c.Ext && fname != "main"+ext {
return false, true
ext := modfile.ClassExt(fname)
switch ext {
case ".gmx":
return true, true
case ".spx":
return fname == "main.spx", true
default:
if c, ok := projects[ext]; ok {
for _, w := range c.Works {
if w.Ext == ext {
if ext != c.Ext || fname != "main"+ext {
return false, true
}
break
}
break
}
return true, true
}
return true, true
}
return
}
Expand Down

0 comments on commit 220c124

Please sign in to comment.