blob: b460258248af742e402d0a829a85d46584e8c3cb [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",
87 "filter/ConfigFilter.cpp",
88 "flatten/Archive.cpp",
89 "flatten/TableFlattener.cpp",
90 "flatten/XmlFlattener.cpp",
Adam Lesinski06460ef2017-03-14 18:52:13 -070091 "io/BigBufferStreams.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050092 "io/File.cpp",
93 "io/FileSystem.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",
Fabien Sanglard19160202017-01-12 14:24:31 -0500102 "link/XmlNamespaceRemover.cpp",
103 "link/XmlReferenceLinker.cpp",
Adam Lesinskid48944a2017-02-21 14:22:30 -0800104 "optimize/ResourceDeduper.cpp",
105 "optimize/VersionCollapser.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500106 "process/SymbolTable.cpp",
107 "proto/ProtoHelpers.cpp",
108 "proto/TableProtoDeserializer.cpp",
109 "proto/TableProtoSerializer.cpp",
110 "split/TableSplitter.cpp",
111 "unflatten/BinaryResourceParser.cpp",
112 "unflatten/ResChunkPullParser.cpp",
113 "util/BigBuffer.cpp",
114 "util/Files.cpp",
115 "util/Util.cpp",
116 "ConfigDescription.cpp",
117 "Debug.cpp",
118 "DominatorTree.cpp",
119 "Flags.cpp",
120 "java/AnnotationProcessor.cpp",
121 "java/ClassDefinition.cpp",
122 "java/JavaClassGenerator.cpp",
123 "java/ManifestClassGenerator.cpp",
124 "java/ProguardRules.cpp",
Pierre Lecesneff759e62017-02-01 00:29:25 +0000125 "LoadedApk.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -0500126 "Locale.cpp",
127 "Resource.cpp",
128 "ResourceParser.cpp",
129 "ResourceTable.cpp",
130 "ResourceUtils.cpp",
131 "ResourceValues.cpp",
132 "SdkConstants.cpp",
133 "StringPool.cpp",
134 "xml/XmlActionExecutor.cpp",
135 "xml/XmlDom.cpp",
136 "xml/XmlPullParser.cpp",
137 "xml/XmlUtil.cpp",
138 "Format.proto",
139 ],
140 proto: {
141 export_proto_headers: true,
142 },
143 defaults: ["aapt_defaults"],
144}
145
146// ==========================================================
147// Build the host shared library: aapt2_jni
148// ==========================================================
149cc_library_host_shared {
150 name: "libaapt2_jni",
151 srcs: toolSources + ["jni/aapt2_jni.cpp"],
152 static_libs: ["libaapt2"],
153 defaults: ["aapt_defaults"],
154}
155
156// ==========================================================
157// Build the host tests: aapt2_tests
158// ==========================================================
159cc_test_host {
160 name: "aapt2_tests",
161 srcs: ["**/*_test.cpp"],
162 static_libs: ["libaapt2"],
163 defaults: ["aapt_defaults"],
164}
165
166// ==========================================================
167// Build the host executable: aapt2
168// ==========================================================
169cc_binary_host {
170 name: "aapt2",
171 srcs: ["Main.cpp"] + toolSources,
172 static_libs: ["libaapt2"],
173 defaults: ["aapt_defaults"],
174}