[mirror] Go on Mobile

Overview

Go support for Mobile devices

Go Reference

The Go mobile repository holds packages and build tools for using Go on mobile platforms.

Package documentation as a starting point:

Caution image

The Go Mobile project is experimental. Use this at your own risk. While we are working hard to improve it, neither Google nor the Go team can provide end-user support.

This is early work and installing the build system requires Go 1.5. Follow the instructions on golang.org/wiki/Mobile to install the gomobile command, build the basic and the bind example apps.

--

Contributions to Go are appreciated. See https://golang.org/doc/contribute.html.

Issues
  • cmd/gomobile: improve support for macOS and Catalyst

    cmd/gomobile: improve support for macOS and Catalyst

    This is is a follow-up from my previous PR (#65). It makes gomobile aware of GOOS=ios and adds support for specifying specific Apple platforms, instead of overloading the "ios" platform.

    Supported platforms: ios, iossimulator, macos, and maccatalyst

    These can now be specified the -target argument to gomobile, e.g.: gomobile build -target=ios,iossimulator,macos,maccatalyst

    It preserves the current behavior of -target=ios, which will build for ios and iossimulator on supported architectures (arm64 and amd64).

    It adds platform-specific build tags so Go code can discriminate between different Apple platforms like maccatalyst (UIKit on macOS).

    This PR also fixes a number of broken tests.

    TODO: cgo has a bug where c-archive builds targeting Catalyst will fail unless -tags=ios is supplied. See https://golang.org/issues/47228

    Fixes https://golang.org/issues/47212 Updates https://golang.org/issues/47228

    cla: yes 
    opened by ydnar 101
  • cmd/gomobile: support macOS and Catalyst

    cmd/gomobile: support macOS and Catalyst

    Add support for macOS (non-Catalyst) and Catalyst targets.

    The compiled library is packaged into a "fat" XCFramework file (as opposed to a Framework), which includes binaries for iOS, macOS, MacCatalyst (iOS on macOS), and iOS Simulator targets, for amd64 and arm64 architectures.

    The generated XCFramework file is suitable for distribution as a binary Swift Package Manager package: https://developer.apple.com/documentation/swift_packages/distributing_binary_frameworks_as_swift_packages

    This change is based on earlier work: https://github.com/golang/mobile/pull/45 https://github.com/golang/mobile/pull/63

    Fixes golang/go#36856

    cla: yes 
    opened by ydnar 65
  • cmd/gomobile: add missing latest tag to gobind

    cmd/gomobile: add missing latest tag to gobind

    Go install requires a version to be provided after the package name. gomobile init command is updated to reflect this new requirement

    Fixes golang/go#50994

    opened by morningsend 34
  • Support building for target catalyst

    Support building for target catalyst

    As of macOS 10.15 target catalyst can be used to build an iPad app to run on macOS. Existing .Framework built with gomobile produces the following error when targetting catalyst:

    error: Building for Mac Catalyst, but the linked framework 'Sample.framework' was built for iOS + iOS Simulator.
    You may need to restrict the platforms for which this framework should be linked in the target editor, or replace it with an XCFramework that supports both platforms. (in target 'MySampleApp' from project 'MySampleApp')
    

    ~~This PR adds a case for catalyst (although architecture is just amd64) when configuring the environment for each architecture, providing the flags needed to enable the built .Framework to be used with catalyst.~~

    Fixes https://github.com/golang/go/issues/36856

    Update 18-Jan-2021

    This PR has been updated to provide nominally working support of .xcframework generation with go1.15, which has removed support for some 32 bit architectures. See: https://github.com/dpwiese/mobile/pull/1#issuecomment-761931422. In addition, unlike https://github.com/dpwiese/mobile/pull/1 this PR doesn't require manual thinning or combining of the generated .frameworks for each of the various "architectures" - this is now done automatically.

    Todo Running go test fails with the following.

    bind_test.go:321: gomobile bind failed: exit status 1
        /var/folders/rx/h40bjl5n0s1fvr5h2w278tm80000gn/T/gomobile-test335293790/gomobile: darwin-catalyst: go build -tags ios -buildmode=c-archive -o /var/folders/rx/h40bjl5n0s1fvr5h2w278tm80000gn/T/gomobile-work-224727912/Cgopkg-amd64.a ./gobind failed: exit status 1
        go: cannot determine module path for source directory /private/var/folders/rx/h40bjl5n0s1fvr5h2w278tm80000gn/T/gomobile-work-224727912/src (outside GOPATH, module path must be specified)
    

    Note: on current master branch TestIOSBuild fails

    cla: yes 
    opened by dpwiese 26
  • bind: annotate ObjC types with nullability annotations

    bind: annotate ObjC types with nullability annotations

    This highly improves interop with Swift. It would map all pointers as implicitly unwrapped optionals, which skip all null safety checks. Adding _Nullable to pointer types makes swift map them as optionals.

    Also constructors are now nullable since it's valid to return nil from Go code.

    cla: yes 
    opened by champo 21
  • cmd/gomobile: support Catalyst and Apple Silicon

    cmd/gomobile: support Catalyst and Apple Silicon

    This PR is derived from golang/mobile#45 .

    I changed the build process and it will create 3 frameworks for ios, simulator and catalyst. Every framework has a fat library contains both arm64 and x86_64 (except ios that only needs arm64).

    Finally create one xcframework from all 3 fat frameworks and this xcframework contains every platform and architecture.

    cla: yes 
    opened by waylybaye 19
  • cmd/gomobile: remove unnecessary IsDir check

    cmd/gomobile: remove unnecessary IsDir check

    The check when looking for android platform is unnecessarily stringent in that the error would be caught by the call to os.Stat, and it fails when the android platform folder is a symlink, which is the case when developing on NixOs.

    cla: yes 
    opened by jmorag 17
  • example: add Swift Package Manager example

    example: add Swift Package Manager example

    Add an example Swift package built with gomobile for multiple Apple platforms (ios, iosimulator, macos, and maccatalyst).

    It builds an XCFramework file which is linked as a binary dependency by Swift Package Manager. The resulting Swift package can be imported into an iOS, macOS, or Catalyst app and called from Swift.

    It has tests written in Swift. To run the tests, run swift test from the example/swift-package directory.

    Depends on golang.org/cl/334689 (golang/mobile#70).

    cla: yes 
    opened by ydnar 13
  • bind/java: Do not get ApplicationContext via reflection, ask for it when needed.

    bind/java: Do not get ApplicationContext via reflection, ask for it when needed.

    Previously any library created using gobind used reflection to get the ApplicationContext. The methods used are disallowed in Android 9 causing any library to crash. However the ApplictionContext is not required and only needed when using RunOnJvm. This change adds an method to set the ApplicationContext when needed, but will not get it by default by using reflection.

    Fixes #31364

    cla: yes 
    opened by timcooijmans 12
  • example: updates for XCFramework and Mac Catalyst

    example: updates for XCFramework and Mac Catalyst

    This updates examples for the changes in golang.org/cl/334689 for .xcframework files and Mac Catalyst.

    Depends on golang.org/cl/334689

    https://go-review.googlesource.com/c/mobile/+/334689/28/example/bind/ios/README#1

    cla: yes 
    opened by ydnar 11
  • cmd/gomobile: xcframework and catalyst support

    cmd/gomobile: xcframework and catalyst support

    Talked with @waylybaye offline, I decided to continue #63 and #45.

    @waylybaye:

    I changed the build process and it will create 3 frameworks for ios, simulator and catalyst. Every framework has a fat library contains both arm64 and x86_64 (except ios that only needs arm64).

    Finally create one xcframework from all 3 fat frameworks and this xcframework contains every platform and architecture.

    Review comments at https://go-review.googlesource.com/c/mobile/+/288752 should be mostly resolved.

    cla: yes 
    opened by imWildCat 10
  • onLowMemory funktionality

    onLowMemory funktionality

    I think this change (https://github.com/fyne-io/fyne/pull/2956) should be added to gomobile too, it is only 2 rows of imports and 2 rows to release memory if Android OS send onLowMemory signal ...

    opened by MatejMagat305 8
  • cmd/gomobile: Use parallel build for frameworks on Apple platforms

    cmd/gomobile: Use parallel build for frameworks on Apple platforms

    Currently the build for different targets and CPU architectures is sequential. Even for a small project, it usually takes about one minute to build for -target maccatalyst,ios,iossimulator,macos, which is very different from our perception of build speed of Golang. By adopting this parallel build approach, we can save a lot of time.

    Simple visualization (gomobile bind -target maccatalyst,ios,iossimulator,macos ...):

    Main Branch

    1. Build Mac Catalyst (amd64)
    2. Build Mac Catalyst (arm64)
      • Merge into a fat binary
    3. Build iOS (arm64)
    4. Build iOS Simulator (amd64)
    5. Build iOS Simulator (arm64)
      • Merge into a fat binary
    6. Build macOS (amd64)
    7. Build macOS (arm64)
      • Merge into a fat binary
    8. Create xcframework

    This PR

    1. Build different architectures in parallel
    2. Merge different architectures for a single target into a fat binary (this is the limitation of xcodebuild. In theory, we don't need to do so. Reference: https://developer.apple.com/forums/thread/666335?answerId=685927022#685927022)
    3. Create xcframework

    Quick Benchmark

    Local machine comparison with a minimal demo Golang project (on M1 Max):

    Sample 1

    Official demo: https://github.com/golang/mobile/tree/master/example/bind/hello

    # This PR
    $ time gomobile-parallel bind -v -target maccatalyst,ios,iossimulator,macos -o /path/to/parallel/Demo.xcframework
    gomobile-parallel bind -v -target  -o   29.46s user 18.07s system 303% cpu 15.645 total
    
    # Main Branch
    $ time gomobile bind -v -target maccatalyst,ios,iossimulator,macos -o /path/to/sequential/Demo.xcframework
    gomobile bind -v -target maccatalyst,ios,iossimulator,macos -o   27.10s user 13.18s system 77% cpu 52.052 total
    

    Sample 2

    # This PR
    gomobile-parallel bind -target  -o   30.98s user 17.43s system 183% cpu 26.400 total
    
    # Main branch
    gomobile bind -target maccatalyst,ios,iossimulator,macos -o   25.80s user 13.17s system 38% cpu 1:42.43 total
    
    opened by imWildCat 10
  • Draft: Mz mods

    Draft: Mz mods

    I propose some changes, which I'm currently implementing in my project. It's not necessary to merge it, but to trigger the discussion about the extension of key codes. It's related to shiny experimental package. More PRs will be coming by me in next week related to shiny pkg.

    cla: yes 
    opened by misak113 1
  • Add ability to disable bitcode

    Add ability to disable bitcode

    Description

    This PR adds a new DISABLE_BITCODE environment variable to be able to disable bitcode.

    Why

    Currently bitcode embedding is enabled by default for go >= 1.14 and there was no way to disable it.

    In our celo-org/celo-blockchain project (written in Go) we currently need bitcode disabled because one of the dependencies is written in Rust and we've had compatibility issues with the Rust generated bitcode and recent version of Xcode.

    We were good with go 1.13 (bitcode is disabled there), but we wanted to upgrade to go 1.14 and got the following error:

    go build runtime/cgo: invalid flag in go:cgo_ldflag: -fembed-bitcode
    

    See more in https://app.circleci.com/pipelines/github/celo-org/celo-blockchain/4999/workflows/9807228b-1b99-44f2-90f7-371bfeba9e97/jobs/46791

    cla: no 
    opened by jeanregisser 2
  • cmd/gomobile: add a flag to manually specify a work dir

    cmd/gomobile: add a flag to manually specify a work dir

    Added a flag to manually specify a work dir to avoid having to rebuild everything from scratch when using gomobile through go module.

    Particularly useful in the context of a large project that takes several tens of minutes to build, especially when only one or two packages need to be recompiled.

    Fixes https://github.com/golang/go/issues/37902

    cla: yes 
    opened by aeddi 17
Owner
Go
The Go Programming Language
Go
[mirror] Go on Mobile

Go support for Mobile devices The Go mobile repository holds packages and build tools for using Go on mobile platforms. Package documentation as a sta

Go 5k Jun 24, 2022
Mirror - Mirror is command line tool for mirroring a web page

mirror mirror is command line tool for mirroring a web page. Caution Do not abus

Yusuke Wada 10 May 29, 2022
💨 A real time messaging system to build a scalable in-app notifications, multiplayer games, chat apps in web and mobile apps.

Beaver A Real Time Messaging Server. Beaver is a real-time messaging server. With beaver you can easily build scalable in-app notifications, realtime

Ahmed 1.3k Jun 27, 2022
Uniqush is a free and open source software system which provides a unified push service for server side notification to apps on mobile devices.

Homepage Download Blog/News @uniqush Introduction Uniqush (\ˈyü-nə-ku̇sh\ "uni" pronounced as in "unified", and "qush" pronounced as in "cushion") is

Uniqush 1.4k Jun 20, 2022
Mobile Blogging System

Mobile Blogging System

mattn 18 Mar 3, 2022
A collection of cool tools used by Mobile hackers. Happy hacking , Happy bug-hunting

A collection of cool tools used by Mobile hackers. Happy hacking , Happy bug-hunting Family project Table of Contents Weapons Contribute Thanks to con

HAHWUL 386 Jun 20, 2022
:zap: Transfer files over wifi from your computer to your mobile device by scanning a QR code without leaving the terminal.

$ qrcp Transfer files over Wi-Fi from your computer to a mobile device by scanning a QR code without leaving the terminal. You can support development

Claudio d'Angelis 8.6k Jun 26, 2022
Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core network solution.

Connecting the Next Billion People Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core

Magma 1.3k Jun 15, 2022
HTML Canvas 2D Context API for mobile, desktop and web

canvas HTML Canvas 2D Context API for mobile, desktop and web Context2D API https://www.w3.org/TR/2dcontext/ native code implement https://github.com/

GoPlus 2 Apr 22, 2022
Mobile Money API Handyman

pesakit pesakit is a highly configurable commandline tool that comes in handy during testing and development of systems that integrate with mobile mon

TECHCRAFT TECHNOLOGIES LIMITED 2 Nov 22, 2021
A Declarative Cloud Firewall Reverse Proxy Solution with Companion Mobile App

A declarative Cloud firewall reverse proxy solution with inbuilt DDoS protection and alerting mechanism to protect your servers and keeping an eye on those malicious requests

null 12 Apr 4, 2022
Building block for mobile money api clients

base the base code for creating mobile money api clients using golang build request request := NewRequestBuilder("login request", http.MethodPost, "ht

TECHCRAFT TECHNOLOGIES LIMITED 3 Jan 4, 2022
MTN Mobile Money API Client in Go

mtnmomo-go This package provides a generic go client template for the MTN Mobile Money API Installation mtnmomo-go is compatible with modern Go releas

Ndole Studio 0 Dec 4, 2021
A mobile security hash generator using golang

Mobile Security Hash Generator Project scope This little script is my first experiment using Go. I wrote it for my friend @marcotrumpet because he nee

null 0 Jan 31, 2022
Iran National Id, Bank Card Number, Mobile Number Validator for golang

Iran IDValidator Iran National Id, Bank Card Number, Mobile Number Validator for golang Installation go get -u github.com/mohammadv184/idvalidator Us

Mohammad Abbasi 1 Dec 20, 2021
Built in user interface, LAN file transfer, such as mobile phone, computer, tablet, different operating system

Modao Built in user interface, LAN file transfer, such as mobile phone, computer, tablet, different operating systems, etc., as well as text transfer

null 0 May 7, 2022
Magma: Gives network operators an open, flexible and extendable mobile core network solution

Connecting the Next Billion People Magma is an open-source software platform tha

nikhilc 0 Dec 24, 2021
The Bhojpur MDM is a software-as-a-service product used as a Mobile Device Manager based on Bhojpur.NET Platform for application delivery.

Bhojpur MDM - Mobile Device Manager The Bhojpur MDM is a software-as-a-service product used as a Mobile Device Manager based on Bhojpur.NET Platform f

Bhojpur Consulting 0 Dec 31, 2021
Bintris - a mobile game developed in Go

?? Bintris Bintris is a mobile game developed in Go! Support me by buying this game on Google PlayStore ?? : https://play.google.com/store/apps/detail

Magnus 149 Jun 26, 2022
Mirror of Apache Calcite - Avatica Go SQL Driver

Apache Avatica/Phoenix SQL Driver Apache Calcite's Avatica Go is a Go database/sql driver for the Avatica server. Avatica is a sub-project of Apache C

The Apache Software Foundation 96 Jun 21, 2022
This is only a mirror and Moved to https://gitea.com/lunny/tango

Tango 简体中文 Package tango is a micro & pluggable web framework for Go. Current version: v0.5.0 Version History Getting Started To install Tango: go get

Lunny Xiao 835 May 31, 2022
[mirror] This is a linter for Go source code.

Golint is a linter for Go source code. Installation Golint requires a supported release of Go. go get -u golang.org/x/lint/golint To find out where g

Go 3.9k Jun 26, 2022
DNS over HTTPS [mirror]

dnss dnss is a daemon for using DNS over HTTPS. It can act as a proxy, receiving DNS requests and resolving them using DNS-over-HTTPs (DoH). This can

Alberto Bertogli 96 Apr 15, 2022
This is only a mirror and Moved to https://gitea.com/lunny/tango

Tango 简体中文 Package tango is a micro & pluggable web framework for Go. Current version: v0.5.0 Version History Getting Started To install Tango: go get

Lunny Xiao 835 May 31, 2022
Mirror of the Gio main repository

Immediate mode GUI programs in Go for Android, iOS, macOS, Linux, FreeBSD, OpenBSD, Windows, and WebAssembly

Gio 664 Jun 19, 2022
k8s-image-swapper Mirror images into your own registry and swap image references automatically.

k8s-image-swapper Mirror images into your own registry and swap image references automatically. k8s-image-swapper is a mutating webhook for Kubernetes

Enrico Stahn 307 Jun 22, 2022
A simple daemon which will watch files on your filesystem, mirror them to MFS, automatically update related pins, and update related IPNS keys.

ipfs-sync is a simple daemon which will watch files on your filesystem, mirror them to MFS, automatically update related pins, and update related IPNS keys, so you can always access your directories from the same address. You can use it to sync your documents, photos, videos, or even a website!

null 72 Jun 14, 2022
[mirror] Performance measurement, storage, and analysis.

Go performance measurement, storage, and analysis tools This subrepository holds the source for various packages and tools related to performance meas

Go 307 Jun 15, 2022
[mirror] star-tex (or *TeX) is a TeX engine in Go.

star-tex star-tex (or *TeX) is a TeX engine in Go. cmd/star-tex star-tex provides a TeX to DVI typesetter. $> star-tex ./testdata/hello.tex out.div $>

null 20 May 11, 2022