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