Commit Graph

70 Commits

Author SHA1 Message Date
Elias Naur 4a26bdad5d cmd/gogio: build for iOS/macOS without -fmodules and -fobjc-arc
The `gogio` tool adds the `-fmodules -fobjc-arc` flags to the Cgo
C flags. Unfortunately, that masks problems where Cgo packages
accidentally didn't have the flags in their #cgo directives such
as package log.

Move the flags so they're only explicitly mentioned when `gogio`
invokes the host compiler to build the `main.m` shim.

Fix package log to include the missing flags.

While we're here, silence OpenGL ES deprecation warnings on iOS, just
as we do for macOS. The warnings are normally not visible because
the gogio tool suppress output from the go tool.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-28 11:40:53 +01:00
Daniel Martí a0692d74af cmd/gogio: improve the UX of the e2e tests
First, add a headless boolean flag that defaults to true. That way, one
can run 'go test -headless=false' to, for example, see how Chrome runs
the webassembly endtoend test.

Second, skip the Chrome test if the browser isn't installed.

While at it, run 'gofmt -s' on the package.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
2019-10-27 21:31:53 +01:00
Elias Naur 3de204b8ef cmd/gogio/testdata: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-27 15:42:18 +01:00
Greg Pomerantz 175144fa99 cmd/gogio: Android: include jar files from package directory
Look for *.jar files in package directory for inclusion in
Android .apk file.

Signed-off-by: Greg Pomerantz <gmp.gio@wow.st>
2019-10-18 16:45:43 +02:00
Elias Naur fc521ec1ff cmd/gogio: update gio version
The path of the supporting Android Java files and iOS header file
moved.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 16:43:21 +02:00
Elias Naur 651e31f7e0 cmd/gogio: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 15:42:47 +02:00
Elias Naur e4b1a46dd2 cmd/gogio: create a temporary signing key if debug.keystore isn't found
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-09 19:08:28 +02:00
Elias Naur 468731538e cmd/gogio: look for javac in JAVA_HOME if it is not in PATH
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-09 18:38:05 +02:00
Elias Naur b749c5dd28 cmd/gogio: fix Android toolchain path for Windows 64-bit
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-09 18:27:09 +02:00
Elias Naur e9db3801cc cmd/gogio: rename gio* files to main*
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-08 13:10:58 +02:00
Greg Pomerantz 81814e6fa4 cmd/gogio: add -minversion flag to specify minimum Android platform
Allow the user to specify a minimum supported Android platform
version.

Signed-off-by: Greg Pomerantz <gmp.gio@wow.st>
2019-10-07 17:00:24 +02:00
Elias Naur 6bc5ff2479 apps: updates for renamed and moved packages
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 17:00:22 +02:00
Elias Naur 3784ece6dd all: rename package ui to unit
Package ui is now only about units except for the Config.Now method.
Remove Now and rename Config to Converter. Add layout.Config to
replace the old ui.Config.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 16:55:47 +02:00
Elias Naur beaec661d2 op/paint: move paint package below the op package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 16:55:47 +02:00
Elias Naur 8cf35a1f97 op: add package op for operations
Extract operation types from package ui into package op.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 16:55:47 +02:00
Elias Naur 3c65aa61f6 cmd/gogio,ui: fixups after gioui.org module rename
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 13:04:10 +02:00
Elias Naur 962bc36dac apps,cmd: update to renamed gioui.org module
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 12:41:29 +02:00
Daniel Martí 687ea833a3 cmd/gogio: add the first end-to-end test for js via chrome
This commit adds the first fully end-to-end test. It builds a very
simple Gio app, loads it on Chrome, and checks that it works.

To control Chrome, we use chromedp, a library in pure Go that takes care
of starting the browser and talking to it via the devtools protocol.

We add the test directly in the cmd module, since it mainly interacts
with the gogio tool, and also because the code might turn into some sort
of 'gogio test' command in the future. This does add chromedp and ui as
test dependencies to go.mod, but GOPROXY should allow a 'go get' of
gogio to not download their entire source code archives.

We don't replace ui with ../../ui in the go.mod, to ensure that testing
the cmd module works from anywhere without unintended differences.

The test app being used is inside a testdata directory, to ensure it's
not go-gettable, and that it doesn't otherwise affect the cmd module.

Finally, the test itself is pretty simple. The app just paints a red
background, and the test verifies that, once loaded, the background of
the browser viewport is indeed red.

The test does currently require Chrome or Chromium to be installed,
which is fine for now. It may also require a GPU, though I don't have a
headless machine to check for sure. The test uses Chrome in headless
mode though, so it doesn't open up any visible browser window.

All in all, the test succeeds in just over a second on my laptop with
Chromium 77.0.3865.75.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
2019-09-23 21:23:31 +02:00
Elias Naur a12912c944 cmd/gogio: rename the gio too to gogio
The `gio` name clashes with a widely deployed GNOME tool.
Rename our tool to `gogio`, "the go tool for gio programs".

Fixes gio#20

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-18 22:46:47 +02:00
Daniel Martí a223b36c25 cmd/gio: avoid a trailing newline in -target errors
I was seeing an extra newline when some errors were printed, like:

	$ gio foo
	please specify target

	$

