blob: 8bef221fe5edd37c0e4494bd7037fe361490e48c [file] [log] [blame]
Fabien Sanglard19160202017-01-12 14:24:31 -05001//
Adam Lesinskid48944a2017-02-21 14:22:30 -08002// Copyright (C) 2017 The Android Open Source Project
Fabien Sanglard19160202017-01-12 14:24:31 -05003//
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
17toolSources = [
Ryan Mitchell833a1a62018-07-10 13:51:36 -070018 "cmd/Command.cpp",
Adam Lesinskid0f492d2017-04-03 18:12:45 -070019 "cmd/Compile.cpp",
Adam Lesinski8780eb62017-10-31 17:44:39 -070020 "cmd/Convert.cpp",
Adam Lesinskid0f492d2017-04-03 18:12:45 -070021 "cmd/Diff.cpp",
22 "cmd/Dump.cpp",
23 "cmd/Link.cpp",
24 "cmd/Optimize.cpp",
25 "cmd/Util.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050026]
27
28cc_defaults {
Dan Willemsen7544b9c2017-09-08 22:44:51 -070029 name: "aapt2_defaults",
Fabien Sanglard19160202017-01-12 14:24:31 -050030 cflags: [
31 "-Wall",
32 "-Werror",
33 "-Wno-unused-parameter",
34 ],
35 cppflags: [
36 "-Wno-missing-field-initializers",
37 "-fno-exceptions",
38 "-fno-rtti",
39 ],
40 target: {
41 windows: {
42 enabled: true,
43 cflags: ["-Wno-maybe-uninitialized"],
Fabien Sanglard19160202017-01-12 14:24:31 -050044 },
45 darwin: {
46 cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
Fabien Sanglard19160202017-01-12 14:24:31 -050047 },
48 },
49 static_libs: [
50 "libandroidfw",
51 "libutils",
52 "liblog",
53 "libcutils",
54 "libexpat",
55 "libziparchive",
56 "libpng",
57 "libbase",
58 "libprotobuf-cpp-lite",
Dan Willemsen85aee732017-09-08 21:26:31 -070059 "libz",
Fabien Sanglard19160202017-01-12 14:24:31 -050060 ],
Ryan Mitchell81bae2d2019-01-04 13:48:04 -080061 stl: "libc++_static",
Fabien Sanglard19160202017-01-12 14:24:31 -050062 group_static_libs: true,
63}
64
65// ==========================================================
66// NOTE: Do not add any shared libraries.
67// AAPT2 is built to run on many environments
68// that may not have the required dependencies.
69// ==========================================================
70
71// ==========================================================
72// Build the host static library: aapt2
73// ==========================================================
74cc_library_host_static {
75 name: "libaapt2",
76 srcs: [
77 "compile/IdAssigner.cpp",
78 "compile/InlineXmlFormatParser.cpp",
79 "compile/NinePatch.cpp",
80 "compile/Png.cpp",
81 "compile/PngChunkFilter.cpp",
82 "compile/PngCrunch.cpp",
83 "compile/PseudolocaleGenerator.cpp",
84 "compile/Pseudolocalizer.cpp",
85 "compile/XmlIdCollector.cpp",
Shane Farmer74cdea32017-05-12 16:22:36 -070086 "configuration/ConfigurationParser.cpp",
Ryan Mitchellfc225b22018-08-21 14:52:51 -070087 "dump/DumpManifest.cpp",
Shane Farmer57669432017-06-19 12:52:04 -070088 "filter/AbiFilter.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050089 "filter/ConfigFilter.cpp",
Adam Lesinski46708052017-09-29 14:49:15 -070090 "format/Archive.cpp",
Adam Lesinski00451162017-10-03 07:44:08 -070091 "format/Container.cpp",
Adam Lesinski46708052017-09-29 14:49:15 -070092 "format/binary/BinaryResourceParser.cpp",
93 "format/binary/ResChunkPullParser.cpp",
94 "format/binary/TableFlattener.cpp",
95 "format/binary/XmlFlattener.cpp",
96 "format/proto/ProtoDeserialize.cpp",
97 "format/proto/ProtoSerialize.cpp",
Adam Lesinski00451162017-10-03 07:44:08 -070098 "io/BigBufferStream.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050099 "io/File.cpp",
Adam Lesinski00451162017-10-03 07:44:08 -0700100 "io/FileStream.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500101 "io/FileSystem.cpp",
Adam Lesinski00451162017-10-03 07:44:08 -0700102 "io/StringStream.cpp",
Adam Lesinskid0f492d2017-04-03 18:12:45 -0700103 "io/Util.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500104 "io/ZipArchive.cpp",
105 "link/AutoVersioner.cpp",
106 "link/ManifestFixer.cpp",
Adam Lesinski34a16872018-02-23 16:18:10 -0800107 "link/NoDefaultResourceRemover.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500108 "link/ProductFilter.cpp",
109 "link/PrivateAttributeMover.cpp",
110 "link/ReferenceLinker.cpp",
Winson3c918b82019-01-25 14:25:37 -0800111 "link/ResourceExcluder.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500112 "link/TableMerger.cpp",
Adam Lesinskic744ae82017-05-17 19:28:38 -0700113 "link/XmlCompatVersioner.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500114 "link/XmlNamespaceRemover.cpp",
115 "link/XmlReferenceLinker.cpp",
Shane Farmer0a5b2012017-06-22 12:24:12 -0700116 "optimize/MultiApkGenerator.cpp",
Adam Lesinskid48944a2017-02-21 14:22:30 -0800117 "optimize/ResourceDeduper.cpp",
Mohamed Heikald3c5fb62018-01-12 11:37:26 -0500118 "optimize/ResourceFilter.cpp",
Mohamed Heikalc7694032018-11-07 16:49:02 -0500119 "optimize/ResourcePathShortener.cpp",
Adam Lesinskid48944a2017-02-21 14:22:30 -0800120 "optimize/VersionCollapser.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500121 "process/SymbolTable.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500122 "split/TableSplitter.cpp",
Adam Lesinski93190b72017-11-03 15:20:17 -0700123 "text/Printer.cpp",
Adam Lesinski66ea8402017-06-28 11:44:11 -0700124 "text/Unicode.cpp",
125 "text/Utf8Iterator.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500126 "util/BigBuffer.cpp",
127 "util/Files.cpp",
128 "util/Util.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500129 "Debug.cpp",
130 "DominatorTree.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500131 "java/AnnotationProcessor.cpp",
132 "java/ClassDefinition.cpp",
133 "java/JavaClassGenerator.cpp",
134 "java/ManifestClassGenerator.cpp",
135 "java/ProguardRules.cpp",
Pierre Lecesneff759e62017-02-01 00:29:25 +0000136 "LoadedApk.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500137 "Resource.cpp",
138 "ResourceParser.cpp",
139 "ResourceTable.cpp",
140 "ResourceUtils.cpp",
141 "ResourceValues.cpp",
142 "SdkConstants.cpp",
143 "StringPool.cpp",
Fabien Sanglard2d34e762019-02-21 15:13:29 -0800144 "trace/TraceBuffer.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500145 "xml/XmlActionExecutor.cpp",
146 "xml/XmlDom.cpp",
147 "xml/XmlPullParser.cpp",
148 "xml/XmlUtil.cpp",
Adam Lesinskib58c3ef2017-09-12 17:39:52 -0700149 "Configuration.proto",
Adam Lesinski4ffea042017-08-10 15:37:28 -0700150 "Resources.proto",
151 "ResourcesInternal.proto",
Fabien Sanglard19160202017-01-12 14:24:31 -0500152 ],
153 proto: {
154 export_proto_headers: true,
155 },
Dan Willemsen7544b9c2017-09-08 22:44:51 -0700156 defaults: ["aapt2_defaults"],
Fabien Sanglard19160202017-01-12 14:24:31 -0500157}
158
159// ==========================================================
160// Build the host shared library: aapt2_jni
161// ==========================================================
162cc_library_host_shared {
163 name: "libaapt2_jni",
164 srcs: toolSources + ["jni/aapt2_jni.cpp"],
165 static_libs: ["libaapt2"],
Dan Willemsen7544b9c2017-09-08 22:44:51 -0700166 defaults: ["aapt2_defaults"],
Fabien Sanglard19160202017-01-12 14:24:31 -0500167}
168
169// ==========================================================
170// Build the host tests: aapt2_tests
171// ==========================================================
172cc_test_host {
173 name: "aapt2_tests",
Adam Lesinskibab4ef52017-06-01 15:22:57 -0700174 srcs: [
Adam Lesinskiefeb7af2017-08-02 14:57:43 -0700175 "test/Builders.cpp",
Adam Lesinskibab4ef52017-06-01 15:22:57 -0700176 "test/Common.cpp",
Ryan Mitchell479fa392019-01-02 17:15:39 -0800177 "test/Fixture.cpp",
Adam Lesinskibab4ef52017-06-01 15:22:57 -0700178 "**/*_test.cpp",
Donald Chaib8f078c2017-10-18 23:51:18 -0700179 ] + toolSources,
Shane Farmer74cdea32017-05-12 16:22:36 -0700180 static_libs: [
181 "libaapt2",
182 "libgmock",
183 ],
Dan Willemsen7544b9c2017-09-08 22:44:51 -0700184 defaults: ["aapt2_defaults"],
Ryan Mitchell479fa392019-01-02 17:15:39 -0800185 data: [
186 "integration-tests/CompileTest/**/*",
Winsonf54c9a12019-01-23 12:39:40 -0800187 "integration-tests/CommandTests/**/*",
188 "integration-tests/ConvertTest/**/*"
Ryan Mitchell479fa392019-01-02 17:15:39 -0800189 ],
Fabien Sanglard19160202017-01-12 14:24:31 -0500190}
191
192// ==========================================================
193// Build the host executable: aapt2
194// ==========================================================
195cc_binary_host {
196 name: "aapt2",
197 srcs: ["Main.cpp"] + toolSources,
198 static_libs: ["libaapt2"],
Dan Willemsen7544b9c2017-09-08 22:44:51 -0700199 defaults: ["aapt2_defaults"],
Fabien Sanglard19160202017-01-12 14:24:31 -0500200}