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 = [ |
Ryan Mitchell | 833a1a6 | 2018-07-10 13:51:36 -0700 | [diff] [blame] | 18 | "cmd/Command.cpp", |
Adam Lesinski | d0f492d | 2017-04-03 18:12:45 -0700 | [diff] [blame] | 19 | "cmd/Compile.cpp", |
Adam Lesinski | 8780eb6 | 2017-10-31 17:44:39 -0700 | [diff] [blame] | 20 | "cmd/Convert.cpp", |
Adam Lesinski | d0f492d | 2017-04-03 18:12:45 -0700 | [diff] [blame] | 21 | "cmd/Diff.cpp", |
| 22 | "cmd/Dump.cpp", |
| 23 | "cmd/Link.cpp", |
| 24 | "cmd/Optimize.cpp", |
| 25 | "cmd/Util.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 26 | ] |
| 27 | |
| 28 | cc_defaults { |
Dan Willemsen | 7544b9c | 2017-09-08 22:44:51 -0700 | [diff] [blame] | 29 | name: "aapt2_defaults", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 30 | cflags: [ |
| 31 | "-Wall", |
| 32 | "-Werror", |
| 33 | "-Wno-unused-parameter", |
| 34 | ], |
| 35 | cppflags: [ |
| 36 | "-Wno-missing-field-initializers", |
| 37 | "-fno-exceptions", |
| 38 | "-fno-rtti", |
| 39 | ], |
| 40 | target: { |
| 41 | windows: { |
| 42 | enabled: true, |
| 43 | cflags: ["-Wno-maybe-uninitialized"], |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 44 | }, |
| 45 | darwin: { |
| 46 | cflags: ["-D_DARWIN_UNLIMITED_STREAMS"], |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 47 | }, |
| 48 | }, |
| 49 | static_libs: [ |
| 50 | "libandroidfw", |
| 51 | "libutils", |
| 52 | "liblog", |
| 53 | "libcutils", |
| 54 | "libexpat", |
| 55 | "libziparchive", |
| 56 | "libpng", |
| 57 | "libbase", |
| 58 | "libprotobuf-cpp-lite", |
Dan Willemsen | 85aee73 | 2017-09-08 21:26:31 -0700 | [diff] [blame] | 59 | "libz", |
Ryan Mitchell | 34039b2 | 2019-03-18 08:57:47 -0700 | [diff] [blame] | 60 | "libbuildversion", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 61 | ], |
Ryan Mitchell | 81bae2d | 2019-01-04 13:48:04 -0800 | [diff] [blame] | 62 | stl: "libc++_static", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 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", |
Ryan Mitchell | fc225b2 | 2018-08-21 14:52:51 -0700 | [diff] [blame] | 88 | "dump/DumpManifest.cpp", |
Shane Farmer | 5766943 | 2017-06-19 12:52:04 -0700 | [diff] [blame] | 89 | "filter/AbiFilter.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 90 | "filter/ConfigFilter.cpp", |
Adam Lesinski | 4670805 | 2017-09-29 14:49:15 -0700 | [diff] [blame] | 91 | "format/Archive.cpp", |
Adam Lesinski | 0045116 | 2017-10-03 07:44:08 -0700 | [diff] [blame] | 92 | "format/Container.cpp", |
Adam Lesinski | 4670805 | 2017-09-29 14:49:15 -0700 | [diff] [blame] | 93 | "format/binary/BinaryResourceParser.cpp", |
| 94 | "format/binary/ResChunkPullParser.cpp", |
| 95 | "format/binary/TableFlattener.cpp", |
| 96 | "format/binary/XmlFlattener.cpp", |
| 97 | "format/proto/ProtoDeserialize.cpp", |
| 98 | "format/proto/ProtoSerialize.cpp", |
Adam Lesinski | 0045116 | 2017-10-03 07:44:08 -0700 | [diff] [blame] | 99 | "io/BigBufferStream.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 100 | "io/File.cpp", |
Adam Lesinski | 0045116 | 2017-10-03 07:44:08 -0700 | [diff] [blame] | 101 | "io/FileStream.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 102 | "io/FileSystem.cpp", |
Adam Lesinski | 0045116 | 2017-10-03 07:44:08 -0700 | [diff] [blame] | 103 | "io/StringStream.cpp", |
Adam Lesinski | d0f492d | 2017-04-03 18:12:45 -0700 | [diff] [blame] | 104 | "io/Util.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 105 | "io/ZipArchive.cpp", |
| 106 | "link/AutoVersioner.cpp", |
| 107 | "link/ManifestFixer.cpp", |
Adam Lesinski | 34a1687 | 2018-02-23 16:18:10 -0800 | [diff] [blame] | 108 | "link/NoDefaultResourceRemover.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 109 | "link/ProductFilter.cpp", |
| 110 | "link/PrivateAttributeMover.cpp", |
| 111 | "link/ReferenceLinker.cpp", |
Winson | 3c918b8 | 2019-01-25 14:25:37 -0800 | [diff] [blame] | 112 | "link/ResourceExcluder.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 113 | "link/TableMerger.cpp", |
Adam Lesinski | c744ae8 | 2017-05-17 19:28:38 -0700 | [diff] [blame] | 114 | "link/XmlCompatVersioner.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 115 | "link/XmlNamespaceRemover.cpp", |
| 116 | "link/XmlReferenceLinker.cpp", |
Shane Farmer | 0a5b201 | 2017-06-22 12:24:12 -0700 | [diff] [blame] | 117 | "optimize/MultiApkGenerator.cpp", |
Adam Lesinski | d48944a | 2017-02-21 14:22:30 -0800 | [diff] [blame] | 118 | "optimize/ResourceDeduper.cpp", |
Mohamed Heikal | d3c5fb6 | 2018-01-12 11:37:26 -0500 | [diff] [blame] | 119 | "optimize/ResourceFilter.cpp", |
Mohamed Heikal | c769403 | 2018-11-07 16:49:02 -0500 | [diff] [blame] | 120 | "optimize/ResourcePathShortener.cpp", |
Adam Lesinski | d48944a | 2017-02-21 14:22:30 -0800 | [diff] [blame] | 121 | "optimize/VersionCollapser.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 122 | "process/SymbolTable.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 123 | "split/TableSplitter.cpp", |
Adam Lesinski | 93190b7 | 2017-11-03 15:20:17 -0700 | [diff] [blame] | 124 | "text/Printer.cpp", |
Adam Lesinski | 66ea840 | 2017-06-28 11:44:11 -0700 | [diff] [blame] | 125 | "text/Unicode.cpp", |
| 126 | "text/Utf8Iterator.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 127 | "util/BigBuffer.cpp", |
| 128 | "util/Files.cpp", |
| 129 | "util/Util.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 130 | "Debug.cpp", |
| 131 | "DominatorTree.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 132 | "java/AnnotationProcessor.cpp", |
| 133 | "java/ClassDefinition.cpp", |
| 134 | "java/JavaClassGenerator.cpp", |
| 135 | "java/ManifestClassGenerator.cpp", |
| 136 | "java/ProguardRules.cpp", |
Pierre Lecesne | ff759e6 | 2017-02-01 00:29:25 +0000 | [diff] [blame] | 137 | "LoadedApk.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 138 | "Resource.cpp", |
| 139 | "ResourceParser.cpp", |
| 140 | "ResourceTable.cpp", |
| 141 | "ResourceUtils.cpp", |
| 142 | "ResourceValues.cpp", |
| 143 | "SdkConstants.cpp", |
| 144 | "StringPool.cpp", |
Fabien Sanglard | 2d34e76 | 2019-02-21 15:13:29 -0800 | [diff] [blame] | 145 | "trace/TraceBuffer.cpp", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 146 | "xml/XmlActionExecutor.cpp", |
| 147 | "xml/XmlDom.cpp", |
| 148 | "xml/XmlPullParser.cpp", |
| 149 | "xml/XmlUtil.cpp", |
Adam Lesinski | b58c3ef | 2017-09-12 17:39:52 -0700 | [diff] [blame] | 150 | "Configuration.proto", |
Adam Lesinski | 4ffea04 | 2017-08-10 15:37:28 -0700 | [diff] [blame] | 151 | "Resources.proto", |
| 152 | "ResourcesInternal.proto", |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 153 | ], |
| 154 | proto: { |
| 155 | export_proto_headers: true, |
| 156 | }, |
Dan Willemsen | 7544b9c | 2017-09-08 22:44:51 -0700 | [diff] [blame] | 157 | defaults: ["aapt2_defaults"], |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 158 | } |
| 159 | |
| 160 | // ========================================================== |
| 161 | // Build the host shared library: aapt2_jni |
| 162 | // ========================================================== |
| 163 | cc_library_host_shared { |
| 164 | name: "libaapt2_jni", |
| 165 | srcs: toolSources + ["jni/aapt2_jni.cpp"], |
| 166 | static_libs: ["libaapt2"], |
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 tests: aapt2_tests |
| 172 | // ========================================================== |
| 173 | cc_test_host { |
| 174 | name: "aapt2_tests", |
Adam Lesinski | bab4ef5 | 2017-06-01 15:22:57 -0700 | [diff] [blame] | 175 | srcs: [ |
Adam Lesinski | efeb7af | 2017-08-02 14:57:43 -0700 | [diff] [blame] | 176 | "test/Builders.cpp", |
Adam Lesinski | bab4ef5 | 2017-06-01 15:22:57 -0700 | [diff] [blame] | 177 | "test/Common.cpp", |
Ryan Mitchell | 479fa39 | 2019-01-02 17:15:39 -0800 | [diff] [blame] | 178 | "test/Fixture.cpp", |
Adam Lesinski | bab4ef5 | 2017-06-01 15:22:57 -0700 | [diff] [blame] | 179 | "**/*_test.cpp", |
Donald Chai | b8f078c | 2017-10-18 23:51:18 -0700 | [diff] [blame] | 180 | ] + toolSources, |
Shane Farmer | 74cdea3 | 2017-05-12 16:22:36 -0700 | [diff] [blame] | 181 | static_libs: [ |
| 182 | "libaapt2", |
| 183 | "libgmock", |
| 184 | ], |
Dan Willemsen | 7544b9c | 2017-09-08 22:44:51 -0700 | [diff] [blame] | 185 | defaults: ["aapt2_defaults"], |
Ryan Mitchell | 479fa39 | 2019-01-02 17:15:39 -0800 | [diff] [blame] | 186 | data: [ |
| 187 | "integration-tests/CompileTest/**/*", |
Winson | f54c9a1 | 2019-01-23 12:39:40 -0800 | [diff] [blame] | 188 | "integration-tests/CommandTests/**/*", |
| 189 | "integration-tests/ConvertTest/**/*" |
Ryan Mitchell | 479fa39 | 2019-01-02 17:15:39 -0800 | [diff] [blame] | 190 | ], |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | // ========================================================== |
| 194 | // Build the host executable: aapt2 |
| 195 | // ========================================================== |
| 196 | cc_binary_host { |
| 197 | name: "aapt2", |
| 198 | srcs: ["Main.cpp"] + toolSources, |
| 199 | static_libs: ["libaapt2"], |
Dan Willemsen | 7544b9c | 2017-09-08 22:44:51 -0700 | [diff] [blame] | 200 | defaults: ["aapt2_defaults"], |
Fabien Sanglard | 1916020 | 2017-01-12 14:24:31 -0500 | [diff] [blame] | 201 | } |
Colin Cross | 0b28a92 | 2019-03-18 22:18:27 -0700 | [diff] [blame] | 202 | |
| 203 | // ========================================================== |
| 204 | // Dist the protos |
| 205 | // ========================================================== |
| 206 | genrule { |
| 207 | name: "aapt2-protos", |
| 208 | tools: [":soong_zip"], |
| 209 | srcs: [ |
| 210 | "Configuration.proto", |
| 211 | "Resources.proto", |
| 212 | ], |
| 213 | out: ["aapt2-protos.zip"], |
| 214 | cmd: "mkdir $(genDir)/protos && " + |
| 215 | "cp $(in) $(genDir)/protos && " + |
| 216 | "$(location :soong_zip) -o $(out) -C $(genDir)/protos -D $(genDir)/protos", |
| 217 | dist: { |
| 218 | targets: ["sdk_repo"], |
| 219 | }, |
| 220 | } |