blob: 57036aad611b366e03ed969d7cfa9a5658132326 [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 = [
18 "compile/Compile.cpp",
19 "diff/Diff.cpp",
20 "dump/Dump.cpp",
21 "link/Link.cpp",
Adam Lesinskid48944a2017-02-21 14:22:30 -080022 "optimize/Optimize.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050023]
24
25cc_defaults {
26 name: "aapt_defaults",
27 cflags: [
28 "-Wall",
29 "-Werror",
30 "-Wno-unused-parameter",
31 ],
32 cppflags: [
33 "-Wno-missing-field-initializers",
34 "-fno-exceptions",
35 "-fno-rtti",
36 ],
37 target: {
38 windows: {
39 enabled: true,
40 cflags: ["-Wno-maybe-uninitialized"],
41 static_libs: ["libz"],
42 },
43 darwin: {
44 cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
45 host_ldlibs: ["-lz"],
46 },
47 linux: {
48 host_ldlibs: ["-lz"],
49 },
50 },
51 static_libs: [
52 "libandroidfw",
53 "libutils",
54 "liblog",
55 "libcutils",
56 "libexpat",
57 "libziparchive",
58 "libpng",
59 "libbase",
60 "libprotobuf-cpp-lite",
61 ],
62 group_static_libs: true,
63}
64
65// ==========================================================
66// NOTE: Do not add any shared libraries.
67// AAPT2 is built to run on many environments
68// that may not have the required dependencies.
69// ==========================================================
70
71// ==========================================================
72// Build the host static library: aapt2
73// ==========================================================
74cc_library_host_static {
75 name: "libaapt2",
76 srcs: [
77 "compile/IdAssigner.cpp",
78 "compile/InlineXmlFormatParser.cpp",
79 "compile/NinePatch.cpp",
80 "compile/Png.cpp",
81 "compile/PngChunkFilter.cpp",
82 "compile/PngCrunch.cpp",
83 "compile/PseudolocaleGenerator.cpp",
84 "compile/Pseudolocalizer.cpp",
85 "compile/XmlIdCollector.cpp",
86 "filter/ConfigFilter.cpp",
87 "flatten/Archive.cpp",
88 "flatten/TableFlattener.cpp",
89 "flatten/XmlFlattener.cpp",
90 "io/File.cpp",
91 "io/FileSystem.cpp",
92 "io/Io.cpp",
93 "io/ZipArchive.cpp",
94 "link/AutoVersioner.cpp",
95 "link/ManifestFixer.cpp",
96 "link/ProductFilter.cpp",
97 "link/PrivateAttributeMover.cpp",
98 "link/ReferenceLinker.cpp",
Fabien Sanglard19160202017-01-12 14:24:31 -050099 "link/TableMerger.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 },
141 defaults: ["aapt_defaults"],
142}
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"],
151 defaults: ["aapt_defaults"],
152}
153
154// ==========================================================
155// Build the host tests: aapt2_tests
156// ==========================================================
157cc_test_host {
158 name: "aapt2_tests",
159 srcs: ["**/*_test.cpp"],
160 static_libs: ["libaapt2"],
161 defaults: ["aapt_defaults"],
162}
163
164// ==========================================================
165// Build the host executable: aapt2
166// ==========================================================
167cc_binary_host {
168 name: "aapt2",
169 srcs: ["Main.cpp"] + toolSources,
170 static_libs: ["libaapt2"],
171 defaults: ["aapt_defaults"],
172}