The source of the little bug was a trailing newline in the error
messages. Printing the messages already adds a newline.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
2019-09-13 18:36:19 +02:00
Greg Pomerantz a68d97f947 cmd/gio: generate appID if not specified
Use the Go import path to create an appID based on the domain name
plus the last directory location in the import path.

Signed-off-by: Greg Pomerantz <gmp.gio@wow.st>
2019-09-11 10:08:04 +02:00
Daniel Martí 85843f1f29 all: update go.mod files to target Go 1.13
Since the main README recommends Go 1.13 or later, let's make the go.mod
files reflect that. This will enable starting to use new language
features.

Modules that still build on 1.12 will continue to work on that version
just fine; this line is just a hint to enable new language features for
versions of Go new enough.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
2019-09-07 11:18:37 +02:00
Daniel Martí e8ba5b6aff all: remove a couple of unused parameters
Both from unexported functions, to keep the change low-risk. Found via
unparam.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
2019-08-25 22:48:15 +01:00
Daniel Martí 2542c55e9d all: fix some issues spotted by static analysis
First, vet was upset by two incorrect fmt verbs. One was an extra %x,
when there was just one argument, so remove it. Another was a %p with a
non-pointer. It's a struct, so for now simply use %#v.

Second, staticcheck found some unused or unnecessary bits of code;
remove the obvious ones.

Finally, staticcheck also complained about some error strings which were
capitalized or had periods. Adjust those, which also makes all error
messages more consistent.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
2019-08-25 22:41:05 +01:00
Elias Naur 44c7be6750 cmd/gio: expand usage document
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-24 22:48:00 +01:00
Elias Naur 470478e574 cmd/gio: replace errorf with a main function returning errors
While we're here, split the usage print out to its own function and
don't display the usage when a package is missing.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-24 21:44:21 +01:00
Elias Naur 7780cf1353 cmd/gio: use path.Base for Go import paths
Go import paths always use forward slashes as separators.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-24 17:44:51 +01:00
Elias Naur 6433cb2d88 cmd/gio: change all occurences of *appID with the buildInfo field
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-24 17:44:14 +01:00
Elias Naur 1f918c751e cmd/gio: use package name for iOS binaries
To make it easier to locate the app in the Console app.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-20 11:10:59 +02:00
Elias Naur c52376065e cmd/gio: list available bundle ids when no match was found
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-16 14:24:58 +02:00
Elias Naur 9d9051d468 cmd/gio: provide DT* fields in iOS Info.plists
Required by App Store.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-16 13:50:55 +02:00
Elias Naur 6007a8c90e cmd/gio: specify CFBundleSupportedPlatforms in iOS ipa bundles
Required by App Store.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-16 12:53:09 +02:00
Elias Naur c4e46e0348 cmd/gio: add support for iOS App Store icons
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-16 12:32:53 +02:00
Elias Naur 50599bc65d cmd/gio: support app icons
If there is an appicon.png file in the main package the gio tool
will use it for Android and iOS apps in buildmode exe.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-16 12:08:44 +02:00
Elias Naur c578043970 cmd/gio: handle subdirectories in apk files
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-15 17:50:56 +02:00
Elias Naur 2440e1880e cmd/gio: specify UISupportedInterfaceOrientations
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-15 09:43:31 +02:00
Elias Naur b10175b233 cmd/gio: add -version flag
For Android and iOS.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-14 17:09:44 +02:00
Elias Naur 105d094030 cmd/gio: drop appDir function
It's not worth its weight.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-14 17:02:36 +02:00
Elias Naur 632e4e3ae6 cmd/gio: specify UIDeviceFamily
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-14 16:52:58 +02:00
Elias Naur ed0bbe9dd2 cmd/gio: filter out unsupported architectures, specify MinimumOSVersion
For the App Store.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-14 16:43:44 +02:00
Elias Naur 5ac1b6ea3c cmd/gio: set DTPlatformName, DTPlatformVersion, UIRequiredDeviceCapabilities
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-14 14:59:27 +02:00
Elias Naur 564f30ca0f cmd/gio: use the package name for app directories inside ipa files
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-14 14:24:51 +02:00
Elias Naur 2a07890086 cmd/gio: add provisioning file to ipa apps
Required by App Store.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-14 12:49:50 +02:00
Elias Naur 3c69c81401 cmd/gio: add package documentation
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-11 20:03:39 +02:00
Elias Naur f223c7b0c9 cmd/gio: clarify usage summary
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-07 14:01:32 +02:00
Elias Naur ddcbccf041 cmd/gio: simplify -o flag description
Only mention the special case for iOS simulators.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-07 12:37:44 +02:00
Elias Naur 8472bbc78b ui/app,cmd/gio: move running of main from driver to GioAppDelegate
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-05 15:38:34 +02:00
Elias Naur 6ce224b89f cmd/gio: don't strip debug info for webassembly builds
The space savings are minimal and we lose function names in the
browser debuggers.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-02 15:48:27 +02:00
Elias Naur 1c5ceab9c1 cmd/gio: don't add a container div for -target js
THe webassembly backend can create and add it itself.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-08-02 09:05:34 +02:00
Elias Naur 5bf5f1e64d cmd/gio: (wasm) support command line flags
Strip also DWARF and the symbol table while here.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-29 13:36:12 +02:00