Merge "jacoco correctly gathers info from APK-in-APEX"
This commit is contained in:
@@ -117,6 +117,9 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexName, moduleDir string)
|
|||||||
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
|
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if fi.jacocoReportClassesFile != nil {
|
||||||
|
fmt.Fprintln(w, "LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=", fi.jacocoReportClassesFile.String())
|
||||||
|
}
|
||||||
if fi.class == javaSharedLib {
|
if fi.class == javaSharedLib {
|
||||||
javaModule := fi.module.(javaLibrary)
|
javaModule := fi.module.(javaLibrary)
|
||||||
// soong_java_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .jar Therefore
|
// soong_java_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .jar Therefore
|
||||||
@@ -128,6 +131,12 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexName, moduleDir string)
|
|||||||
fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", fi.builtFile.String())
|
fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", fi.builtFile.String())
|
||||||
fmt.Fprintln(w, "LOCAL_DEX_PREOPT := false")
|
fmt.Fprintln(w, "LOCAL_DEX_PREOPT := false")
|
||||||
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk")
|
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk")
|
||||||
|
} else if fi.class == app {
|
||||||
|
// soong_app_prebuilt.mk sets LOCAL_MODULE_SUFFIX := .apk Therefore
|
||||||
|
// we need to remove the suffix from LOCAL_MODULE_STEM, otherwise
|
||||||
|
// we will have foo.apk.apk
|
||||||
|
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", strings.TrimSuffix(fi.builtFile.Base(), ".apk"))
|
||||||
|
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_app_prebuilt.mk")
|
||||||
} else if fi.class == nativeSharedLib || fi.class == nativeExecutable || fi.class == nativeTest {
|
} else if fi.class == nativeSharedLib || fi.class == nativeExecutable || fi.class == nativeTest {
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.builtFile.Base())
|
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.builtFile.Base())
|
||||||
if cc, ok := fi.module.(*cc.Module); ok {
|
if cc, ok := fi.module.(*cc.Module); ok {
|
||||||
|
11
apex/apex.go
11
apex/apex.go
@@ -465,6 +465,8 @@ type apexFile struct {
|
|||||||
requiredModuleNames []string
|
requiredModuleNames []string
|
||||||
targetRequiredModuleNames []string
|
targetRequiredModuleNames []string
|
||||||
hostRequiredModuleNames []string
|
hostRequiredModuleNames []string
|
||||||
|
|
||||||
|
jacocoReportClassesFile android.Path // only for javalibs and apps
|
||||||
}
|
}
|
||||||
|
|
||||||
func newApexFile(ctx android.BaseModuleContext, builtFile android.Path, moduleName string, installDir string, class apexFileClass, module android.Module) apexFile {
|
func newApexFile(ctx android.BaseModuleContext, builtFile android.Path, moduleName string, installDir string, class apexFileClass, module android.Module) apexFile {
|
||||||
@@ -900,7 +902,9 @@ type javaLibrary interface {
|
|||||||
func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib javaLibrary) apexFile {
|
func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib javaLibrary) apexFile {
|
||||||
dirInApex := "javalib"
|
dirInApex := "javalib"
|
||||||
fileToCopy := lib.DexJar()
|
fileToCopy := lib.DexJar()
|
||||||
return newApexFile(ctx, fileToCopy, lib.Name(), dirInApex, javaSharedLib, lib)
|
af := newApexFile(ctx, fileToCopy, lib.Name(), dirInApex, javaSharedLib, lib)
|
||||||
|
af.jacocoReportClassesFile = lib.JacocoReportClassesFile()
|
||||||
|
return af
|
||||||
}
|
}
|
||||||
|
|
||||||
func apexFileForPrebuiltEtc(ctx android.BaseModuleContext, prebuilt android.PrebuiltEtcModule, depName string) apexFile {
|
func apexFileForPrebuiltEtc(ctx android.BaseModuleContext, prebuilt android.PrebuiltEtcModule, depName string) apexFile {
|
||||||
@@ -913,6 +917,7 @@ func apexFileForAndroidApp(ctx android.BaseModuleContext, aapp interface {
|
|||||||
android.Module
|
android.Module
|
||||||
Privileged() bool
|
Privileged() bool
|
||||||
OutputFile() android.Path
|
OutputFile() android.Path
|
||||||
|
JacocoReportClassesFile() android.Path
|
||||||
}, pkgName string) apexFile {
|
}, pkgName string) apexFile {
|
||||||
appDir := "app"
|
appDir := "app"
|
||||||
if aapp.Privileged() {
|
if aapp.Privileged() {
|
||||||
@@ -920,7 +925,9 @@ func apexFileForAndroidApp(ctx android.BaseModuleContext, aapp interface {
|
|||||||
}
|
}
|
||||||
dirInApex := filepath.Join(appDir, pkgName)
|
dirInApex := filepath.Join(appDir, pkgName)
|
||||||
fileToCopy := aapp.OutputFile()
|
fileToCopy := aapp.OutputFile()
|
||||||
return newApexFile(ctx, fileToCopy, aapp.Name(), dirInApex, app, aapp)
|
af := newApexFile(ctx, fileToCopy, aapp.Name(), dirInApex, app, aapp)
|
||||||
|
af.jacocoReportClassesFile = aapp.JacocoReportClassesFile()
|
||||||
|
return af
|
||||||
}
|
}
|
||||||
|
|
||||||
// Context "decorator", overriding the InstallBypassMake method to always reply `true`.
|
// Context "decorator", overriding the InstallBypassMake method to always reply `true`.
|
||||||
|
@@ -576,6 +576,10 @@ func (a *AARImport) Name() string {
|
|||||||
return a.prebuilt.Name(a.ModuleBase.Name())
|
return a.prebuilt.Name(a.ModuleBase.Name())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *AARImport) JacocoReportClassesFile() android.Path {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (a *AARImport) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (a *AARImport) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
if !ctx.Config().UnbundledBuildUsePrebuiltSdks() {
|
if !ctx.Config().UnbundledBuildUsePrebuiltSdks() {
|
||||||
sdkDep := decodeSdkDep(ctx, sdkContext(a))
|
sdkDep := decodeSdkDep(ctx, sdkContext(a))
|
||||||
|
@@ -1062,6 +1062,10 @@ func (a *AndroidAppImport) OutputFile() android.Path {
|
|||||||
return a.outputFile
|
return a.outputFile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *AndroidAppImport) JacocoReportClassesFile() android.Path {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var dpiVariantGroupType reflect.Type
|
var dpiVariantGroupType reflect.Type
|
||||||
var archVariantGroupType reflect.Type
|
var archVariantGroupType reflect.Type
|
||||||
|
|
||||||
|
@@ -170,6 +170,10 @@ func (d *DeviceHostConverter) SrcJarArgs() ([]string, android.Paths) {
|
|||||||
return d.srcJarArgs, d.srcJarDeps
|
return d.srcJarArgs, d.srcJarDeps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *DeviceHostConverter) JacocoReportClassesFile() android.Path {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (d *DeviceHostConverter) AndroidMk() android.AndroidMkData {
|
func (d *DeviceHostConverter) AndroidMk() android.AndroidMkData {
|
||||||
return android.AndroidMkData{
|
return android.AndroidMkData{
|
||||||
Class: "JAVA_LIBRARIES",
|
Class: "JAVA_LIBRARIES",
|
||||||
|
@@ -447,6 +447,7 @@ type Dependency interface {
|
|||||||
ExportedPlugins() (android.Paths, []string)
|
ExportedPlugins() (android.Paths, []string)
|
||||||
SrcJarArgs() ([]string, android.Paths)
|
SrcJarArgs() ([]string, android.Paths)
|
||||||
BaseModuleName() string
|
BaseModuleName() string
|
||||||
|
JacocoReportClassesFile() android.Path
|
||||||
}
|
}
|
||||||
|
|
||||||
type SdkLibraryDependency interface {
|
type SdkLibraryDependency interface {
|
||||||
@@ -1727,6 +1728,10 @@ func (j *Module) Stem() string {
|
|||||||
return proptools.StringDefault(j.deviceProperties.Stem, j.Name())
|
return proptools.StringDefault(j.deviceProperties.Stem, j.Name())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (j *Module) JacocoReportClassesFile() android.Path {
|
||||||
|
return j.jacocoReportClassesFile
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Java libraries (.jar file)
|
// Java libraries (.jar file)
|
||||||
//
|
//
|
||||||
@@ -2303,6 +2308,10 @@ func (j *Import) Stem() string {
|
|||||||
return proptools.StringDefault(j.properties.Stem, j.ModuleBase.Name())
|
return proptools.StringDefault(j.properties.Stem, j.ModuleBase.Name())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *Import) JacocoReportClassesFile() android.Path {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (j *Import) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (j *Import) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...)
|
ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user