Compare commits

...

6 Commits

Author SHA1 Message Date
Kenny
ba037eac0f
Merge 37ed48db86 into 59521d715b 2024-03-27 14:59:45 +09:00
Hajime Hoshi
59521d715b all: update go-text 2024-03-27 14:55:02 +09:00
Hajime Hoshi
11398f3bb5 ebiten: rename BuildTag -> BuildConstraints 2024-03-27 14:50:09 +09:00
Hajime Hoshi
5c0c084b6e cmd/ebitenmobile: update the default Android SDK version to 21 2024-03-27 14:23:00 +09:00
Hajime Hoshi
25a814d561 cmd/ebitenmobile: bug fix: wrong path was used
Updates #2937
2024-03-27 12:30:12 +09:00
Hajime Hoshi
0ab4538fa1 all: update gomobile
Closes #2937
2024-03-27 11:55:08 +09:00
4 changed files with 37 additions and 23 deletions

View File

@ -54,11 +54,6 @@ func goEnv(name string) string {
return strings.TrimSpace(string(val))
}
const (
// Copied from gomobile.
minAndroidAPI = 15
)
var (
buildA bool // -a
buildI bool // -i
@ -99,6 +94,11 @@ func main() {
flag.Usage()
}
// minAndroidAPI specifies the minimum API version for Android.
// Now Google Player v23.30.99+ drops the API level that is older than 21.
// See https://apilevels.com/.
const minAndroidAPI = 21
var flagset flag.FlagSet
flagset.StringVar(&buildO, "o", "", "")
flagset.StringVar(&buildGcflags, "gcflags", "", "")
@ -150,6 +150,20 @@ func main() {
log.Fatal(err)
}
// If args doesn't include '-androidapi', set it to args explicitly.
// It's because ebitenmobile's default API level is different from gomobile's one.
if buildTarget == "android" && buildAndroidAPI == minAndroidAPI {
var found bool
flag.Visit(func(f *flag.Flag) {
if f.Name == "androidapi" {
found = true
}
})
if !found {
args = append([]string{args[0], "-androidapi", fmt.Sprintf("%d", minAndroidAPI)}, args[1:]...)
}
}
if err := doBind(args, &flagset, buildTarget); err != nil {
log.Fatal(err)
}
@ -251,7 +265,7 @@ func doBind(args []string, flagset *flag.FlagSet, buildOS string) error {
// TODO: strings.Title is used here for the consistency with gomobile (see cmd/gomobile/bind_iosapp.go).
// As strings.Title is deprecated, golang.org/x/text/cases should be used.
frameworkNameBase = strings.Title(frameworkNameBase)
dir := filepath.Join(buildO, name, frameworkNameBase+".framework", "Versions", "A")
dir := filepath.Join(buildO, name, frameworkNameBase+".framework")
if err := os.WriteFile(filepath.Join(dir, "Headers", prefixUpper+"EbitenViewController.h"), []byte(replacePrefixes(objcH)), 0644); err != nil {
return err

View File

@ -576,7 +576,7 @@ const uiGLFWKeysTmpl = `{{.License}}
{{.DoNotEdit}}
{{.BuildTag}}
{{.BuildConstraints}}
package ui
@ -594,7 +594,7 @@ const uiJSKeysTmpl = `{{.License}}
{{.DoNotEdit}}
{{.BuildTag}}
{{.BuildConstraints}}
package ui
@ -612,7 +612,7 @@ const glfwKeysTmpl = `{{.License}}
{{.DoNotEdit}}
{{.BuildTag}}
{{.BuildConstraints}}
package glfw
@ -626,7 +626,7 @@ const mobileAndroidKeysTmpl = `{{.License}}
{{.DoNotEdit}}
{{.BuildTag}}
{{.BuildConstraints}}
package ebitenmobileview
@ -644,7 +644,7 @@ const mobileIOSKeysTmpl = `{{.License}}
{{.DoNotEdit}}
{{.BuildTag}}
{{.BuildConstraints}}
package ebitenmobileview
@ -799,20 +799,20 @@ func main() {
// The build tag can't be included in the templates because of `go vet`.
// Pass the build tag and extract this in the template to make `go vet` happy.
buildTag := ""
buildConstraints := ""
switch path {
case filepath.Join("internal", "glfw", "keys.go"):
buildTag = "//go:build darwin || freebsd || linux || netbsd || openbsd || windows"
buildConstraints = "//go:build darwin || freebsd || linux || netbsd || openbsd || windows"
case filepath.Join("internal", "ui", "keys_mobile.go"):
buildTag = "//go:build android || ios"
buildConstraints = "//go:build android || ios"
case filepath.Join("internal", "ui", "keys_glfw.go"):
buildTag = "//go:build !android && !ios && !js && !nintendosdk && !playstation5"
buildConstraints = "//go:build !android && !ios && !js && !nintendosdk && !playstation5"
}
// NOTE: According to godoc, maps are automatically sorted by key.
if err := tmpl.Execute(f, struct {
License string
DoNotEdit string
BuildTag string
BuildConstraints string
UIKeyNameToJSCode map[string]string
EbitengineKeyNames []string
EbitengineKeyNamesWithoutOld []string
@ -826,7 +826,7 @@ func main() {
}{
License: license,
DoNotEdit: doNotEdit,
BuildTag: buildTag,
BuildConstraints: buildConstraints,
UIKeyNameToJSCode: uiKeyNameToJSCode,
EbitengineKeyNames: ebitengineKeyNames,
EbitengineKeyNamesWithoutOld: ebitengineKeyNamesWithoutOld,

4
go.mod
View File

@ -3,11 +3,11 @@ module github.com/hajimehoshi/ebiten/v2
go 1.18
require (
github.com/ebitengine/gomobile v0.0.0-20240320163605-0b2c67584a2b
github.com/ebitengine/gomobile v0.0.0-20240327025426-b04d93b1a983
github.com/ebitengine/hideconsole v1.0.0
github.com/ebitengine/oto/v3 v3.2.0-alpha.4
github.com/ebitengine/purego v0.7.0-alpha.3
github.com/go-text/typesetting v0.1.1-0.20240319115800-09fd9aa0cd1b
github.com/go-text/typesetting v0.1.1-0.20240325125605-c7936fe59984
github.com/hajimehoshi/bitmapfont/v3 v3.0.0
github.com/hajimehoshi/go-mp3 v0.3.4
github.com/jakecoffman/cp v1.2.1

8
go.sum
View File

@ -1,13 +1,13 @@
github.com/ebitengine/gomobile v0.0.0-20240320163605-0b2c67584a2b h1:ccykWd0kO+TooxL9yKfKsI3RB/yK+k/a4vdlA4Q9th8=
github.com/ebitengine/gomobile v0.0.0-20240320163605-0b2c67584a2b/go.mod h1:tWboRRNagZwwwis4QIgEFG1ZNFwBJ3LAhSLAXAAxobQ=
github.com/ebitengine/gomobile v0.0.0-20240327025426-b04d93b1a983 h1:hHib1v7Z+pXVENSB5x3EF8eQJThPhRfj35RymJFVgm0=
github.com/ebitengine/gomobile v0.0.0-20240327025426-b04d93b1a983/go.mod h1:tWboRRNagZwwwis4QIgEFG1ZNFwBJ3LAhSLAXAAxobQ=
github.com/ebitengine/hideconsole v1.0.0 h1:5J4U0kXF+pv/DhiXt5/lTz0eO5ogJ1iXb8Yj1yReDqE=
github.com/ebitengine/hideconsole v1.0.0/go.mod h1:hTTBTvVYWKBuxPr7peweneWdkUwEuHuB3C1R/ielR1A=
github.com/ebitengine/oto/v3 v3.2.0-alpha.4 h1:aaUdcbEDUV1oErHDv/Cd0IAjQaQPChZuvO8Cn/kQHE8=
github.com/ebitengine/oto/v3 v3.2.0-alpha.4/go.mod h1:JtMbxJHZBDXfS8BmVYwzWk9Z6r7jsjwsHzOuZrEkfs4=
github.com/ebitengine/purego v0.7.0-alpha.3 h1:9hH1aneqLaM3sM+PMUgRJVsMe2SqfVjZtV3DEzxBDJU=
github.com/ebitengine/purego v0.7.0-alpha.3/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ=
github.com/go-text/typesetting v0.1.1-0.20240319115800-09fd9aa0cd1b h1:CPNyzp2f5+D9FDN7yT6pXWTDAmpnpjnWi5jt3bKPJyA=
github.com/go-text/typesetting v0.1.1-0.20240319115800-09fd9aa0cd1b/go.mod h1:2+owI/sxa73XA581LAzVuEBZ3WEEV2pXeDswCH/3i1I=
github.com/go-text/typesetting v0.1.1-0.20240325125605-c7936fe59984 h1:NwCC36eQsDf1xVZG9jD7ngXNNjsvk8KXky15ogA1Vo0=
github.com/go-text/typesetting v0.1.1-0.20240325125605-c7936fe59984/go.mod h1:2+owI/sxa73XA581LAzVuEBZ3WEEV2pXeDswCH/3i1I=
github.com/go-text/typesetting-utils v0.0.0-20240317173224-1986cbe96c66 h1:GUrm65PQPlhFSKjLPGOZNPNxLCybjzjYBzjfoBGaDUY=
github.com/hajimehoshi/bitmapfont/v3 v3.0.0 h1:r2+6gYK38nfztS/et50gHAswb9hXgxXECYgE8Nczmi4=
github.com/hajimehoshi/bitmapfont/v3 v3.0.0/go.mod h1:+CxxG+uMmgU4mI2poq944i3uZ6UYFfAkj9V6WqmuvZA=