Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 1 | // |
Adam Lesinski | d48944a | 2017-02-21 14:22:30 -0800 | [diff] [blame] | 2 | // Copyright (C) 2017 The Android Open Source Project |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 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 | toolSources = [ |
Adam Lesinski | d0f492d | 2017-04-03 18:12:45 -0700 | [diff] [blame] | 18 | "cmd/Compile.cpp", |
| 19 | "cmd/Diff.cpp", |
| 20 | "cmd/Dump.cpp", |
| 21 | "cmd/Link.cpp", |
| 22 | "cmd/Optimize.cpp", |
| 23 | "cmd/Util.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 24 | ] |
| 25 | |
| 26 | cc_defaults { |
| 27 | name: "aapt_defaults", |
| 28 | cflags: [ |
| 29 | "-Wall", |
| 30 | "-Werror", |
| 31 | "-Wno-unused-parameter", |
| 32 | ], |
| 33 | cppflags: [ |
| 34 | "-Wno-missing-field-initializers", |
| 35 | "-fno-exceptions", |
| 36 | "-fno-rtti", |
| 37 | ], |
| 38 | target: { |
| 39 | windows: { |
| 40 | enabled: true, |
| 41 | cflags: ["-Wno-maybe-uninitialized"], |
| 42 | static_libs: ["libz"], |
| 43 | }, |
| 44 | darwin: { |
| 45 | cflags: ["-D_DARWIN_UNLIMITED_STREAMS"], |
| 46 | host_ldlibs: ["-lz"], |
| 47 | }, |
| 48 | linux: { |
| 49 | host_ldlibs: ["-lz"], |
| 50 | }, |
| 51 | }, |
| 52 | static_libs: [ |
| 53 | "libandroidfw", |
| 54 | "libutils", |
| 55 | "liblog", |
| 56 | "libcutils", |
| 57 | "libexpat", |
| 58 | "libziparchive", |
| 59 | "libpng", |
| 60 | "libbase", |
| 61 | "libprotobuf-cpp-lite", |
| 62 | ], |
| 63 | group_static_libs: true, |
| 64 | } |
| 65 | |
| 66 | // ========================================================== |
| 67 | // NOTE: Do not add any shared libraries. |
| 68 | // AAPT2 is built to run on many environments |
| 69 | // that may not have the required dependencies. |
| 70 | // ========================================================== |
| 71 | |
| 72 | // ========================================================== |
| 73 | // Build the host static library: aapt2 |
| 74 | // ========================================================== |
| 75 | cc_library_host_static { |
| 76 | name: "libaapt2", |
| 77 | srcs: [ |
| 78 | "compile/IdAssigner.cpp", |
| 79 | "compile/InlineXmlFormatParser.cpp", |
| 80 | "compile/NinePatch.cpp", |
| 81 | "compile/Png.cpp", |
| 82 | "compile/PngChunkFilter.cpp", |
| 83 | "compile/PngCrunch.cpp", |
| 84 | "compile/PseudolocaleGenerator.cpp", |
| 85 | "compile/Pseudolocalizer.cpp", |
| 86 | "compile/XmlIdCollector.cpp", |
Shane Farmer | 74cdea3 | 2017-05-12 16:22:36 -0700 | [diff] [blame] | 87 | "configuration/ConfigurationParser.cpp", |
Shane Farmer | 5766943 | 2017-06-19 12:52:04 -0700 | [diff] [blame] | 88 | "filter/AbiFilter.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 89 | "filter/ConfigFilter.cpp", |
| 90 | "flatten/Archive.cpp", |
| 91 | "flatten/TableFlattener.cpp", |
| 92 | "flatten/XmlFlattener.cpp", |
Adam Lesinski | 06460ef | 2017-03-14 18:52:13 -0700 | [diff] [blame] | 93 | "io/BigBufferStreams.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 94 | "io/File.cpp", |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame^] | 95 | "io/FileInputStream.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 96 | "io/FileSystem.cpp", |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame^] | 97 | "io/StringInputStream.cpp", |
Adam Lesinski | d0f492d | 2017-04-03 18:12:45 -0700 | [diff] [blame] | 98 | "io/Util.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 99 | "io/ZipArchive.cpp", |
| 100 | "link/AutoVersioner.cpp", |
| 101 | "link/ManifestFixer.cpp", |
| 102 | "link/ProductFilter.cpp", |
| 103 | "link/PrivateAttributeMover.cpp", |
| 104 | "link/ReferenceLinker.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 105 | "link/TableMerger.cpp", |
Adam Lesinski | c744ae8 | 2017-05-17 19:28:38 -0700 | [diff] [blame] | 106 | "link/XmlCompatVersioner.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 107 | "link/XmlNamespaceRemover.cpp", |
| 108 | "link/XmlReferenceLinker.cpp", |
Adam Lesinski | d48944a | 2017-02-21 14:22:30 -0800 | [diff] [blame] | 109 | "optimize/ResourceDeduper.cpp", |
| 110 | "optimize/VersionCollapser.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 111 | "process/SymbolTable.cpp", |
| 112 | "proto/ProtoHelpers.cpp", |
| 113 | "proto/TableProtoDeserializer.cpp", |
| 114 | "proto/TableProtoSerializer.cpp", |
| 115 | "split/TableSplitter.cpp", |
Adam Lesinski | 66ea840 | 2017-06-28 11:44:11 -0700 | [diff] [blame] | 116 | "text/Unicode.cpp", |
| 117 | "text/Utf8Iterator.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 118 | "unflatten/BinaryResourceParser.cpp", |
| 119 | "unflatten/ResChunkPullParser.cpp", |
| 120 | "util/BigBuffer.cpp", |
| 121 | "util/Files.cpp", |
| 122 | "util/Util.cpp", |
| 123 | "ConfigDescription.cpp", |
| 124 | "Debug.cpp", |
| 125 | "DominatorTree.cpp", |
| 126 | "Flags.cpp", |
| 127 | "java/AnnotationProcessor.cpp", |
| 128 | "java/ClassDefinition.cpp", |
| 129 | "java/JavaClassGenerator.cpp", |
| 130 | "java/ManifestClassGenerator.cpp", |
| 131 | "java/ProguardRules.cpp", |
Pierre Lecesne | ff759e6 | 2017-02-01 00:29:25 +0000 | [diff] [blame] | 132 | "LoadedApk.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 133 | "Locale.cpp", |
| 134 | "Resource.cpp", |
| 135 | "ResourceParser.cpp", |
| 136 | "ResourceTable.cpp", |
| 137 | "ResourceUtils.cpp", |
| 138 | "ResourceValues.cpp", |
| 139 | "SdkConstants.cpp", |
| 140 | "StringPool.cpp", |
| 141 | "xml/XmlActionExecutor.cpp", |
| 142 | "xml/XmlDom.cpp", |
| 143 | "xml/XmlPullParser.cpp", |
| 144 | "xml/XmlUtil.cpp", |
| 145 | "Format.proto", |
| 146 | ], |
| 147 | proto: { |
| 148 | export_proto_headers: true, |
| 149 | }, |
| 150 | defaults: ["aapt_defaults"], |
| 151 | } |
| 152 | |
| 153 | // ========================================================== |
| 154 | // Build the host shared library: aapt2_jni |
| 155 | // ========================================================== |
| 156 | cc_library_host_shared { |
| 157 | name: "libaapt2_jni", |
| 158 | srcs: toolSources + ["jni/aapt2_jni.cpp"], |
| 159 | static_libs: ["libaapt2"], |
| 160 | defaults: ["aapt_defaults"], |
| 161 | } |
| 162 | |
| 163 | // ========================================================== |
| 164 | // Build the host tests: aapt2_tests |
| 165 | // ========================================================== |
| 166 | cc_test_host { |
| 167 | name: "aapt2_tests", |
Adam Lesinski | bab4ef5 | 2017-06-01 15:22:57 -0700 | [diff] [blame] | 168 | srcs: [ |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame^] | 169 | "test/Builders.cpp", |
Adam Lesinski | bab4ef5 | 2017-06-01 15:22:57 -0700 | [diff] [blame] | 170 | "test/Common.cpp", |
| 171 | "**/*_test.cpp", |
| 172 | ], |
Shane Farmer | 74cdea3 | 2017-05-12 16:22:36 -0700 | [diff] [blame] | 173 | static_libs: [ |
| 174 | "libaapt2", |
| 175 | "libgmock", |
| 176 | ], |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 177 | defaults: ["aapt_defaults"], |
| 178 | } |
| 179 | |
| 180 | // ========================================================== |
| 181 | // Build the host executable: aapt2 |
| 182 | // ========================================================== |
| 183 | cc_binary_host { |
| 184 | name: "aapt2", |
| 185 | srcs: ["Main.cpp"] + toolSources, |
| 186 | static_libs: ["libaapt2"], |
| 187 | defaults: ["aapt_defaults"], |
| 188 | } |