cmd/ebitenmobile: Enable to specify a local gomobile

This commit is contained in:
Hajime Hoshi 2020-07-25 03:00:52 +09:00
parent f4fff5439e
commit 5ec3113aa2
2 changed files with 14 additions and 0 deletions

View File

@ -106,6 +106,14 @@ func prepareGomobileCommands() error {
if err := runGo("get", "golang.org/x/mobile@"+gomobileHash); err != nil { if err := runGo("get", "golang.org/x/mobile@"+gomobileHash); err != nil {
return err return err
} }
if localgm := os.Getenv("EBITENMOBILE_GOMOBILE"); localgm != "" {
if !filepath.IsAbs(localgm) {
localgm = filepath.Join(pwd, localgm)
}
if err := runGo("mod", "edit", "-replace=golang.org/x/mobile="+localgm); err != nil {
return err
}
}
if err := runGo("build", "-o", exe(filepath.Join("bin", "gomobile")), "golang.org/x/mobile/cmd/gomobile"); err != nil { if err := runGo("build", "-o", exe(filepath.Join("bin", "gomobile")), "golang.org/x/mobile/cmd/gomobile"); err != nil {
return err return err
} }

View File

@ -12,6 +12,12 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// ebitenmobile is a wrapper of gomobile for Ebiten.
//
// For the usage, see https://ebiten.org/documents/mobile.html.
//
// gomobile's version is fixed by ebitenmobile.
// You can specify gomobile's version by EBITENMOBILE_GOMOBILE environment variable.
package main package main
import ( import (