blob: 046de469c7cc8ba96b7df3fd9161b75a3a4c361e [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",
Fabien Sanglard19160202017-01-12 14:24:31 -050084 "filter/ConfigFilter.cpp",
85 "flatten/Archive.cpp",
86 "flatten/TableFlattener.cpp",
87 "flatten/XmlFlattener.cpp",
Adam Lesinski06460ef2017-03-14 18:52:13 -070088 "io/BigBufferStreams.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050089 "io/File.cpp",
90 "io/FileSystem.cpp",
Adam Lesinskid0f492d2017-04-03 18:12:45 -070091 "io/Util.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050092 "io/ZipArchive.cpp",
93 "link/AutoVersioner.cpp",
94 "link/ManifestFixer.cpp",
95 "link/ProductFilter.cpp",
96 "link/PrivateAttributeMover.cpp",
97 "link/ReferenceLinker.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050098 "link/TableMerger.cpp",
Adam Lesinskic744ae82017-05-17 19:28:38 -070099 "link/XmlCompatVersioner.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500100 "link/XmlNamespaceRemover.cpp",
101 "link/XmlReferenceLinker.cpp",
Adam Lesinskid48944a2017-02-21 14:22:30 -0800102 "optimize/ResourceDeduper.cpp",
103 "optimize/VersionCollapser.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500104 "process/SymbolTable.cpp",
105 "proto/ProtoHelpers.cpp",
106 "proto/TableProtoDeserializer.cpp",
107 "proto/TableProtoSerializer.cpp",
108 "split/TableSplitter.cpp",
109 "unflatten/BinaryResourceParser.cpp",
110 "unflatten/ResChunkPullParser.cpp",
111 "util/BigBuffer.cpp",
112 "util/Files.cpp",
113 "util/Util.cpp",
114 "ConfigDescription.cpp",
115 "Debug.cpp",
116 "DominatorTree.cpp",
117 "Flags.cpp",
118 "java/AnnotationProcessor.cpp",
119 "java/ClassDefinition.cpp",
120 "java/JavaClassGenerator.cpp",
121 "java/ManifestClassGenerator.cpp",
122 "java/ProguardRules.cpp",
Pierre Lecesneff759e62017-02-01 00:29:25 +0000123 "LoadedApk.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500124 "Locale.cpp",
125 "Resource.cpp",
126 "ResourceParser.cpp",
127 "ResourceTable.cpp",
128 "ResourceUtils.cpp",
129 "ResourceValues.cpp",
130 "SdkConstants.cpp",
131 "StringPool.cpp",
132 "xml/XmlActionExecutor.cpp",
133 "xml/XmlDom.cpp",
134 "xml/XmlPullParser.cpp",
135 "xml/XmlUtil.cpp",
136 "Format.proto",
137 ],
138 proto: {
139 export_proto_headers: true,
140 },
Dan Willemsen7544b9c2017-09-08 22:44:51 -0700141 defaults: ["aapt2_defaults"],
Fabien Sanglard19160202017-01-12 14:24:31 -0500142}
143
144// ==========================================================
145// Build the host shared library: aapt2_jni
146// ==========================================================
147cc_library_host_shared {
148 name: "libaapt2_jni",
149 srcs: toolSources + ["jni/aapt2_jni.cpp"],
150 static_libs: ["libaapt2"],
Dan Willemsen7544b9c2017-09-08 22:44:51 -0700151 defaults: ["aapt2_defaults"],
Fabien Sanglard19160202017-01-12 14:24:31 -0500152}
153
154// ==========================================================
155// Build the host tests: aapt2_tests
156// ==========================================================
157cc_test_host {
158 name: "aapt2_tests",
Adam Lesinskibab4ef52017-06-01 15:22:57 -0700159 srcs: [
160 "test/Common.cpp",
161 "**/*_test.cpp",
162 ],
Shane Farmer74cdea32017-05-12 16:22:36 -0700163 static_libs: [
164 "libaapt2",
165 "libgmock",
166 ],
Dan Willemsen7544b9c2017-09-08 22:44:51 -0700167 defaults: ["aapt2_defaults"],
Fabien Sanglard19160202017-01-12 14:24:31 -0500168}
169
170// ==========================================================
171// Build the host executable: aapt2
172// ==========================================================
173cc_binary_host {
174 name: "aapt2",
175 srcs: ["Main.cpp"] + toolSources,
176 static_libs: ["libaapt2"],
Dan Willemsen7544b9c2017-09-08 22:44:51 -0700177 defaults: ["aapt2_defaults"],
Fabien Sanglard19160202017-01-12 14:24:31 -0500178}