blob: 2ff92e651edabf1c8f0219896f9eefc290ace3ba [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 = [
Adam Lesinskid0f492d2017-04-03 18:12:45 -070018 "cmd/Compile.cpp",
Adam Lesinski8780eb62017-10-31 17:44:39 -070019 "cmd/Convert.cpp",
Adam Lesinskid0f492d2017-04-03 18:12:45 -070020 "cmd/Diff.cpp",
21 "cmd/Dump.cpp",
22 "cmd/Link.cpp",
23 "cmd/Optimize.cpp",
24 "cmd/Util.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050025]
26
27cc_defaults {
Dan Willemsen7544b9c2017-09-08 22:44:51 -070028 name: "aapt2_defaults",
Fabien Sanglard19160202017-01-12 14:24:31 -050029 cflags: [
30 "-Wall",
31 "-Werror",
32 "-Wno-unused-parameter",
33 ],
34 cppflags: [
35 "-Wno-missing-field-initializers",
36 "-fno-exceptions",
37 "-fno-rtti",
38 ],
39 target: {
40 windows: {
41 enabled: true,
42 cflags: ["-Wno-maybe-uninitialized"],
Fabien Sanglard19160202017-01-12 14:24:31 -050043 },
44 darwin: {
45 cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
Fabien Sanglard19160202017-01-12 14:24:31 -050046 },
47 },
48 static_libs: [
49 "libandroidfw",
50 "libutils",
51 "liblog",
52 "libcutils",
53 "libexpat",
54 "libziparchive",
55 "libpng",
56 "libbase",
57 "libprotobuf-cpp-lite",
Dan Willemsen85aee732017-09-08 21:26:31 -070058 "libz",
Fabien Sanglard19160202017-01-12 14:24:31 -050059 ],
60 group_static_libs: true,
61}
62
63// ==========================================================
64// NOTE: Do not add any shared libraries.
65// AAPT2 is built to run on many environments
66// that may not have the required dependencies.
67// ==========================================================
68
69// ==========================================================
70// Build the host static library: aapt2
71// ==========================================================
72cc_library_host_static {
73 name: "libaapt2",
74 srcs: [
75 "compile/IdAssigner.cpp",
76 "compile/InlineXmlFormatParser.cpp",
77 "compile/NinePatch.cpp",
78 "compile/Png.cpp",
79 "compile/PngChunkFilter.cpp",
80 "compile/PngCrunch.cpp",
81 "compile/PseudolocaleGenerator.cpp",
82 "compile/Pseudolocalizer.cpp",
83 "compile/XmlIdCollector.cpp",
Shane Farmer74cdea32017-05-12 16:22:36 -070084 "configuration/ConfigurationParser.cpp",
Shane Farmer57669432017-06-19 12:52:04 -070085 "filter/AbiFilter.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050086 "filter/ConfigFilter.cpp",
Adam Lesinski46708052017-09-29 14:49:15 -070087 "format/Archive.cpp",
Adam Lesinski00451162017-10-03 07:44:08 -070088 "format/Container.cpp",
Adam Lesinski46708052017-09-29 14:49:15 -070089 "format/binary/BinaryResourceParser.cpp",
90 "format/binary/ResChunkPullParser.cpp",
91 "format/binary/TableFlattener.cpp",
92 "format/binary/XmlFlattener.cpp",
93 "format/proto/ProtoDeserialize.cpp",
94 "format/proto/ProtoSerialize.cpp",
Adam Lesinski00451162017-10-03 07:44:08 -070095 "io/BigBufferStream.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050096 "io/File.cpp",
Adam Lesinski00451162017-10-03 07:44:08 -070097 "io/FileStream.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050098 "io/FileSystem.cpp",
Adam Lesinski00451162017-10-03 07:44:08 -070099 "io/StringStream.cpp",
Adam Lesinskid0f492d2017-04-03 18:12:45 -0700100 "io/Util.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500101 "io/ZipArchive.cpp",
102 "link/AutoVersioner.cpp",
103 "link/ManifestFixer.cpp",
Adam Lesinski34a16872018-02-23 16:18:10 -0800104 "link/NoDefaultResourceRemover.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500105 "link/ProductFilter.cpp",
106 "link/PrivateAttributeMover.cpp",
107 "link/ReferenceLinker.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500108 "link/TableMerger.cpp",
Adam Lesinskic744ae82017-05-17 19:28:38 -0700109 "link/XmlCompatVersioner.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500110 "link/XmlNamespaceRemover.cpp",
111 "link/XmlReferenceLinker.cpp",
Shane Farmer0a5b2012017-06-22 12:24:12 -0700112 "optimize/MultiApkGenerator.cpp",
Adam Lesinskid48944a2017-02-21 14:22:30 -0800113 "optimize/ResourceDeduper.cpp",
114 "optimize/VersionCollapser.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500115 "process/SymbolTable.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500116 "split/TableSplitter.cpp",
Adam Lesinski93190b72017-11-03 15:20:17 -0700117 "text/Printer.cpp",
Adam Lesinski66ea8402017-06-28 11:44:11 -0700118 "text/Unicode.cpp",
119 "text/Utf8Iterator.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500120 "util/BigBuffer.cpp",
121 "util/Files.cpp",
122 "util/Util.cpp",
123 "ConfigDescription.cpp",
124 "Debug.cpp",
125 "DominatorTree.cpp",
126 "Flags.cpp",
127 "java/AnnotationProcessor.cpp",
128 "java/ClassDefinition.cpp",
129 "java/JavaClassGenerator.cpp",
130 "java/ManifestClassGenerator.cpp",
131 "java/ProguardRules.cpp",
Pierre Lecesneff759e62017-02-01 00:29:25 +0000132 "LoadedApk.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500133 "Locale.cpp",
134 "Resource.cpp",
135 "ResourceParser.cpp",
136 "ResourceTable.cpp",
137 "ResourceUtils.cpp",
138 "ResourceValues.cpp",
139 "SdkConstants.cpp",
140 "StringPool.cpp",
141 "xml/XmlActionExecutor.cpp",
142 "xml/XmlDom.cpp",
143 "xml/XmlPullParser.cpp",
144 "xml/XmlUtil.cpp",
Adam Lesinskib58c3ef2017-09-12 17:39:52 -0700145 "Configuration.proto",
Adam Lesinski4ffea042017-08-10 15:37:28 -0700146 "Resources.proto",
147 "ResourcesInternal.proto",
Fabien Sanglard19160202017-01-12 14:24:31 -0500148 ],
149 proto: {
150 export_proto_headers: true,
151 },
Dan Willemsen7544b9c2017-09-08 22:44:51 -0700152 defaults: ["aapt2_defaults"],
Fabien Sanglard19160202017-01-12 14:24:31 -0500153}
154
155// ==========================================================
156// Build the host shared library: aapt2_jni
157// ==========================================================
158cc_library_host_shared {
159 name: "libaapt2_jni",
160 srcs: toolSources + ["jni/aapt2_jni.cpp"],
161 static_libs: ["libaapt2"],
Dan Willemsen7544b9c2017-09-08 22:44:51 -0700162 defaults: ["aapt2_defaults"],
Fabien Sanglard19160202017-01-12 14:24:31 -0500163}
164
165// ==========================================================
166// Build the host tests: aapt2_tests
167// ==========================================================
168cc_test_host {
169 name: "aapt2_tests",
Adam Lesinskibab4ef52017-06-01 15:22:57 -0700170 srcs: [
Adam Lesinskiefeb7af2017-08-02 14:57:43 -0700171 "test/Builders.cpp",
Adam Lesinskibab4ef52017-06-01 15:22:57 -0700172 "test/Common.cpp",
173 "**/*_test.cpp",
Donald Chaib8f078c2017-10-18 23:51:18 -0700174 ] + toolSources,
Shane Farmer74cdea32017-05-12 16:22:36 -0700175 static_libs: [
176 "libaapt2",
177 "libgmock",
178 ],
Dan Willemsen7544b9c2017-09-08 22:44:51 -0700179 defaults: ["aapt2_defaults"],
Fabien Sanglard19160202017-01-12 14:24:31 -0500180}
181
182// ==========================================================
183// Build the host executable: aapt2
184// ==========================================================
185cc_binary_host {
186 name: "aapt2",
187 srcs: ["Main.cpp"] + toolSources,
188 static_libs: ["libaapt2"],
Dan Willemsen7544b9c2017-09-08 22:44:51 -0700189 defaults: ["aapt2_defaults"],
Fabien Sanglard19160202017-01-12 14:24:31 -0500190}