• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2023 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15load("//build/bazel/rules/android:rules.bzl", "aar_import", "android_binary", "android_library")
16load("//build/bazel/rules/cc:cc_library_shared.bzl", "cc_library_shared")
17load("//build/bazel/rules/cc:cc_library_static.bzl", "cc_library_static")
18
19package(default_applicable_licenses = ["//build/soong/licenses:Android-Apache-2.0"])
20
21android_binary(
22    name = "app",
23    manifest = "AndroidManifest.xml",
24    sdk_version = "current",
25    target_compatible_with = ["//build/bazel/platforms/os:android"],
26    deps = [
27        ":applib",
28    ],
29)
30
31android_binary(
32    name = "app-cert-string",
33    certificate_name = "platform",
34    manifest = "AndroidManifest.xml",
35    sdk_version = "current",
36    target_compatible_with = ["//build/bazel/platforms/os:android"],
37    deps = [
38        ":applib",
39    ],
40)
41
42android_binary(
43    name = "app-cert-module",
44    certificate = "//build/make/target/product/security:aosp-testkey",
45    manifest = "AndroidManifest.xml",
46    sdk_version = "current",
47    target_compatible_with = ["//build/bazel/platforms/os:android"],
48    deps = [
49        ":applib",
50    ],
51)
52
53android_library(
54    name = "applib",
55    srcs = [
56        "Jni.java",
57        "MainActivity.java",
58        "some_kotlin.kt",
59    ],
60    manifest = "AndroidManifest.xml",
61    resource_files = glob(["res/**"]),
62    sdk_version = "current",
63    target_compatible_with = ["//build/bazel/platforms/os:android"],
64    deps = [
65        # TODO(b/240555494): re-enable JNI when it is supported
66        # ":jni",
67        ":lib",
68    ],
69)
70
71android_library(
72    name = "lib",
73    srcs = ["Lib.java"],
74    sdk_version = "current",
75    target_compatible_with = ["//build/bazel/platforms/os:android"],
76)
77
78cc_library_shared(
79    name = "jni",
80    srcs = ["jni.cc"],
81    deps = [":jni_dep"],
82)
83
84cc_library_static(
85    name = "jni_dep",
86    srcs = ["jni_dep.cc"],
87    hdrs = ["jni_dep.h"],
88    deps = ["//libnativehelper:jni_headers"],
89)
90
91aar_import(
92    name = "import",
93    aar = "example_lib.aar",
94    sdk_version = "32",
95    target_compatible_with = ["//build/bazel/platforms/os:android"],
96)
97