Debian Codegraph @

tools/aapt2/Android.bp

raw
1 //
2 // Copyright (C) 2017 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 package {
18 // See: http://go/android-license-faq
19 // A large-scale-change added 'default_applicable_licenses' to import
20 // all of the 'license_kinds' from "frameworks_base_license"
21 // to get the below license kinds:
22 // SPDX-license-identifier-Apache-2.0
23 default_applicable_licenses: ["frameworks_base_license"],
24 }
25
26 toolSources = [
27 "cmd/Command.cpp",
28 "cmd/Compile.cpp",
29 "cmd/Convert.cpp",
30 "cmd/Diff.cpp",
31 "cmd/Dump.cpp",
32 "cmd/Link.cpp",
33 "cmd/Optimize.cpp",
34 "cmd/Util.cpp",
35 ]
36
37 cc_defaults {
38 name: "aapt2_defaults",
39 cflags: [
40 "-Wall",
41 "-Werror",
42 "-Wno-unused-parameter",
43 ],
44 cppflags: [
45 "-Wno-missing-field-initializers",
46 "-fno-exceptions",
47 "-fno-rtti",
48 ],
49 target: {
50 windows: {
51 enabled: true,
52 cflags: ["-Wno-maybe-uninitialized"],
53 ldflags: ["-static"],
54 },
55 darwin: {
56 cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
57 },
58 },
59 header_libs: ["jni_headers"],
60 static_libs: [
61 "libandroidfw",
62 "libutils",
63 "liblog",
64 "libcutils",
65 "libexpat",
66 "libziparchive",
67 "libpng",
68 "libbase",
69 "libprotobuf-cpp-full",
70 "libz",
71 "libbuildversion",
72 "libidmap2_policies",
73 ],
74 stl: "libc++_static",
75 }
76
77 // ==========================================================
78 // NOTE: Do not add any shared libraries.
79 // AAPT2 is built to run on many environments
80 // that may not have the required dependencies.
81 // ==========================================================
82
83 // ==========================================================
84 // Build the host static library: aapt2
85 // ==========================================================
86 cc_library_host_static {
87 name: "libaapt2",
88 srcs: [
89 "compile/IdAssigner.cpp",
90 "compile/InlineXmlFormatParser.cpp",
91 "compile/NinePatch.cpp",
92 "compile/Png.cpp",
93 "compile/PngChunkFilter.cpp",
94 "compile/PngCrunch.cpp",
95 "compile/PseudolocaleGenerator.cpp",
96 "compile/Pseudolocalizer.cpp",
97 "compile/XmlIdCollector.cpp",
98 "configuration/ConfigurationParser.cpp",
99 "dump/DumpManifest.cpp",
100 "filter/AbiFilter.cpp",
101 "filter/ConfigFilter.cpp",
102 "format/Archive.cpp",
103 "format/Container.cpp",
104 "format/binary/BinaryResourceParser.cpp",
105 "format/binary/ResChunkPullParser.cpp",
106 "format/binary/TableFlattener.cpp",
107 "format/binary/XmlFlattener.cpp",
108 "format/proto/ProtoDeserialize.cpp",
109 "format/proto/ProtoSerialize.cpp",
110 "io/BigBufferStream.cpp",
111 "io/File.cpp",
112 "io/FileStream.cpp",
113 "io/FileSystem.cpp",
114 "io/StringStream.cpp",
115 "io/Util.cpp",
116 "io/ZipArchive.cpp",
117 "link/AutoVersioner.cpp",
118 "link/ManifestFixer.cpp",
119 "link/NoDefaultResourceRemover.cpp",
120 "link/ProductFilter.cpp",
121 "link/PrivateAttributeMover.cpp",
122 "link/ReferenceLinker.cpp",
123 "link/ResourceExcluder.cpp",
124 "link/TableMerger.cpp",
125 "link/XmlCompatVersioner.cpp",
126 "link/XmlNamespaceRemover.cpp",
127 "link/XmlReferenceLinker.cpp",
128 "optimize/MultiApkGenerator.cpp",
129 "optimize/ResourceDeduper.cpp",
130 "optimize/ResourceFilter.cpp",
131 "optimize/ResourcePathShortener.cpp",
132 "optimize/VersionCollapser.cpp",
133 "process/SymbolTable.cpp",
134 "split/TableSplitter.cpp",
135 "text/Printer.cpp",
136 "text/Unicode.cpp",
137 "text/Utf8Iterator.cpp",
138 "util/BigBuffer.cpp",
139 "util/Files.cpp",
140 "util/Util.cpp",
141 "Debug.cpp",
142 "DominatorTree.cpp",
143 "java/AnnotationProcessor.cpp",
144 "java/ClassDefinition.cpp",
145 "java/JavaClassGenerator.cpp",
146 "java/ManifestClassGenerator.cpp",
147 "java/ProguardRules.cpp",
148 "LoadedApk.cpp",
149 "Resource.cpp",
150 "ResourceParser.cpp",
151 "ResourceTable.cpp",
152 "ResourceUtils.cpp",
153 "ResourceValues.cpp",
154 "SdkConstants.cpp",
155 "StringPool.cpp",
156 "trace/TraceBuffer.cpp",
157 "xml/XmlActionExecutor.cpp",
158 "xml/XmlDom.cpp",
159 "xml/XmlPullParser.cpp",
160 "xml/XmlUtil.cpp",
161 "Configuration.proto",
162 "Resources.proto",
163 "ResourcesInternal.proto",
164 "ValueTransformer.cpp",
165 ],
166 proto: {
167 export_proto_headers: true,
168 type: "full",
169 },
170 defaults: ["aapt2_defaults"],
171 }
172
173 // ==========================================================
174 // Build the host tests: aapt2_tests
175 // ==========================================================
176 cc_test_host {
177 name: "aapt2_tests",
178 srcs: [
179 "test/Builders.cpp",
180 "test/Common.cpp",
181 "test/Fixture.cpp",
182 "**/*_test.cpp",
183 ] + toolSources,
184 static_libs: [
185 "libaapt2",
186 "libgmock",
187 ],
188 defaults: ["aapt2_defaults"],
189 data: [
190 "integration-tests/CompileTest/**/*",
191 "integration-tests/CommandTests/**/*",
192 "integration-tests/ConvertTest/**/*",
193 ],
194 }
195
196 // ==========================================================
197 // Build the host executable: aapt2
198 // ==========================================================
199 cc_binary_host {
200 name: "aapt2",
201 srcs: ["Main.cpp"] + toolSources,
202 use_version_lib: true,
203 static_libs: ["libaapt2"],
204 defaults: ["aapt2_defaults"],
205 dist: {
206 targets: ["aapt2_artifacts"],
207 },
208 }
209
210 // ==========================================================
211 // Dist the protos
212 // ==========================================================
213 genrule {
214 name: "aapt2-protos",
215 tools: [":soong_zip"],
216 srcs: [
217 "Configuration.proto",
218 "ResourcesInternal.proto",
219 "Resources.proto",
220 ],
221 out: ["aapt2-protos.zip"],
222 cmd: "mkdir $(genDir)/protos && " +
223 "cp $(in) $(genDir)/protos && " +
224 "$(location :soong_zip) -o $(out) -C $(genDir)/protos -D $(genDir)/protos",
225 dist: {
226 targets: [
227 "sdk_repo",
228 "aapt2_artifacts",
229 ],
230 },
231 }