Skip to content

Commit

Permalink
Define //tools:defs.bzl as the shortcut.
Browse files Browse the repository at this point in the history
  • Loading branch information
bolitt committed Sep 30, 2021
1 parent 2f842dd commit 721aa62
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# rules_gomobile
gomobile bind rules for Bazel.

# Environment.
# Environment
To build Android app, we need the pre-installed Android, and set `ANDROID_HOME` and `ANDROID_NDK_HOME`.

For example,
Expand All @@ -15,7 +15,7 @@ If you want one command to install Android SDK and NDK, please check this standa

We also use the local JDK which is used by `bazel` too. `JAVA_HOME` is detected automatically, if you can run `bazel` directly.

# Build.
# Build: Examples

To build Gobind for Android (`<Lib>@java`) and iOS (`<Lib>@objc`), and then export respective packages:
aar (`<Lib>_aar_import`) and xcframwork (`<Lib>@objc@xcframework`).
Expand Down Expand Up @@ -56,6 +56,6 @@ The code is ported from https://github.com/znly/rules_gomobile. Since the repo h

Now the repo has been refactored at large scale.

- Changed the Go generator from command `gobind` to [`gomobile`](https://golang.org/wiki/Mobile) for Android/iOS. (See pkg: https://pkg.go.dev/golang.org/x/mobile/cmd/gomobile for details)
- Used `gazelle` to manage Go packages.
- Changed the Go generator from command [`gobind`](https://pkg.go.dev/golang.org/x/mobile/cmd/gobind) to [`gomobile`](https://golang.org/wiki/Mobile) for Android/iOS. (See pkg: https://pkg.go.dev/golang.org/x/mobile/cmd/gomobile for details)
- Used [`gazelle`](https://github.com/bazelbuild/bazel-gazelle) to manage Go packages.
- Simplified rules.
2 changes: 1 addition & 1 deletion examples/helloworld/go/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See all details:
# bazel query --output build //examples/helloworld/...
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("//tools/rule_mobile:gobind.bzl", "gobind")
load("//tools:defs.bzl", "gobind")

package(default_visibility = ["//visibility:public"])

Expand Down
8 changes: 8 additions & 0 deletions tools/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

package(default_visibility = ["//visibility:public"])

bzl_library(
name = "lib",
srcs = glob(["*.bzl"]),
)
3 changes: 3 additions & 0 deletions tools/defs.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//tools/rule_mobile:gobind.bzl", _go_bind = "gobind")

gobind = _go_bind

0 comments on commit 721aa62

Please sign in to comment.