AAPT would accept files with multiple periods in the filename as input. This lead to cases explained in b/74999475. This change adds error messages for files with multiple periods unless the legacy flag is present. With the legacy flag present, AAPT2 will behave like AAPT rather than throwing an error. Test: Added tests to aapt2_tests Bug: 73071563 Bug: 74999475 Change-Id: I28dfceeea7b39f8e4b9e6671e0fc8793cf388f52
192 lines
5.5 KiB
Plaintext
192 lines
5.5 KiB
Plaintext
//
|
|
// Copyright (C) 2017 The Android Open Source Project
|
|
//
|
|
// 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 = [
|
|
"cmd/Compile.cpp",
|
|
"cmd/Convert.cpp",
|
|
"cmd/Diff.cpp",
|
|
"cmd/Dump.cpp",
|
|
"cmd/Link.cpp",
|
|
"cmd/Optimize.cpp",
|
|
"cmd/Util.cpp",
|
|
]
|
|
|
|
cc_defaults {
|
|
name: "aapt2_defaults",
|
|
cflags: [
|
|
"-Wall",
|
|
"-Werror",
|
|
"-Wno-unused-parameter",
|
|
],
|
|
cppflags: [
|
|
"-Wno-missing-field-initializers",
|
|
"-fno-exceptions",
|
|
"-fno-rtti",
|
|
],
|
|
target: {
|
|
windows: {
|
|
enabled: true,
|
|
cflags: ["-Wno-maybe-uninitialized"],
|
|
},
|
|
darwin: {
|
|
cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
|
|
},
|
|
},
|
|
static_libs: [
|
|
"libandroidfw",
|
|
"libutils",
|
|
"liblog",
|
|
"libcutils",
|
|
"libexpat",
|
|
"libziparchive",
|
|
"libpng",
|
|
"libbase",
|
|
"libprotobuf-cpp-lite",
|
|
"libz",
|
|
],
|
|
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",
|
|
"configuration/ConfigurationParser.cpp",
|
|
"filter/AbiFilter.cpp",
|
|
"filter/ConfigFilter.cpp",
|
|
"format/Archive.cpp",
|
|
"format/Container.cpp",
|
|
"format/binary/BinaryResourceParser.cpp",
|
|
"format/binary/ResChunkPullParser.cpp",
|
|
"format/binary/TableFlattener.cpp",
|
|
"format/binary/XmlFlattener.cpp",
|
|
"format/proto/ProtoDeserialize.cpp",
|
|
"format/proto/ProtoSerialize.cpp",
|
|
"io/BigBufferStream.cpp",
|
|
"io/File.cpp",
|
|
"io/FileStream.cpp",
|
|
"io/FileSystem.cpp",
|
|
"io/StringStream.cpp",
|
|
"io/Util.cpp",
|
|
"io/ZipArchive.cpp",
|
|
"link/AutoVersioner.cpp",
|
|
"link/ManifestFixer.cpp",
|
|
"link/NoDefaultResourceRemover.cpp",
|
|
"link/ProductFilter.cpp",
|
|
"link/PrivateAttributeMover.cpp",
|
|
"link/ReferenceLinker.cpp",
|
|
"link/TableMerger.cpp",
|
|
"link/XmlCompatVersioner.cpp",
|
|
"link/XmlNamespaceRemover.cpp",
|
|
"link/XmlReferenceLinker.cpp",
|
|
"optimize/MultiApkGenerator.cpp",
|
|
"optimize/ResourceDeduper.cpp",
|
|
"optimize/VersionCollapser.cpp",
|
|
"process/SymbolTable.cpp",
|
|
"split/TableSplitter.cpp",
|
|
"text/Printer.cpp",
|
|
"text/Unicode.cpp",
|
|
"text/Utf8Iterator.cpp",
|
|
"util/BigBuffer.cpp",
|
|
"util/Files.cpp",
|
|
"util/Util.cpp",
|
|
"ConfigDescription.cpp",
|
|
"Debug.cpp",
|
|
"DominatorTree.cpp",
|
|
"Flags.cpp",
|
|
"java/AnnotationProcessor.cpp",
|
|
"java/ClassDefinition.cpp",
|
|
"java/JavaClassGenerator.cpp",
|
|
"java/ManifestClassGenerator.cpp",
|
|
"java/ProguardRules.cpp",
|
|
"LoadedApk.cpp",
|
|
"Locale.cpp",
|
|
"Resource.cpp",
|
|
"ResourceParser.cpp",
|
|
"ResourceTable.cpp",
|
|
"ResourceUtils.cpp",
|
|
"ResourceValues.cpp",
|
|
"SdkConstants.cpp",
|
|
"StringPool.cpp",
|
|
"xml/XmlActionExecutor.cpp",
|
|
"xml/XmlDom.cpp",
|
|
"xml/XmlPullParser.cpp",
|
|
"xml/XmlUtil.cpp",
|
|
"Configuration.proto",
|
|
"Resources.proto",
|
|
"ResourcesInternal.proto",
|
|
],
|
|
proto: {
|
|
export_proto_headers: true,
|
|
},
|
|
defaults: ["aapt2_defaults"],
|
|
}
|
|
|
|
// ==========================================================
|
|
// Build the host shared library: aapt2_jni
|
|
// ==========================================================
|
|
cc_library_host_shared {
|
|
name: "libaapt2_jni",
|
|
srcs: toolSources + ["jni/aapt2_jni.cpp"],
|
|
static_libs: ["libaapt2"],
|
|
defaults: ["aapt2_defaults"],
|
|
}
|
|
|
|
// ==========================================================
|
|
// Build the host tests: aapt2_tests
|
|
// ==========================================================
|
|
cc_test_host {
|
|
name: "aapt2_tests",
|
|
srcs: [
|
|
"test/Builders.cpp",
|
|
"test/Common.cpp",
|
|
"**/*_test.cpp",
|
|
] + toolSources,
|
|
static_libs: [
|
|
"libaapt2",
|
|
"libgmock",
|
|
],
|
|
defaults: ["aapt2_defaults"],
|
|
data: ["integration-tests/CompileTest/**/*"],
|
|
}
|
|
|
|
// ==========================================================
|
|
// Build the host executable: aapt2
|
|
// ==========================================================
|
|
cc_binary_host {
|
|
name: "aapt2",
|
|
srcs: ["Main.cpp"] + toolSources,
|
|
static_libs: ["libaapt2"],
|
|
defaults: ["aapt2_defaults"],
|
|
}
|