From 721aa6290eacfb76fe5a7381f2b993fd1173b86c Mon Sep 17 00:00:00 2001 From: Tian Lin Date: Thu, 30 Sep 2021 09:01:42 +0800 Subject: [PATCH] Define //tools:defs.bzl as the shortcut. --- README.md | 8 ++++---- examples/helloworld/go/BUILD | 2 +- tools/BUILD | 8 ++++++++ tools/defs.bzl | 3 +++ 4 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 tools/defs.bzl diff --git a/README.md b/README.md index c47fd25..6986ce8 100644 --- a/README.md +++ b/README.md @@ -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, @@ -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 (`@java`) and iOS (`@objc`), and then export respective packages: aar (`_aar_import`) and xcframwork (`@objc@xcframework`). @@ -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. diff --git a/examples/helloworld/go/BUILD b/examples/helloworld/go/BUILD index 6c0cab3..4378035 100644 --- a/examples/helloworld/go/BUILD +++ b/examples/helloworld/go/BUILD @@ -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"]) diff --git a/tools/BUILD b/tools/BUILD index e69de29..1362e37 100644 --- a/tools/BUILD +++ b/tools/BUILD @@ -0,0 +1,8 @@ +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") + +package(default_visibility = ["//visibility:public"]) + +bzl_library( + name = "lib", + srcs = glob(["*.bzl"]), +) diff --git a/tools/defs.bzl b/tools/defs.bzl new file mode 100644 index 0000000..a19d69d --- /dev/null +++ b/tools/defs.bzl @@ -0,0 +1,3 @@ +load("//tools/rule_mobile:gobind.bzl", _go_bind = "gobind") + +gobind = _go_bind