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
|
load(":android_mock.bzl", "android_binary", "android_library")
load("@rules_license//tools:test_helpers.bzl", "golden_cmd_test")
# These two rules today capture what an android_binary would look like.
# This rule represents the Android specific code that displays licenses
# on the display. Note that it does not depend on anything to get the
# license contents; the implementation of these rules macros handle that
# detail.
android_library(
name = "licenses",
srcs = [
"license_display.sh",
],
data = [
"@rules_license//distro:distro",
],
)
# This captures how the application would be built. The dependencies of this
# rule are crawled to identify third-party licenses in use. The macro definition
# of this rule creates a graph to capture that process of identifying licenses,
# building the licenses target, and finally invoking the "real" android_binary
# rule to build the final output with the injected license content.
android_binary(
name = "main",
srcs = ["main.sh"],
deps = [
],
data = [
":licenses",
],
)
golden_cmd_test(
name = "main_test",
srcs = [],
cmd = "$(location :main)",
tools = [":main"],
golden = "main_golden.txt",
)
|