Merge "Allow instrumenting android_test modules."
diff --git a/android/module.go b/android/module.go
index 4d9ddd4..ae12274 100644
--- a/android/module.go
+++ b/android/module.go
@@ -602,6 +602,10 @@
return Bool(p.commonProperties.Recovery)
}
+func (a *ModuleBase) Owner() string {
+ return String(a.commonProperties.Owner)
+}
+
func (a *ModuleBase) generateModuleTarget(ctx ModuleContext) {
allInstalledFiles := Paths{}
allCheckbuildFiles := Paths{}
diff --git a/cc/binary.go b/cc/binary.go
index 6352ba1..07d503b 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -208,7 +208,7 @@
func (binary *binaryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {
flags = binary.baseLinker.linkerFlags(ctx, flags)
- if ctx.Host() && !binary.static() {
+ if ctx.Host() && !ctx.Windows() && !binary.static() {
if !ctx.Config().IsEnvTrue("DISABLE_HOST_PIE") {
flags.LdFlags = append(flags.LdFlags, "-pie")
}
diff --git a/cc/cc.go b/cc/cc.go
index 188a1cc..d31a38a 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -366,6 +366,10 @@
staticVariant *Module
}
+func (c *Module) OutputFile() android.OptionalPath {
+ return c.outputFile
+}
+
func (c *Module) Init() android.Module {
c.AddProperties(&c.Properties, &c.VendorProperties)
if c.compiler != nil {
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index 3bffacd..2709a89 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -39,6 +39,7 @@
ndkPrebuiltSharedLibs = []string{
"android",
+ "binder_ndk",
"c",
"dl",
"EGL",
diff --git a/cc/stl.go b/cc/stl.go
index 5c69948..f44902e 100644
--- a/cc/stl.go
+++ b/cc/stl.go
@@ -213,10 +213,9 @@
hostDynamicGccLibs = map[android.OsType][]string{
android.Linux: []string{"-lgcc_s", "-lgcc", "-lc", "-lgcc_s", "-lgcc"},
android.Darwin: []string{"-lc", "-lSystem"},
- android.Windows: []string{"-lmsvcr110", "-lmingw32", "-lgcc", "-lmoldname",
- "-lmingwex", "-lmsvcrt", "-ladvapi32", "-lshell32", "-luser32",
- "-lkernel32", "-lmingw32", "-lgcc", "-lmoldname", "-lmingwex",
- "-lmsvcrt"},
+ android.Windows: []string{"-lmingw32", "-lgcc", "-lmoldname", "-lmingwex", "-lmsvcr110",
+ "-lmsvcrt", "-ladvapi32", "-lshell32", "-luser32", "-lkernel32", "-lmingw32",
+ "-lgcc", "-lmoldname", "-lmingwex", "-lmsvcrt"},
}
hostStaticGccLibs = map[android.OsType][]string{
android.Linux: []string{"-Wl,--start-group", "-lgcc", "-lgcc_eh", "-lc", "-Wl,--end-group"},
diff --git a/java/dex.go b/java/dex.go
index 054a176..6445940 100644
--- a/java/dex.go
+++ b/java/dex.go
@@ -42,6 +42,7 @@
`rm -f "$outDict" && ` +
`${config.R8Cmd} -injars $in --output $outDir ` +
`--force-proguard-compatibility ` +
+ `--no-data-resources ` +
`-printmapping $outDict ` +
`$dxFlags $r8Flags && ` +
`touch "$outDict" && ` +
diff --git a/java/sdk_library.go b/java/sdk_library.go
index d588801..3e6908b 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -217,38 +217,45 @@
fmt.Fprintln(w, "LOCAL_MODULE :=", name)
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES := "+module.implName())
fmt.Fprintln(w, "include $(BUILD_PHONY_PACKAGE)")
+ owner := module.ModuleBase.Owner()
+ if owner == "" {
+ owner = "android"
+ }
// Create dist rules to install the stubs libs to the dist dir
if len(module.publicApiStubsPath) == 1 {
fmt.Fprintln(w, "$(call dist-for-goals,sdk win_sdk,"+
module.publicApiStubsPath.Strings()[0]+
- ":"+path.Join("apistubs", "public", module.BaseModuleName()+".jar")+")")
+ ":"+path.Join("apistubs", owner, "public",
+ module.BaseModuleName()+".jar")+")")
}
if len(module.systemApiStubsPath) == 1 {
fmt.Fprintln(w, "$(call dist-for-goals,sdk win_sdk,"+
module.systemApiStubsPath.Strings()[0]+
- ":"+path.Join("apistubs", "system", module.BaseModuleName()+".jar")+")")
+ ":"+path.Join("apistubs", owner, "system",
+ module.BaseModuleName()+".jar")+")")
}
if len(module.testApiStubsPath) == 1 {
fmt.Fprintln(w, "$(call dist-for-goals,sdk win_sdk,"+
module.testApiStubsPath.Strings()[0]+
- ":"+path.Join("apistubs", "test", module.BaseModuleName()+".jar")+")")
+ ":"+path.Join("apistubs", owner, "test",
+ module.BaseModuleName()+".jar")+")")
}
if module.publicApiFilePath != nil {
fmt.Fprintln(w, "$(call dist-for-goals,sdk win_sdk,"+
module.publicApiFilePath.String()+
- ":"+path.Join("apistubs", "public", "api",
+ ":"+path.Join("apistubs", owner, "public", "api",
module.BaseModuleName()+".txt")+")")
}
if module.systemApiFilePath != nil {
fmt.Fprintln(w, "$(call dist-for-goals,sdk win_sdk,"+
module.systemApiFilePath.String()+
- ":"+path.Join("apistubs", "system", "api",
+ ":"+path.Join("apistubs", owner, "system", "api",
module.BaseModuleName()+".txt")+")")
}
if module.testApiFilePath != nil {
fmt.Fprintln(w, "$(call dist-for-goals,sdk win_sdk,"+
module.testApiFilePath.String()+
- ":"+path.Join("apistubs", "test", "api",
+ ":"+path.Join("apistubs", owner, "test", "api",
module.BaseModuleName()+".txt")+")")
}
},