blob: 01eb4f69f8423f4bc249d6feea4fd93227db5a39 [file] [log] [blame]
Dan Willemsend3eac262017-09-08 22:47:47 -07001//
2// Copyright (C) 2014 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
17// ==========================================================
18// Setup some common variables for the different build
19// targets here.
20// ==========================================================
21
Bob Badour8a6a2bc2021-02-12 17:07:05 -080022package {
23 default_applicable_licenses: ["frameworks_base_tools_aapt_license"],
24}
25
26// Added automatically by a large-scale-change
27// See: http://go/android-license-faq
28license {
29 name: "frameworks_base_tools_aapt_license",
30 visibility: [":__subpackages__"],
31 license_kinds: [
32 "SPDX-license-identifier-Apache-2.0",
33 ],
34 license_text: [
35 "NOTICE",
36 ],
37}
38
Dan Willemsend3eac262017-09-08 22:47:47 -070039cc_defaults {
40 name: "aapt_defaults",
41
42 static_libs: [
43 "libandroidfw",
44 "libpng",
45 "libutils",
46 "liblog",
47 "libcutils",
48 "libexpat",
49 "libziparchive",
50 "libbase",
51 "libz",
52 ],
Dan Willemsend3eac262017-09-08 22:47:47 -070053
54 cflags: [
55 "-Wall",
56 "-Werror",
57 ],
58
59 target: {
60 windows: {
61 enabled: true,
62 },
63 },
64
65 // This tool is prebuilt if we're doing an app-only build.
66 product_variables: {
67 pdk: {
68 enabled: false,
69 },
70 unbundled_build: {
71 enabled: false,
72 },
73 },
74}
75
76// ==========================================================
77// Build the host static library: libaapt
78// ==========================================================
79cc_library_host_static {
80 name: "libaapt",
81 defaults: ["aapt_defaults"],
82 target: {
83 darwin: {
84 cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
85 },
86 },
87 cflags: [
88 "-Wno-format-y2k",
89 "-DSTATIC_ANDROIDFW_FOR_TOOLS",
90 ],
91
92 srcs: [
93 "AaptAssets.cpp",
94 "AaptConfig.cpp",
95 "AaptUtil.cpp",
96 "AaptXml.cpp",
97 "ApkBuilder.cpp",
98 "Command.cpp",
99 "CrunchCache.cpp",
100 "FileFinder.cpp",
101 "Images.cpp",
102 "Package.cpp",
103 "pseudolocalize.cpp",
104 "Resource.cpp",
105 "ResourceFilter.cpp",
106 "ResourceIdCache.cpp",
107 "ResourceTable.cpp",
108 "SourcePos.cpp",
109 "StringPool.cpp",
110 "WorkQueue.cpp",
111 "XMLNode.cpp",
112 "ZipEntry.cpp",
113 "ZipFile.cpp",
114 ],
115}
116
117// ==========================================================
Dan Willemsen5d129352018-08-29 17:22:14 -0700118// Build the host executable: aapt
119// ==========================================================
120cc_binary_host {
121 name: "aapt",
122 defaults: ["aapt_defaults"],
123 srcs: ["Main.cpp"],
124 use_version_lib: true,
125 static_libs: ["libaapt"],
Ryan Mitchellc3d69322021-05-04 07:42:46 -0700126 dist: {
127 targets: ["aapt2_artifacts"],
128 },
Dan Willemsen5d129352018-08-29 17:22:14 -0700129}
130
131// ==========================================================
Dan Willemsend3eac262017-09-08 22:47:47 -0700132// Build the host tests: libaapt_tests
133// ==========================================================
134cc_test_host {
135 name: "libaapt_tests",
136 defaults: ["aapt_defaults"],
137 srcs: [
138 "tests/AaptConfig_test.cpp",
139 "tests/AaptGroupEntry_test.cpp",
140 "tests/Pseudolocales_test.cpp",
141 "tests/ResourceFilter_test.cpp",
142 "tests/ResourceTable_test.cpp",
143 ],
144 static_libs: ["libaapt"],
145}