-
Notifications
You must be signed in to change notification settings - Fork 564
Expand file tree
/
Copy pathBUILD.bazel
More file actions
46 lines (41 loc) · 1.17 KB
/
BUILD.bazel
File metadata and controls
46 lines (41 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
load("@rules_android//android:rules.bzl", "android_binary", "android_library")
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_rust//rust:defs.bzl", "rust_library")
rust_library(
name = "rust_lib",
srcs = ["demo.rs"],
edition = "2018",
)
cc_library(
name = "jni_shim",
srcs = ["android_link_hack.c"], # Required because of https://github.com/bazelbuild/rules_rust/issues/1271
linkopts = [
"-lm", # Required to avoid dlopen runtime failures unrelated to rust
],
deps = [":rust_lib"],
alwayslink = True, # Required since JNI symbols appear to be unused
)
android_library(
name = "android_main",
srcs = [
"AndroidMain.java",
"JniShim.java",
],
custom_package = "com.example.androidapp",
manifest = "AndroidManifest.xml",
resource_files = ["res/layout/android_main.xml"],
deps = [":jni_shim"],
)
android_binary(
name = "android_app",
custom_package = "com.example.androidapp",
manifest = "AndroidManifest.xml",
deps = [":android_main"],
)
platform(
name = "arm64-v8a",
constraint_values = [
"@platforms//cpu:arm64",
"@platforms//os:android",
],
)