blob: 24aa6ebbcbc2d144fbfb30523bee005876ad02bb [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",
19 "cmd/Diff.cpp",
20 "cmd/Dump.cpp",
21 "cmd/Link.cpp",
22 "cmd/Optimize.cpp",
23 "cmd/Util.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050024]
25
26cc_defaults {
27 name: "aapt_defaults",
28 cflags: [
29 "-Wall",
30 "-Werror",
31 "-Wno-unused-parameter",
32 ],
33 cppflags: [
34 "-Wno-missing-field-initializers",
35 "-fno-exceptions",
36 "-fno-rtti",
37 ],
38 target: {
39 windows: {
40 enabled: true,
41 cflags: ["-Wno-maybe-uninitialized"],
42 static_libs: ["libz"],
43 },
44 darwin: {
45 cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
46 host_ldlibs: ["-lz"],
47 },
48 linux: {
49 host_ldlibs: ["-lz"],
50 },
51 },
52 static_libs: [
53 "libandroidfw",
54 "libutils",
55 "liblog",
56 "libcutils",
57 "libexpat",
58 "libziparchive",
59 "libpng",
60 "libbase",
61 "libprotobuf-cpp-lite",
62 ],
63 group_static_libs: true,
64}
65
66// ==========================================================
67// NOTE: Do not add any shared libraries.
68// AAPT2 is built to run on many environments
69// that may not have the required dependencies.
70// ==========================================================
71
72// ==========================================================
73// Build the host static library: aapt2
74// ==========================================================
75cc_library_host_static {
76 name: "libaapt2",
77 srcs: [
78 "compile/IdAssigner.cpp",
79 "compile/InlineXmlFormatParser.cpp",
80 "compile/NinePatch.cpp",
81 "compile/Png.cpp",
82 "compile/PngChunkFilter.cpp",
83 "compile/PngCrunch.cpp",
84 "compile/PseudolocaleGenerator.cpp",
85 "compile/Pseudolocalizer.cpp",
86 "compile/XmlIdCollector.cpp",
Shane Farmer74cdea32017-05-12 16:22:36 -070087 "configuration/ConfigurationParser.cpp",
Shane Farmer57669432017-06-19 12:52:04 -070088 "filter/AbiFilter.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050089 "filter/ConfigFilter.cpp",
90 "flatten/Archive.cpp",
91 "flatten/TableFlattener.cpp",
92 "flatten/XmlFlattener.cpp",
Adam Lesinski06460ef2017-03-14 18:52:13 -070093 "io/BigBufferStreams.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050094 "io/File.cpp",
Adam Lesinskiefeb7af2017-08-02 14:57:43 -070095 "io/FileInputStream.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050096 "io/FileSystem.cpp",
Adam Lesinskiefeb7af2017-08-02 14:57:43 -070097 "io/StringInputStream.cpp",
Adam Lesinskid0f492d2017-04-03 18:12:45 -070098 "io/Util.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050099 "io/ZipArchive.cpp",
100 "link/AutoVersioner.cpp",
101 "link/ManifestFixer.cpp",
102 "link/ProductFilter.cpp",
103 "link/PrivateAttributeMover.cpp",
104 "link/ReferenceLinker.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500105 "link/TableMerger.cpp",
Adam Lesinskic744ae82017-05-17 19:28:38 -0700106 "link/XmlCompatVersioner.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500107 "link/XmlNamespaceRemover.cpp",
108 "link/XmlReferenceLinker.cpp",
Shane Farmer0a5b2012017-06-22 12:24:12 -0700109 "optimize/MultiApkGenerator.cpp",
Adam Lesinskid48944a2017-02-21 14:22:30 -0800110 "optimize/ResourceDeduper.cpp",
111 "optimize/VersionCollapser.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500112 "process/SymbolTable.cpp",
113 "proto/ProtoHelpers.cpp",
114 "proto/TableProtoDeserializer.cpp",
115 "proto/TableProtoSerializer.cpp",
116 "split/TableSplitter.cpp",
Adam Lesinski66ea8402017-06-28 11:44:11 -0700117 "text/Unicode.cpp",
118 "text/Utf8Iterator.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500119 "unflatten/BinaryResourceParser.cpp",
120 "unflatten/ResChunkPullParser.cpp",
121 "util/BigBuffer.cpp",
122 "util/Files.cpp",
123 "util/Util.cpp",
124 "ConfigDescription.cpp",
125 "Debug.cpp",
126 "DominatorTree.cpp",
127 "Flags.cpp",
128 "java/AnnotationProcessor.cpp",
129 "java/ClassDefinition.cpp",
130 "java/JavaClassGenerator.cpp",
131 "java/ManifestClassGenerator.cpp",
132 "java/ProguardRules.cpp",
Pierre Lecesneff759e62017-02-01 00:29:25 +0000133 "LoadedApk.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500134 "Locale.cpp",
135 "Resource.cpp",
136 "ResourceParser.cpp",
137 "ResourceTable.cpp",
138 "ResourceUtils.cpp",
139 "ResourceValues.cpp",
140 "SdkConstants.cpp",
141 "StringPool.cpp",
142 "xml/XmlActionExecutor.cpp",
143 "xml/XmlDom.cpp",
144 "xml/XmlPullParser.cpp",
145 "xml/XmlUtil.cpp",
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 },
152 defaults: ["aapt_defaults"],
153}
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"],
162 defaults: ["aapt_defaults"],
163}
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",
174 ],
Shane Farmer74cdea32017-05-12 16:22:36 -0700175 static_libs: [
176 "libaapt2",
177 "libgmock",
178 ],
Fabien Sanglard19160202017-01-12 14:24:31 -0500179 defaults: ["aapt_defaults"],
180}
181
182// ==========================================================
183// Build the host executable: aapt2
184// ==========================================================
185cc_binary_host {
186 name: "aapt2",
187 srcs: ["Main.cpp"] + toolSources,
188 static_libs: ["libaapt2"],
189 defaults: ["aapt_defaults"],
190}