Home | History | Annotate | Download | only in aapt2
      1 //
      2 // Copyright (C) 2017 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 toolSources = [
     18     "cmd/Compile.cpp",
     19     "cmd/Diff.cpp",
     20     "cmd/Dump.cpp",
     21     "cmd/Link.cpp",
     22     "cmd/Optimize.cpp",
     23     "cmd/Util.cpp",
     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",
     87         "filter/ConfigFilter.cpp",
     88         "flatten/Archive.cpp",
     89         "flatten/TableFlattener.cpp",
     90         "flatten/XmlFlattener.cpp",
     91         "io/BigBufferStreams.cpp",
     92         "io/File.cpp",
     93         "io/FileSystem.cpp",
     94         "io/Util.cpp",
     95         "io/ZipArchive.cpp",
     96         "link/AutoVersioner.cpp",
     97         "link/ManifestFixer.cpp",
     98         "link/ProductFilter.cpp",
     99         "link/PrivateAttributeMover.cpp",
    100         "link/ReferenceLinker.cpp",
    101         "link/TableMerger.cpp",
    102         "link/XmlCompatVersioner.cpp",
    103         "link/XmlNamespaceRemover.cpp",
    104         "link/XmlReferenceLinker.cpp",
    105         "optimize/ResourceDeduper.cpp",
    106         "optimize/VersionCollapser.cpp",
    107         "process/SymbolTable.cpp",
    108         "proto/ProtoHelpers.cpp",
    109         "proto/TableProtoDeserializer.cpp",
    110         "proto/TableProtoSerializer.cpp",
    111         "split/TableSplitter.cpp",
    112         "unflatten/BinaryResourceParser.cpp",
    113         "unflatten/ResChunkPullParser.cpp",
    114         "util/BigBuffer.cpp",
    115         "util/Files.cpp",
    116         "util/Util.cpp",
    117         "ConfigDescription.cpp",
    118         "Debug.cpp",
    119         "DominatorTree.cpp",
    120         "Flags.cpp",
    121         "java/AnnotationProcessor.cpp",
    122         "java/ClassDefinition.cpp",
    123         "java/JavaClassGenerator.cpp",
    124         "java/ManifestClassGenerator.cpp",
    125         "java/ProguardRules.cpp",
    126         "LoadedApk.cpp",
    127         "Locale.cpp",
    128         "Resource.cpp",
    129         "ResourceParser.cpp",
    130         "ResourceTable.cpp",
    131         "ResourceUtils.cpp",
    132         "ResourceValues.cpp",
    133         "SdkConstants.cpp",
    134         "StringPool.cpp",
    135         "xml/XmlActionExecutor.cpp",
    136         "xml/XmlDom.cpp",
    137         "xml/XmlPullParser.cpp",
    138         "xml/XmlUtil.cpp",
    139         "Format.proto",
    140     ],
    141     proto: {
    142         export_proto_headers: true,
    143     },
    144     defaults: ["aapt_defaults"],
    145 }
    146 
    147 // ==========================================================
    148 // Build the host shared library: aapt2_jni
    149 // ==========================================================
    150 cc_library_host_shared {
    151     name: "libaapt2_jni",
    152     srcs: toolSources + ["jni/aapt2_jni.cpp"],
    153     static_libs: ["libaapt2"],
    154     defaults: ["aapt_defaults"],
    155 }
    156 
    157 // ==========================================================
    158 // Build the host tests: aapt2_tests
    159 // ==========================================================
    160 cc_test_host {
    161     name: "aapt2_tests",
    162     srcs: ["test/Common.cpp", "**/*_test.cpp"],
    163     static_libs: ["libaapt2", "libgmock"],
    164     defaults: ["aapt_defaults"],
    165 }
    166 
    167 // ==========================================================
    168 // Build the host executable: aapt2
    169 // ==========================================================
    170 cc_binary_host {
    171     name: "aapt2",
    172     srcs: ["Main.cpp"] + toolSources,
    173     static_libs: ["libaapt2"],
    174     defaults: ["aapt_defaults"],
    175 }
    176