blob: 20439cc498e6264ee417df63972da363298d3d14 [file] [log] [blame]
Fabien Sanglard19160202017-01-12 14:24:31 -05001//
2// Copyright (C) 2015 The Android Open Source Project
3//
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",
22]
23
24cc_defaults {
25 name: "aapt_defaults",
26 cflags: [
27 "-Wall",
28 "-Werror",
29 "-Wno-unused-parameter",
30 ],
31 cppflags: [
32 "-Wno-missing-field-initializers",
33 "-fno-exceptions",
34 "-fno-rtti",
35 ],
36 target: {
37 windows: {
38 enabled: true,
39 cflags: ["-Wno-maybe-uninitialized"],
40 static_libs: ["libz"],
41 },
42 darwin: {
43 cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
44 host_ldlibs: ["-lz"],
45 },
46 linux: {
47 host_ldlibs: ["-lz"],
48 },
49 },
50 static_libs: [
51 "libandroidfw",
52 "libutils",
53 "liblog",
54 "libcutils",
55 "libexpat",
56 "libziparchive",
57 "libpng",
58 "libbase",
59 "libprotobuf-cpp-lite",
60 ],
61 group_static_libs: true,
62}
63
64// ==========================================================
65// NOTE: Do not add any shared libraries.
66// AAPT2 is built to run on many environments
67// that may not have the required dependencies.
68// ==========================================================
69
70// ==========================================================
71// Build the host static library: aapt2
72// ==========================================================
73cc_library_host_static {
74 name: "libaapt2",
75 srcs: [
76 "compile/IdAssigner.cpp",
77 "compile/InlineXmlFormatParser.cpp",
78 "compile/NinePatch.cpp",
79 "compile/Png.cpp",
80 "compile/PngChunkFilter.cpp",
81 "compile/PngCrunch.cpp",
82 "compile/PseudolocaleGenerator.cpp",
83 "compile/Pseudolocalizer.cpp",
84 "compile/XmlIdCollector.cpp",
85 "filter/ConfigFilter.cpp",
86 "flatten/Archive.cpp",
87 "flatten/TableFlattener.cpp",
88 "flatten/XmlFlattener.cpp",
89 "io/File.cpp",
90 "io/FileSystem.cpp",
91 "io/Io.cpp",
92 "io/ZipArchive.cpp",
93 "link/AutoVersioner.cpp",
94 "link/ManifestFixer.cpp",
95 "link/ProductFilter.cpp",
96 "link/PrivateAttributeMover.cpp",
97 "link/ReferenceLinker.cpp",
98 "link/ResourceDeduper.cpp",
99 "link/TableMerger.cpp",
100 "link/VersionCollapser.cpp",
101 "link/XmlNamespaceRemover.cpp",
102 "link/XmlReferenceLinker.cpp",
103 "process/SymbolTable.cpp",
104 "proto/ProtoHelpers.cpp",
105 "proto/TableProtoDeserializer.cpp",
106 "proto/TableProtoSerializer.cpp",
107 "split/TableSplitter.cpp",
108 "unflatten/BinaryResourceParser.cpp",
109 "unflatten/ResChunkPullParser.cpp",
110 "util/BigBuffer.cpp",
111 "util/Files.cpp",
112 "util/Util.cpp",
113 "ConfigDescription.cpp",
114 "Debug.cpp",
115 "DominatorTree.cpp",
116 "Flags.cpp",
117 "java/AnnotationProcessor.cpp",
118 "java/ClassDefinition.cpp",
119 "java/JavaClassGenerator.cpp",
120 "java/ManifestClassGenerator.cpp",
121 "java/ProguardRules.cpp",
122 "Locale.cpp",
123 "Resource.cpp",
124 "ResourceParser.cpp",
125 "ResourceTable.cpp",
126 "ResourceUtils.cpp",
127 "ResourceValues.cpp",
128 "SdkConstants.cpp",
129 "StringPool.cpp",
130 "xml/XmlActionExecutor.cpp",
131 "xml/XmlDom.cpp",
132 "xml/XmlPullParser.cpp",
133 "xml/XmlUtil.cpp",
134 "Format.proto",
135 ],
136 proto: {
137 export_proto_headers: true,
138 },
139 defaults: ["aapt_defaults"],
140}
141
142// ==========================================================
143// Build the host shared library: aapt2_jni
144// ==========================================================
145cc_library_host_shared {
146 name: "libaapt2_jni",
147 srcs: toolSources + ["jni/aapt2_jni.cpp"],
148 static_libs: ["libaapt2"],
149 defaults: ["aapt_defaults"],
150}
151
152// ==========================================================
153// Build the host tests: aapt2_tests
154// ==========================================================
155cc_test_host {
156 name: "aapt2_tests",
157 srcs: ["**/*_test.cpp"],
158 static_libs: ["libaapt2"],
159 defaults: ["aapt_defaults"],
160}
161
162// ==========================================================
163// Build the host executable: aapt2
164// ==========================================================
165cc_binary_host {
166 name: "aapt2",
167 srcs: ["Main.cpp"] + toolSources,
168 static_libs: ["libaapt2"],
169 defaults: ["aapt_defaults"],
170}