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