1//
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
22package {
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
39cc_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    ],
53
54    cflags: [
55        "-Wall",
56        "-Werror",
57    ],
58
59    target: {
60        windows: {
61            enabled: true,
62        },
63    },
64}
65
66// ==========================================================
67// Build the host static library: libaapt
68// ==========================================================
69cc_library_host_static {
70    name: "libaapt",
71    defaults: ["aapt_defaults"],
72    target: {
73        darwin: {
74            cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
75        },
76    },
77    cflags: [
78        "-Wno-format-y2k",
79        "-DSTATIC_ANDROIDFW_FOR_TOOLS",
80    ],
81
82    srcs: [
83        "AaptAssets.cpp",
84        "AaptConfig.cpp",
85        "AaptUtil.cpp",
86        "AaptXml.cpp",
87        "ApkBuilder.cpp",
88        "Command.cpp",
89        "CrunchCache.cpp",
90        "FileFinder.cpp",
91        "Images.cpp",
92        "Package.cpp",
93        "pseudolocalize.cpp",
94        "Resource.cpp",
95        "ResourceFilter.cpp",
96        "ResourceIdCache.cpp",
97        "ResourceTable.cpp",
98        "SourcePos.cpp",
99        "StringPool.cpp",
100        "WorkQueue.cpp",
101        "XMLNode.cpp",
102        "ZipEntry.cpp",
103        "ZipFile.cpp",
104    ],
105}
106
107// ==========================================================
108// Build the host executable: aapt
109// ==========================================================
110cc_binary_host {
111    name: "aapt",
112    defaults: ["aapt_defaults"],
113    srcs: ["Main.cpp"],
114    use_version_lib: true,
115    static_libs: ["libaapt"],
116    dist: {
117        targets: ["aapt2_artifacts"],
118    },
119}
120
121// ==========================================================
122// Build the host tests: libaapt_tests
123// ==========================================================
124cc_test_host {
125    name: "libaapt_tests",
126    defaults: ["aapt_defaults"],
127    srcs: [
128        "tests/AaptConfig_test.cpp",
129        "tests/AaptGroupEntry_test.cpp",
130        "tests/Pseudolocales_test.cpp",
131        "tests/ResourceFilter_test.cpp",
132        "tests/ResourceTable_test.cpp",
133    ],
134    static_libs: ["libaapt"],
135}
136