2017-01-12 14:24:31 -05:00
|
|
|
//
|
2017-02-21 14:22:30 -08:00
|
|
|
// Copyright (C) 2017 The Android Open Source Project
|
2017-01-12 14:24:31 -05:00
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
|
|
|
|
toolSources = [
|
2018-07-10 13:51:36 -07:00
|
|
|
"cmd/Command.cpp",
|
2017-04-03 18:12:45 -07:00
|
|
|
"cmd/Compile.cpp",
|
2017-10-31 17:44:39 -07:00
|
|
|
"cmd/Convert.cpp",
|
2017-04-03 18:12:45 -07:00
|
|
|
"cmd/Diff.cpp",
|
|
|
|
"cmd/Dump.cpp",
|
|
|
|
"cmd/Link.cpp",
|
|
|
|
"cmd/Optimize.cpp",
|
|
|
|
"cmd/Util.cpp",
|
2017-01-12 14:24:31 -05:00
|
|
|
]
|
|
|
|
|
|
|
|
cc_defaults {
|
2017-09-08 22:44:51 -07:00
|
|
|
name: "aapt2_defaults",
|
2017-01-12 14:24:31 -05:00
|
|
|
cflags: [
|
|
|
|
"-Wall",
|
|
|
|
"-Werror",
|
|
|
|
"-Wno-unused-parameter",
|
|
|
|
],
|
|
|
|
cppflags: [
|
|
|
|
"-Wno-missing-field-initializers",
|
|
|
|
"-fno-exceptions",
|
|
|
|
"-fno-rtti",
|
|
|
|
],
|
|
|
|
target: {
|
|
|
|
windows: {
|
|
|
|
enabled: true,
|
|
|
|
cflags: ["-Wno-maybe-uninitialized"],
|
2019-05-06 11:54:41 -07:00
|
|
|
ldflags: ["-static"],
|
2017-01-12 14:24:31 -05:00
|
|
|
},
|
|
|
|
darwin: {
|
|
|
|
cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
|
|
|
|
},
|
|
|
|
},
|
2020-04-03 09:42:03 +01:00
|
|
|
header_libs: ["jni_headers"],
|
2017-01-12 14:24:31 -05:00
|
|
|
static_libs: [
|
|
|
|
"libandroidfw",
|
|
|
|
"libutils",
|
|
|
|
"liblog",
|
|
|
|
"libcutils",
|
|
|
|
"libexpat",
|
|
|
|
"libziparchive",
|
|
|
|
"libpng",
|
|
|
|
"libbase",
|
|
|
|
"libprotobuf-cpp-lite",
|
2017-09-08 21:26:31 -07:00
|
|
|
"libz",
|
2019-03-18 08:57:47 -07:00
|
|
|
"libbuildversion",
|
2017-01-12 14:24:31 -05:00
|
|
|
],
|
2019-01-04 13:48:04 -08:00
|
|
|
stl: "libc++_static",
|
2017-01-12 14:24:31 -05:00
|
|
|
group_static_libs: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
// ==========================================================
|
|
|
|
// NOTE: Do not add any shared libraries.
|
|
|
|
// AAPT2 is built to run on many environments
|
|
|
|
// that may not have the required dependencies.
|
|
|
|
// ==========================================================
|
|
|
|
|
|
|
|
// ==========================================================
|
|
|
|
// Build the host static library: aapt2
|
|
|
|
// ==========================================================
|
|
|
|
cc_library_host_static {
|
|
|
|
name: "libaapt2",
|
|
|
|
srcs: [
|
|
|
|
"compile/IdAssigner.cpp",
|
|
|
|
"compile/InlineXmlFormatParser.cpp",
|
|
|
|
"compile/NinePatch.cpp",
|
|
|
|
"compile/Png.cpp",
|
|
|
|
"compile/PngChunkFilter.cpp",
|
|
|
|
"compile/PngCrunch.cpp",
|
|
|
|
"compile/PseudolocaleGenerator.cpp",
|
|
|
|
"compile/Pseudolocalizer.cpp",
|
|
|
|
"compile/XmlIdCollector.cpp",
|
2017-05-12 16:22:36 -07:00
|
|
|
"configuration/ConfigurationParser.cpp",
|
2018-08-21 14:52:51 -07:00
|
|
|
"dump/DumpManifest.cpp",
|
2017-06-19 12:52:04 -07:00
|
|
|
"filter/AbiFilter.cpp",
|
2017-01-12 14:24:31 -05:00
|
|
|
"filter/ConfigFilter.cpp",
|
2017-09-29 14:49:15 -07:00
|
|
|
"format/Archive.cpp",
|
2017-10-03 07:44:08 -07:00
|
|
|
"format/Container.cpp",
|
2017-09-29 14:49:15 -07:00
|
|
|
"format/binary/BinaryResourceParser.cpp",
|
|
|
|
"format/binary/ResChunkPullParser.cpp",
|
|
|
|
"format/binary/TableFlattener.cpp",
|
|
|
|
"format/binary/XmlFlattener.cpp",
|
|
|
|
"format/proto/ProtoDeserialize.cpp",
|
|
|
|
"format/proto/ProtoSerialize.cpp",
|
2017-10-03 07:44:08 -07:00
|
|
|
"io/BigBufferStream.cpp",
|
2017-01-12 14:24:31 -05:00
|
|
|
"io/File.cpp",
|
2017-10-03 07:44:08 -07:00
|
|
|
"io/FileStream.cpp",
|
2017-01-12 14:24:31 -05:00
|
|
|
"io/FileSystem.cpp",
|
2017-10-03 07:44:08 -07:00
|
|
|
"io/StringStream.cpp",
|
2017-04-03 18:12:45 -07:00
|
|
|
"io/Util.cpp",
|
2017-01-12 14:24:31 -05:00
|
|
|
"io/ZipArchive.cpp",
|
|
|
|
"link/AutoVersioner.cpp",
|
|
|
|
"link/ManifestFixer.cpp",
|
2018-02-23 16:18:10 -08:00
|
|
|
"link/NoDefaultResourceRemover.cpp",
|
2017-01-12 14:24:31 -05:00
|
|
|
"link/ProductFilter.cpp",
|
|
|
|
"link/PrivateAttributeMover.cpp",
|
|
|
|
"link/ReferenceLinker.cpp",
|
2019-01-25 14:25:37 -08:00
|
|
|
"link/ResourceExcluder.cpp",
|
2017-01-12 14:24:31 -05:00
|
|
|
"link/TableMerger.cpp",
|
2017-05-17 19:28:38 -07:00
|
|
|
"link/XmlCompatVersioner.cpp",
|
2017-01-12 14:24:31 -05:00
|
|
|
"link/XmlNamespaceRemover.cpp",
|
|
|
|
"link/XmlReferenceLinker.cpp",
|
2017-06-22 12:24:12 -07:00
|
|
|
"optimize/MultiApkGenerator.cpp",
|
2017-02-21 14:22:30 -08:00
|
|
|
"optimize/ResourceDeduper.cpp",
|
2018-01-12 11:37:26 -05:00
|
|
|
"optimize/ResourceFilter.cpp",
|
2018-11-07 16:49:02 -05:00
|
|
|
"optimize/ResourcePathShortener.cpp",
|
2017-02-21 14:22:30 -08:00
|
|
|
"optimize/VersionCollapser.cpp",
|
2017-01-12 14:24:31 -05:00
|
|
|
"process/SymbolTable.cpp",
|
|
|
|
"split/TableSplitter.cpp",
|
2017-11-03 15:20:17 -07:00
|
|
|
"text/Printer.cpp",
|
2017-06-28 11:44:11 -07:00
|
|
|
"text/Unicode.cpp",
|
|
|
|
"text/Utf8Iterator.cpp",
|
2017-01-12 14:24:31 -05:00
|
|
|
"util/BigBuffer.cpp",
|
|
|
|
"util/Files.cpp",
|
|
|
|
"util/Util.cpp",
|
|
|
|
"Debug.cpp",
|
|
|
|
"DominatorTree.cpp",
|
|
|
|
"java/AnnotationProcessor.cpp",
|
|
|
|
"java/ClassDefinition.cpp",
|
|
|
|
"java/JavaClassGenerator.cpp",
|
|
|
|
"java/ManifestClassGenerator.cpp",
|
|
|
|
"java/ProguardRules.cpp",
|
2017-02-01 00:29:25 +00:00
|
|
|
"LoadedApk.cpp",
|
2017-01-12 14:24:31 -05:00
|
|
|
"Resource.cpp",
|
|
|
|
"ResourceParser.cpp",
|
|
|
|
"ResourceTable.cpp",
|
|
|
|
"ResourceUtils.cpp",
|
|
|
|
"ResourceValues.cpp",
|
|
|
|
"SdkConstants.cpp",
|
|
|
|
"StringPool.cpp",
|
2019-02-21 15:13:29 -08:00
|
|
|
"trace/TraceBuffer.cpp",
|
2017-01-12 14:24:31 -05:00
|
|
|
"xml/XmlActionExecutor.cpp",
|
|
|
|
"xml/XmlDom.cpp",
|
|
|
|
"xml/XmlPullParser.cpp",
|
|
|
|
"xml/XmlUtil.cpp",
|
2017-09-12 17:39:52 -07:00
|
|
|
"Configuration.proto",
|
2017-08-10 15:37:28 -07:00
|
|
|
"Resources.proto",
|
|
|
|
"ResourcesInternal.proto",
|
2017-01-12 14:24:31 -05:00
|
|
|
],
|
|
|
|
proto: {
|
|
|
|
export_proto_headers: true,
|
|
|
|
},
|
2017-09-08 22:44:51 -07:00
|
|
|
defaults: ["aapt2_defaults"],
|
2017-01-12 14:24:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// ==========================================================
|
|
|
|
// Build the host shared library: aapt2_jni
|
|
|
|
// ==========================================================
|
|
|
|
cc_library_host_shared {
|
|
|
|
name: "libaapt2_jni",
|
|
|
|
srcs: toolSources + ["jni/aapt2_jni.cpp"],
|
|
|
|
static_libs: ["libaapt2"],
|
2017-09-08 22:44:51 -07:00
|
|
|
defaults: ["aapt2_defaults"],
|
2017-01-12 14:24:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// ==========================================================
|
|
|
|
// Build the host tests: aapt2_tests
|
|
|
|
// ==========================================================
|
|
|
|
cc_test_host {
|
|
|
|
name: "aapt2_tests",
|
2017-06-01 15:22:57 -07:00
|
|
|
srcs: [
|
2017-08-02 14:57:43 -07:00
|
|
|
"test/Builders.cpp",
|
2017-06-01 15:22:57 -07:00
|
|
|
"test/Common.cpp",
|
2019-01-02 17:15:39 -08:00
|
|
|
"test/Fixture.cpp",
|
2017-06-01 15:22:57 -07:00
|
|
|
"**/*_test.cpp",
|
2017-10-18 23:51:18 -07:00
|
|
|
] + toolSources,
|
2017-05-12 16:22:36 -07:00
|
|
|
static_libs: [
|
|
|
|
"libaapt2",
|
|
|
|
"libgmock",
|
|
|
|
],
|
2017-09-08 22:44:51 -07:00
|
|
|
defaults: ["aapt2_defaults"],
|
2019-01-02 17:15:39 -08:00
|
|
|
data: [
|
|
|
|
"integration-tests/CompileTest/**/*",
|
2019-01-23 12:39:40 -08:00
|
|
|
"integration-tests/CommandTests/**/*",
|
|
|
|
"integration-tests/ConvertTest/**/*"
|
2019-01-02 17:15:39 -08:00
|
|
|
],
|
2017-01-12 14:24:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// ==========================================================
|
|
|
|
// Build the host executable: aapt2
|
|
|
|
// ==========================================================
|
|
|
|
cc_binary_host {
|
|
|
|
name: "aapt2",
|
|
|
|
srcs: ["Main.cpp"] + toolSources,
|
|
|
|
static_libs: ["libaapt2"],
|
2017-09-08 22:44:51 -07:00
|
|
|
defaults: ["aapt2_defaults"],
|
2017-01-12 14:24:31 -05:00
|
|
|
}
|
2019-03-18 22:18:27 -07:00
|
|
|
|
|
|
|
// ==========================================================
|
|
|
|
// Dist the protos
|
|
|
|
// ==========================================================
|
|
|
|
genrule {
|
|
|
|
name: "aapt2-protos",
|
|
|
|
tools: [":soong_zip"],
|
|
|
|
srcs: [
|
|
|
|
"Configuration.proto",
|
|
|
|
"Resources.proto",
|
|
|
|
],
|
|
|
|
out: ["aapt2-protos.zip"],
|
|
|
|
cmd: "mkdir $(genDir)/protos && " +
|
|
|
|
"cp $(in) $(genDir)/protos && " +
|
|
|
|
"$(location :soong_zip) -o $(out) -C $(genDir)/protos -D $(genDir)/protos",
|
|
|
|
dist: {
|
|
|
|
targets: ["sdk_repo"],
|
|
|
|
},
|
|
|
|
}
|