mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
This commit adds comprehensive Android support for Wails v3, enabling Go applications to run as native Android apps with WebView-based UI. Key features: - Android-specific application implementation with JNI bridge - WebView integration via WebViewAssetLoader for serving assets - JavaScript runtime injection and execution via JNI callbacks - Binding call support with async result callbacks - Event system support for Android platform - Full example Android app with Gradle build system Technical details: - Uses CGO with Android NDK for cross-compilation - Implements JNI callbacks for Go <-> Java communication - Supports both ARM64 and x86_64 architectures - WebView debugging support via Chrome DevTools Protocol - Handles empty response body case in binding calls to prevent panic Files added: - v3/pkg/application/*_android.go - Android platform implementations - v3/pkg/events/events_android.go - Android event definitions - v3/internal/*/\*_android.go - Android-specific internal packages - v3/examples/android/ - Complete example Android application - v3/ANDROID_ARCHITECTURE.md - Architecture documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
81 lines
2.8 KiB
YAML
81 lines
2.8 KiB
YAML
version: '3'
|
|
|
|
includes:
|
|
common: ../Taskfile.yml
|
|
|
|
tasks:
|
|
build:
|
|
summary: Creates a production build of the application
|
|
deps:
|
|
- task: common:go:mod:tidy
|
|
- task: common:build:frontend
|
|
vars:
|
|
BUILD_FLAGS:
|
|
ref: .BUILD_FLAGS
|
|
PRODUCTION:
|
|
ref: .PRODUCTION
|
|
- task: common:generate:icons
|
|
cmds:
|
|
- go build {{.BUILD_FLAGS}} -o {{.OUTPUT}}
|
|
vars:
|
|
BUILD_FLAGS: '{{if eq .PRODUCTION "true"}}-tags production -trimpath -buildvcs=false -ldflags="-w -s"{{else}}-buildvcs=false -gcflags=all="-l"{{end}}'
|
|
DEFAULT_OUTPUT: '{{.BIN_DIR}}/{{.APP_NAME}}'
|
|
OUTPUT: '{{ .OUTPUT | default .DEFAULT_OUTPUT }}'
|
|
env:
|
|
GOOS: darwin
|
|
CGO_ENABLED: 1
|
|
GOARCH: '{{.ARCH | default ARCH}}'
|
|
CGO_CFLAGS: "-mmacosx-version-min=10.15"
|
|
CGO_LDFLAGS: "-mmacosx-version-min=10.15"
|
|
MACOSX_DEPLOYMENT_TARGET: "10.15"
|
|
PRODUCTION: '{{.PRODUCTION | default "false"}}'
|
|
|
|
build:universal:
|
|
summary: Builds darwin universal binary (arm64 + amd64)
|
|
deps:
|
|
- task: build
|
|
vars:
|
|
ARCH: amd64
|
|
OUTPUT: "{{.BIN_DIR}}/{{.APP_NAME}}-amd64"
|
|
- task: build
|
|
vars:
|
|
ARCH: arm64
|
|
OUTPUT: "{{.BIN_DIR}}/{{.APP_NAME}}-arm64"
|
|
cmds:
|
|
- lipo -create -output "{{.BIN_DIR}}/{{.APP_NAME}}" "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" "{{.BIN_DIR}}/{{.APP_NAME}}-arm64"
|
|
- rm "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" "{{.BIN_DIR}}/{{.APP_NAME}}-arm64"
|
|
|
|
package:
|
|
summary: Packages a production build of the application into a `.app` bundle
|
|
deps:
|
|
- task: build
|
|
vars:
|
|
PRODUCTION: "true"
|
|
cmds:
|
|
- task: create:app:bundle
|
|
|
|
package:universal:
|
|
summary: Packages darwin universal binary (arm64 + amd64)
|
|
deps:
|
|
- task: build:universal
|
|
cmds:
|
|
- task: create:app:bundle
|
|
|
|
|
|
create:app:bundle:
|
|
summary: Creates an `.app` bundle
|
|
cmds:
|
|
- mkdir -p {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/{MacOS,Resources}
|
|
- cp build/darwin/icons.icns {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/Resources
|
|
- cp {{.BIN_DIR}}/{{.APP_NAME}} {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents/MacOS
|
|
- cp build/darwin/Info.plist {{.BIN_DIR}}/{{.APP_NAME}}.app/Contents
|
|
- codesign --force --deep --sign - {{.BIN_DIR}}/{{.APP_NAME}}.app
|
|
|
|
run:
|
|
cmds:
|
|
- mkdir -p {{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/{MacOS,Resources}
|
|
- cp build/darwin/icons.icns {{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/Resources
|
|
- cp {{.BIN_DIR}}/{{.APP_NAME}} {{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/MacOS
|
|
- cp build/darwin/Info.dev.plist {{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/Info.plist
|
|
- codesign --force --deep --sign - {{.BIN_DIR}}/{{.APP_NAME}}.dev.app
|
|
- '{{.BIN_DIR}}/{{.APP_NAME}}.dev.app/Contents/MacOS/{{.APP_NAME}}'
|