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 22 cc_defaults { 23 name: "aapt_defaults", 24 25 static_libs: [ 26 "libandroidfw", 27 "libpng", 28 "libutils", 29 "liblog", 30 "libcutils", 31 "libexpat", 32 "libziparchive", 33 "libbase", 34 "libz", 35 ], 36 group_static_libs: true, 37 38 cflags: [ 39 "-Wall", 40 "-Werror", 41 ], 42 43 target: { 44 windows: { 45 enabled: true, 46 }, 47 }, 48 49 // This tool is prebuilt if we're doing an app-only build. 50 product_variables: { 51 pdk: { 52 enabled: false, 53 }, 54 unbundled_build: { 55 enabled: false, 56 }, 57 }, 58 } 59 60 // ========================================================== 61 // Build the host static library: libaapt 62 // ========================================================== 63 cc_library_host_static { 64 name: "libaapt", 65 defaults: ["aapt_defaults"], 66 target: { 67 darwin: { 68 cflags: ["-D_DARWIN_UNLIMITED_STREAMS"], 69 }, 70 }, 71 cflags: [ 72 "-Wno-format-y2k", 73 "-DSTATIC_ANDROIDFW_FOR_TOOLS", 74 // Allow implicit fallthroughs in AaptAssets.cpp until they are fixed. 75 "-Wno-error=implicit-fallthrough", 76 ], 77 78 srcs: [ 79 "AaptAssets.cpp", 80 "AaptConfig.cpp", 81 "AaptUtil.cpp", 82 "AaptXml.cpp", 83 "ApkBuilder.cpp", 84 "Command.cpp", 85 "CrunchCache.cpp", 86 "FileFinder.cpp", 87 "Images.cpp", 88 "Package.cpp", 89 "pseudolocalize.cpp", 90 "Resource.cpp", 91 "ResourceFilter.cpp", 92 "ResourceIdCache.cpp", 93 "ResourceTable.cpp", 94 "SourcePos.cpp", 95 "StringPool.cpp", 96 "WorkQueue.cpp", 97 "XMLNode.cpp", 98 "ZipEntry.cpp", 99 "ZipFile.cpp", 100 ], 101 } 102 103 // ========================================================== 104 // Build the host executable: aapt 105 // ========================================================== 106 cc_binary_host { 107 name: "aapt", 108 defaults: ["aapt_defaults"], 109 srcs: ["Main.cpp"], 110 use_version_lib: true, 111 static_libs: ["libaapt"], 112 } 113 114 // ========================================================== 115 // Build the host tests: libaapt_tests 116 // ========================================================== 117 cc_test_host { 118 name: "libaapt_tests", 119 defaults: ["aapt_defaults"], 120 srcs: [ 121 "tests/AaptConfig_test.cpp", 122 "tests/AaptGroupEntry_test.cpp", 123 "tests/Pseudolocales_test.cpp", 124 "tests/ResourceFilter_test.cpp", 125 "tests/ResourceTable_test.cpp", 126 ], 127 static_libs: ["libaapt"], 128 } 129