Merge "Whitelist Offline.getProbes(..)."
diff --git a/androidmk/cmd/androidmk/android.go b/androidmk/cmd/androidmk/android.go
index 4af5d97..c66acdc 100644
--- a/androidmk/cmd/androidmk/android.go
+++ b/androidmk/cmd/androidmk/android.go
@@ -42,21 +42,26 @@
var rewriteProperties = map[string](func(variableAssignmentContext) error){
// custom functions
- "LOCAL_32_BIT_ONLY": local32BitOnly,
- "LOCAL_AIDL_INCLUDES": localAidlIncludes,
- "LOCAL_C_INCLUDES": localIncludeDirs,
- "LOCAL_EXPORT_C_INCLUDE_DIRS": exportIncludeDirs,
- "LOCAL_LDFLAGS": ldflags,
- "LOCAL_MODULE_CLASS": prebuiltClass,
- "LOCAL_MODULE_STEM": stem,
- "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,
- "LOCAL_MODULE_PATH": prebuiltModulePath,
+ "LOCAL_32_BIT_ONLY": local32BitOnly,
+ "LOCAL_ADDITIONAL_CERTIFICATES": localizePathList("additional_certificates"),
+ "LOCAL_AIDL_INCLUDES": localAidlIncludes,
+ "LOCAL_ASSET_DIR": localizePathList("asset_dirs"),
+ "LOCAL_C_INCLUDES": localIncludeDirs,
+ "LOCAL_CERTIFICATE": localizePath("certificate"),
+ "LOCAL_EXPORT_C_INCLUDE_DIRS": exportIncludeDirs,
+ "LOCAL_JARJAR_RULES": localizePath("jarjar_rules"),
+ "LOCAL_LDFLAGS": ldflags,
+ "LOCAL_MODULE_CLASS": prebuiltClass,
+ "LOCAL_MODULE_STEM": stem,
+ "LOCAL_MODULE_HOST_OS": hostOs,
+ "LOCAL_RESOURCE_DIR": localizePathList("resource_dirs"),
+ "LOCAL_SANITIZE": sanitize(""),
+ "LOCAL_SANITIZE_DIAG": sanitize("diag."),
+ "LOCAL_STRIP_MODULE": strip(),
+ "LOCAL_CFLAGS": cflags,
+ "LOCAL_UNINSTALLABLE_MODULE": invert("installable"),
+ "LOCAL_PROGUARD_ENABLED": proguardEnabled,
+ "LOCAL_MODULE_PATH": prebuiltModulePath,
// composite functions
"LOCAL_MODULE_TAGS": includeVariableIf(bpVariable{"tags", bpparser.ListType}, not(valueDumpEquals("optional"))),
@@ -93,8 +98,6 @@
"LOCAL_MIN_SDK_VERSION": "min_sdk_version",
"LOCAL_NDK_STL_VARIANT": "stl",
"LOCAL_JAR_MANIFEST": "manifest",
- "LOCAL_JARJAR_RULES": "jarjar_rules",
- "LOCAL_CERTIFICATE": "certificate",
"LOCAL_PACKAGE_NAME": "name",
"LOCAL_MODULE_RELATIVE_PATH": "relative_install_path",
"LOCAL_PROTOC_OPTIMIZE_TYPE": "proto.type",
@@ -140,7 +143,6 @@
"LOCAL_RENDERSCRIPT_FLAGS": "renderscript.flags",
"LOCAL_JAVA_RESOURCE_DIRS": "java_resource_dirs",
- "LOCAL_RESOURCE_DIR": "resource_dirs",
"LOCAL_JAVACFLAGS": "javacflags",
"LOCAL_ERROR_PRONE_FLAGS": "errorprone.javacflags",
"LOCAL_DX_FLAGS": "dxflags",
@@ -161,7 +163,6 @@
// java_library_static to android_library.
"LOCAL_SHARED_ANDROID_LIBRARIES": "android_libs",
"LOCAL_STATIC_ANDROID_LIBRARIES": "android_static_libs",
- "LOCAL_ADDITIONAL_CERTIFICATES": "additional_certificates",
// Jacoco filters:
"LOCAL_JACK_COVERAGE_INCLUDE_FILTER": "jacoco.include_filter",
@@ -389,6 +390,64 @@
return splitAndAssign(ctx, classifyLocalOrGlobalPath, map[string]string{"global": "aidl.include_dirs", "local": "aidl.local_include_dirs"})
}
+func localizePathList(attribute string) func(ctx variableAssignmentContext) error {
+ return func(ctx variableAssignmentContext) error {
+ paths, err := localizePaths(ctx)
+ if err == nil {
+ err = setVariable(ctx.file, ctx.append, ctx.prefix, attribute, paths, true)
+ }
+ return err
+ }
+}
+
+func localizePath(attribute string) func(ctx variableAssignmentContext) error {
+ return func(ctx variableAssignmentContext) error {
+ paths, err := localizePaths(ctx)
+ if err == nil {
+ pathList, ok := paths.(*bpparser.List)
+ if !ok {
+ panic("Expected list")
+ }
+ switch len(pathList.Values) {
+ case 0:
+ err = setVariable(ctx.file, ctx.append, ctx.prefix, attribute, &bpparser.List{}, true)
+ case 1:
+ err = setVariable(ctx.file, ctx.append, ctx.prefix, attribute, pathList.Values[0], true)
+ default:
+ err = fmt.Errorf("Expected single value for %s", attribute)
+ }
+ }
+ return err
+ }
+}
+
+// Convert the "full" paths (that is, from the top of the source tree) to the relative one
+// (from the directory containing the blueprint file) and set given attribute to it.
+// This is needed for some of makefile variables (e.g., LOCAL_RESOURCE_DIR).
+// At the moment only the paths of the `$(LOCAL_PATH)/foo/bar` format can be converted
+// (to `foo/bar` in this case) as we cannot convert a literal path without
+// knowing makefiles's location in the source tree. We just issue a warning in the latter case.
+func localizePaths(ctx variableAssignmentContext) (bpparser.Expression, error) {
+ bpvalue, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
+ var result bpparser.Expression
+ if err != nil {
+ return result, err
+ }
+ classifiedPaths, err := splitBpList(bpvalue, classifyLocalOrGlobalPath)
+ if err != nil {
+ return result, err
+ }
+ for pathClass, path := range classifiedPaths {
+ switch pathClass {
+ case "local":
+ result = path
+ default:
+ err = fmt.Errorf("Only $(LOCAL_PATH)/.. values are allowed")
+ }
+ }
+ return result, err
+}
+
func stem(ctx variableAssignmentContext) error {
val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.StringType)
if err != nil {
diff --git a/androidmk/cmd/androidmk/androidmk_test.go b/androidmk/cmd/androidmk/androidmk_test.go
index 9af2bea..bc249d0 100644
--- a/androidmk/cmd/androidmk/androidmk_test.go
+++ b/androidmk/cmd/androidmk/androidmk_test.go
@@ -112,6 +112,32 @@
}`,
},
{
+ desc: "Convert to local path",
+ in: `
+include $(CLEAR_VARS)
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res $(LOCAL_PATH)/res2
+LOCAL_ASSET_DIR := $(LOCAL_PATH)/asset
+LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt
+LOCAL_CERTIFICATE := $(LOCAL_PATH)/cert
+LOCAL_ADDITIONAL_CERTIFICATES := $(LOCAL_PATH)/cert1 $(LOCAL_PATH)/cert2
+include $(BUILD_PACKAGE)
+ `,
+ expected: `
+android_app {
+ resource_dirs: [
+ "res",
+ "res2",
+ ],
+ asset_dirs: ["asset"],
+ jarjar_rules: "jarjar-rules.txt",
+ certificate: "cert",
+ additional_certificates: [
+ "cert1",
+ "cert2",
+ ],
+}`,
+ },
+ {
desc: "LOCAL_MODULE_STEM",
in: `
include $(CLEAR_VARS)
@@ -642,7 +668,7 @@
in: `
include $(CLEAR_VARS)
LOCAL_SRC_FILES := test.java
- LOCAL_RESOURCE_DIR := res
+ LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_JACK_COVERAGE_INCLUDE_FILTER := foo.*
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/cc/cc.go b/cc/cc.go
index 7b19e98..ddc47ea 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1225,12 +1225,18 @@
return
}
- actx.AddVariationDependencies([]blueprint.Variation{
- {Mutator: "link", Variation: "static"},
- }, wholeStaticDepTag, deps.WholeStaticLibs...)
-
syspropImplLibraries := syspropImplLibraries(actx.Config())
+ for _, lib := range deps.WholeStaticLibs {
+ depTag := wholeStaticDepTag
+ if impl, ok := syspropImplLibraries[lib]; ok {
+ lib = impl
+ }
+ actx.AddVariationDependencies([]blueprint.Variation{
+ {Mutator: "link", Variation: "static"},
+ }, depTag, lib)
+ }
+
for _, lib := range deps.StaticLibs {
depTag := staticDepTag
if inList(lib, deps.ReexportStaticLibHeaders) {
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index 31a3e26..280b601 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -196,6 +196,7 @@
func dexpreoptConfigMakevars(ctx android.MakeVarsContext) {
ctx.Strict("PRODUCT_BOOTCLASSPATH", strings.Join(defaultBootclasspath(ctx), ":"))
+ ctx.Strict("PRODUCT_DEX2OAT_BOOTCLASSPATH", strings.Join(defaultBootImageConfig(ctx).dexLocations, ":"))
ctx.Strict("PRODUCT_SYSTEM_SERVER_CLASSPATH", strings.Join(systemServerClasspath(ctx), ":"))
ctx.Strict("DEXPREOPT_BOOT_JARS_MODULES", strings.Join(defaultBootImageConfig(ctx).modules, ":"))
diff --git a/sysprop/sysprop_library.go b/sysprop/sysprop_library.go
index 4069e78..643fe8e 100644
--- a/sysprop/sysprop_library.go
+++ b/sysprop/sysprop_library.go
@@ -42,9 +42,10 @@
}
type commonProperties struct {
- Srcs []string
- Recovery *bool
- Vendor_available *bool
+ Srcs []string
+ Recovery *bool
+ Recovery_available *bool
+ Vendor_available *bool
}
var (
diff --git a/sysprop/sysprop_test.go b/sysprop/sysprop_test.go
index 745e424..79b0f4e 100644
--- a/sysprop/sysprop_test.go
+++ b/sysprop/sysprop_test.go
@@ -73,6 +73,7 @@
})
ctx.RegisterModuleType("cc_library", android.ModuleFactoryAdaptor(cc.LibraryFactory))
+ ctx.RegisterModuleType("cc_library_static", android.ModuleFactoryAdaptor(cc.LibraryFactory))
ctx.RegisterModuleType("cc_object", android.ModuleFactoryAdaptor(cc.ObjectFactory))
ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(cc.LlndkLibraryFactory))
ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(cc.ToolchainLibraryFactory))
@@ -251,6 +252,12 @@
static_libs: ["sysprop-platform"],
}
+ cc_library_static {
+ name: "cc-client-platform-static",
+ srcs: ["d.cpp"],
+ whole_static_libs: ["sysprop-platform"],
+ }
+
cc_library {
name: "cc-client-product",
srcs: ["d.cpp"],
@@ -300,12 +307,21 @@
platformClient := ctx.ModuleForTests("cc-client-platform", coreVariant)
platformFlags := platformClient.Rule("cc").Args["cFlags"]
- // Platform should use platform's internal header
+ // platform should use platform's internal header
if !strings.Contains(platformFlags, platformInternalPath) {
t.Errorf("flags for platform must contain %#v, but was %#v.",
platformInternalPath, platformFlags)
}
+ platformStaticClient := ctx.ModuleForTests("cc-client-platform-static", coreVariant)
+ platformStaticFlags := platformStaticClient.Rule("cc").Args["cFlags"]
+
+ // platform-static should use platform's internal header
+ if !strings.Contains(platformStaticFlags, platformInternalPath) {
+ t.Errorf("flags for platform-static must contain %#v, but was %#v.",
+ platformInternalPath, platformStaticFlags)
+ }
+
productClient := ctx.ModuleForTests("cc-client-product", coreVariant)
productFlags := productClient.Rule("cc").Args["cFlags"]