• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    group_static_libs: true,
54
55    cflags: [
56        "-Wall",
57        "-Werror",
58    ],
59
60    target: {
61        windows: {
62            enabled: true,
63        },
64    },
65
66    // This tool is prebuilt if we're doing an app-only build.
67    product_variables: {
68        pdk: {
69            enabled: false,
70        },
71        unbundled_build: {
72            enabled: false,
73        },
74    },
75}
76
77// ==========================================================
78// Build the host static library: libaapt
79// ==========================================================
80cc_library_host_static {
81    name: "libaapt",
82    defaults: ["aapt_defaults"],
83    target: {
84        darwin: {
85            cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
86        },
87    },
88    cflags: [
89        "-Wno-format-y2k",
90        "-DSTATIC_ANDROIDFW_FOR_TOOLS",
91    ],
92
93    srcs: [
94        "AaptAssets.cpp",
95        "AaptConfig.cpp",
96        "AaptUtil.cpp",
97        "AaptXml.cpp",
98        "ApkBuilder.cpp",
99        "Command.cpp",
100        "CrunchCache.cpp",
101        "FileFinder.cpp",
102        "Images.cpp",
103        "Package.cpp",
104        "pseudolocalize.cpp",
105        "Resource.cpp",
106        "ResourceFilter.cpp",
107        "ResourceIdCache.cpp",
108        "ResourceTable.cpp",
109        "SourcePos.cpp",
110        "StringPool.cpp",
111        "WorkQueue.cpp",
112        "XMLNode.cpp",
113        "ZipEntry.cpp",
114        "ZipFile.cpp",
115    ],
116}
117
118// ==========================================================
119// Build the host executable: aapt
120// ==========================================================
121cc_binary_host {
122    name: "aapt",
123    defaults: ["aapt_defaults"],
124    srcs: ["Main.cpp"],
125    use_version_lib: true,
126    static_libs: ["libaapt"],
127    dist: {
128        targets: ["aapt2_artifacts"],
129    },
130}
131
132// ==========================================================
133// Build the host tests: libaapt_tests
134// ==========================================================
135cc_test_host {
136    name: "libaapt_tests",
137    defaults: ["aapt_defaults"],
138    srcs: [
139        "tests/AaptConfig_test.cpp",
140        "tests/AaptGroupEntry_test.cpp",
141        "tests/Pseudolocales_test.cpp",
142        "tests/ResourceFilter_test.cpp",
143        "tests/ResourceTable_test.cpp",
144    ],
145    static_libs: ["libaapt"],
146}
147