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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# Copyright (C) 2021 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ApexToolchainInfo = provider(
doc = "APEX toolchain",
fields = [
"aapt2",
"avbtool",
"apexer",
"mke2fs",
"resize2fs",
"e2fsdroid",
"sefcontext_compile",
"conv_apex_manifest",
"android_jar",
"apex_compression_tool",
"soong_zip",
"jsonmodify",
"manifest_fixer",
"gen_ndk_usedby_apex",
"readelf",
"gen_java_usedby_apex",
"dexdeps",
"notice_generator",
],
)
def _apex_toolchain_impl(ctx):
toolchain_info = platform_common.ToolchainInfo(
toolchain_info = ApexToolchainInfo(
aapt2 = ctx.file.aapt2,
avbtool = ctx.attr.avbtool,
apexer = ctx.attr.apexer,
mke2fs = ctx.attr.mke2fs,
resize2fs = ctx.attr.resize2fs,
e2fsdroid = ctx.attr.e2fsdroid,
sefcontext_compile = ctx.attr.sefcontext_compile,
conv_apex_manifest = ctx.attr.conv_apex_manifest,
android_jar = ctx.file.android_jar,
apex_compression_tool = ctx.attr.apex_compression_tool,
soong_zip = ctx.file.soong_zip,
jsonmodify = ctx.attr.jsonmodify,
manifest_fixer = ctx.attr.manifest_fixer,
gen_ndk_usedby_apex = ctx.attr.gen_ndk_usedby_apex,
readelf = ctx.attr.readelf,
gen_java_usedby_apex = ctx.attr.gen_java_usedby_apex,
dexdeps = ctx.attr.dexdeps,
notice_generator = ctx.attr.notice_generator,
),
)
return [toolchain_info]
apex_toolchain = rule(
implementation = _apex_toolchain_impl,
attrs = {
"aapt2": attr.label(allow_single_file = True, cfg = "exec", executable = True, mandatory = True),
"android_jar": attr.label(allow_single_file = True, cfg = "exec", mandatory = True),
"apex_compression_tool": attr.label(cfg = "exec", executable = True, mandatory = True),
"apexer": attr.label(cfg = "exec", executable = True, mandatory = True),
"avbtool": attr.label(cfg = "exec", executable = True, mandatory = True),
"conv_apex_manifest": attr.label(cfg = "exec", executable = True, mandatory = True),
"dexdeps": attr.label(cfg = "exec", executable = True, mandatory = True),
"e2fsdroid": attr.label(cfg = "exec", executable = True, mandatory = True),
"gen_java_usedby_apex": attr.label(cfg = "exec", executable = True, mandatory = True, allow_single_file = [".sh"]),
"gen_ndk_usedby_apex": attr.label(cfg = "exec", executable = True, mandatory = True, allow_single_file = [".sh"]),
"jsonmodify": attr.label(cfg = "exec", executable = True, mandatory = True),
"manifest_fixer": attr.label(cfg = "exec", executable = True, mandatory = True),
"mke2fs": attr.label(cfg = "exec", executable = True, mandatory = True),
"notice_generator": attr.label(allow_single_file = True, cfg = "exec", executable = True, mandatory = True),
"readelf": attr.label(cfg = "exec", executable = True, mandatory = True, allow_single_file = True),
"resize2fs": attr.label(cfg = "exec", executable = True, mandatory = True),
"sefcontext_compile": attr.label(cfg = "exec", executable = True, mandatory = True),
# soong_zip is added as a dependency of apex_compression_tool which uses
# soong_zip to compress APEX files. avbtool is also used in apex_compression tool
# and has been added to apex toolchain previously.
"soong_zip": attr.label(allow_single_file = True, cfg = "exec", executable = True, mandatory = True),
},
)
|