Commit Graph

280 Commits

Author SHA1 Message Date
Elias Naur 9b2bdf6c0c cmd/gogio: bump Android target SDK to 31
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-03-08 10:49:32 +01:00
Inkeliz 668d0e7d79 cmd/gogio: use JAVA_HOME first
Tools such as the Android SDK `d8` looks for Java tools in JAVA_HOME
before PATH. We should match so we use the same tools, in particular to
make sure our Java version check report the version actually used.

Fixes: https://todo.sr.ht/~eliasnaur/gio/349
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2022-01-31 18:51:07 +01:00
Elias Naur 69a6b47f7b cmd/gogio: [Android] update arguments to d8
According to the d8 documentation[0] `--lib` should be used to specify
the path to android.jar, not `--classpath`. Also specify minimum SDK version
to allow d8 to perform version-specific optimizations.

May fix #349.

References: https://todo.sr.ht/~eliasnaur/gio/349
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-01-31 14:46:44 +01:00
Elias Naur cf54e39736 cmd/gogio: [Android] suggest only Java 1.8 when d8 fails
We're compiling with -target and -source set to 1.8, so 1.7 is not
adequate.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-01-21 17:57:52 +01:00
Elias Naur 2879fe8b41 cmd/gogio: add support for OpenJDK to java version detection
When the `d8` command from the Android SDK fails because of an incompatible
java version, the error message is cryptic. Before reporting the errors, we
attempt to detect incompatible versions and report a clearer error. This change
adds support for OpenJDK as well as other vendors to the detection logic.

Fixes: https://todo.sr.ht/~eliasnaur/gio/342
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-01-15 18:32:57 +01:00
Chris Waldon 99e3481419 cmd/gogio: allow missing tool version components
This commit changes the way that gogio searches for build tools
so that it correctly identifies versions like '31' as equivalent
to '31.0.0'. The Android SDK appears to not provide version
components in the path name when the component is zero.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
2022-01-04 17:42:10 +01:00
Inkeliz ac3bbc72ac cmd/gogio: add -minsdk to iOS
Before that patch the minimum iOS version was hardcoded. That patch makes possible
to change the minimum iOS version using `-minsdk`.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2022-01-04 17:35:48 +01:00
Elias Naur 6b7e6c85f4 cmd: update gioui.org dependency
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-11-10 16:01:16 +01:00
Elias Naur 3e0b72304a all: replace deprecated pointer.Rect with clip.Rect
Converted with

gofmt -w -r 'pointer.Rect(r) -> clip.Rect(r)' .
gofmt -w -r 'pointer.Ellipse(r) -> clip.Ellipse(layout.FRect(r))' .

combined with 'goimports -w .' to clean up imports.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-11-03 14:12:31 +01:00
Inkeliz dd3edf3c23 cmd/gogio: [android] add adaptive icon
This change adds basic support for adaptive icons:

https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-10-25 10:03:09 +02:00
Elias Naur a4242d04d1 cmd/gogio: ensure compatible gioui.org module version
Fixes gio#286

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-10-09 16:58:57 +02:00
Inkeliz 50476239f6 cmd/gogio: compile when no icon is found
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-10-03 15:48:02 +02:00
Elias Naur dae3b0fa5a cmd/gogio: [Android] report unsupported JDK versions when d8 fails
d8 doesn't check and fails with an inscrutable error when using
unsupported JDK versions such as JDK 11.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-09-11 09:31:24 +02:00
Elias Naur c175aaeb7c cmd: bump gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-09-10 08:25:53 +02:00
Felix Lange 0a4de4f88c cmd/gogio: handle darwin/arm64 in archNDK
This makes gogio builds work for android on darwin/arm64.

Signed-off-by: Felix Lange <fjl@twurst.com>
2021-09-03 14:46:33 +02:00
Elias Naur 9823e040de cmd/gogio: disable Wayland end-to-end tests
It works for me locally, but not on the builds.sr.ht builder.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-08-29 22:00:24 +02:00
Elias Naur ba421fb583 cmd: upgrade gio version
The support files for Android and iOS has moved from package
app/internal/wm to package app.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-08-29 22:00:24 +02:00
Elias Naur 45da52cee7 app: merge app/internal/wm into package app
The app and app/internal/wm packages are tightly coupled, requiring
quite a bit of forwarding types, values and constants from the internal
package to export it. Further, no other package imports package wm.

This change merges the two packages.

