Merge "Define runfiles_path before try so that finally can use it."
diff --git a/android/arch.go b/android/arch.go
index 6516558..3378317 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -1012,6 +1012,7 @@
{"arm", "armv7-a-neon", "cortex-a72", []string{"armeabi-v7a"}},
{"arm", "armv7-a-neon", "cortex-a73", []string{"armeabi-v7a"}},
{"arm", "armv7-a-neon", "cortex-a75", []string{"armeabi-v7a"}},
+ {"arm", "armv7-a-neon", "cortex-a76", []string{"armeabi-v7a"}},
{"arm", "armv7-a-neon", "denver", []string{"armeabi-v7a"}},
{"arm", "armv7-a-neon", "krait", []string{"armeabi-v7a"}},
{"arm", "armv7-a-neon", "kryo", []string{"armeabi-v7a"}},
@@ -1025,6 +1026,7 @@
{"arm64", "armv8-a", "exynos-m1", []string{"arm64-v8a"}},
{"arm64", "armv8-a", "exynos-m2", []string{"arm64-v8a"}},
{"arm64", "armv8-2a", "cortex-a75", []string{"arm64-v8a"}},
+ {"arm64", "armv8-2a", "cortex-a76", []string{"arm64-v8a"}},
{"mips", "mips32-fp", "", []string{"mips"}},
{"mips", "mips32r2-fp", "", []string{"mips"}},
{"mips", "mips32r2-fp-xburst", "", []string{"mips"}},
diff --git a/android/neverallow.go b/android/neverallow.go
index 217a8d4..d3a2801 100644
--- a/android/neverallow.go
+++ b/android/neverallow.go
@@ -56,7 +56,9 @@
without("vendor", "true").
without("owner", "").
because("a VNDK module can never have an owner."),
- neverallow().notIn("libcore", "development", "external/bouncycastle", "external/conscrypt", "external/okhttp").with("no_standard_libs", "true"),
+ neverallow().
+ notIn("libcore", "development", "external/apache-harmony", "external/apache-xml", "external/bouncycastle", "external/conscrypt", "external/icu", "external/okhttp", "external/wycheproof").
+ with("no_standard_libs", "true"),
// TODO(b/67974785): always enforce the manifest
neverallow().
diff --git a/androidmk/cmd/androidmk/android.go b/androidmk/cmd/androidmk/android.go
index 10e5b0a..b3d5aec 100644
--- a/androidmk/cmd/androidmk/android.go
+++ b/androidmk/cmd/androidmk/android.go
@@ -51,6 +51,7 @@
"LOCAL_MODULE_HOST_OS": hostOs,
"LOCAL_SANITIZE": sanitize(""),
"LOCAL_SANITIZE_DIAG": sanitize("diag."),
+ "LOCAL_STRIP_MODULE": strip(),
"LOCAL_CFLAGS": cflags,
"LOCAL_UNINSTALLABLE_MODULE": invert("installable"),
"LOCAL_PROGUARD_ENABLED": proguardEnabled,
@@ -81,7 +82,6 @@
map[string]string{
"LOCAL_MODULE": "name",
"LOCAL_CXX_STL": "stl",
- "LOCAL_STRIP_MODULE": "strip",
"LOCAL_MULTILIB": "compile_multilib",
"LOCAL_ARM_MODE_HACK": "instruction_set",
"LOCAL_SDK_VERSION": "sdk_version",
@@ -463,6 +463,29 @@
}
}
+func strip() func(ctx variableAssignmentContext) error {
+ return func(ctx variableAssignmentContext) error {
+ val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.StringType)
+ if err != nil {
+ return err
+ }
+
+ if _, ok := val.(*bpparser.String); !ok {
+ return fmt.Errorf("unsupported strip expression")
+ }
+
+ bpTrue := &bpparser.Bool{
+ Value: true,
+ }
+ v := val.(*bpparser.String).Value
+ sub := (map[string]string{"false": "none", "true": "all", "keep_symbols": "keep_symbols"})[v]
+ if sub == "" {
+ return fmt.Errorf("unexpected strip option: %s", v)
+ }
+ return setVariable(ctx.file, false, ctx.prefix, "strip."+sub, bpTrue, true)
+ }
+}
+
func prebuiltClass(ctx variableAssignmentContext) error {
class := ctx.mkvalue.Value(ctx.file.scope)
if v, ok := prebuiltTypes[class]; ok {
diff --git a/androidmk/cmd/androidmk/androidmk_test.go b/androidmk/cmd/androidmk/androidmk_test.go
index 80e7a75..0f6c5ac 100644
--- a/androidmk/cmd/androidmk/androidmk_test.go
+++ b/androidmk/cmd/androidmk/androidmk_test.go
@@ -692,6 +692,47 @@
}
`,
},
+ {
+ desc: "LOCAL_STRIP_MODULE",
+ in: `
+include $(CLEAR_VARS)
+LOCAL_MODULE := libtest
+LOCAL_STRIP_MODULE := false
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libtest2
+LOCAL_STRIP_MODULE := true
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libtest3
+LOCAL_STRIP_MODULE := keep_symbols
+include $(BUILD_SHARED_LIBRARY)
+`,
+ expected: `
+cc_library_shared {
+ name: "libtest",
+ strip: {
+ none: true,
+ }
+}
+
+cc_library_shared {
+ name: "libtest2",
+ strip: {
+ all: true,
+ }
+}
+
+cc_library_shared {
+ name: "libtest3",
+ strip: {
+ keep_symbols: true,
+ }
+}
+`,
+ },
}
func TestEndToEnd(t *testing.T) {
diff --git a/apex/apex.go b/apex/apex.go
index 0749ab3..68d9cb8 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -39,9 +39,10 @@
generateFsConfig = pctx.StaticRule("generateFsConfig", blueprint.RuleParams{
Command: `echo '/ 1000 1000 0644' > ${out} && ` +
`echo '/manifest.json 1000 1000 0644' >> ${out} && ` +
- `echo ${paths} | tr ' ' '\n' | awk '{print "/"$$1 " 1000 1000 0644"}' >> ${out}`,
+ `echo ${ro_paths} | tr ' ' '\n' | awk '{print "/"$$1 " 1000 1000 0644"}' >> ${out} && ` +
+ `echo ${exec_paths} | tr ' ' '\n' | awk '{print "/"$$1 " 1000 1000 0755"}' >> ${out}`,
Description: "fs_config ${out}",
- }, "paths")
+ }, "ro_paths", "exec_paths")
// TODO(b/113233103): make sure that file_contexts is sane, i.e., validate
// against the binary policy using sefcontext_compiler -p <policy>.
@@ -302,21 +303,28 @@
})
// files and dirs that will be created in apex
- var pathsInApex []string
+ var readOnlyPaths []string
+ var executablePaths []string // this also includes dirs
for fileToCopy, dirInApex := range copyManifest {
pathInApex := filepath.Join(dirInApex, fileToCopy.Base())
- pathsInApex = append(pathsInApex, pathInApex)
- if !android.InList(dirInApex, pathsInApex) {
- pathsInApex = append(pathsInApex, dirInApex)
+ if dirInApex == "bin" {
+ executablePaths = append(executablePaths, pathInApex)
+ } else {
+ readOnlyPaths = append(readOnlyPaths, pathInApex)
+ }
+ if !android.InList(dirInApex, executablePaths) {
+ executablePaths = append(executablePaths, dirInApex)
}
}
- sort.Strings(pathsInApex)
+ sort.Strings(readOnlyPaths)
+ sort.Strings(executablePaths)
cannedFsConfig := android.PathForModuleOut(ctx, "canned_fs_config")
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
Rule: generateFsConfig,
Output: cannedFsConfig,
Args: map[string]string{
- "paths": strings.Join(pathsInApex, " "),
+ "ro_paths": strings.Join(readOnlyPaths, " "),
+ "exec_paths": strings.Join(executablePaths, " "),
},
})
diff --git a/build_test.bash b/build_test.bash
index 4c43224..ee979e7 100755
--- a/build_test.bash
+++ b/build_test.bash
@@ -27,6 +27,10 @@
# that's detected in the Go code, which skips calculating the startup time.
export TRACE_BEGIN_SOONG=$(date +%s%N)
+# Remove BUILD_NUMBER so that incremental builds on build servers don't
+# re-read makefiles every time.
+unset BUILD_NUMBER
+
export TOP=$(cd $(dirname ${BASH_SOURCE[0]})/../..; PWD= /bin/pwd)
cd "${TOP}"
source "${TOP}/build/soong/scripts/microfactory.bash"
diff --git a/cc/builder.go b/cc/builder.go
index d16efd0..d9a6cae 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -169,7 +169,7 @@
// -w has been added since header-abi-dumper does not need to produce any sort of diagnostic information.
sAbiDump = pctx.AndroidStaticRule("sAbiDump",
blueprint.RuleParams{
- Command: "rm -f $out && $sAbiDumper -o ${out} $in $exportDirs -- $cFlags -w -isystem ${config.RSIncludePath}",
+ Command: "rm -f $out && $sAbiDumper -o ${out} $in $exportDirs -- $cFlags -w -isystem prebuilts/clang-tools/${config.HostPrebuiltTag}/clang-headers",
CommandDeps: []string{"$sAbiDumper"},
},
"cFlags", "exportDirs")
diff --git a/cc/config/arm64_device.go b/cc/config/arm64_device.go
index cacd287..6a63828 100644
--- a/cc/config/arm64_device.go
+++ b/cc/config/arm64_device.go
@@ -60,6 +60,11 @@
// core (cortex-a55) and is sensitive to ordering.
"-mcpu=cortex-a55",
},
+ "cortex-a76": []string{
+ // Use the cortex-a55 since it is similar to the little
+ // core (cortex-a55) and is sensitive to ordering.
+ "-mcpu=cortex-a55",
+ },
"kryo": []string{
"-mcpu=kryo",
},
@@ -85,6 +90,7 @@
"cortex-a72",
"cortex-a73",
"cortex-a75",
+ "cortex-a76",
"kryo",
"exynos-m1",
"exynos-m2",
@@ -136,6 +142,7 @@
"cortex-a72": "${config.Arm64ClangCortexA53Cflags}",
"cortex-a73": "${config.Arm64ClangCortexA53Cflags}",
"cortex-a75": "${config.Arm64ClangCortexA55Cflags}",
+ "cortex-a76": "${config.Arm64ClangCortexA55Cflags}",
"kryo": "${config.Arm64ClangKryoCflags}",
"exynos-m1": "${config.Arm64ClangExynosM1Cflags}",
"exynos-m2": "${config.Arm64ClangExynosM2Cflags}",
diff --git a/cc/config/arm_device.go b/cc/config/arm_device.go
index 95c9495..75f5962 100644
--- a/cc/config/arm_device.go
+++ b/cc/config/arm_device.go
@@ -117,6 +117,15 @@
// better solution comes around. See Bug 27340895
"-D__ARM_FEATURE_LPAE=1",
},
+ "cortex-a76": []string{
+ "-mcpu=cortex-a55",
+ "-mfpu=neon-fp-armv8",
+ // Fake an ARM compiler flag as these processors support LPAE which GCC/clang
+ // don't advertise.
+ // TODO This is a hack and we need to add it for each processor that supports LPAE until some
+ // better solution comes around. See Bug 27340895
+ "-D__ARM_FEATURE_LPAE=1",
+ },
"krait": []string{
"-mcpu=krait",
"-mfpu=neon-vfpv4",
@@ -162,6 +171,7 @@
"cortex-a72",
"cortex-a73",
"cortex-a75",
+ "cortex-a76",
"krait",
"kryo",
"exynos-m1",
diff --git a/cc/config/clang.go b/cc/config/clang.go
index 5cf2421..b58223f 100644
--- a/cc/config/clang.go
+++ b/cc/config/clang.go
@@ -92,12 +92,7 @@
"-Wl,-m,aarch64_elf64_le_vec",
})
-var ClangLibToolingUnknownCflags = []string{
- // Remove -flto and other flto dependent flags.
- "-flto*",
- "-fsanitize*",
- "-fwhole-program-vtables",
-}
+var ClangLibToolingUnknownCflags []string = nil
func init() {
pctx.StaticVariable("ClangExtraCflags", strings.Join([]string{
diff --git a/cc/config/global.go b/cc/config/global.go
index 29dca9f..330cb10 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -125,8 +125,8 @@
// prebuilts/clang default settings.
ClangDefaultBase = "prebuilts/clang/host"
- ClangDefaultVersion = "clang-r339409"
- ClangDefaultShortVersion = "8.0.1"
+ ClangDefaultVersion = "clang-r339409b"
+ ClangDefaultShortVersion = "8.0.2"
// Directories with warnings from Android.bp files.
WarningAllowedProjects = []string{
diff --git a/cc/config/toolchain.go b/cc/config/toolchain.go
index 997bca6..d5e9d01 100644
--- a/cc/config/toolchain.go
+++ b/cc/config/toolchain.go
@@ -220,6 +220,10 @@
return LibclangRuntimeLibrary(t, "scudo")
}
+func ScudoMinimalRuntimeLibrary(t Toolchain) string {
+ return LibclangRuntimeLibrary(t, "scudo_minimal")
+}
+
func ToolPath(t Toolchain) string {
if p := t.ToolPath(); p != "" {
return p
diff --git a/cc/config/x86_windows_host.go b/cc/config/x86_windows_host.go
index 988ba03..6300a1b 100644
--- a/cc/config/x86_windows_host.go
+++ b/cc/config/x86_windows_host.go
@@ -47,18 +47,11 @@
"-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include",
}
- windowsClangCppflags = []string{
- "-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include/c++/4.8.3",
- "-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include/c++/4.8.3/backward",
- }
+ windowsClangCppflags = []string{}
- windowsX86ClangCppflags = []string{
- "-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include/c++/4.8.3/${WindowsGccTriple}/32",
- }
+ windowsX86ClangCppflags = []string{}
- windowsX8664ClangCppflags = []string{
- "-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include/c++/4.8.3/${WindowsGccTriple}",
- }
+ windowsX8664ClangCppflags = []string{}
windowsLdflags = []string{
"--enable-stdcall-fixup",
@@ -80,24 +73,18 @@
"-m32",
"-Wl,--large-address-aware",
"-L${WindowsGccRoot}/${WindowsGccTriple}/lib32",
- "-static-libgcc",
}
windowsX86ClangLdflags = append(ClangFilterUnknownCflags(windowsX86Ldflags), []string{
"-B${WindowsGccRoot}/${WindowsGccTriple}/bin",
"-B${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/32",
"-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/32",
"-B${WindowsGccRoot}/${WindowsGccTriple}/lib32",
- "-pthread",
- // Bug: http://b/109759970 - WAR until issue with ld.bfd's
- // inability to handle Clang-generated section names is fixed.
- "-Wl,--allow-multiple-definition",
}...)
windowsX86ClangLldflags = ClangFilterUnknownLldflags(windowsX86ClangLdflags)
windowsX8664Ldflags = []string{
"-m64",
"-L${WindowsGccRoot}/${WindowsGccTriple}/lib64",
- "-static-libgcc",
"-Wl,--high-entropy-va",
}
windowsX8664ClangLdflags = append(ClangFilterUnknownCflags(windowsX8664Ldflags), []string{
@@ -105,7 +92,6 @@
"-B${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3",
"-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3",
"-B${WindowsGccRoot}/${WindowsGccTriple}/lib64",
- "-pthread",
}...)
windowsX8664ClangLldflags = ClangFilterUnknownLldflags(windowsX8664ClangLdflags)
diff --git a/cc/gen_stub_libs.py b/cc/gen_stub_libs.py
index 8c99bbf..c49d197 100755
--- a/cc/gen_stub_libs.py
+++ b/cc/gen_stub_libs.py
@@ -20,6 +20,7 @@
import logging
import os
import re
+import sys
ALL_ARCHITECTURES = (
@@ -107,22 +108,33 @@
return version.endswith('_PRIVATE') or version.endswith('_PLATFORM')
-def should_omit_version(name, tags, arch, api, vndk):
+def should_omit_version(version, arch, api, vndk):
"""Returns True if the version section should be ommitted.
We want to omit any sections that do not have any symbols we'll have in the
stub library. Sections that contain entirely future symbols or only symbols
for certain architectures.
"""
- if version_is_private(name):
+ if version_is_private(version.name):
return True
- if 'platform-only' in tags:
+ if 'platform-only' in version.tags:
return True
- if 'vndk' in tags and not vndk:
+ if 'vndk' in version.tags and not vndk:
return True
- if not symbol_in_arch(tags, arch):
+ if not symbol_in_arch(version.tags, arch):
return True
- if not symbol_in_api(tags, arch, api):
+ if not symbol_in_api(version.tags, arch, api):
+ return True
+ return False
+
+
+def should_omit_symbol(symbol, arch, api, vndk):
+ """Returns True if the symbol should be omitted."""
+ if not vndk and 'vndk' in symbol.tags:
+ return True
+ if not symbol_in_arch(symbol.tags, arch):
+ return True
+ if not symbol_in_api(symbol.tags, arch, api):
return True
return False
@@ -189,6 +201,15 @@
pass
+class MultiplyDefinedSymbolError(RuntimeError):
+ """A symbol name was multiply defined."""
+ def __init__(self, multiply_defined_symbols):
+ super(MultiplyDefinedSymbolError, self).__init__(
+ 'Version script contains multiple definitions for: {}'.format(
+ ', '.join(multiply_defined_symbols)))
+ self.multiply_defined_symbols = multiply_defined_symbols
+
+
class Version(object):
"""A version block of a symbol file."""
def __init__(self, name, base, tags, symbols):
@@ -221,9 +242,12 @@
class SymbolFileParser(object):
"""Parses NDK symbol files."""
- def __init__(self, input_file, api_map):
+ def __init__(self, input_file, api_map, arch, api, vndk):
self.input_file = input_file
self.api_map = api_map
+ self.arch = arch
+ self.api = api
+ self.vndk = vndk
self.current_line = None
def parse(self):
@@ -235,8 +259,36 @@
else:
raise ParseError(
'Unexpected contents at top level: ' + self.current_line)
+
+ self.check_no_duplicate_symbols(versions)
return versions
+ def check_no_duplicate_symbols(self, versions):
+ """Raises errors for multiply defined symbols.
+
+ This situation is the normal case when symbol versioning is actually
+ used, but this script doesn't currently handle that. The error message
+ will be a not necessarily obvious "error: redefition of 'foo'" from
+ stub.c, so it's better for us to catch this situation and raise a
+ better error.
+ """
+ symbol_names = set()
+ multiply_defined_symbols = set()
+ for version in versions:
+ if should_omit_version(version, self.arch, self.api, self.vndk):
+ continue
+
+ for symbol in version.symbols:
+ if should_omit_symbol(symbol, self.arch, self.api, self.vndk):
+ continue
+
+ if symbol.name in symbol_names:
+ multiply_defined_symbols.add(symbol.name)
+ symbol_names.add(symbol.name)
+ if multiply_defined_symbols:
+ raise MultiplyDefinedSymbolError(
+ sorted(list(multiply_defined_symbols)))
+
def parse_version(self):
"""Parses a single version section and returns a Version object."""
name = self.current_line.split('{')[0].strip()
@@ -274,7 +326,8 @@
elif global_scope and not cpp_symbols:
symbols.append(self.parse_symbol())
else:
- # We're in a hidden scope or in 'extern "C++"' block. Ignore everything.
+ # We're in a hidden scope or in 'extern "C++"' block. Ignore
+ # everything.
pass
raise ParseError('Unexpected EOF in version block.')
@@ -324,20 +377,14 @@
def write_version(self, version):
"""Writes a single version block's data to the output files."""
- name = version.name
- tags = version.tags
- if should_omit_version(name, tags, self.arch, self.api, self.vndk):
+ if should_omit_version(version, self.arch, self.api, self.vndk):
return
- section_versioned = symbol_versioned_in_api(tags, self.api)
+ section_versioned = symbol_versioned_in_api(version.tags, self.api)
version_empty = True
pruned_symbols = []
for symbol in version.symbols:
- if not self.vndk and 'vndk' in symbol.tags:
- continue
- if not symbol_in_arch(symbol.tags, self.arch):
- continue
- if not symbol_in_api(symbol.tags, self.arch, self.api):
+ if should_omit_symbol(symbol, self.arch, self.api, self.vndk):
continue
if symbol_versioned_in_api(symbol.tags, self.api):
@@ -432,7 +479,11 @@
logging.basicConfig(level=verbose_map[verbosity])
with open(args.symbol_file) as symbol_file:
- versions = SymbolFileParser(symbol_file, api_map).parse()
+ try:
+ versions = SymbolFileParser(symbol_file, api_map, args.arch, api,
+ args.vndk).parse()
+ except MultiplyDefinedSymbolError as ex:
+ sys.exit('{}: error: {}'.format(args.symbol_file, ex))
with open(args.stub_src, 'w') as src_file:
with open(args.version_script, 'w') as version_file:
diff --git a/cc/makevars.go b/cc/makevars.go
index 47e5491..b590786 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -126,6 +126,7 @@
ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES", strings.Join(asanLibs, " "))
ctx.Strict("HWADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS", strings.Join(hwasanCflags, " "))
+ ctx.Strict("HWADDRESS_SANITIZER_GLOBAL_OPTIONS", strings.Join(hwasanGlobalOptions, ","))
ctx.Strict("CFI_EXTRA_CFLAGS", strings.Join(cfiCflags, " "))
ctx.Strict("CFI_EXTRA_ASFLAGS", strings.Join(cfiAsflags, " "))
@@ -281,6 +282,7 @@
ctx.Strict(secondPrefix+"UBSAN_MINIMAL_RUNTIME_LIBRARY", strings.TrimSuffix(config.UndefinedBehaviorSanitizerMinimalRuntimeLibrary(toolchain), ".a"))
ctx.Strict(secondPrefix+"TSAN_RUNTIME_LIBRARY", strings.TrimSuffix(config.ThreadSanitizerRuntimeLibrary(toolchain), ".so"))
ctx.Strict(secondPrefix+"SCUDO_RUNTIME_LIBRARY", strings.TrimSuffix(config.ScudoRuntimeLibrary(toolchain), ".so"))
+ ctx.Strict(secondPrefix+"SCUDO_MINIMAL_RUNTIME_LIBRARY", strings.TrimSuffix(config.ScudoMinimalRuntimeLibrary(toolchain), ".so"))
}
// This is used by external/gentoo/...
diff --git a/cc/sabi.go b/cc/sabi.go
index 72a3c5c..4a86499 100644
--- a/cc/sabi.go
+++ b/cc/sabi.go
@@ -73,17 +73,6 @@
flags.ToolingCFlags = filterOutWithPrefix(flags.CFlags, config.ClangLibToolingUnknownCflags)
flags.ToolingCppFlags = filterOutWithPrefix(flags.CppFlags, config.ClangLibToolingUnknownCflags)
- // RSClang does not support recent mcpu option likes exynos-m2.
- // So we need overriding mcpu option when we want to use it.
- mappedArch := map[string]string{
- "exynos-m2": "cortex-a53",
- "cortex-a55": "cortex-a53",
- "cortex-a75": "cortex-a57",
- }
- if arch, ok := mappedArch[ctx.Arch().CpuVariant]; ok {
- flags.ToolingCFlags = append(flags.ToolingCFlags, "-mcpu="+arch)
- }
-
return flags
}
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 8262a68..330a5e3 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -52,6 +52,7 @@
intOverflowCflags = []string{"-fsanitize-blacklist=build/soong/cc/config/integer_overflow_blacklist.txt"}
minimalRuntimeFlags = []string{"-fsanitize-minimal-runtime", "-fno-sanitize-trap=integer,undefined",
"-fno-sanitize-recover=integer,undefined"}
+ hwasanGlobalOptions = []string{"heap_history_size=4095"}
)
type sanitizerType int
@@ -531,7 +532,11 @@
} else if Bool(sanitize.Properties.Sanitize.Thread) {
runtimeLibrary = config.ThreadSanitizerRuntimeLibrary(ctx.toolchain())
} else if Bool(sanitize.Properties.Sanitize.Scudo) {
- runtimeLibrary = config.ScudoRuntimeLibrary(ctx.toolchain())
+ if len(diagSanitizers) == 0 && !sanitize.Properties.UbsanRuntimeDep {
+ runtimeLibrary = config.ScudoMinimalRuntimeLibrary(ctx.toolchain())
+ } else {
+ runtimeLibrary = config.ScudoRuntimeLibrary(ctx.toolchain())
+ }
} else if len(diagSanitizers) > 0 || sanitize.Properties.UbsanRuntimeDep {
runtimeLibrary = config.UndefinedBehaviorSanitizerRuntimeLibrary(ctx.toolchain())
}
@@ -831,7 +836,6 @@
func enableMinimalRuntime(sanitize *sanitize) bool {
if !Bool(sanitize.Properties.Sanitize.Address) &&
!Bool(sanitize.Properties.Sanitize.Hwaddress) &&
- !Bool(sanitize.Properties.Sanitize.Scudo) &&
(Bool(sanitize.Properties.Sanitize.Integer_overflow) ||
len(sanitize.Properties.Sanitize.Misc_undefined) > 0) &&
!(Bool(sanitize.Properties.Sanitize.Diag.Integer_overflow) ||
diff --git a/cc/stl.go b/cc/stl.go
index f44902e..8eee612 100644
--- a/cc/stl.go
+++ b/cc/stl.go
@@ -81,9 +81,9 @@
}
} else if ctx.Windows() {
switch s {
- case "libc++", "libc++_static", "libstdc++", "":
- // libc++ is not supported on mingw
- return "libstdc++"
+ case "libc++", "libc++_static", "":
+ // Only use static libc++ for Windows.
+ return "libc++_static"
case "none":
return ""
default:
@@ -177,6 +177,20 @@
} else {
flags.LdFlags = append(flags.LdFlags, hostDynamicGccLibs[ctx.Os()]...)
}
+ if ctx.Windows() {
+ // Use SjLj exceptions for 32-bit. libgcc_eh implements SjLj
+ // exception model for 32-bit.
+ if ctx.Arch().ArchType == android.X86 {
+ flags.CppFlags = append(flags.CppFlags, "-fsjlj-exceptions")
+ }
+ flags.CppFlags = append(flags.CppFlags,
+ // Disable visiblity annotations since we're using static
+ // libc++.
+ "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ // Use Win32 threads in libc++.
+ "-D_LIBCPP_HAS_THREAD_API_WIN32")
+ }
} else {
if ctx.Arch().ArchType == android.Arm {
flags.LdFlags = append(flags.LdFlags, "-Wl,--exclude-libs,libunwind_llvm.a")
@@ -213,9 +227,10 @@
hostDynamicGccLibs = map[android.OsType][]string{
android.Linux: []string{"-lgcc_s", "-lgcc", "-lc", "-lgcc_s", "-lgcc"},
android.Darwin: []string{"-lc", "-lSystem"},
- android.Windows: []string{"-lmingw32", "-lgcc", "-lmoldname", "-lmingwex", "-lmsvcr110",
- "-lmsvcrt", "-ladvapi32", "-lshell32", "-luser32", "-lkernel32", "-lmingw32",
- "-lgcc", "-lmoldname", "-lmingwex", "-lmsvcrt"},
+ android.Windows: []string{"-Wl,--start-group", "-lmingw32", "-lgcc", "-lgcc_eh",
+ "-lmoldname", "-lmingwex", "-lmsvcr110", "-lmsvcrt", "-lpthread",
+ "-ladvapi32", "-lshell32", "-luser32", "-lkernel32", "-lpsapi",
+ "-Wl,--end-group"},
}
hostStaticGccLibs = map[android.OsType][]string{
android.Linux: []string{"-Wl,--start-group", "-lgcc", "-lgcc_eh", "-lc", "-Wl,--end-group"},
diff --git a/cc/test_gen_stub_libs.py b/cc/test_gen_stub_libs.py
index b20a5c7..3b5585a 100755
--- a/cc/test_gen_stub_libs.py
+++ b/cc/test_gen_stub_libs.py
@@ -15,7 +15,7 @@
# limitations under the License.
#
"""Tests for gen_stub_libs.py."""
-import cStringIO
+import io
import textwrap
import unittest
@@ -163,51 +163,106 @@
class OmitVersionTest(unittest.TestCase):
def test_omit_private(self):
- self.assertFalse(gsl.should_omit_version('foo', [], 'arm', 9, False))
-
- self.assertTrue(gsl.should_omit_version(
- 'foo_PRIVATE', [], 'arm', 9, False))
- self.assertTrue(gsl.should_omit_version(
- 'foo_PLATFORM', [], 'arm', 9, False))
-
- self.assertTrue(gsl.should_omit_version(
- 'foo', ['platform-only'], 'arm', 9, False))
-
- def test_omit_vndk(self):
- self.assertTrue(gsl.should_omit_version(
- 'foo', ['vndk'], 'arm', 9, False))
-
- self.assertFalse(gsl.should_omit_version('foo', [], 'arm', 9, True))
- self.assertFalse(gsl.should_omit_version(
- 'foo', ['vndk'], 'arm', 9, True))
-
- def test_omit_arch(self):
- self.assertFalse(gsl.should_omit_version('foo', [], 'arm', 9, False))
- self.assertFalse(gsl.should_omit_version(
- 'foo', ['arm'], 'arm', 9, False))
-
- self.assertTrue(gsl.should_omit_version(
- 'foo', ['x86'], 'arm', 9, False))
-
- def test_omit_api(self):
- self.assertFalse(gsl.should_omit_version('foo', [], 'arm', 9, False))
self.assertFalse(
- gsl.should_omit_version('foo', ['introduced=9'], 'arm', 9, False))
+ gsl.should_omit_version(
+ gsl.Version('foo', None, [], []), 'arm', 9, False))
self.assertTrue(
- gsl.should_omit_version('foo', ['introduced=14'], 'arm', 9, False))
+ gsl.should_omit_version(
+ gsl.Version('foo_PRIVATE', None, [], []), 'arm', 9, False))
+ self.assertTrue(
+ gsl.should_omit_version(
+ gsl.Version('foo_PLATFORM', None, [], []), 'arm', 9, False))
+
+ self.assertTrue(
+ gsl.should_omit_version(
+ gsl.Version('foo', None, ['platform-only'], []), 'arm', 9,
+ False))
+
+ def test_omit_vndk(self):
+ self.assertTrue(
+ gsl.should_omit_version(
+ gsl.Version('foo', None, ['vndk'], []), 'arm', 9, False))
+
+ self.assertFalse(
+ gsl.should_omit_version(
+ gsl.Version('foo', None, [], []), 'arm', 9, True))
+ self.assertFalse(
+ gsl.should_omit_version(
+ gsl.Version('foo', None, ['vndk'], []), 'arm', 9, True))
+
+ def test_omit_arch(self):
+ self.assertFalse(
+ gsl.should_omit_version(
+ gsl.Version('foo', None, [], []), 'arm', 9, False))
+ self.assertFalse(
+ gsl.should_omit_version(
+ gsl.Version('foo', None, ['arm'], []), 'arm', 9, False))
+
+ self.assertTrue(
+ gsl.should_omit_version(
+ gsl.Version('foo', None, ['x86'], []), 'arm', 9, False))
+
+ def test_omit_api(self):
+ self.assertFalse(
+ gsl.should_omit_version(
+ gsl.Version('foo', None, [], []), 'arm', 9, False))
+ self.assertFalse(
+ gsl.should_omit_version(
+ gsl.Version('foo', None, ['introduced=9'], []), 'arm', 9,
+ False))
+
+ self.assertTrue(
+ gsl.should_omit_version(
+ gsl.Version('foo', None, ['introduced=14'], []), 'arm', 9,
+ False))
+
+
+class OmitSymbolTest(unittest.TestCase):
+ def test_omit_vndk(self):
+ self.assertTrue(
+ gsl.should_omit_symbol(
+ gsl.Symbol('foo', ['vndk']), 'arm', 9, False))
+
+ self.assertFalse(
+ gsl.should_omit_symbol(gsl.Symbol('foo', []), 'arm', 9, True))
+ self.assertFalse(
+ gsl.should_omit_symbol(
+ gsl.Symbol('foo', ['vndk']), 'arm', 9, True))
+
+ def test_omit_arch(self):
+ self.assertFalse(
+ gsl.should_omit_symbol(gsl.Symbol('foo', []), 'arm', 9, False))
+ self.assertFalse(
+ gsl.should_omit_symbol(
+ gsl.Symbol('foo', ['arm']), 'arm', 9, False))
+
+ self.assertTrue(
+ gsl.should_omit_symbol(
+ gsl.Symbol('foo', ['x86']), 'arm', 9, False))
+
+ def test_omit_api(self):
+ self.assertFalse(
+ gsl.should_omit_symbol(gsl.Symbol('foo', []), 'arm', 9, False))
+ self.assertFalse(
+ gsl.should_omit_symbol(
+ gsl.Symbol('foo', ['introduced=9']), 'arm', 9, False))
+
+ self.assertTrue(
+ gsl.should_omit_symbol(
+ gsl.Symbol('foo', ['introduced=14']), 'arm', 9, False))
class SymbolFileParseTest(unittest.TestCase):
def test_next_line(self):
- input_file = cStringIO.StringIO(textwrap.dedent("""\
+ input_file = io.StringIO(textwrap.dedent("""\
foo
bar
# baz
qux
"""))
- parser = gsl.SymbolFileParser(input_file, {})
+ parser = gsl.SymbolFileParser(input_file, {}, 'arm', 16, False)
self.assertIsNone(parser.current_line)
self.assertEqual('foo', parser.next_line().strip())
@@ -223,7 +278,7 @@
self.assertEqual('', parser.current_line)
def test_parse_version(self):
- input_file = cStringIO.StringIO(textwrap.dedent("""\
+ input_file = io.StringIO(textwrap.dedent("""\
VERSION_1 { # foo bar
baz;
qux; # woodly doodly
@@ -232,7 +287,7 @@
VERSION_2 {
} VERSION_1; # asdf
"""))
- parser = gsl.SymbolFileParser(input_file, {})
+ parser = gsl.SymbolFileParser(input_file, {}, 'arm', 16, False)
parser.next_line()
version = parser.parse_version()
@@ -253,31 +308,31 @@
self.assertEqual([], version.tags)
def test_parse_version_eof(self):
- input_file = cStringIO.StringIO(textwrap.dedent("""\
+ input_file = io.StringIO(textwrap.dedent("""\
VERSION_1 {
"""))
- parser = gsl.SymbolFileParser(input_file, {})
+ parser = gsl.SymbolFileParser(input_file, {}, 'arm', 16, False)
parser.next_line()
with self.assertRaises(gsl.ParseError):
parser.parse_version()
def test_unknown_scope_label(self):
- input_file = cStringIO.StringIO(textwrap.dedent("""\
+ input_file = io.StringIO(textwrap.dedent("""\
VERSION_1 {
foo:
}
"""))
- parser = gsl.SymbolFileParser(input_file, {})
+ parser = gsl.SymbolFileParser(input_file, {}, 'arm', 16, False)
parser.next_line()
with self.assertRaises(gsl.ParseError):
parser.parse_version()
def test_parse_symbol(self):
- input_file = cStringIO.StringIO(textwrap.dedent("""\
+ input_file = io.StringIO(textwrap.dedent("""\
foo;
bar; # baz qux
"""))
- parser = gsl.SymbolFileParser(input_file, {})
+ parser = gsl.SymbolFileParser(input_file, {}, 'arm', 16, False)
parser.next_line()
symbol = parser.parse_symbol()
@@ -290,47 +345,47 @@
self.assertEqual(['baz', 'qux'], symbol.tags)
def test_wildcard_symbol_global(self):
- input_file = cStringIO.StringIO(textwrap.dedent("""\
+ input_file = io.StringIO(textwrap.dedent("""\
VERSION_1 {
*;
};
"""))
- parser = gsl.SymbolFileParser(input_file, {})
+ parser = gsl.SymbolFileParser(input_file, {}, 'arm', 16, False)
parser.next_line()
with self.assertRaises(gsl.ParseError):
parser.parse_version()
def test_wildcard_symbol_local(self):
- input_file = cStringIO.StringIO(textwrap.dedent("""\
+ input_file = io.StringIO(textwrap.dedent("""\
VERSION_1 {
local:
*;
};
"""))
- parser = gsl.SymbolFileParser(input_file, {})
+ parser = gsl.SymbolFileParser(input_file, {}, 'arm', 16, False)
parser.next_line()
version = parser.parse_version()
self.assertEqual([], version.symbols)
def test_missing_semicolon(self):
- input_file = cStringIO.StringIO(textwrap.dedent("""\
+ input_file = io.StringIO(textwrap.dedent("""\
VERSION_1 {
foo
};
"""))
- parser = gsl.SymbolFileParser(input_file, {})
+ parser = gsl.SymbolFileParser(input_file, {}, 'arm', 16, False)
parser.next_line()
with self.assertRaises(gsl.ParseError):
parser.parse_version()
def test_parse_fails_invalid_input(self):
with self.assertRaises(gsl.ParseError):
- input_file = cStringIO.StringIO('foo')
- parser = gsl.SymbolFileParser(input_file, {})
+ input_file = io.StringIO('foo')
+ parser = gsl.SymbolFileParser(input_file, {}, 'arm', 16, False)
parser.parse()
def test_parse(self):
- input_file = cStringIO.StringIO(textwrap.dedent("""\
+ input_file = io.StringIO(textwrap.dedent("""\
VERSION_1 {
local:
hidden1;
@@ -347,7 +402,7 @@
qwerty;
} VERSION_1;
"""))
- parser = gsl.SymbolFileParser(input_file, {})
+ parser = gsl.SymbolFileParser(input_file, {}, 'arm', 16, False)
versions = parser.parse()
expected = [
@@ -368,8 +423,8 @@
def test_omit_version(self):
# Thorough testing of the cases involved here is handled by
# OmitVersionTest, PrivateVersionTest, and SymbolPresenceTest.
- src_file = cStringIO.StringIO()
- version_file = cStringIO.StringIO()
+ src_file = io.StringIO()
+ version_file = io.StringIO()
generator = gsl.Generator(src_file, version_file, 'arm', 9, False)
version = gsl.Version('VERSION_PRIVATE', None, [], [
@@ -396,8 +451,8 @@
def test_omit_symbol(self):
# Thorough testing of the cases involved here is handled by
# SymbolPresenceTest.
- src_file = cStringIO.StringIO()
- version_file = cStringIO.StringIO()
+ src_file = io.StringIO()
+ version_file = io.StringIO()
generator = gsl.Generator(src_file, version_file, 'arm', 9, False)
version = gsl.Version('VERSION_1', None, [], [
@@ -422,8 +477,8 @@
self.assertEqual('', version_file.getvalue())
def test_write(self):
- src_file = cStringIO.StringIO()
- version_file = cStringIO.StringIO()
+ src_file = io.StringIO()
+ version_file = io.StringIO()
generator = gsl.Generator(src_file, version_file, 'arm', 9, False)
versions = [
@@ -475,7 +530,7 @@
'P': 9001,
}
- input_file = cStringIO.StringIO(textwrap.dedent("""\
+ input_file = io.StringIO(textwrap.dedent("""\
VERSION_1 {
global:
foo; # var
@@ -505,11 +560,11 @@
wobble;
} VERSION_4;
"""))
- parser = gsl.SymbolFileParser(input_file, api_map)
+ parser = gsl.SymbolFileParser(input_file, api_map, 'arm', 9, False)
versions = parser.parse()
- src_file = cStringIO.StringIO()
- version_file = cStringIO.StringIO()
+ src_file = io.StringIO()
+ version_file = io.StringIO()
generator = gsl.Generator(src_file, version_file, 'arm', 9, False)
generator.write(versions)
@@ -545,7 +600,7 @@
'Q': 9002,
}
- input_file = cStringIO.StringIO(textwrap.dedent("""\
+ input_file = io.StringIO(textwrap.dedent("""\
VERSION_1 {
global:
foo; # introduced=O
@@ -555,11 +610,11 @@
*;
};
"""))
- parser = gsl.SymbolFileParser(input_file, api_map)
+ parser = gsl.SymbolFileParser(input_file, api_map, 'arm', 9001, False)
versions = parser.parse()
- src_file = cStringIO.StringIO()
- version_file = cStringIO.StringIO()
+ src_file = io.StringIO()
+ version_file = io.StringIO()
generator = gsl.Generator(src_file, version_file, 'arm', 9001, False)
generator.write(versions)
@@ -578,6 +633,38 @@
""")
self.assertEqual(expected_version, version_file.getvalue())
+ def test_multiple_definition(self):
+ input_file = io.StringIO(textwrap.dedent("""\
+ VERSION_1 {
+ global:
+ foo;
+ foo;
+ bar;
+ baz;
+ qux; # arm
+ local:
+ *;
+ };
+
+ VERSION_2 {
+ global:
+ bar;
+ qux; # arm64
+ } VERSION_1;
+
+ VERSION_PRIVATE {
+ global:
+ baz;
+ } VERSION_2;
+
+ """))
+ parser = gsl.SymbolFileParser(input_file, {}, 'arm', 16, False)
+
+ with self.assertRaises(gsl.MultiplyDefinedSymbolError) as cm:
+ parser.parse()
+ self.assertEquals(['bar', 'foo'],
+ cm.exception.multiply_defined_symbols)
+
def main():
suite = unittest.TestLoader().loadTestsFromName(__name__)
diff --git a/cc/vndk.go b/cc/vndk.go
index 5a24a98..1a9b77a 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -15,6 +15,7 @@
package cc
import (
+ "errors"
"sort"
"strings"
"sync"
@@ -151,38 +152,42 @@
}
// Check the dependencies of VNDK shared libraries.
- if !vndkIsVndkDepAllowed(vndk, to.vndkdep) {
- ctx.ModuleErrorf("(%s) should not link to %q (%s)",
- vndk.typeName(), to.Name(), to.vndkdep.typeName())
+ if err := vndkIsVndkDepAllowed(vndk, to.vndkdep); err != nil {
+ ctx.ModuleErrorf("(%s) should not link to %q (%s): %v",
+ vndk.typeName(), to.Name(), to.vndkdep.typeName(), err)
return
}
}
-func vndkIsVndkDepAllowed(from *vndkdep, to *vndkdep) bool {
+func vndkIsVndkDepAllowed(from *vndkdep, to *vndkdep) error {
// Check the dependencies of VNDK, VNDK-Ext, VNDK-SP, VNDK-SP-Ext and vendor modules.
if from.isVndkExt() {
if from.isVndkSp() {
- // VNDK-SP-Ext may depend on VNDK-SP, VNDK-SP-Ext, or vendor libs (excluding
- // VNDK and VNDK-Ext).
- return to.isVndkSp() || !to.isVndk()
+ if to.isVndk() && !to.isVndkSp() {
+ return errors.New("VNDK-SP extensions must not depend on VNDK or VNDK extensions")
+ }
+ return nil
}
// VNDK-Ext may depend on VNDK, VNDK-Ext, VNDK-SP, VNDK-SP-Ext, or vendor libs.
- return true
+ return nil
}
if from.isVndk() {
if to.isVndkExt() {
- // VNDK-core and VNDK-SP must not depend on VNDK extensions.
- return false
+ return errors.New("VNDK-core and VNDK-SP must not depend on VNDK extensions")
}
if from.isVndkSp() {
- // VNDK-SP must only depend on VNDK-SP.
- return to.isVndkSp()
+ if !to.isVndkSp() {
+ return errors.New("VNDK-SP must only depend on VNDK-SP")
+ }
+ return nil
}
- // VNDK-core may depend on VNDK-core or VNDK-SP.
- return to.isVndk()
+ if !to.isVndk() {
+ return errors.New("VNDK-core must only depend on VNDK-core or VNDK-SP")
+ }
+ return nil
}
// Vendor modules may depend on VNDK, VNDK-Ext, VNDK-SP, VNDK-SP-Ext, or vendor libs.
- return true
+ return nil
}
var (
diff --git a/java/java.go b/java/java.go
index c5414f4..e5218bb 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1757,7 +1757,7 @@
// solution to get the Import name.
name := j.Name()
if strings.HasPrefix(name, removedPrefix) {
- name = strings.Trim(name, removedPrefix)
+ name = strings.TrimPrefix(name, removedPrefix)
}
return name
}
diff --git a/java/sdk_library.go b/java/sdk_library.go
index c1b8880..e513a59 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -128,6 +128,11 @@
// Defaults to "android.annotation".
Srcs_lib_whitelist_pkgs []string
+ // if set to true, create stubs through Metalava instead of Doclava. Javadoc/Doclava is
+ // currently still used for documentation generation, and will be replaced by Dokka soon.
+ // Defaults to true.
+ Metalava_enabled *bool
+
// TODO: determines whether to create HTML doc or not
//Html_doc *bool
}
@@ -417,7 +422,6 @@
props := struct {
Name *string
Srcs []string
- Custom_template *string
Installable *bool
Srcs_lib *string
Srcs_lib_whitelist_dirs []string
@@ -436,11 +440,13 @@
Local_include_dirs []string
}
}{}
+ droiddocProps := struct {
+ Custom_template *string
+ }{}
props.Name = proptools.StringPtr(module.docsName(apiScope))
props.Srcs = append(props.Srcs, module.properties.Srcs...)
props.Srcs = append(props.Srcs, module.properties.Api_srcs...)
- props.Custom_template = proptools.StringPtr("droiddoc-templates-sdk")
props.Installable = proptools.BoolPtr(false)
// A droiddoc module has only one Libs property and doesn't distinguish between
// shared libs and static libs. So we need to add both of these libs to Libs property.
@@ -449,10 +455,26 @@
props.Aidl.Include_dirs = module.deviceProperties.Aidl.Include_dirs
props.Aidl.Local_include_dirs = module.deviceProperties.Aidl.Local_include_dirs
- droiddocArgs := " -hide 110 -hide 111 -hide 113 -hide 121 -hide 125 -hide 126 -hide 127 -hide 128" +
- " -stubpackages " + strings.Join(module.properties.Api_packages, ":") +
- " " + android.JoinWithPrefix(module.properties.Hidden_api_packages, "-hidePackage ") +
- " " + android.JoinWithPrefix(module.properties.Droiddoc_options, "-") + " -nodocs"
+ if module.properties.Metalava_enabled == nil {
+ module.properties.Metalava_enabled = proptools.BoolPtr(true)
+ }
+
+ droiddocArgs := ""
+ if Bool(module.properties.Metalava_enabled) == true {
+ droiddocArgs = " --stub-packages " + strings.Join(module.properties.Api_packages, ":") +
+ " " + android.JoinWithPrefix(module.properties.Hidden_api_packages, " --hide-package ") +
+ " " + android.JoinWithPrefix(module.properties.Droiddoc_options, " ") +
+ " --hide MissingPermission --hide BroadcastBehavior " +
+ "--hide HiddenSuperclass --hide DeprecationMismatch --hide UnavailableSymbol " +
+ "--hide SdkConstant --hide HiddenTypeParameter --hide Todo --hide Typo"
+ } else {
+ droiddocProps.Custom_template = proptools.StringPtr("droiddoc-templates-sdk")
+ droiddocArgs = " -stubpackages " + strings.Join(module.properties.Api_packages, ":") +
+ " " + android.JoinWithPrefix(module.properties.Hidden_api_packages, " -hidePackage ") +
+ " " + android.JoinWithPrefix(module.properties.Droiddoc_options, " ") +
+ " -hide 110 -hide 111 -hide 113 -hide 121 -hide 125 -hide 126 -hide 127 -hide 128 -nodocs"
+ }
+
switch apiScope {
case apiScopeSystem:
droiddocArgs = droiddocArgs + " -showAnnotation android.annotation.SystemApi"
@@ -484,36 +506,40 @@
// check against the not-yet-release API
props.Check_api.Current.Api_file = proptools.StringPtr(currentApiFileName)
props.Check_api.Current.Removed_api_file = proptools.StringPtr(removedApiFileName)
- // any change is reported as error
- props.Check_api.Current.Args = proptools.StringPtr("-error 2 -error 3 -error 4 -error 5 " +
- "-error 6 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 " +
- "-error 14 -error 15 -error 16 -error 17 -error 18 -error 19 -error 20 " +
- "-error 21 -error 23 -error 24 -error 25 -error 26 -error 27")
// check against the latest released API
props.Check_api.Last_released.Api_file = proptools.StringPtr(
module.latestApiFilegroupName(apiScope))
props.Check_api.Last_released.Removed_api_file = proptools.StringPtr(
module.latestRemovedApiFilegroupName(apiScope))
- // backward incompatible changes are reported as error
- props.Check_api.Last_released.Args = proptools.StringPtr("-hide 2 -hide 3 -hide 4 -hide 5 " +
- "-hide 6 -hide 24 -hide 25 -hide 26 -hide 27 " +
- "-error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 " +
- "-error 15 -error 16 -error 17 -error 18")
+ if Bool(module.properties.Metalava_enabled) == false {
+ // any change is reported as error
+ props.Check_api.Current.Args = proptools.StringPtr("-error 2 -error 3 -error 4 -error 5 " +
+ "-error 6 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 " +
+ "-error 14 -error 15 -error 16 -error 17 -error 18 -error 19 -error 20 " +
+ "-error 21 -error 23 -error 24 -error 25 -error 26 -error 27")
- // Include the part of the framework source. This is required for the case when
- // API class is extending from the framework class. In that case, doclava needs
- // to know whether the base class is hidden or not. Since that information is
- // encoded as @hide string in the comment, we need source files for the classes,
- // not the compiled ones.
- props.Srcs_lib = proptools.StringPtr("framework")
- props.Srcs_lib_whitelist_dirs = []string{"core/java"}
- // Add android.annotation package to give access to the framework-defined
- // annotations such as SystemApi, NonNull, etc.
- if module.properties.Srcs_lib_whitelist_pkgs != nil {
- props.Srcs_lib_whitelist_pkgs = module.properties.Srcs_lib_whitelist_pkgs
- } else {
- props.Srcs_lib_whitelist_pkgs = []string{"android.annotation"}
+ // backward incompatible changes are reported as error
+ props.Check_api.Last_released.Args = proptools.StringPtr("-hide 2 -hide 3 -hide 4 -hide 5 " +
+ "-hide 6 -hide 24 -hide 25 -hide 26 -hide 27 " +
+ "-error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 " +
+ "-error 15 -error 16 -error 17 -error 18")
+
+ // Include the part of the framework source. This is required for the case when
+ // API class is extending from the framework class. In that case, doclava needs
+ // to know whether the base class is hidden or not. Since that information is
+ // encoded as @hide string in the comment, we need source files for the classes,
+ // not the compiled ones.
+ props.Srcs_lib = proptools.StringPtr("framework")
+ props.Srcs_lib_whitelist_dirs = []string{"core/java"}
+
+ // Add android.annotation package to give access to the framework-defined
+ // annotations such as SystemApi, NonNull, etc.
+ if module.properties.Srcs_lib_whitelist_pkgs != nil {
+ props.Srcs_lib_whitelist_pkgs = module.properties.Srcs_lib_whitelist_pkgs
+ } else {
+ props.Srcs_lib_whitelist_pkgs = []string{"android.annotation"}
+ }
}
// These libs are required by doclava to parse the framework sources add via
// Src_lib and Src_lib_whitelist_* properties just above.
@@ -521,7 +547,11 @@
// though they don't break the build.
props.Libs = append(props.Libs, "framework")
- mctx.CreateModule(android.ModuleFactoryAdaptor(DroiddocFactory), &props)
+ if Bool(module.properties.Metalava_enabled) == true {
+ mctx.CreateModule(android.ModuleFactoryAdaptor(DroidstubsFactory), &props)
+ } else {
+ mctx.CreateModule(android.ModuleFactoryAdaptor(DroiddocFactory), &props, &droiddocProps)
+ }
}
// Creates the runtime library. This is not directly linkable from other modules.
diff --git a/scripts/manifest_fixer.py b/scripts/manifest_fixer.py
index 80a398b..9256cb2 100755
--- a/scripts/manifest_fixer.py
+++ b/scripts/manifest_fixer.py
@@ -56,7 +56,9 @@
parser.add_argument('--library', dest='library', action='store_true',
help='manifest is for a static library')
parser.add_argument('--uses-library', dest='uses_libraries', action='append',
- help='specify additional <uses-library> tag to add')
+ help='specify additional <uses-library> tag to add. android:requred is set to true')
+ parser.add_argument('--optional-uses-library', dest='optional_uses_libraries', action='append',
+ help='specify additional <uses-library> tag to add. android:requred is set to false')
parser.add_argument('--uses-non-sdk-api', dest='uses_non_sdk_api', action='store_true',
help='manifest is for a package built against the platform')
parser.add_argument('input', help='input AndroidManifest.xml file')
@@ -190,12 +192,13 @@
element.setAttributeNode(target_attr)
-def add_uses_libraries(doc, new_uses_libraries):
- """Add additional <uses-library> tags with android:required=true.
+def add_uses_libraries(doc, new_uses_libraries, required):
+ """Add additional <uses-library> tags
Args:
doc: The XML document. May be modified by this function.
new_uses_libraries: The names of libraries to be added by this function.
+ required: The value of android:required attribute. Can be true or false.
Raises:
RuntimeError: Invalid manifest
"""
@@ -227,7 +230,7 @@
ul = doc.createElement('uses-library')
ul.setAttributeNS(android_ns, 'android:name', name)
- ul.setAttributeNS(android_ns, 'android:required', 'true')
+ ul.setAttributeNS(android_ns, 'android:required', str(required).lower())
application.insertBefore(doc.createTextNode(indent), last)
application.insertBefore(ul, last)
@@ -285,7 +288,10 @@
raise_min_sdk_version(doc, args.min_sdk_version, args.target_sdk_version, args.library)
if args.uses_libraries:
- add_uses_libraries(doc, args.uses_libraries)
+ add_uses_libraries(doc, args.uses_libraries, True)
+
+ if args.optional_uses_libraries:
+ add_uses_libraries(doc, args.optional_uses_libraries, False)
if args.uses_non_sdk_api:
add_uses_non_sdk_api(doc)
diff --git a/ui/build/paths/config.go b/ui/build/paths/config.go
index 6851e8c..7e19da6 100644
--- a/ui/build/paths/config.go
+++ b/ui/build/paths/config.go
@@ -41,8 +41,8 @@
var Log = PathConfig{
Symlink: true,
- Log: true,
- Error: false,
+ Log: true,
+ Error: false,
}
// The configuration used if the tool is not listed in the config below.
@@ -110,7 +110,6 @@
"openssl": Allowed,
"paste": Allowed,
"patch": Allowed,
- "perl": Log,
"pgrep": Allowed,
"pkill": Allowed,
"ps": Allowed,