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