While here, drop the pre-Go 1.14 SIGPIPE workaround.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-08-29 22:00:16 +02:00
Elias Naur 04cc616e1f cmd/gogio: bump minimum iOS version to 10.0
The Go 1.17 runtime crashes on iOS 9 because clock_gettime is missing.
iOS 10 introduced clock_gettime.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-08-21 08:30:48 +02:00
Elias Naur 0d1ee09a64 cmd/gogio: set minimum iOS simulator version to 13
Metal is available from iOS 8 on devices, yet from version 13 on the
simulator.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-08-16 15:47:23 +02:00
Elias Naur a77d74f20a .builds: disable go.local.mod test for gogio
I gave up figuring out how to run it under Go 1.17.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-07-27 12:23:20 +02:00
Elias Naur 152a30f468 cmd/gogio: bump minimum Android SDK version to 17 (Android 4.2)
The CPU fallback renderer relies on posix_memalign, which was exposed in
Android 4.2. Support for Android 4.1 could be restored by writing
posix_memalign outselves, but this change is easier.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-07-26 16:43:29 +02:00
Elias Naur 060ae1cdf9 all: add //go:build lines
They're automatically added by Go 1.17 source formatters. This change
adds them all now.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-07-26 15:17:51 +02:00
Elias Naur bc7f7f6706 cmd/gogio: enable iPad support
Found by Christophe Meessen.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-06-25 14:44:26 +02:00
Inkeliz 1842b61935 cmd/gogio: [wasm] add favicon and title support
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-06-07 17:10:21 +02:00
Elias Naur a7be7cc22b .builds: bump android SDK version to fix gogio builds
Upgrade gogio's version of the gioui.org module while here.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-05-19 11:38:43 +02:00
Elias Naur 217f3f4de6 cmd/gogio: dump child program outputs to test log
Without logging, a failing child result in nondescript errors such as

windows_test.go:126: exit status 2

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-28 16:18:47 +02:00
Inkeliz b7dc407dbe cmd/gogio: [android] add support for AAB
That patch makes possible to generate Android App Bundle (`.aab`) instead
of APK. In order to generate AAB use `-o outputfile.aab`.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-03-25 08:19:41 +01:00
Elias Naur a50a0db3a2 cmd/gogio: bump screenshot retry timeout
Hoping to fix Wayland flakes:

 TestEndToEnd/X11_using_go_import_path: e2e_test.go:102: starting driver and gio app
    TestEndToEnd/Wayland: e2e_test.go:113: retrying after 200ms
    TestEndToEnd/Wayland: e2e_test.go:113: retrying after 400ms
    TestEndToEnd/Wayland: e2e_test.go:113: last error: encountered 12 color mismatches:
          5,5   got 0xffffffffffff, want 0xdedeadadbebe
        395,5   got 0xffffffffffff, want 0xdedeadadbebe
          5,295 got 0xffffffffffff, want 0xdedeadadbebe
        395,295 got 0xffffffffffff, want 0xdedeadadbebe
          5,305 got 0xffffffffffff, want 0x000000000000
        395,305 got 0xffffffffffff, want 0x000000000000
          5,595 got 0xffffffffffff, want 0x000000000000
        395,595 got 0xffffffffffff, want 0x000000000000
        405,305 got 0xffffffffffff, want 0xbbbbbbbbbbbb
        795,305 got 0xffffffffffff, want 0xbbbbbbbbbbbb
        405,595 got 0xffffffffffff, want 0xbbbbbbbbbbbb
        795,595 got 0xffffffffffff, want 0xbbbbbbbbbbbb

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-14 11:51:51 +01:00
Peter Sanford 2aa1cc8112 Add new permission: networkstate
For android this provides ACCESS_NETWORK_STATE

Signed-off-by: Peter Sanford <psanford@sanford.io>
2021-03-08 08:19:22 +01:00
Elias Naur 7059b6284a app/internal/wm: rename confusing app/internal/window
Package wm (for "window manager") is a better fit for the package, and
distinguishes it from the low-level package windows for the Windows API.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-06 14:28:57 +01:00
Elias Naur 8ff6546285 gpu,gpu/backend: implement generic backend.NewDevice
NewDevice creates a Device given an API, which is the necessary GPU
resources for a backend.

Convert gpu.New to take an API instead of a backend.Device directly.

In turn, this frees us to later unexport the backend package along with
the backend implementations (for now just gioui.org/gpu/gl for OpenGL).
It also allows programs that embed Gio (such as gioui.org/example/glfw)
to freely choose a backend, not just OpenGL.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-06 14:24:09 +01:00
Elias Naur 57dee8e61a cmd/gogio: bump Wine timeout for window movement
The Windows tests on builds.sr.ht are still flaky:

    TestEndToEnd/Windows: e2e_test.go:130: retrying after 400ms
    TestEndToEnd/Windows: e2e_test.go:130: retrying after 800ms
    TestEndToEnd/Windows: e2e_test.go:130: retrying after 1.6s
    TestEndToEnd/Windows: e2e_test.go:130: retrying after 2s
    TestEndToEnd/Windows: e2e_test.go:130: last error: encountered 6 color mismatches:
	5,5   got 0xffffffffffff, want 0xffff00000000
	395,5   got 0xffffffffffff, want 0xffff00000000
	5,305 got 0xffff00000000, want 0x000000000000
	395,305 got 0xffff00000000, want 0x000000000000
	405,305 got 0xffffffffffff, want 0xffff00000000
	795,305 got 0xffffffffffff, want 0xffff00000000
    TestEndToEnd/Windows: e2e_test.go:130: hit timeout of 4s after 6 tries

