blob: f0ebf10ec527fa6a31699c9dcfa852589ce9f59e [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 {
Dan Willemsen7544b9c2017-09-08 22:44:51 -070027 name: "aapt2_defaults",
Fabien Sanglard19160202017-01-12 14:24:31 -050028 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"],
Fabien Sanglard19160202017-01-12 14:24:31 -050042 },
43 darwin: {
44 cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
Fabien Sanglard19160202017-01-12 14:24:31 -050045 },
46 },
47 static_libs: [
48 "libandroidfw",
49 "libutils",
50 "liblog",
51 "libcutils",
52 "libexpat",
53 "libziparchive",
54 "libpng",
55 "libbase",
56 "libprotobuf-cpp-lite",
Dan Willemsen85aee732017-09-08 21:26:31 -070057 "libz",
Fabien Sanglard19160202017-01-12 14:24:31 -050058 ],
59 group_static_libs: true,
60}
61
62// ==========================================================
63// NOTE: Do not add any shared libraries.
64// AAPT2 is built to run on many environments
65// that may not have the required dependencies.
66// ==========================================================
67
68// ==========================================================
69// Build the host static library: aapt2
70// ==========================================================
71cc_library_host_static {
72 name: "libaapt2",
73 srcs: [
74 "compile/IdAssigner.cpp",
75 "compile/InlineXmlFormatParser.cpp",
76 "compile/NinePatch.cpp",
77 "compile/Png.cpp",
78 "compile/PngChunkFilter.cpp",
79 "compile/PngCrunch.cpp",
80 "compile/PseudolocaleGenerator.cpp",
81 "compile/Pseudolocalizer.cpp",
82 "compile/XmlIdCollector.cpp",
Shane Farmer74cdea32017-05-12 16:22:36 -070083 "configuration/ConfigurationParser.cpp",
Shane Farmer57669432017-06-19 12:52:04 -070084 "filter/AbiFilter.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050085 "filter/ConfigFilter.cpp",
86 "flatten/Archive.cpp",
87 "flatten/TableFlattener.cpp",
88 "flatten/XmlFlattener.cpp",
Adam Lesinski06460ef2017-03-14 18:52:13 -070089 "io/BigBufferStreams.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050090 "io/File.cpp",
Adam Lesinskiefeb7af2017-08-02 14:57:43 -070091 "io/FileInputStream.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050092 "io/FileSystem.cpp",
Adam Lesinskiefeb7af2017-08-02 14:57:43 -070093 "io/StringInputStream.cpp",
Adam Lesinskid0f492d2017-04-03 18:12:45 -070094 "io/Util.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050095 "io/ZipArchive.cpp",
96 "link/AutoVersioner.cpp",
97 "link/ManifestFixer.cpp",
98 "link/ProductFilter.cpp",
99 "link/PrivateAttributeMover.cpp",
100 "link/ReferenceLinker.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500101 "link/TableMerger.cpp",
Adam Lesinskic744ae82017-05-17 19:28:38 -0700102 "link/XmlCompatVersioner.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500103 "link/XmlNamespaceRemover.cpp",
104 "link/XmlReferenceLinker.cpp",
Shane Farmer0a5b2012017-06-22 12:24:12 -0700105 "optimize/MultiApkGenerator.cpp",
Adam Lesinskid48944a2017-02-21 14:22:30 -0800106 "optimize/ResourceDeduper.cpp",
107 "optimize/VersionCollapser.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500108 "process/SymbolTable.cpp",
109 "proto/ProtoHelpers.cpp",
110 "proto/TableProtoDeserializer.cpp",
111 "proto/TableProtoSerializer.cpp",
112 "split/TableSplitter.cpp",
Adam Lesinski66ea8402017-06-28 11:44:11 -0700113 "text/Unicode.cpp",
114 "text/Utf8Iterator.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500115 "unflatten/BinaryResourceParser.cpp",
116 "unflatten/ResChunkPullParser.cpp",
117 "util/BigBuffer.cpp",
118 "util/Files.cpp",
119 "util/Util.cpp",
120 "ConfigDescription.cpp",
121 "Debug.cpp",
122 "DominatorTree.cpp",
123 "Flags.cpp",
124 "java/AnnotationProcessor.cpp",
125 "java/ClassDefinition.cpp",
126 "java/JavaClassGenerator.cpp",
127 "java/ManifestClassGenerator.cpp",
128 "java/ProguardRules.cpp",
Pierre Lecesneff759e62017-02-01 00:29:25 +0000129 "LoadedApk.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500130 "Locale.cpp",
131 "Resource.cpp",
132 "ResourceParser.cpp",
133 "ResourceTable.cpp",
134 "ResourceUtils.cpp",
135 "ResourceValues.cpp",
136 "SdkConstants.cpp",
137 "StringPool.cpp",
138 "xml/XmlActionExecutor.cpp",
139 "xml/XmlDom.cpp",
140 "xml/XmlPullParser.cpp",
141 "xml/XmlUtil.cpp",
Adam Lesinskib58c3ef2017-09-12 17:39:52 -0700142 "Configuration.proto",
Adam Lesinski4ffea042017-08-10 15:37:28 -0700143 "Resources.proto",
144 "ResourcesInternal.proto",
Fabien Sanglard19160202017-01-12 14:24:31 -0500145 ],
146 proto: {
147 export_proto_headers: true,
148 },
Dan Willemsen7544b9c2017-09-08 22:44:51 -0700149 defaults: ["aapt2_defaults"],
Fabien Sanglard19160202017-01-12 14:24:31 -0500150}
151
152// ==========================================================
153// Build the host shared library: aapt2_jni
154// ==========================================================
155cc_library_host_shared {
156 name: "libaapt2_jni",
157 srcs: toolSources + ["jni/aapt2_jni.cpp"],
158 static_libs: ["libaapt2"],
Dan Willemsen7544b9c2017-09-08 22:44:51 -0700159 defaults: ["aapt2_defaults"],
Fabien Sanglard19160202017-01-12 14:24:31 -0500160}
161
162// ==========================================================
163// Build the host tests: aapt2_tests
164// ==========================================================
165cc_test_host {
166 name: "aapt2_tests",
Adam Lesinskibab4ef52017-06-01 15:22:57 -0700167 srcs: [
Adam Lesinskiefeb7af2017-08-02 14:57:43 -0700168 "test/Builders.cpp",
Adam Lesinskibab4ef52017-06-01 15:22:57 -0700169 "test/Common.cpp",
170 "**/*_test.cpp",
171 ],
Shane Farmer74cdea32017-05-12 16:22:36 -0700172 static_libs: [
173 "libaapt2",
174 "libgmock",
175 ],
Dan Willemsen7544b9c2017-09-08 22:44:51 -0700176 defaults: ["aapt2_defaults"],
Fabien Sanglard19160202017-01-12 14:24:31 -0500177}
178
179// ==========================================================
180// Build the host executable: aapt2
181// ==========================================================
182cc_binary_host {
183 name: "aapt2",
184 srcs: ["Main.cpp"] + toolSources,
185 static_libs: ["libaapt2"],
Dan Willemsen7544b9c2017-09-08 22:44:51 -0700186 defaults: ["aapt2_defaults"],
Fabien Sanglard19160202017-01-12 14:24:31 -0500187}