Bump the window movement delay in the hope that it helps.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-03 11:15:13 +01:00
Egon Elbre 60db802951 cmd/gogio: fix test work group handling
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2021-02-28 10:18:37 +01:00
Egon Elbre 2e15c3d5b9 cmd: fix hash to gioui.org
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2021-02-28 10:18:37 +01:00
Inkeliz 8227f7ab04 cmd/gogio: [android] update target sdk version
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-02-25 12:44:28 +01:00
Elias Naur 53763a3410 cmd/gogio: raise end-to-end test timeout
Windows tests often flake:

TestEndToEnd/Windows: e2e_test.go:113: last error: encountered 6 color mismatches:
          5,5   got 0xffffffffffff, want 0xdedeadadbebe
        395,5   got 0xffffffffffff, want 0xdedeadadbebe
          5,305 got 0xdedeadadbebe, want 0x000000000000
        395,305 got 0xdedeadadbebe, want 0x000000000000
        405,305 got 0xffffffffffff, want 0xbbbbbbbbbbbb
        795,305 got 0xffffffffffff, want 0xbbbbbbbbbbbb

Bump the timeout as a quick workaround.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-24 12:52:12 +01:00
Inkeliz 212f7809cb cmd/gogio: [android] allow custom signature-key
That change makes possible to provide custom PKCS#12 (JKS/PFX) using `-signkey` and the password with `-signpass`.

By default the gogio will use the `debug.keystore`, if no key is provided.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-02-24 12:34:43 +01:00
Inkeliz 2a7295750d cmd/gogio: fix icon/resources for Android
Previously that patch, gogio unzip the `link.apk` (generated by AAPT2) to an temporary folder and then compress it again to a new `app.ap_` file.

For some unknown reason, that unzip-then-zip doesn't work. The resources are included but is corrupted in somehow. That PR aims to fix that by avoid the extraction to an temporary folder.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-02-22 12:10:36 +01:00
Elias Naur ffb56f42b9 cmd/gogio/testdata: always clear background to white
The webassembly port changed to use transparent black to allow content
below Gio to show through. However, the end-to-end tests expect a white
background.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-18 09:06:24 +01:00
Elias Naur b420fdf096 cmd/gogio: remove obsolete headless chrome workaround
The two listed issues are fixed, and the builders pass with the
workaround removed.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-18 08:46:03 +01:00
Elias Naur d420654dbc cmd/gogio: fix argv passing from URL search fragment to Go program
Fixes the examples on gioui.org/doc/architecture.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-01 16:51:31 +01:00
Elias Naur 5dd3ce9923 cmd/gogio: [iOS] identify certificates by their SHA-1 fingerprint
Unlike the common name, the fingerprint is almost certainly unique.
Xcode uses the fingerprint as well.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-02-01 13:18:22 +01:00
Inkeliz 07715a8125 cmd/gogio: remove windres dependency
Now, it's possible to compile to Windows (`-target windows`) without
having `windres`. The PNG icon, manifest and version info will be
generated and include using `gogio`.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-01-07 09:49:26 +01:00
Walter Werner SCHNEIDER fd2d96adfc all: fix spelling errors
Signed-off-by: Walter Werner SCHNEIDER <contact@schnwalter.eu>
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-17 08:55:23 +01:00
Robin Eklind 9cc90d9695 cmd/gogio: sort and group imports using goimports
find gio/ -type f -name '*.go' | xargs -I '{}' goimports -w '{}'

Signed-off-by: Robin Eklind
2020-12-16 02:09:44 +01:00
Inkeliz fe844cc489 cmd/gogio: fix support for older browsers
That change removes the "??" operator, it isn't supported
by old browsers [0].

[0]: https://caniuse.com/mdn-javascript_operators_nullish_coalescing

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2020-12-14 16:33:56 +01:00
Inkeliz 745bb949bb cmd/gogio: [wasm] embed .js files
Similar to the Android, which includes all .jar files into the .apk.
Now, the `gogio -target js` will include all `*_js.js` files
into the resulting `wasm.js`.

That change make possible to adds custom wasm-imports, which might
be used in future versions of Gio.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2020-12-11 20:24:34 +01:00
Inkeliz fa96e12b6d cmd/gogio: add support for Windows
Now, gogio can build the program for Windows, using the `-target
windows`.

It will build with `-H=windowsgui`, by default. Also, it can compile for
multiple platforms if specified using `-target` (e.g. `-target arm, 386,
amd64`), the executable will have the respective suffix (i.e.
`_386.exe`).

gogio will also attach (any) appicon.png as executable icon resource and
include some information about the file and supported operating system.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2020-12-11 17:00:21 +01:00
Chris Waldon acc3f704e4 example/{kitchen,tabs,gophers}: update to use material.Palette
Update gioui.org/cmd while here.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
2020-12-06 23:04:52 +01:00