Merge "apex_available is defaultable"
diff --git a/Android.bp b/Android.bp
index 0ca11d3..6910d75 100644
--- a/Android.bp
+++ b/Android.bp
@@ -503,6 +503,7 @@
"soong-java",
],
srcs: [
+ "sdk/bp.go",
"sdk/sdk.go",
"sdk/update.go",
],
diff --git a/android/module.go b/android/module.go
index 2ae2961..b4f8f1a 100644
--- a/android/module.go
+++ b/android/module.go
@@ -778,6 +778,13 @@
*m.hostAndDeviceProperties.Device_supported)
}
+func (m *ModuleBase) HostSupported() bool {
+ return m.commonProperties.HostOrDeviceSupported == HostSupported ||
+ m.commonProperties.HostOrDeviceSupported == HostAndDeviceSupported &&
+ (m.hostAndDeviceProperties.Host_supported != nil &&
+ *m.hostAndDeviceProperties.Host_supported)
+}
+
func (m *ModuleBase) Platform() bool {
return !m.DeviceSpecific() && !m.SocSpecific() && !m.ProductSpecific() && !m.SystemExtSpecific()
}
diff --git a/android/paths.go b/android/paths.go
index 8dbb086..1a37a34 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -247,6 +247,33 @@
return ret
}
+// OutputPaths is a slice of OutputPath objects, with helpers to operate on the collection.
+type OutputPaths []OutputPath
+
+// Paths returns the OutputPaths as a Paths
+func (p OutputPaths) Paths() Paths {
+ if p == nil {
+ return nil
+ }
+ ret := make(Paths, len(p))
+ for i, path := range p {
+ ret[i] = path
+ }
+ return ret
+}
+
+// Strings returns the string forms of the writable paths.
+func (p OutputPaths) Strings() []string {
+ if p == nil {
+ return nil
+ }
+ ret := make([]string, len(p))
+ for i, path := range p {
+ ret[i] = path.String()
+ }
+ return ret
+}
+
// PathsAndMissingDepsForModuleSrcExcludes returns Paths rooted from the module's local source directory, excluding
// paths listed in the excludes arguments, and a list of missing dependencies. It expands globs, references to
// SourceFileProducer modules using the ":name" syntax, and references to OutputFileProducer modules using the
diff --git a/android/sdk.go b/android/sdk.go
index 73cb256..01e18ed 100644
--- a/android/sdk.go
+++ b/android/sdk.go
@@ -167,16 +167,39 @@
// Unzip the supplied zip into the snapshot relative directory destDir.
UnzipToSnapshot(zipPath Path, destDir string)
- // Get the AndroidBpFile for the snapshot.
- AndroidBpFile() GeneratedSnapshotFile
-
- // Get a versioned name appropriate for the SDK snapshot version being taken.
- VersionedSdkMemberName(unversionedName string) interface{}
+ // Add a new prebuilt module to the snapshot. The returned module
+ // must be populated with the module type specific properties. The following
+ // properties will be automatically populated.
+ //
+ // * name
+ // * sdk_member_name
+ // * prefer
+ //
+ // This will result in two Soong modules being generated in the Android. One
+ // that is versioned, coupled to the snapshot version and marked as
+ // prefer=true. And one that is not versioned, not marked as prefer=true and
+ // will only be used if the equivalently named non-prebuilt module is not
+ // present.
+ AddPrebuiltModule(name string, moduleType string) BpModule
}
-// Provides support for generating a file, e.g. the Android.bp file.
-type GeneratedSnapshotFile interface {
- Printfln(format string, args ...interface{})
- Indent()
- Dedent()
+// A set of properties for use in a .bp file.
+type BpPropertySet interface {
+ // Add a property, the value can be one of the following types:
+ // * string
+ // * array of the above
+ // * bool
+ // * BpPropertySet
+ //
+ // It is an error is multiples properties with the same name are added.
+ AddProperty(name string, value interface{})
+
+ // Add a property set with the specified name and return so that additional
+ // properties can be added.
+ AddPropertySet(name string) BpPropertySet
+}
+
+// A .bp module definition.
+type BpModule interface {
+ BpPropertySet
}
diff --git a/apex/androidmk.go b/apex/androidmk.go
index dd5da97..35622f0 100644
--- a/apex/androidmk.go
+++ b/apex/androidmk.go
@@ -168,7 +168,6 @@
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", strings.Join(moduleNames, " "))
}
fmt.Fprintln(w, "include $(BUILD_PHONY_PACKAGE)")
- fmt.Fprintln(w, "$(LOCAL_INSTALLED_MODULE): .KATI_IMPLICIT_OUTPUTS :=", a.outputFile.String())
} else {
fmt.Fprintln(w, "\ninclude $(CLEAR_VARS)")
diff --git a/apex/apex.go b/apex/apex.go
index d467b12..3dde149 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -370,20 +370,6 @@
Apps []string
}
-type apexFileClass int
-
-const (
- etc apexFileClass = iota
- nativeSharedLib
- nativeExecutable
- shBinary
- pyBinary
- goBinary
- javaSharedLib
- nativeTest
- app
-)
-
type apexPackaging int
const (
@@ -415,6 +401,20 @@
}
}
+type apexFileClass int
+
+const (
+ etc apexFileClass = iota
+ nativeSharedLib
+ nativeExecutable
+ shBinary
+ pyBinary
+ goBinary
+ javaSharedLib
+ nativeTest
+ app
+)
+
func (class apexFileClass) NameInMake() string {
switch class {
case etc:
@@ -441,13 +441,30 @@
}
}
+// apexFile represents a file in an APEX bundle
type apexFile struct {
builtFile android.Path
moduleName string
installDir string
class apexFileClass
module android.Module
- symlinks []string
+ // list of symlinks that will be created in installDir that point to this apexFile
+ symlinks []string
+ transitiveDep bool
+}
+
+func newApexFile(builtFile android.Path, moduleName string, installDir string, class apexFileClass, module android.Module) apexFile {
+ return apexFile{
+ builtFile: builtFile,
+ moduleName: moduleName,
+ installDir: installDir,
+ class: class,
+ module: module,
+ }
+}
+
+func (af *apexFile) Ok() bool {
+ return af.builtFile != nil || af.builtFile.String() == ""
}
type apexBundle struct {
@@ -761,9 +778,11 @@
a.properties.HideFromMake = true
}
-func getCopyManifestForNativeLibrary(ccMod *cc.Module, config android.Config, handleSpecialLibs bool) (fileToCopy android.Path, dirInApex string) {
+// TODO(jiyong) move apexFileFor* close to the apexFile type definition
+func apexFileForNativeLibrary(ccMod *cc.Module, config android.Config, handleSpecialLibs bool) apexFile {
// Decide the APEX-local directory by the multilib of the library
// In the future, we may query this to the module.
+ var dirInApex string
switch ccMod.Arch().ArchType.Multilib {
case "lib32":
dirInApex = "lib"
@@ -788,83 +807,84 @@
dirInApex = filepath.Join(dirInApex, "bionic")
}
- fileToCopy = ccMod.OutputFile().Path()
- return
+ fileToCopy := ccMod.OutputFile().Path()
+ return newApexFile(fileToCopy, ccMod.Name(), dirInApex, nativeSharedLib, ccMod)
}
-func getCopyManifestForExecutable(cc *cc.Module) (fileToCopy android.Path, dirInApex string) {
- dirInApex = filepath.Join("bin", cc.RelativeInstallPath())
+func apexFileForExecutable(cc *cc.Module) apexFile {
+ dirInApex := filepath.Join("bin", cc.RelativeInstallPath())
if cc.Target().NativeBridge == android.NativeBridgeEnabled {
dirInApex = filepath.Join(dirInApex, cc.Target().NativeBridgeRelativePath)
}
- fileToCopy = cc.OutputFile().Path()
- return
+ fileToCopy := cc.OutputFile().Path()
+ af := newApexFile(fileToCopy, cc.Name(), dirInApex, nativeExecutable, cc)
+ af.symlinks = cc.Symlinks()
+ return af
}
-func getCopyManifestForPyBinary(py *python.Module) (fileToCopy android.Path, dirInApex string) {
- dirInApex = "bin"
- fileToCopy = py.HostToolPath().Path()
- return
+func apexFileForPyBinary(py *python.Module) apexFile {
+ dirInApex := "bin"
+ fileToCopy := py.HostToolPath().Path()
+ return newApexFile(fileToCopy, py.Name(), dirInApex, pyBinary, py)
}
-func getCopyManifestForGoBinary(ctx android.ModuleContext, gb bootstrap.GoBinaryTool) (fileToCopy android.Path, dirInApex string) {
- dirInApex = "bin"
+func apexFileForGoBinary(ctx android.ModuleContext, depName string, gb bootstrap.GoBinaryTool) apexFile {
+ dirInApex := "bin"
s, err := filepath.Rel(android.PathForOutput(ctx).String(), gb.InstallPath())
if err != nil {
ctx.ModuleErrorf("Unable to use compiled binary at %s", gb.InstallPath())
- return
+ return apexFile{}
}
- fileToCopy = android.PathForOutput(ctx, s)
- return
+ fileToCopy := android.PathForOutput(ctx, s)
+ // NB: Since go binaries are static we don't need the module for anything here, which is
+ // good since the go tool is a blueprint.Module not an android.Module like we would
+ // normally use.
+ return newApexFile(fileToCopy, depName, dirInApex, goBinary, nil)
}
-func getCopyManifestForShBinary(sh *android.ShBinary) (fileToCopy android.Path, dirInApex string) {
- dirInApex = filepath.Join("bin", sh.SubDir())
- fileToCopy = sh.OutputFile()
- return
+func apexFileForShBinary(sh *android.ShBinary) apexFile {
+ dirInApex := filepath.Join("bin", sh.SubDir())
+ fileToCopy := sh.OutputFile()
+ af := newApexFile(fileToCopy, sh.Name(), dirInApex, shBinary, sh)
+ af.symlinks = sh.Symlinks()
+ return af
}
-func getCopyManifestForJavaLibrary(java *java.Library) (fileToCopy android.Path, dirInApex string) {
- dirInApex = "javalib"
- fileToCopy = java.DexJarFile()
- return
+func apexFileForJavaLibrary(java *java.Library) apexFile {
+ dirInApex := "javalib"
+ fileToCopy := java.DexJarFile()
+ return newApexFile(fileToCopy, java.Name(), dirInApex, javaSharedLib, java)
}
-func getCopyManifestForPrebuiltJavaLibrary(java *java.Import) (fileToCopy android.Path, dirInApex string) {
- dirInApex = "javalib"
+func apexFileForPrebuiltJavaLibrary(java *java.Import) apexFile {
+ dirInApex := "javalib"
// The output is only one, but for some reason, ImplementationJars returns Paths, not Path
implJars := java.ImplementationJars()
if len(implJars) != 1 {
panic(fmt.Errorf("java.ImplementationJars() must return single Path, but got: %s",
strings.Join(implJars.Strings(), ", ")))
}
- fileToCopy = implJars[0]
- return
+ fileToCopy := implJars[0]
+ return newApexFile(fileToCopy, java.Name(), dirInApex, javaSharedLib, java)
}
-func getCopyManifestForPrebuiltEtc(prebuilt android.PrebuiltEtcModule) (fileToCopy android.Path, dirInApex string) {
- dirInApex = filepath.Join("etc", prebuilt.SubDir())
- fileToCopy = prebuilt.OutputFile()
- return
+func apexFileForPrebuiltEtc(prebuilt android.PrebuiltEtcModule, depName string) apexFile {
+ dirInApex := filepath.Join("etc", prebuilt.SubDir())
+ fileToCopy := prebuilt.OutputFile()
+ return newApexFile(fileToCopy, depName, dirInApex, etc, prebuilt)
}
-func getCopyManifestForAndroidApp(app *java.AndroidApp, pkgName string) (fileToCopy android.Path, dirInApex string) {
+func apexFileForAndroidApp(aapp interface {
+ android.Module
+ Privileged() bool
+ OutputFile() android.Path
+}, pkgName string) apexFile {
appDir := "app"
- if app.Privileged() {
+ if aapp.Privileged() {
appDir = "priv-app"
}
- dirInApex = filepath.Join(appDir, pkgName)
- fileToCopy = app.OutputFile()
- return
-}
-
-func getCopyManifestForAndroidAppImport(app *java.AndroidAppImport, pkgName string) (fileToCopy android.Path, dirInApex string) {
- appDir := "app"
- if app.Privileged() {
- appDir = "priv-app"
- }
- dirInApex = filepath.Join(appDir, pkgName)
- fileToCopy = app.OutputFile()
- return
+ dirInApex := filepath.Join(appDir, pkgName)
+ fileToCopy := aapp.OutputFile()
+ return newApexFile(fileToCopy, aapp.Name(), dirInApex, app, aapp)
}
// Context "decorator", overriding the InstallBypassMake method to always reply `true`.
@@ -877,8 +897,6 @@
}
func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- filesInfo := []apexFile{}
-
buildFlattenedAsDefault := ctx.Config().FlattenApex() && !ctx.Config().UnbundledBuild()
switch a.properties.ApexType {
case imageApex:
@@ -939,68 +957,67 @@
providedNativeSharedLibs = append(providedNativeSharedLibs, other.properties.Native_shared_libs...)
})
+ var filesInfo []apexFile
ctx.WalkDepsBlueprint(func(child, parent blueprint.Module) bool {
depTag := ctx.OtherModuleDependencyTag(child)
depName := ctx.OtherModuleName(child)
- if _, ok := parent.(*apexBundle); ok {
- // direct dependencies
+ if _, isDirectDep := parent.(*apexBundle); isDirectDep {
switch depTag {
case sharedLibTag:
if cc, ok := child.(*cc.Module); ok {
if cc.HasStubsVariants() {
provideNativeLibs = append(provideNativeLibs, cc.OutputFile().Path().Base())
}
- fileToCopy, dirInApex := getCopyManifestForNativeLibrary(cc, ctx.Config(), handleSpecialLibs)
- filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, nativeSharedLib, cc, nil})
- return true
+ filesInfo = append(filesInfo, apexFileForNativeLibrary(cc, ctx.Config(), handleSpecialLibs))
+ return true // track transitive dependencies
} else {
ctx.PropertyErrorf("native_shared_libs", "%q is not a cc_library or cc_library_shared module", depName)
}
case executableTag:
if cc, ok := child.(*cc.Module); ok {
- fileToCopy, dirInApex := getCopyManifestForExecutable(cc)
- filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, nativeExecutable, cc, cc.Symlinks()})
- return true
+ filesInfo = append(filesInfo, apexFileForExecutable(cc))
+ return true // track transitive dependencies
} else if sh, ok := child.(*android.ShBinary); ok {
- fileToCopy, dirInApex := getCopyManifestForShBinary(sh)
- filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, shBinary, sh, sh.Symlinks()})
+ filesInfo = append(filesInfo, apexFileForShBinary(sh))
} else if py, ok := child.(*python.Module); ok && py.HostToolPath().Valid() {
- fileToCopy, dirInApex := getCopyManifestForPyBinary(py)
- filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, pyBinary, py, nil})
+ filesInfo = append(filesInfo, apexFileForPyBinary(py))
} else if gb, ok := child.(bootstrap.GoBinaryTool); ok && a.Host() {
- fileToCopy, dirInApex := getCopyManifestForGoBinary(ctx, gb)
- // NB: Since go binaries are static we don't need the module for anything here, which is
- // good since the go tool is a blueprint.Module not an android.Module like we would
- // normally use.
- filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, goBinary, nil, nil})
+ filesInfo = append(filesInfo, apexFileForGoBinary(ctx, depName, gb))
} else {
ctx.PropertyErrorf("binaries", "%q is neither cc_binary, (embedded) py_binary, (host) blueprint_go_binary, (host) bootstrap_go_binary, nor sh_binary", depName)
}
case javaLibTag:
if javaLib, ok := child.(*java.Library); ok {
- fileToCopy, dirInApex := getCopyManifestForJavaLibrary(javaLib)
- if fileToCopy == nil {
+ af := apexFileForJavaLibrary(javaLib)
+ if !af.Ok() {
ctx.PropertyErrorf("java_libs", "%q is not configured to be compiled into dex", depName)
} else {
- filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, javaSharedLib, javaLib, nil})
+ filesInfo = append(filesInfo, af)
+ return true // track transitive dependencies
}
- return true
} else if javaLib, ok := child.(*java.Import); ok {
- fileToCopy, dirInApex := getCopyManifestForPrebuiltJavaLibrary(javaLib)
- if fileToCopy == nil {
+ af := apexFileForPrebuiltJavaLibrary(javaLib)
+ if !af.Ok() {
ctx.PropertyErrorf("java_libs", "%q does not have a jar output", depName)
} else {
- filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, javaSharedLib, javaLib, nil})
+ filesInfo = append(filesInfo, af)
}
- return true
} else {
ctx.PropertyErrorf("java_libs", "%q of type %q is not supported", depName, ctx.OtherModuleType(child))
}
+ case androidAppTag:
+ pkgName := ctx.DeviceConfig().OverridePackageNameFor(depName)
+ if ap, ok := child.(*java.AndroidApp); ok {
+ filesInfo = append(filesInfo, apexFileForAndroidApp(ap, pkgName))
+ return true // track transitive dependencies
+ } else if ap, ok := child.(*java.AndroidAppImport); ok {
+ filesInfo = append(filesInfo, apexFileForAndroidApp(ap, pkgName))
+ } else {
+ ctx.PropertyErrorf("apps", "%q is not an android_app module", depName)
+ }
case prebuiltTag:
if prebuilt, ok := child.(android.PrebuiltEtcModule); ok {
- fileToCopy, dirInApex := getCopyManifestForPrebuiltEtc(prebuilt)
- filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, etc, prebuilt, nil})
- return true
+ filesInfo = append(filesInfo, apexFileForPrebuiltEtc(prebuilt, depName))
} else {
ctx.PropertyErrorf("prebuilts", "%q is not a prebuilt_etc module", depName)
}
@@ -1016,10 +1033,10 @@
return true
} else {
// Single-output test module (where `test_per_src: false`).
- fileToCopy, dirInApex := getCopyManifestForExecutable(ccTest)
- filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, nativeTest, ccTest, nil})
+ af := apexFileForExecutable(ccTest)
+ af.class = nativeTest
+ filesInfo = append(filesInfo, af)
}
- return true
} else {
ctx.PropertyErrorf("tests", "%q is not a cc module", depName)
}
@@ -1027,15 +1044,14 @@
if key, ok := child.(*apexKey); ok {
a.private_key_file = key.private_key_file
a.public_key_file = key.public_key_file
- return false
} else {
ctx.PropertyErrorf("key", "%q is not an apex_key module", depName)
}
+ return false
case certificateTag:
if dep, ok := child.(*java.AndroidAppCertificate); ok {
a.container_certificate_file = dep.Certificate.Pem
a.container_private_key_file = dep.Certificate.Key
- return false
} else {
ctx.ModuleErrorf("certificate dependency %q must be an android_app_certificate module", depName)
}
@@ -1045,17 +1061,6 @@
if prebuilt, ok := child.(*Prebuilt); ok && prebuilt.isForceDisabled() {
a.prebuiltFileToDelete = prebuilt.InstallFilename()
}
- case androidAppTag:
- if ap, ok := child.(*java.AndroidApp); ok {
- fileToCopy, dirInApex := getCopyManifestForAndroidApp(ap, ctx.DeviceConfig().OverridePackageNameFor(depName))
- filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, app, ap, nil})
- return true
- } else if ap, ok := child.(*java.AndroidAppImport); ok {
- fileToCopy, dirInApex := getCopyManifestForAndroidAppImport(ap, ctx.DeviceConfig().OverridePackageNameFor(depName))
- filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, app, ap, nil})
- } else {
- ctx.PropertyErrorf("apps", "%q is not an android_app module", depName)
- }
}
} else if !a.vndkApex {
// indirect dependencies
@@ -1084,23 +1089,26 @@
// Don't track further
return false
}
- fileToCopy, dirInApex := getCopyManifestForNativeLibrary(cc, ctx.Config(), handleSpecialLibs)
- filesInfo = append(filesInfo, apexFile{fileToCopy, depName, dirInApex, nativeSharedLib, cc, nil})
- return true
+ af := apexFileForNativeLibrary(cc, ctx.Config(), handleSpecialLibs)
+ af.transitiveDep = true
+ filesInfo = append(filesInfo, af)
+ return true // track transitive dependencies
}
} else if cc.IsTestPerSrcDepTag(depTag) {
if cc, ok := child.(*cc.Module); ok {
- fileToCopy, dirInApex := getCopyManifestForExecutable(cc)
+ af := apexFileForExecutable(cc)
// Handle modules created as `test_per_src` variations of a single test module:
// use the name of the generated test binary (`fileToCopy`) instead of the name
// of the original test module (`depName`, shared by all `test_per_src`
// variations of that module).
- moduleName := filepath.Base(fileToCopy.String())
- filesInfo = append(filesInfo, apexFile{fileToCopy, moduleName, dirInApex, nativeTest, cc, nil})
- return true
+ af.moduleName = filepath.Base(af.builtFile.String())
+ af.transitiveDep = true
+ filesInfo = append(filesInfo, af)
+ return true // track transitive dependencies
}
} else if java.IsJniDepTag(depTag) {
// Do nothing for JNI dep. JNI libraries are always embedded in APK-in-APEX.
+ return true
} else if am.CanHaveApexVariants() && am.IsInstallableToApex() {
ctx.ModuleErrorf("unexpected tag %q for indirect dependency %q", depTag, depName)
}
@@ -1117,7 +1125,8 @@
dirInApex := filepath.Join("javalib", arch.String())
for _, f := range files {
localModule := "javalib_" + arch.String() + "_" + filepath.Base(f.String())
- filesInfo = append(filesInfo, apexFile{f, localModule, dirInApex, etc, nil, nil})
+ af := newApexFile(f, localModule, dirInApex, etc, nil)
+ filesInfo = append(filesInfo, af)
}
}
}
diff --git a/apex/apex_test.go b/apex/apex_test.go
index a41f914..509d760 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -2994,10 +2994,11 @@
var builder strings.Builder
data.Custom(&builder, name, "TARGET_", "", data)
androidMk := builder.String()
- ensureContains(t, androidMk, "LOCAL_MODULE := app.override_myapex")
+ ensureContains(t, androidMk, "LOCAL_MODULE := override_app.override_myapex")
ensureContains(t, androidMk, "LOCAL_MODULE := apex_manifest.pb.override_myapex")
ensureContains(t, androidMk, "LOCAL_MODULE_STEM := override_myapex.apex")
ensureNotContains(t, androidMk, "LOCAL_MODULE := app.myapex")
+ ensureNotContains(t, androidMk, "LOCAL_MODULE := override_app.myapex")
ensureNotContains(t, androidMk, "LOCAL_MODULE := apex_manifest.pb.myapex")
ensureNotContains(t, androidMk, "LOCAL_MODULE_STEM := myapex.apex")
}
diff --git a/apex/builder.go b/apex/builder.go
index 70f3e1a..f199bd4 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -501,8 +501,8 @@
if a.installable() {
// For flattened APEX, do nothing but make sure that apex_manifest.json and apex_pubkey are also copied along
// with other ordinary files.
- a.filesInfo = append(a.filesInfo, apexFile{a.manifestJsonOut, "apex_manifest.json." + a.Name() + a.suffix, ".", etc, nil, nil})
- a.filesInfo = append(a.filesInfo, apexFile{a.manifestPbOut, "apex_manifest.pb." + a.Name() + a.suffix, ".", etc, nil, nil})
+ a.filesInfo = append(a.filesInfo, newApexFile(a.manifestJsonOut, "apex_manifest.json."+a.Name()+a.suffix, ".", etc, nil))
+ a.filesInfo = append(a.filesInfo, newApexFile(a.manifestPbOut, "apex_manifest.pb."+a.Name()+a.suffix, ".", etc, nil))
// rename to apex_pubkey
copiedPubkey := android.PathForModuleOut(ctx, "apex_pubkey")
@@ -511,7 +511,7 @@
Input: a.public_key_file,
Output: copiedPubkey,
})
- a.filesInfo = append(a.filesInfo, apexFile{copiedPubkey, "apex_pubkey." + a.Name() + a.suffix, ".", etc, nil, nil})
+ a.filesInfo = append(a.filesInfo, newApexFile(copiedPubkey, "apex_pubkey."+a.Name()+a.suffix, ".", etc, nil))
if a.properties.ApexType == flattenedApex {
apexName := proptools.StringDefault(a.properties.Apex_name, a.Name())
diff --git a/cc/compiler.go b/cc/compiler.go
index 671861b..2bc6ae2 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -27,6 +27,10 @@
"android/soong/cc/config"
)
+var (
+ allowedManualInterfacePaths = []string{"vendor/", "hardware/"}
+)
+
// This file contains the basic C/C++/assembly to .o compliation steps
type BaseCompilerProperties struct {
@@ -509,6 +513,12 @@
flags.Local.CFlags = append(flags.Local.CFlags, "-fopenmp")
}
+ // Exclude directories from manual binder interface whitelisting.
+ //TODO(b/145621474): Move this check into IInterface.h when clang-tidy no longer uses absolute paths.
+ if android.PrefixInList(ctx.ModuleDir(), allowedManualInterfacePaths) {
+ flags.Local.CFlags = append(flags.Local.CFlags, "-DDO_NOT_CHECK_MANUAL_BINDER_INTERFACES")
+ }
+
return flags
}
diff --git a/cc/config/clang.go b/cc/config/clang.go
index eddc341..8618d09 100644
--- a/cc/config/clang.go
+++ b/cc/config/clang.go
@@ -132,6 +132,10 @@
// Disable -Winconsistent-missing-override until we can clean up the existing
// codebase for it.
"-Wno-inconsistent-missing-override",
+
+ // Warnings from clang-10
+ // Nested and array designated initialization is nice to have.
+ "-Wno-c99-designator",
}, " "))
pctx.StaticVariable("ClangExtraCppflags", strings.Join([]string{
@@ -161,6 +165,10 @@
// new warnings are fixed.
"-Wno-tautological-constant-compare",
"-Wno-tautological-type-limit-compare",
+ // http://b/145210666
+ "-Wno-reorder-init-list",
+ // http://b/145211066
+ "-Wno-implicit-int-float-conversion",
}, " "))
// Extra cflags for external third-party projects to disable warnings that
@@ -176,6 +184,13 @@
// Bug: http://b/29823425 Disable -Wnull-dereference until the
// new instances detected by this warning are fixed.
"-Wno-null-dereference",
+
+ // http://b/145211477
+ "-Wno-pointer-compare",
+ // http://b/145211022
+ "-Wno-xor-used-as-pow",
+ // http://b/145211022
+ "-Wno-final-dtor-non-final-class",
}, " "))
}
diff --git a/cc/config/global.go b/cc/config/global.go
index 0943126..f18f950 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -124,8 +124,8 @@
// prebuilts/clang default settings.
ClangDefaultBase = "prebuilts/clang/host"
- ClangDefaultVersion = "clang-r365631b"
- ClangDefaultShortVersion = "9.0.7"
+ ClangDefaultVersion = "clang-r370808"
+ ClangDefaultShortVersion = "10.0.1"
// Directories with warnings from Android.bp files.
WarningAllowedProjects = []string{
diff --git a/cc/fuzz.go b/cc/fuzz.go
index bb89bb4..c2b0ff4 100644
--- a/cc/fuzz.go
+++ b/cc/fuzz.go
@@ -345,6 +345,11 @@
return
}
+ // Discard modules that are in an unavailable namespace.
+ if !ccModule.ExportedToMake() {
+ return
+ }
+
s.fuzzTargets[module.Name()] = true
hostOrTargetString := "target"
diff --git a/cc/makevars.go b/cc/makevars.go
index e8cedf0..0f9f4c1 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -147,6 +147,7 @@
ctx.Strict("WITH_TIDY_FLAGS", "${config.TidyWithTidyFlags}")
ctx.Strict("AIDL_CPP", "${aidlCmd}")
+ ctx.Strict("ALLOWED_MANUAL_INTERFACE_PATHS", strings.Join(allowedManualInterfacePaths, " "))
ctx.Strict("M4", "${m4Cmd}")
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index c47cbf0..da94d33 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -261,6 +261,7 @@
// We're knowingly doing some otherwise unsightly things with builtin
// functions here. We're just generating stub libraries, so ignore it.
"-Wno-incompatible-library-redeclaration",
+ "-Wno-incomplete-setjmp-declaration",
"-Wno-builtin-requires-header",
"-Wno-invalid-noreturn",
"-Wall",
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 55bdd1c..b4082d3 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -39,7 +39,16 @@
hwasanCflags = []string{"-fno-omit-frame-pointer", "-Wno-frame-larger-than=",
"-fsanitize-hwaddress-abi=platform",
- "-fno-experimental-new-pass-manager"}
+ "-fno-experimental-new-pass-manager",
+ // The following improves debug location information
+ // availability at the cost of its accuracy. It increases
+ // the likelihood of a stack variable's frame offset
+ // to be recorded in the debug info, which is important
+ // for the quality of hwasan reports. The downside is a
+ // higher number of "optimized out" stack variables.
+ // b/112437883.
+ "-mllvm", "-instcombine-lower-dbg-declare=0",
+ }
cfiCflags = []string{"-flto", "-fsanitize-cfi-cross-dso",
"-fsanitize-blacklist=external/compiler-rt/lib/cfi/cfi_blacklist.txt"}
diff --git a/cuj/Android.bp b/cuj/Android.bp
new file mode 100644
index 0000000..21d667f
--- /dev/null
+++ b/cuj/Android.bp
@@ -0,0 +1,12 @@
+blueprint_go_binary {
+ name: "cuj_tests",
+ deps: [
+ "soong-ui-build",
+ "soong-ui-logger",
+ "soong-ui-terminal",
+ "soong-ui-tracer",
+ ],
+ srcs: [
+ "cuj.go",
+ ],
+}
diff --git a/cuj/cuj.go b/cuj/cuj.go
new file mode 100644
index 0000000..c7ff8ff
--- /dev/null
+++ b/cuj/cuj.go
@@ -0,0 +1,190 @@
+// Copyright 2019 Google Inc. All rights reserved.
+//
+// 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.
+
+// This executable runs a series of build commands to test and benchmark some critical user journeys.
+package main
+
+import (
+ "context"
+ "fmt"
+ "os"
+ "path/filepath"
+ "strconv"
+ "strings"
+ "time"
+
+ "android/soong/ui/build"
+ "android/soong/ui/logger"
+ "android/soong/ui/metrics"
+ "android/soong/ui/status"
+ "android/soong/ui/terminal"
+ "android/soong/ui/tracer"
+)
+
+type Test struct {
+ name string
+ args []string
+
+ results TestResults
+}
+
+type TestResults struct {
+ metrics *metrics.Metrics
+ err error
+}
+
+// Run runs a single build command. It emulates the "m" command line by calling into Soong UI directly.
+func (t *Test) Run(logsDir string) {
+ output := terminal.NewStatusOutput(os.Stdout, "", false, false)
+
+ log := logger.New(output)
+ defer log.Cleanup()
+
+ ctx, cancel := context.WithCancel(context.Background())
+ defer cancel()
+
+ trace := tracer.New(log)
+ defer trace.Close()
+
+ met := metrics.New()
+
+ stat := &status.Status{}
+ defer stat.Finish()
+ stat.AddOutput(output)
+ stat.AddOutput(trace.StatusTracer())
+
+ build.SetupSignals(log, cancel, func() {
+ trace.Close()
+ log.Cleanup()
+ stat.Finish()
+ })
+
+ buildCtx := build.Context{ContextImpl: &build.ContextImpl{
+ Context: ctx,
+ Logger: log,
+ Metrics: met,
+ Tracer: trace,
+ Writer: output,
+ Status: stat,
+ }}
+
+ defer logger.Recover(func(err error) {
+ t.results.err = err
+ })
+
+ config := build.NewConfig(buildCtx, t.args...)
+ build.SetupOutDir(buildCtx, config)
+
+ os.MkdirAll(logsDir, 0777)
+ log.SetOutput(filepath.Join(logsDir, "soong.log"))
+ trace.SetOutput(filepath.Join(logsDir, "build.trace"))
+ stat.AddOutput(status.NewVerboseLog(log, filepath.Join(logsDir, "verbose.log")))
+ stat.AddOutput(status.NewErrorLog(log, filepath.Join(logsDir, "error.log")))
+ stat.AddOutput(status.NewProtoErrorLog(log, filepath.Join(logsDir, "build_error")))
+ stat.AddOutput(status.NewCriticalPath(log))
+
+ defer met.Dump(filepath.Join(logsDir, "soong_metrics"))
+
+ if start, ok := os.LookupEnv("TRACE_BEGIN_SOONG"); ok {
+ if !strings.HasSuffix(start, "N") {
+ if start_time, err := strconv.ParseUint(start, 10, 64); err == nil {
+ log.Verbosef("Took %dms to start up.",
+ time.Since(time.Unix(0, int64(start_time))).Nanoseconds()/time.Millisecond.Nanoseconds())
+ buildCtx.CompleteTrace(metrics.RunSetupTool, "startup", start_time, uint64(time.Now().UnixNano()))
+ }
+ }
+
+ if executable, err := os.Executable(); err == nil {
+ trace.ImportMicrofactoryLog(filepath.Join(filepath.Dir(executable), "."+filepath.Base(executable)+".trace"))
+ }
+ }
+
+ f := build.NewSourceFinder(buildCtx, config)
+ defer f.Shutdown()
+ build.FindSources(buildCtx, config, f)
+
+ build.Build(buildCtx, config, build.BuildAll)
+
+ t.results.metrics = met
+}
+
+func main() {
+ outDir := os.Getenv("OUT_DIR")
+ if outDir == "" {
+ outDir = "out"
+ }
+
+ cujDir := filepath.Join(outDir, "cuj_tests")
+
+ // Use a subdirectory for the out directory for the tests to keep them isolated.
+ os.Setenv("OUT_DIR", filepath.Join(cujDir, "out"))
+
+ // Each of these tests is run in sequence without resetting the output tree. The state of the output tree will
+ // affect each successive test. To maintain the validity of the benchmarks across changes, care must be taken
+ // to avoid changing the state of the tree when a test is run. This is most easily accomplished by adding tests
+ // at the end.
+ tests := []Test{
+ {
+ // Reset the out directory to get reproducible results.
+ name: "clean",
+ args: []string{"clean"},
+ },
+ {
+ // Parse the build files.
+ name: "nothing",
+ args: []string{"nothing"},
+ },
+ {
+ // Parse the build files again to monitor issues like globs rerunning.
+ name: "nothing_rebuild",
+ args: []string{"nothing"},
+ },
+ {
+ // Parse the build files again, this should always be very short.
+ name: "nothing_rebuild_twice",
+ args: []string{"nothing"},
+ },
+ {
+ // Build the framework as a common developer task and one that keeps getting longer.
+ name: "framework",
+ args: []string{"framework"},
+ },
+ {
+ // Build the framework again to make sure it doesn't rebuild anything.
+ name: "framework_rebuild",
+ args: []string{"framework"},
+ },
+ {
+ // Build the framework again to make sure it doesn't rebuild anything even if it did the second time.
+ name: "framework_rebuild_twice",
+ args: []string{"framework"},
+ },
+ }
+
+ cujMetrics := metrics.NewCriticalUserJourneysMetrics()
+ defer cujMetrics.Dump(filepath.Join(cujDir, "logs", "cuj_metrics.pb"))
+
+ for i, t := range tests {
+ logsSubDir := fmt.Sprintf("%02d_%s", i, t.name)
+ logsDir := filepath.Join(cujDir, "logs", logsSubDir)
+ t.Run(logsDir)
+ if t.results.err != nil {
+ fmt.Printf("error running test %q: %s\n", t.name, t.results.err)
+ break
+ }
+ if t.results.metrics != nil {
+ cujMetrics.Add(t.name, t.results.metrics)
+ }
+ }
+}
diff --git a/cuj/run_cuj_tests.sh b/cuj/run_cuj_tests.sh
new file mode 100755
index 0000000..b4f9f88
--- /dev/null
+++ b/cuj/run_cuj_tests.sh
@@ -0,0 +1,29 @@
+#!/bin/bash -e
+
+readonly UNAME="$(uname)"
+case "$UNAME" in
+Linux)
+ readonly OS='linux'
+ ;;
+Darwin)
+ readonly OS='darwin'
+ ;;
+*)
+ echo "Unsupported OS '$UNAME'"
+ exit 1
+ ;;
+esac
+
+readonly ANDROID_TOP="$(cd $(dirname $0)/../../..; pwd)"
+cd "$ANDROID_TOP"
+
+export OUT_DIR="${OUT_DIR:-out}"
+readonly SOONG_OUT="${OUT_DIR}/soong"
+
+build/soong/soong_ui.bash --make-mode "${SOONG_OUT}/host/${OS}-x86/bin/cuj_tests"
+
+"${SOONG_OUT}/host/${OS}-x86/bin/cuj_tests" || true
+
+if [ -n "${DIST_DIR}" ]; then
+ cp -r "${OUT_DIR}/cuj_tests/logs" "${DIST_DIR}"
+fi
diff --git a/dexpreopt/config.go b/dexpreopt/config.go
index f38d892..83e3673 100644
--- a/dexpreopt/config.go
+++ b/dexpreopt/config.go
@@ -38,11 +38,10 @@
DisableGenerateProfile bool // don't generate profiles
ProfileDir string // directory to find profiles in
- BootJars []string // modules for jars that form the boot class path
+ BootJars []string // modules for jars that form the boot class path
+ UpdatableBootJars []string // jars within apex that form the boot class path
- ArtApexJars []string // modules for jars that are in the ART APEX
- ProductUpdatableBootModules []string
- ProductUpdatableBootLocations []string
+ ArtApexJars []string // modules for jars that are in the ART APEX
SystemServerJars []string // jars that form the system server
SystemServerApps []string // apps that are loaded into system server
@@ -118,9 +117,10 @@
UsesLibraries []string
LibraryPaths map[string]android.Path
- Archs []android.ArchType
- DexPreoptImages []android.Path
- DexPreoptImagesDeps []android.Paths
+ Archs []android.ArchType
+ DexPreoptImages []android.Path
+ DexPreoptImagesDeps []android.OutputPaths
+ DexPreoptImageLocations []string
PreoptBootClassPathDexFiles android.Paths // file paths of boot class path files
PreoptBootClassPathDexLocations []string // virtual locations of boot class path files
@@ -226,6 +226,7 @@
ProfileClassListing string
LibraryPaths map[string]string
DexPreoptImages []string
+ DexPreoptImageLocations []string
PreoptBootClassPathDexFiles []string
}
@@ -243,10 +244,11 @@
config.ModuleConfig.ProfileClassListing = android.OptionalPathForPath(constructPath(ctx, config.ProfileClassListing))
config.ModuleConfig.LibraryPaths = constructPathMap(ctx, config.LibraryPaths)
config.ModuleConfig.DexPreoptImages = constructPaths(ctx, config.DexPreoptImages)
+ config.ModuleConfig.DexPreoptImageLocations = config.DexPreoptImageLocations
config.ModuleConfig.PreoptBootClassPathDexFiles = constructPaths(ctx, config.PreoptBootClassPathDexFiles)
// This needs to exist, but dependencies are already handled in Make, so we don't need to pass them through JSON.
- config.ModuleConfig.DexPreoptImagesDeps = make([]android.Paths, len(config.ModuleConfig.DexPreoptImages))
+ config.ModuleConfig.DexPreoptImagesDeps = make([]android.OutputPaths, len(config.ModuleConfig.DexPreoptImages))
return config.ModuleConfig, nil
}
@@ -281,9 +283,8 @@
DisableGenerateProfile: false,
ProfileDir: "",
BootJars: nil,
+ UpdatableBootJars: nil,
ArtApexJars: nil,
- ProductUpdatableBootModules: nil,
- ProductUpdatableBootLocations: nil,
SystemServerJars: nil,
SystemServerApps: nil,
UpdatableSystemServerJars: nil,
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index 18a38fb..40986c3 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -86,10 +86,8 @@
generateDM := shouldGenerateDM(module, global)
- for i, arch := range module.Archs {
- image := module.DexPreoptImages[i]
- imageDeps := module.DexPreoptImagesDeps[i]
- dexpreoptCommand(ctx, global, module, rule, arch, profile, image, imageDeps, appImage, generateDM)
+ for archIdx, _ := range module.Archs {
+ dexpreoptCommand(ctx, global, module, rule, archIdx, profile, appImage, generateDM)
}
}
}
@@ -193,7 +191,9 @@
}
func dexpreoptCommand(ctx android.PathContext, global GlobalConfig, module ModuleConfig, rule *android.RuleBuilder,
- arch android.ArchType, profile, bootImage android.Path, bootImageDeps android.Paths, appImage, generateDM bool) {
+ archIdx int, profile android.WritablePath, appImage bool, generateDM bool) {
+
+ arch := module.Archs[archIdx]
// HACK: make soname in Soong-generated .odex files match Make.
base := filepath.Base(module.DexLocation)
@@ -222,13 +222,6 @@
invocationPath := odexPath.ReplaceExtension(ctx, "invocation")
- // bootImage is .../dex_bootjars/system/framework/arm64/boot.art, but dex2oat wants
- // .../dex_bootjars/system/framework/boot.art on the command line
- var bootImageLocation string
- if bootImage != nil {
- bootImageLocation = PathToLocation(bootImage, arch)
- }
-
// The class loader context using paths in the build
var classLoaderContextHost android.Paths
@@ -356,7 +349,7 @@
Flag("--runtime-arg").FlagWithList("-Xbootclasspath-locations:", module.PreoptBootClassPathDexLocations, ":").
Flag("${class_loader_context_arg}").
Flag("${stored_class_loader_context_arg}").
- FlagWithArg("--boot-image=", bootImageLocation).Implicits(bootImageDeps).
+ FlagWithArg("--boot-image=", strings.Join(module.DexPreoptImageLocations, ":")).Implicits(module.DexPreoptImagesDeps[archIdx].Paths()).
FlagWithInput("--dex-file=", module.DexPath).
FlagWithArg("--dex-location=", dexLocationArg).
FlagWithOutput("--oat-file=", odexPath).ImplicitOutput(vdexPath).
@@ -554,6 +547,12 @@
return apexJarPair[0], apexJarPair[1]
}
+// Expected format for apexJarValue = <apex name>:<jar name>
+func GetJarLocationFromApexJarPair(apexJarValue string) string {
+ apex, jar := SplitApexJarPair(apexJarValue)
+ return filepath.Join("/apex", apex, "javalib", jar+".jar")
+}
+
func contains(l []string, s string) bool {
for _, e := range l {
if e == s {
diff --git a/dexpreopt/dexpreopt_test.go b/dexpreopt/dexpreopt_test.go
index 6f8120e..254be0a 100644
--- a/dexpreopt/dexpreopt_test.go
+++ b/dexpreopt/dexpreopt_test.go
@@ -49,7 +49,8 @@
LibraryPaths: nil,
Archs: []android.ArchType{android.Arm},
DexPreoptImages: android.Paths{android.PathForTesting("system/framework/arm/boot.art")},
- DexPreoptImagesDeps: []android.Paths{android.Paths{}},
+ DexPreoptImagesDeps: []android.OutputPaths{android.OutputPaths{}},
+ DexPreoptImageLocations: []string{},
PreoptBootClassPathDexFiles: nil,
PreoptBootClassPathDexLocations: nil,
PreoptExtractedApk: false,
diff --git a/java/app_test.go b/java/app_test.go
index 7e461bc..fc8cf8e 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -399,18 +399,21 @@
android_library {
name: "lib",
+ sdk_version: "current",
resource_dirs: ["lib/res"],
static_libs: ["lib2"],
}
android_library {
name: "lib2",
+ sdk_version: "current",
resource_dirs: ["lib2/res"],
}
// This library has the same resources as lib (should not lead to dupe RROs)
android_library {
name: "lib3",
+ sdk_version: "current",
resource_dirs: ["lib/res"]
}
`
diff --git a/java/dex.go b/java/dex.go
index 5b25b21..cd6d90d 100644
--- a/java/dex.go
+++ b/java/dex.go
@@ -115,7 +115,6 @@
r8Flags = append(r8Flags, proguardRaiseDeps.FormJavaClassPath("-libraryjars"))
r8Flags = append(r8Flags, flags.bootClasspath.FormJavaClassPath("-libraryjars"))
r8Flags = append(r8Flags, flags.classpath.FormJavaClassPath("-libraryjars"))
- r8Flags = append(r8Flags, "-forceprocessing")
r8Deps = append(r8Deps, proguardRaiseDeps...)
r8Deps = append(r8Deps, flags.bootClasspath...)
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 2b1c994..479dec6 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -124,7 +124,7 @@
}
var images android.Paths
- var imagesDeps []android.Paths
+ var imagesDeps []android.OutputPaths
for _, arch := range archs {
images = append(images, bootImage.images[arch])
imagesDeps = append(imagesDeps, bootImage.imagesDeps[arch])
@@ -169,15 +169,16 @@
UsesLibraries: d.usesLibs,
LibraryPaths: d.libraryPaths,
- Archs: archs,
- DexPreoptImages: images,
- DexPreoptImagesDeps: imagesDeps,
+ Archs: archs,
+ DexPreoptImages: images,
+ DexPreoptImagesDeps: imagesDeps,
+ DexPreoptImageLocations: bootImage.imageLocations,
// We use the dex paths and dex locations of the default boot image, as it
// contains the full dexpreopt boot classpath. Other images may just contain a subset of
// the dexpreopt boot classpath.
- PreoptBootClassPathDexFiles: defaultBootImage.dexPaths.Paths(),
- PreoptBootClassPathDexLocations: defaultBootImage.dexLocations,
+ PreoptBootClassPathDexFiles: defaultBootImage.dexPathsDeps.Paths(),
+ PreoptBootClassPathDexLocations: defaultBootImage.dexLocationsDeps,
PreoptExtractedApk: false,
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index a29665e..280ce8c 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -22,7 +22,6 @@
"android/soong/android"
"android/soong/dexpreopt"
- "github.com/google/blueprint/pathtools"
"github.com/google/blueprint/proptools"
)
@@ -50,38 +49,77 @@
// will then reconstruct the real path, so the rules must have a dependency on the real path.
type bootImageConfig struct {
- name string
- stem string
- modules []string
- dexLocations []string
- dexPaths android.WritablePaths
- dir android.OutputPath
- symbolsDir android.OutputPath
- targets []android.Target
- images map[android.ArchType]android.OutputPath
- imagesDeps map[android.ArchType]android.Paths
- zip android.WritablePath
+ // Whether this image is an extension.
+ extension bool
+
+ // Image name (used in directory names and ninja rule names).
+ name string
+
+ // Basename of the image: the resulting filenames are <stem>[-<jar>].{art,oat,vdex}.
+ stem string
+
+ // Output directory for the image files.
+ dir android.OutputPath
+
+ // Output directory for the image files with debug symbols.
+ symbolsDir android.OutputPath
+
+ // Subdirectory where the image files are installed.
+ installSubdir string
+
+ // Targets for which the image is generated.
+ targets []android.Target
+
+ // The names of jars that constitute this image.
+ modules []string
+
+ // The "locations" of jars.
+ dexLocations []string // for this image
+ dexLocationsDeps []string // for the dependency images and in this image
+
+ // File paths to jars.
+ dexPaths android.WritablePaths // for this image
+ dexPathsDeps android.WritablePaths // for the dependency images and in this image
+
+ // The "locations" of the dependency images and in this image.
+ imageLocations []string
+
+ // Paths to image files (grouped by target).
+ images map[android.ArchType]android.OutputPath // first image file
+ imagesDeps map[android.ArchType]android.OutputPaths // all files
+
+ // File path to a zip archive with all image files (or nil, if not needed).
+ zip android.WritablePath
}
-func (image bootImageConfig) moduleFiles(ctx android.PathContext, dir android.OutputPath, exts ...string) []android.OutputPath {
- ret := make([]android.OutputPath, 0, len(image.modules)*len(exts))
-
- // dex preopt on the bootclasspath produces multiple files. The first dex file
- // is converted into to 'name'.art (to match the legacy assumption that 'name'.art
+func (image bootImageConfig) moduleName(idx int) string {
+ // Dexpreopt on the boot class path produces multiple files. The first dex file
+ // is converted into 'name'.art (to match the legacy assumption that 'name'.art
// exists), and the rest are converted to 'name'-<jar>.art.
- // In addition, each .art file has an associated .oat and .vdex file, and an
- // unstripped .oat file
- for i, m := range image.modules {
- name := image.stem
- if i != 0 {
- name += "-" + stemOf(m)
- }
+ m := image.modules[idx]
+ name := image.stem
+ if idx != 0 || image.extension {
+ name += "-" + stemOf(m)
+ }
+ return name
+}
+func (image bootImageConfig) firstModuleNameOrStem() string {
+ if len(image.modules) > 0 {
+ return image.moduleName(0)
+ } else {
+ return image.stem
+ }
+}
+
+func (image bootImageConfig) moduleFiles(ctx android.PathContext, dir android.OutputPath, exts ...string) android.OutputPaths {
+ ret := make(android.OutputPaths, 0, len(image.modules)*len(exts))
+ for i := range image.modules {
+ name := image.moduleName(i)
for _, ext := range exts {
ret = append(ret, dir.Join(ctx, name+ext))
}
}
-
return ret
}
@@ -140,12 +178,6 @@
return false
}
-func skipDexpreoptArtBootJars(ctx android.BuilderContext) bool {
- // with EMMA_INSTRUMENT_FRAMEWORK=true ART boot class path libraries have dependencies on framework,
- // therefore dexpreopt ART libraries cannot be dexpreopted in isolation => no ART boot image
- return ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK")
-}
-
type dexpreoptBootJars struct {
defaultBootImage *bootImage
otherImages []*bootImage
@@ -154,8 +186,8 @@
}
// Accessor function for the apex package. Returns nil if dexpreopt is disabled.
-func DexpreoptedArtApexJars(ctx android.BuilderContext) map[android.ArchType]android.Paths {
- if skipDexpreoptBootJars(ctx) || skipDexpreoptArtBootJars(ctx) {
+func DexpreoptedArtApexJars(ctx android.BuilderContext) map[android.ArchType]android.OutputPaths {
+ if skipDexpreoptBootJars(ctx) {
return nil
}
return artBootImageConfig(ctx).imagesDeps
@@ -184,10 +216,8 @@
// Always create the default boot image first, to get a unique profile rule for all images.
d.defaultBootImage = buildBootImage(ctx, defaultBootImageConfig(ctx))
- if !skipDexpreoptArtBootJars(ctx) {
- // Create boot image for the ART apex (build artifacts are accessed via the global boot image config).
- buildBootImage(ctx, artBootImageConfig(ctx))
- }
+ // Create boot image for the ART apex (build artifacts are accessed via the global boot image config).
+ d.otherImages = append(d.otherImages, buildBootImage(ctx, artBootImageConfig(ctx)))
if global.GenerateApexImage {
// Create boot images for the JIT-zygote experiment.
d.otherImages = append(d.otherImages, buildBootImage(ctx, apexBootImageConfig(ctx)))
@@ -201,7 +231,6 @@
image := newBootImage(ctx, config)
bootDexJars := make(android.Paths, len(image.modules))
-
ctx.VisitAllModules(func(module android.Module) {
// Collect dex jar paths for the modules listed above.
if j, ok := module.(interface{ DexJar() android.Path }); ok {
@@ -265,11 +294,12 @@
global := dexpreoptGlobalConfig(ctx)
- symbolsDir := image.symbolsDir.Join(ctx, "system/framework", arch.String())
+ symbolsDir := image.symbolsDir.Join(ctx, image.installSubdir, arch.String())
symbolsFile := symbolsDir.Join(ctx, image.stem+".oat")
- outputDir := image.dir.Join(ctx, "system/framework", arch.String())
- outputPath := image.images[arch]
- oatLocation := pathtools.ReplaceExtension(dexpreopt.PathToLocation(outputPath, arch), "oat")
+ outputDir := image.dir.Join(ctx, image.installSubdir, arch.String())
+ outputPath := outputDir.Join(ctx, image.stem+".oat")
+ oatLocation := dexpreopt.PathToLocation(outputPath, arch)
+ imagePath := outputPath.ReplaceExtension(ctx, "art")
rule := android.NewRuleBuilder()
rule.MissingDeps(missingDeps)
@@ -312,18 +342,27 @@
cmd.FlagWithInput("--dirty-image-objects=", global.DirtyImageObjects.Path())
}
+ if image.extension {
+ artImage := artBootImageConfig(ctx).images[arch]
+ cmd.
+ Flag("--runtime-arg").FlagWithInputList("-Xbootclasspath:", image.dexPathsDeps.Paths(), ":").
+ Flag("--runtime-arg").FlagWithList("-Xbootclasspath-locations:", image.dexLocationsDeps, ":").
+ FlagWithArg("--boot-image=", dexpreopt.PathToLocation(artImage, arch)).Implicit(artImage)
+ } else {
+ cmd.FlagWithArg("--base=", ctx.Config().LibartImgDeviceBaseAddress())
+ }
+
cmd.
FlagForEachInput("--dex-file=", image.dexPaths.Paths()).
FlagForEachArg("--dex-location=", image.dexLocations).
Flag("--generate-debug-info").
Flag("--generate-build-id").
Flag("--image-format=lz4hc").
- FlagWithOutput("--oat-symbols=", symbolsFile).
+ FlagWithArg("--oat-symbols=", symbolsFile.String()).
Flag("--strip").
- FlagWithOutput("--oat-file=", outputPath.ReplaceExtension(ctx, "oat")).
+ FlagWithArg("--oat-file=", outputPath.String()).
FlagWithArg("--oat-location=", oatLocation).
- FlagWithOutput("--image=", outputPath).
- FlagWithArg("--base=", ctx.Config().LibartImgDeviceBaseAddress()).
+ FlagWithArg("--image=", imagePath.String()).
FlagWithArg("--instruction-set=", arch.String()).
FlagWithArg("--instruction-set-variant=", global.CpuVariant[arch]).
FlagWithArg("--instruction-set-features=", global.InstructionSetFeatures[arch]).
@@ -341,8 +380,8 @@
cmd.Textf(`|| ( echo %s ; false )`, proptools.ShellEscape(failureMessage))
- installDir := filepath.Join("/system/framework", arch.String())
- vdexInstallDir := filepath.Join("/system/framework")
+ installDir := filepath.Join("/", image.installSubdir, arch.String())
+ vdexInstallDir := filepath.Join("/", image.installSubdir)
var vdexInstalls android.RuleBuilderInstalls
var unstrippedInstalls android.RuleBuilderInstalls
@@ -425,8 +464,8 @@
Text(`ANDROID_LOG_TAGS="*:e"`).
Tool(tools.Profman).
FlagWithInput("--create-profile-from=", bootImageProfile).
- FlagForEachInput("--apk=", image.dexPaths.Paths()).
- FlagForEachArg("--dex-location=", image.dexLocations).
+ FlagForEachInput("--apk=", image.dexPathsDeps.Paths()).
+ FlagForEachArg("--dex-location=", image.dexLocationsDeps).
FlagWithOutput("--reference-profile-file=", profile)
rule.Install(profile, "/system/etc/boot-image.prof")
@@ -477,8 +516,8 @@
Tool(tools.Profman).
Flag("--generate-boot-profile").
FlagWithInput("--create-profile-from=", bootFrameworkProfile).
- FlagForEachInput("--apk=", image.dexPaths.Paths()).
- FlagForEachArg("--dex-location=", image.dexLocations).
+ FlagForEachInput("--apk=", image.dexPathsDeps.Paths()).
+ FlagForEachArg("--dex-location=", image.dexLocationsDeps).
FlagWithOutput("--reference-profile-file=", profile)
rule.Install(profile, "/system/etc/boot-image.bprof")
@@ -506,8 +545,8 @@
rule.Command().
// TODO: for now, use the debug version for better error reporting
BuiltTool(ctx, "oatdumpd").
- FlagWithInputList("--runtime-arg -Xbootclasspath:", image.dexPaths.Paths(), ":").
- FlagWithList("--runtime-arg -Xbootclasspath-locations:", image.dexLocations, ":").
+ FlagWithInputList("--runtime-arg -Xbootclasspath:", image.dexPathsDeps.Paths(), ":").
+ FlagWithList("--runtime-arg -Xbootclasspath-locations:", image.dexLocationsDeps, ":").
FlagWithArg("--image=", dexpreopt.PathToLocation(image.images[arch], arch)).Implicit(image.images[arch]).
FlagWithOutput("--output=", output).
FlagWithArg("--instruction-set=", arch.String())
@@ -556,9 +595,9 @@
image := d.defaultBootImage
if image != nil {
ctx.Strict("DEXPREOPT_IMAGE_PROFILE_BUILT_INSTALLED", image.profileInstalls.String())
- ctx.Strict("DEXPREOPT_BOOTCLASSPATH_DEX_FILES", strings.Join(image.dexPaths.Strings(), " "))
- ctx.Strict("DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS", strings.Join(image.dexLocations, " "))
- ctx.Strict("DEXPREOPT_IMAGE_ZIP_"+image.name, image.zip.String())
+ ctx.Strict("DEXPREOPT_BOOTCLASSPATH_DEX_FILES", strings.Join(image.dexPathsDeps.Strings(), " "))
+ ctx.Strict("DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS", strings.Join(image.dexLocationsDeps, " "))
+ ctx.Strict("DEXPREOPT_IMAGE_LOCATIONS", strings.Join(image.imageLocations, ":"))
var imageNames []string
for _, current := range append(d.otherImages, image) {
@@ -579,6 +618,8 @@
if current.zip != nil {
}
}
+
+ ctx.Strict("DEXPREOPT_IMAGE_ZIP_"+current.name, current.zip.String())
}
ctx.Strict("DEXPREOPT_IMAGE_NAMES", strings.Join(imageNames, " "))
}
diff --git a/java/dexpreopt_bootjars_test.go b/java/dexpreopt_bootjars_test.go
index 29a5abe..87d5e30 100644
--- a/java/dexpreopt_bootjars_test.go
+++ b/java/dexpreopt_bootjars_test.go
@@ -48,7 +48,7 @@
pathCtx := android.PathContextForTesting(config, nil)
dexpreoptConfig := dexpreopt.GlobalConfigForTests(pathCtx)
- dexpreoptConfig.ArtApexJars = []string{"foo", "bar", "baz"}
+ dexpreoptConfig.BootJars = []string{"foo", "bar", "baz"}
setDexpreoptTestGlobalConfig(config, dexpreoptConfig)
ctx := testContext(bp, nil)
@@ -59,9 +59,10 @@
dexpreoptBootJars := ctx.SingletonForTests("dex_bootjars")
- bootArt := dexpreoptBootJars.Output("boot.art")
+ bootArt := dexpreoptBootJars.Output("boot-foo.art")
expectedInputs := []string{
+ "dex_artjars/apex/com.android.art/javalib/arm64/boot.art",
"dex_bootjars_input/foo.jar",
"dex_bootjars_input/bar.jar",
"dex_bootjars_input/baz.jar",
@@ -82,19 +83,19 @@
expectedOutputs := []string{
"dex_bootjars/system/framework/arm64/boot.invocation",
- "dex_bootjars/system/framework/arm64/boot.art",
+ "dex_bootjars/system/framework/arm64/boot-foo.art",
"dex_bootjars/system/framework/arm64/boot-bar.art",
"dex_bootjars/system/framework/arm64/boot-baz.art",
- "dex_bootjars/system/framework/arm64/boot.oat",
+ "dex_bootjars/system/framework/arm64/boot-foo.oat",
"dex_bootjars/system/framework/arm64/boot-bar.oat",
"dex_bootjars/system/framework/arm64/boot-baz.oat",
- "dex_bootjars/system/framework/arm64/boot.vdex",
+ "dex_bootjars/system/framework/arm64/boot-foo.vdex",
"dex_bootjars/system/framework/arm64/boot-bar.vdex",
"dex_bootjars/system/framework/arm64/boot-baz.vdex",
- "dex_bootjars_unstripped/system/framework/arm64/boot.oat",
+ "dex_bootjars_unstripped/system/framework/arm64/boot-foo.oat",
"dex_bootjars_unstripped/system/framework/arm64/boot-bar.oat",
"dex_bootjars_unstripped/system/framework/arm64/boot-baz.oat",
}
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index 4747c64..fd1cfd4 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -78,9 +78,8 @@
filepath.Join("/system/framework", m+".jar"))
}
for _, m := range global.UpdatableSystemServerJars {
- apex, jar := dexpreopt.SplitApexJarPair(m)
systemServerClasspathLocations = append(systemServerClasspathLocations,
- filepath.Join("/apex", apex, "javalib", jar+".jar"))
+ dexpreopt.GetJarLocationFromApexJarPair(m))
}
return systemServerClasspathLocations
})
@@ -111,114 +110,157 @@
return moduleName
}
-// Construct a variant of the global config for dexpreopted bootclasspath jars. The variants differ
-// in the list of input jars (libcore, framework, or both), in the naming scheme for the dexpreopt
-// files (ART recognizes "apex" names as special), and whether to include a zip archive.
-//
-// 'name' is a string unique for each profile (used in directory names and ninja rule names)
-// 'stem' is the basename of the image: the resulting filenames are <stem>[-<jar>].{art,oat,vdex}.
-func getBootImageConfig(ctx android.PathContext, key android.OnceKey, name string, stem string,
- needZip bool, artApexJarsOnly bool) bootImageConfig {
+func getJarsFromApexJarPairs(apexJarPairs []string) []string {
+ modules := make([]string, len(apexJarPairs))
+ for i, p := range apexJarPairs {
+ _, jar := dexpreopt.SplitApexJarPair(p)
+ modules[i] = jar
+ }
+ return modules
+}
- return ctx.Config().Once(key, func() interface{} {
+var (
+ bootImageConfigKey = android.NewOnceKey("bootImageConfig")
+ artBootImageName = "art"
+ frameworkBootImageName = "boot"
+ apexBootImageName = "apex"
+)
+
+// Construct the global boot image configs.
+func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
+ return ctx.Config().Once(bootImageConfigKey, func() interface{} {
+
global := dexpreoptGlobalConfig(ctx)
+ targets := dexpreoptTargets(ctx)
+ deviceDir := android.PathForOutput(ctx, ctx.Config().DeviceName())
artModules := global.ArtApexJars
- imageModules := artModules
+ // In coverage builds ART boot class path jars are instrumented and have additional dependencies.
+ if ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") {
+ artModules = append(artModules, "jacocoagent")
+ }
+ frameworkModules := android.RemoveListFromList(global.BootJars,
+ concat(artModules, getJarsFromApexJarPairs(global.UpdatableBootJars)))
- var bootLocations []string
+ artSubdir := "apex/com.android.art/javalib"
+ frameworkSubdir := "system/framework"
+ var artLocations, frameworkLocations []string
for _, m := range artModules {
- bootLocations = append(bootLocations,
- filepath.Join("/apex/com.android.art/javalib", stemOf(m)+".jar"))
+ artLocations = append(artLocations, filepath.Join("/"+artSubdir, stemOf(m)+".jar"))
+ }
+ for _, m := range frameworkModules {
+ frameworkLocations = append(frameworkLocations, filepath.Join("/"+frameworkSubdir, stemOf(m)+".jar"))
}
- if !artApexJarsOnly {
- nonFrameworkModules := concat(artModules, global.ProductUpdatableBootModules)
- frameworkModules := android.RemoveListFromList(global.BootJars, nonFrameworkModules)
- imageModules = concat(imageModules, frameworkModules)
+ // ART config for the primary boot image in the ART apex.
+ // It includes the Core Libraries.
+ artCfg := bootImageConfig{
+ extension: false,
+ name: artBootImageName,
+ stem: "boot",
+ installSubdir: artSubdir,
+ modules: artModules,
+ dexLocations: artLocations,
+ dexLocationsDeps: artLocations,
+ }
- for _, m := range frameworkModules {
- bootLocations = append(bootLocations,
- filepath.Join("/system/framework", stemOf(m)+".jar"))
+ // Framework config for the boot image extension.
+ // It includes framework libraries and depends on the ART config.
+ frameworkCfg := bootImageConfig{
+ extension: true,
+ name: frameworkBootImageName,
+ stem: "boot",
+ installSubdir: frameworkSubdir,
+ modules: frameworkModules,
+ dexLocations: frameworkLocations,
+ dexLocationsDeps: append(artLocations, frameworkLocations...),
+ }
+
+ // Apex config for the boot image used in the JIT-zygote experiment.
+ // It includes both the Core libraries and framework.
+ apexCfg := bootImageConfig{
+ extension: false,
+ name: apexBootImageName,
+ stem: "apex",
+ installSubdir: frameworkSubdir,
+ modules: concat(artModules, frameworkModules),
+ dexLocations: concat(artLocations, frameworkLocations),
+ dexLocationsDeps: concat(artLocations, frameworkLocations),
+ }
+
+ configs := map[string]*bootImageConfig{
+ artBootImageName: &artCfg,
+ frameworkBootImageName: &frameworkCfg,
+ apexBootImageName: &apexCfg,
+ }
+
+ // common to all configs
+ for _, c := range configs {
+ c.targets = targets
+
+ c.dir = deviceDir.Join(ctx, "dex_"+c.name+"jars")
+ c.symbolsDir = deviceDir.Join(ctx, "dex_"+c.name+"jars_unstripped")
+
+ // expands to <stem>.art for primary image and <stem>-<1st module>.art for extension
+ imageName := c.firstModuleNameOrStem() + ".art"
+
+ c.imageLocations = []string{c.dir.Join(ctx, c.installSubdir, imageName).String()}
+
+ // The path to bootclasspath dex files needs to be known at module
+ // GenerateAndroidBuildAction time, before the bootclasspath modules have been compiled.
+ // Set up known paths for them, the singleton rules will copy them there.
+ // TODO(b/143682396): use module dependencies instead
+ inputDir := deviceDir.Join(ctx, "dex_"+c.name+"jars_input")
+ for _, m := range c.modules {
+ c.dexPaths = append(c.dexPaths, inputDir.Join(ctx, stemOf(m)+".jar"))
}
- }
+ c.dexPathsDeps = c.dexPaths
- // The path to bootclasspath dex files needs to be known at module GenerateAndroidBuildAction time, before
- // the bootclasspath modules have been compiled. Set up known paths for them, the singleton rules will copy
- // them there.
- // TODO(b/143682396): use module dependencies instead
- var bootDexPaths android.WritablePaths
- for _, m := range imageModules {
- bootDexPaths = append(bootDexPaths,
- android.PathForOutput(ctx, ctx.Config().DeviceName(), "dex_"+name+"jars_input", m+".jar"))
- }
+ c.images = make(map[android.ArchType]android.OutputPath)
+ c.imagesDeps = make(map[android.ArchType]android.OutputPaths)
- dir := android.PathForOutput(ctx, ctx.Config().DeviceName(), "dex_"+name+"jars")
- symbolsDir := android.PathForOutput(ctx, ctx.Config().DeviceName(), "dex_"+name+"jars_unstripped")
-
- var zip android.WritablePath
- if needZip {
- zip = dir.Join(ctx, stem+".zip")
- }
-
- targets := dexpreoptTargets(ctx)
-
- imageConfig := bootImageConfig{
- name: name,
- stem: stem,
- modules: imageModules,
- dexLocations: bootLocations,
- dexPaths: bootDexPaths,
- dir: dir,
- symbolsDir: symbolsDir,
- targets: targets,
- images: make(map[android.ArchType]android.OutputPath),
- imagesDeps: make(map[android.ArchType]android.Paths),
- zip: zip,
- }
-
- for _, target := range targets {
- imageDir := dir.Join(ctx, "system/framework", target.Arch.ArchType.String())
- imageConfig.images[target.Arch.ArchType] = imageDir.Join(ctx, stem+".art")
-
- imagesDeps := make([]android.Path, 0, len(imageConfig.modules)*3)
- for _, dep := range imageConfig.moduleFiles(ctx, imageDir, ".art", ".oat", ".vdex") {
- imagesDeps = append(imagesDeps, dep)
+ for _, target := range targets {
+ arch := target.Arch.ArchType
+ imageDir := c.dir.Join(ctx, c.installSubdir, arch.String())
+ c.images[arch] = imageDir.Join(ctx, imageName)
+ c.imagesDeps[arch] = c.moduleFiles(ctx, imageDir, ".art", ".oat", ".vdex")
}
- imageConfig.imagesDeps[target.Arch.ArchType] = imagesDeps
+
+ c.zip = c.dir.Join(ctx, c.name+".zip")
}
- return imageConfig
- }).(bootImageConfig)
+ // specific to the framework config
+ frameworkCfg.dexPathsDeps = append(artCfg.dexPathsDeps, frameworkCfg.dexPathsDeps...)
+ frameworkCfg.imageLocations = append(artCfg.imageLocations, frameworkCfg.imageLocations...)
+
+ return configs
+ }).(map[string]*bootImageConfig)
}
-// Default config is the one that goes in the system image. It includes both libcore and framework.
-var defaultBootImageConfigKey = android.NewOnceKey("defaultBootImageConfig")
-
-func defaultBootImageConfig(ctx android.PathContext) bootImageConfig {
- return getBootImageConfig(ctx, defaultBootImageConfigKey, "boot", "boot", true, false)
-}
-
-// Apex config is used for the JIT-zygote experiment. It includes both libcore and framework, but AOT-compiles only libcore.
-var apexBootImageConfigKey = android.NewOnceKey("apexBootImageConfig")
-
-func apexBootImageConfig(ctx android.PathContext) bootImageConfig {
- return getBootImageConfig(ctx, apexBootImageConfigKey, "apex", "apex", false, false)
-}
-
-// ART config is the one used for the ART apex. It includes only libcore.
-var artBootImageConfigKey = android.NewOnceKey("artBootImageConfig")
-
func artBootImageConfig(ctx android.PathContext) bootImageConfig {
- return getBootImageConfig(ctx, artBootImageConfigKey, "art", "boot", false, true)
+ return *genBootImageConfigs(ctx)[artBootImageName]
+}
+
+func defaultBootImageConfig(ctx android.PathContext) bootImageConfig {
+ return *genBootImageConfigs(ctx)[frameworkBootImageName]
+}
+
+func apexBootImageConfig(ctx android.PathContext) bootImageConfig {
+ return *genBootImageConfigs(ctx)[apexBootImageName]
}
func defaultBootclasspath(ctx android.PathContext) []string {
return ctx.Config().OnceStringSlice(defaultBootclasspathKey, func() []string {
global := dexpreoptGlobalConfig(ctx)
image := defaultBootImageConfig(ctx)
- bootclasspath := append(copyOf(image.dexLocations), global.ProductUpdatableBootLocations...)
+
+ updatableBootclasspath := make([]string, len(global.UpdatableBootJars))
+ for i, p := range global.UpdatableBootJars {
+ updatableBootclasspath[i] = dexpreopt.GetJarLocationFromApexJarPair(p)
+ }
+
+ bootclasspath := append(copyOf(image.dexLocationsDeps), updatableBootclasspath...)
return bootclasspath
})
}
@@ -233,7 +275,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_DEX2OAT_BOOTCLASSPATH", strings.Join(defaultBootImageConfig(ctx).dexLocationsDeps, ":"))
ctx.Strict("PRODUCT_SYSTEM_SERVER_CLASSPATH", strings.Join(systemServerClasspath(ctx), ":"))
ctx.Strict("DEXPREOPT_BOOT_JARS_MODULES", strings.Join(defaultBootImageConfig(ctx).modules, ":"))
diff --git a/java/droiddoc.go b/java/droiddoc.go
index 96c8416..16e6921 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -1979,28 +1979,6 @@
snapshotRelativeDir := filepath.Join("java", d.Name()+"_stubs_sources")
builder.UnzipToSnapshot(stubsSrcJar, snapshotRelativeDir)
- d.generatePrebuiltStubsSources(builder, snapshotRelativeDir, true)
-
- // This module is for the case when the source tree for the unversioned module
- // doesn't exist (i.e. building in an unbundled tree). "prefer:" is set to false
- // so that this module does not eclipse the unversioned module if it exists.
- d.generatePrebuiltStubsSources(builder, snapshotRelativeDir, false)
-}
-
-func (d *Droidstubs) generatePrebuiltStubsSources(builder android.SnapshotBuilder, snapshotRelativeDir string, versioned bool) {
- bp := builder.AndroidBpFile()
- name := d.Name()
- bp.Printfln("prebuilt_stubs_sources {")
- bp.Indent()
- if versioned {
- bp.Printfln("name: %q,", builder.VersionedSdkMemberName(name))
- bp.Printfln("sdk_member_name: %q,", name)
- } else {
- bp.Printfln("name: %q,", name)
- bp.Printfln("prefer: false,")
- }
- bp.Printfln("srcs: [%q],", snapshotRelativeDir)
- bp.Dedent()
- bp.Printfln("}")
- bp.Printfln("")
+ pbm := builder.AddPrebuiltModule(sdkModuleContext.OtherModuleName(d), "prebuilt_stubs_sources")
+ pbm.AddProperty("srcs", []string{snapshotRelativeDir})
}
diff --git a/java/java.go b/java/java.go
index 1c52575..9c0fcba 100644
--- a/java/java.go
+++ b/java/java.go
@@ -689,7 +689,12 @@
javaPlatform
)
-func getLinkType(m *Module, name string) (ret linkType, stubs bool) {
+type linkTypeContext interface {
+ android.Module
+ getLinkType(name string) (ret linkType, stubs bool)
+}
+
+func (m *Module) getLinkType(name string) (ret linkType, stubs bool) {
ver := m.sdkVersion()
switch {
case name == "core.current.stubs" || name == "core.platform.api.stubs" ||
@@ -720,16 +725,16 @@
}
}
-func checkLinkType(ctx android.ModuleContext, from *Module, to *Library, tag dependencyTag) {
+func checkLinkType(ctx android.ModuleContext, from *Module, to linkTypeContext, tag dependencyTag) {
if ctx.Host() {
return
}
- myLinkType, stubs := getLinkType(from, ctx.ModuleName())
+ myLinkType, stubs := from.getLinkType(ctx.ModuleName())
if stubs {
return
}
- otherLinkType, _ := getLinkType(&to.Module, ctx.OtherModuleName(to))
+ otherLinkType, _ := to.getLinkType(ctx.OtherModuleName(to))
commonMessage := "Adjust sdk_version: property of the source or target module so that target module is built with the same or smaller API set than the source."
switch myLinkType {
@@ -786,11 +791,14 @@
// Handled by AndroidApp.collectAppDeps
return
}
-
- if to, ok := module.(*Library); ok {
- switch tag {
- case bootClasspathTag, libTag, staticLibTag:
- checkLinkType(ctx, j, to, tag.(dependencyTag))
+ switch module.(type) {
+ case *Library:
+ case *AndroidLibrary:
+ if to, ok := module.(linkTypeContext); ok {
+ switch tag {
+ case bootClasspathTag, libTag, staticLibTag:
+ checkLinkType(ctx, j, to, tag.(dependencyTag))
+ }
}
}
switch dep := module.(type) {
@@ -1729,30 +1737,8 @@
}
}
- j.generateJavaImport(builder, snapshotRelativeJavaLibPath, true)
-
- // This module is for the case when the source tree for the unversioned module
- // doesn't exist (i.e. building in an unbundled tree). "prefer:" is set to false
- // so that this module does not eclipse the unversioned module if it exists.
- j.generateJavaImport(builder, snapshotRelativeJavaLibPath, false)
-}
-
-func (j *Library) generateJavaImport(builder android.SnapshotBuilder, snapshotRelativeJavaLibPath string, versioned bool) {
- bp := builder.AndroidBpFile()
- name := j.Name()
- bp.Printfln("java_import {")
- bp.Indent()
- if versioned {
- bp.Printfln("name: %q,", builder.VersionedSdkMemberName(name))
- bp.Printfln("sdk_member_name: %q,", name)
- } else {
- bp.Printfln("name: %q,", name)
- bp.Printfln("prefer: false,")
- }
- bp.Printfln("jars: [%q],", snapshotRelativeJavaLibPath)
- bp.Dedent()
- bp.Printfln("}")
- bp.Printfln("")
+ module := builder.AddPrebuiltModule(sdkModuleContext.OtherModuleName(j), "java_import")
+ module.AddProperty("jars", []string{snapshotRelativeJavaLibPath})
}
// java_library builds and links sources into a `.jar` file for the device, and possibly for the host as well.
diff --git a/python/tests/par_test.py b/python/tests/par_test.py
index 1fafe0f..56a5063 100644
--- a/python/tests/par_test.py
+++ b/python/tests/par_test.py
@@ -44,6 +44,13 @@
assert_equal("sys.path[1]", sys.path[1], os.path.join(archive, "internal"))
assert_equal("sys.path[2]", sys.path[2], os.path.join(archive, "internal", "stdlib"))
+if os.getenv('ARGTEST', False):
+ assert_equal("len(sys.argv)", len(sys.argv), 3)
+ assert_equal("sys.argv[1]", sys.argv[1], "--arg1")
+ assert_equal("sys.argv[2]", sys.argv[2], "arg2")
+else:
+ assert_equal("len(sys.argv)", len(sys.argv), 1)
+
if failed:
sys.exit(1)
diff --git a/python/tests/runtest.sh b/python/tests/runtest.sh
index 1ecdebc..21187ed 100755
--- a/python/tests/runtest.sh
+++ b/python/tests/runtest.sh
@@ -36,8 +36,12 @@
PYTHONHOME=/usr $ANDROID_HOST_OUT/nativetest64/par_test/par_test
PYTHONPATH=/usr $ANDROID_HOST_OUT/nativetest64/par_test/par_test
+ARGTEST=true $ANDROID_HOST_OUT/nativetest64/par_test/par_test --arg1 arg2
+
PYTHONHOME= PYTHONPATH= $ANDROID_HOST_OUT/nativetest64/par_test3/par_test3
PYTHONHOME=/usr $ANDROID_HOST_OUT/nativetest64/par_test3/par_test3
PYTHONPATH=/usr $ANDROID_HOST_OUT/nativetest64/par_test3/par_test3
+ARGTEST=true $ANDROID_HOST_OUT/nativetest64/par_test3/par_test3 --arg1 arg2
+
echo "Passed!"
diff --git a/rust/androidmk.go b/rust/androidmk.go
index edd5c5f..2636d97 100644
--- a/rust/androidmk.go
+++ b/rust/androidmk.go
@@ -90,11 +90,7 @@
func (test *testDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
test.binaryDecorator.AndroidMk(ctx, ret)
ret.Class = "NATIVE_TESTS"
- stem := String(test.baseCompiler.Properties.Stem)
- if stem != "" && !strings.HasSuffix(ctx.Name(), "_"+stem) {
- // Avoid repeated suffix in the module name.
- ret.SubName = "_" + stem
- }
+ ret.SubName = test.getMutatedModuleSubName(ctx.Name())
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) {
if len(test.Properties.Test_suites) > 0 {
fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=",
diff --git a/rust/test.go b/rust/test.go
index cb64e8f..b391103 100644
--- a/rust/test.go
+++ b/rust/test.go
@@ -69,15 +69,28 @@
return append(test.binaryDecorator.compilerProps(), &test.Properties)
}
+func (test *testDecorator) getMutatedModuleSubName(moduleName string) string {
+ stem := String(test.baseCompiler.Properties.Stem)
+ if stem != "" && !strings.HasSuffix(moduleName, "_"+stem) {
+ // Avoid repeated suffix in the module name.
+ return "_" + stem
+ }
+ return ""
+}
+
func (test *testDecorator) install(ctx ModuleContext, file android.Path) {
name := ctx.ModuleName() // default executable name
- if stem := String(test.baseCompiler.Properties.Stem); stem != "" {
- name = stem
+ if ctx.Device() { // on device, use mutated module name
+ name = name + test.getMutatedModuleSubName(name)
+ } else { // on host, use stem name in relative_install_path
+ if stem := String(test.baseCompiler.Properties.Stem); stem != "" {
+ name = stem
+ }
+ if path := test.baseCompiler.relativeInstallPath(); path != "" {
+ name = path + "/" + name
+ }
}
- if path := test.baseCompiler.relativeInstallPath(); path != "" {
- name = path + "/" + name
- }
- test.testConfig = tradefed.AutoGenRustHostTestConfig(ctx, name,
+ test.testConfig = tradefed.AutoGenRustTestConfig(ctx, name,
test.Properties.Test_config,
test.Properties.Test_config_template,
test.Properties.Test_suites,
diff --git a/sdk/bp.go b/sdk/bp.go
new file mode 100644
index 0000000..19fb70d
--- /dev/null
+++ b/sdk/bp.go
@@ -0,0 +1,141 @@
+// Copyright (C) 2019 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.
+
+package sdk
+
+import (
+ "fmt"
+
+ "android/soong/android"
+)
+
+type bpPropertySet struct {
+ properties map[string]interface{}
+ order []string
+}
+
+var _ android.BpPropertySet = (*bpPropertySet)(nil)
+
+func (s *bpPropertySet) init() {
+ s.properties = make(map[string]interface{})
+}
+
+func (s *bpPropertySet) AddProperty(name string, value interface{}) {
+ if s.properties[name] != nil {
+ panic("Property %q already exists in property set")
+ }
+
+ s.properties[name] = value
+ s.order = append(s.order, name)
+}
+
+func (s *bpPropertySet) AddPropertySet(name string) android.BpPropertySet {
+ set := &bpPropertySet{}
+ set.init()
+ s.AddProperty(name, set)
+ return set
+}
+
+func (s *bpPropertySet) getValue(name string) interface{} {
+ return s.properties[name]
+}
+
+func (s *bpPropertySet) copy() bpPropertySet {
+ propertiesCopy := make(map[string]interface{})
+ for p, v := range s.properties {
+ propertiesCopy[p] = v
+ }
+
+ return bpPropertySet{
+ properties: propertiesCopy,
+ order: append([]string(nil), s.order...),
+ }
+}
+
+func (s *bpPropertySet) setProperty(name string, value interface{}) {
+ if s.properties[name] == nil {
+ s.AddProperty(name, value)
+ } else {
+ s.properties[name] = value
+ }
+}
+
+func (s *bpPropertySet) insertAfter(position string, name string, value interface{}) {
+ if s.properties[name] != nil {
+ panic("Property %q already exists in property set")
+ }
+
+ // Add the name to the end of the order, to ensure it has necessary capacity
+ // and to handle the case when the position does not exist.
+ s.order = append(s.order, name)
+
+ // Search through the order for the item that matches supplied position. If
+ // found then insert the name of the new property after it.
+ for i, v := range s.order {
+ if v == position {
+ // Copy the items after the one where the new property should be inserted.
+ copy(s.order[i+2:], s.order[i+1:])
+ // Insert the item in the list.
+ s.order[i+1] = name
+ }
+ }
+
+ s.properties[name] = value
+}
+
+type bpModule struct {
+ bpPropertySet
+ moduleType string
+}
+
+var _ android.BpModule = (*bpModule)(nil)
+
+func (m *bpModule) copy() *bpModule {
+ return &bpModule{
+ bpPropertySet: m.bpPropertySet.copy(),
+ moduleType: m.moduleType,
+ }
+}
+
+// A .bp file
+type bpFile struct {
+ modules map[string]*bpModule
+ order []*bpModule
+}
+
+// Add a module.
+//
+// The module must have had its "name" property set to a string value that
+// is unique within this file.
+func (f *bpFile) AddModule(module android.BpModule) {
+ m := module.(*bpModule)
+ if name, ok := m.getValue("name").(string); ok {
+ if f.modules[name] != nil {
+ panic(fmt.Sprintf("Module %q already exists in bp file", name))
+ }
+
+ f.modules[name] = m
+ f.order = append(f.order, m)
+ } else {
+ panic("Module does not have a name property, or it is not a string")
+ }
+}
+
+func (f *bpFile) newModule(moduleType string) *bpModule {
+ module := &bpModule{
+ moduleType: moduleType,
+ }
+ (&module.bpPropertySet).init()
+ return module
+}
diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go
index 1bbd286..5435ef6 100644
--- a/sdk/sdk_test.go
+++ b/sdk/sdk_test.go
@@ -544,15 +544,9 @@
sdk_snapshot {
name: "mysdk@current",
- java_libs: [
- "mysdk_myjavalib@current",
- ],
- stubs_sources: [
- "mysdk_myjavaapistubs@current",
- ],
- native_shared_libs: [
- "mysdk_mynativelib@current",
- ],
+ java_libs: ["mysdk_myjavalib@current"],
+ stubs_sources: ["mysdk_myjavaapistubs@current"],
+ native_shared_libs: ["mysdk_mynativelib@current"],
}
`)
@@ -602,6 +596,201 @@
}
}
+func TestHostSnapshot(t *testing.T) {
+ // b/145598135 - Generating host snapshots for anything other than linux is not supported.
+ SkipIfNotLinux(t)
+
+ ctx, config := testSdk(t, `
+ sdk {
+ name: "mysdk",
+ device_supported: false,
+ host_supported: true,
+ java_libs: ["myjavalib"],
+ native_shared_libs: ["mynativelib"],
+ stubs_sources: ["myjavaapistubs"],
+ }
+
+ java_library {
+ name: "myjavalib",
+ device_supported: false,
+ host_supported: true,
+ srcs: ["Test.java"],
+ aidl: {
+ export_include_dirs: ["aidl"],
+ },
+ system_modules: "none",
+ sdk_version: "none",
+ compile_dex: true,
+ }
+
+ cc_library_shared {
+ name: "mynativelib",
+ device_supported: false,
+ host_supported: true,
+ srcs: [
+ "Test.cpp",
+ "aidl/foo/bar/Test.aidl",
+ ],
+ export_include_dirs: ["include"],
+ aidl: {
+ export_aidl_headers: true,
+ },
+ system_shared_libs: [],
+ stl: "none",
+ }
+
+ droidstubs {
+ name: "myjavaapistubs",
+ device_supported: false,
+ host_supported: true,
+ srcs: ["foo/bar/Foo.java"],
+ system_modules: "none",
+ sdk_version: "none",
+ }
+ `)
+
+ sdk := ctx.ModuleForTests("mysdk", "linux_glibc_common").Module().(*sdk)
+
+ checkSnapshotAndroidBpContents(t, sdk, `// This is auto-generated. DO NOT EDIT.
+
+java_import {
+ name: "mysdk_myjavalib@current",
+ sdk_member_name: "myjavalib",
+ device_supported: false,
+ host_supported: true,
+ jars: ["java/myjavalib.jar"],
+}
+
+java_import {
+ name: "myjavalib",
+ prefer: false,
+ device_supported: false,
+ host_supported: true,
+ jars: ["java/myjavalib.jar"],
+}
+
+prebuilt_stubs_sources {
+ name: "mysdk_myjavaapistubs@current",
+ sdk_member_name: "myjavaapistubs",
+ device_supported: false,
+ host_supported: true,
+ srcs: ["java/myjavaapistubs_stubs_sources"],
+}
+
+prebuilt_stubs_sources {
+ name: "myjavaapistubs",
+ prefer: false,
+ device_supported: false,
+ host_supported: true,
+ srcs: ["java/myjavaapistubs_stubs_sources"],
+}
+
+cc_prebuilt_library_shared {
+ name: "mysdk_mynativelib@current",
+ sdk_member_name: "mynativelib",
+ device_supported: false,
+ host_supported: true,
+ arch: {
+ x86_64: {
+ srcs: ["x86_64/lib/mynativelib.so"],
+ export_include_dirs: [
+ "x86_64/include/include",
+ "x86_64/include_gen/mynativelib",
+ ],
+ },
+ x86: {
+ srcs: ["x86/lib/mynativelib.so"],
+ export_include_dirs: [
+ "x86/include/include",
+ "x86/include_gen/mynativelib",
+ ],
+ },
+ },
+ stl: "none",
+ system_shared_libs: [],
+}
+
+cc_prebuilt_library_shared {
+ name: "mynativelib",
+ prefer: false,
+ device_supported: false,
+ host_supported: true,
+ arch: {
+ x86_64: {
+ srcs: ["x86_64/lib/mynativelib.so"],
+ export_include_dirs: [
+ "x86_64/include/include",
+ "x86_64/include_gen/mynativelib",
+ ],
+ },
+ x86: {
+ srcs: ["x86/lib/mynativelib.so"],
+ export_include_dirs: [
+ "x86/include/include",
+ "x86/include_gen/mynativelib",
+ ],
+ },
+ },
+ stl: "none",
+ system_shared_libs: [],
+}
+
+sdk_snapshot {
+ name: "mysdk@current",
+ device_supported: false,
+ host_supported: true,
+ java_libs: ["mysdk_myjavalib@current"],
+ stubs_sources: ["mysdk_myjavaapistubs@current"],
+ native_shared_libs: ["mysdk_mynativelib@current"],
+}
+
+`)
+
+ var copySrcs []string
+ var copyDests []string
+ buildParams := sdk.BuildParamsForTests()
+ var zipBp android.BuildParams
+ for _, bp := range buildParams {
+ ruleString := bp.Rule.String()
+ if ruleString == "android/soong/android.Cp" {
+ copySrcs = append(copySrcs, bp.Input.String())
+ copyDests = append(copyDests, bp.Output.Rel()) // rooted at the snapshot root
+ } else if ruleString == "<local rule>:m.mysdk_linux_glibc_common.snapshot" {
+ zipBp = bp
+ }
+ }
+
+ buildDir := config.BuildDir()
+ ensureListContains(t, copySrcs, "aidl/foo/bar/Test.aidl")
+ ensureListContains(t, copySrcs, "include/Test.h")
+ ensureListContains(t, copySrcs, filepath.Join(buildDir, ".intermediates/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/BnTest.h"))
+ ensureListContains(t, copySrcs, filepath.Join(buildDir, ".intermediates/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/BpTest.h"))
+ ensureListContains(t, copySrcs, filepath.Join(buildDir, ".intermediates/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/Test.h"))
+ ensureListContains(t, copySrcs, filepath.Join(buildDir, ".intermediates/myjavalib/linux_glibc_common/javac/myjavalib.jar"))
+ ensureListContains(t, copySrcs, filepath.Join(buildDir, ".intermediates/mynativelib/linux_glibc_x86_64_shared/mynativelib.so"))
+
+ ensureListContains(t, copyDests, "aidl/aidl/foo/bar/Test.aidl")
+ ensureListContains(t, copyDests, "x86_64/include/include/Test.h")
+ ensureListContains(t, copyDests, "x86_64/include_gen/mynativelib/aidl/foo/bar/BnTest.h")
+ ensureListContains(t, copyDests, "x86_64/include_gen/mynativelib/aidl/foo/bar/BpTest.h")
+ ensureListContains(t, copyDests, "x86_64/include_gen/mynativelib/aidl/foo/bar/Test.h")
+ ensureListContains(t, copyDests, "java/myjavalib.jar")
+ ensureListContains(t, copyDests, "x86_64/lib/mynativelib.so")
+
+ // Ensure that the droidstubs .srcjar as repackaged into a temporary zip file
+ // and then merged together with the intermediate snapshot zip.
+ snapshotCreationInputs := zipBp.Implicits.Strings()
+ ensureListContains(t, snapshotCreationInputs,
+ filepath.Join(buildDir, ".intermediates/mysdk/linux_glibc_common/tmp/java/myjavaapistubs_stubs_sources.zip"))
+ ensureListContains(t, snapshotCreationInputs,
+ filepath.Join(buildDir, ".intermediates/mysdk/linux_glibc_common/mysdk-current.unmerged.zip"))
+ actual := zipBp.Output.String()
+ expected := filepath.Join(buildDir, ".intermediates/mysdk/linux_glibc_common/mysdk-current.zip")
+ if actual != expected {
+ t.Errorf("Expected snapshot output to be %q but was %q", expected, actual)
+ }
+}
+
func checkSnapshotAndroidBpContents(t *testing.T, s *sdk, expectedContents string) {
t.Helper()
androidBpContents := strings.NewReplacer("\\n", "\n").Replace(s.GetAndroidBpContentsForTests())
@@ -634,3 +823,10 @@
os.Exit(run())
}
+
+func SkipIfNotLinux(t *testing.T) {
+ t.Helper()
+ if android.BuildOs != android.Linux {
+ t.Skipf("Skipping as sdk snapshot generation is only supported on %s not %s", android.Linux, android.BuildOs)
+ }
+}
diff --git a/sdk/update.go b/sdk/update.go
index 000d200..8159d3b 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -17,6 +17,7 @@
import (
"fmt"
"path/filepath"
+ "reflect"
"strings"
"github.com/google/blueprint/proptools"
@@ -28,34 +29,37 @@
var pctx = android.NewPackageContext("android/soong/sdk")
-// generatedFile abstracts operations for writing contents into a file and emit a build rule
-// for the file.
-type generatedFile struct {
- path android.OutputPath
+type generatedContents struct {
content strings.Builder
indentLevel int
}
+// generatedFile abstracts operations for writing contents into a file and emit a build rule
+// for the file.
+type generatedFile struct {
+ generatedContents
+ path android.OutputPath
+}
+
func newGeneratedFile(ctx android.ModuleContext, path ...string) *generatedFile {
return &generatedFile{
- path: android.PathForModuleOut(ctx, path...).OutputPath,
- indentLevel: 0,
+ path: android.PathForModuleOut(ctx, path...).OutputPath,
}
}
-func (gf *generatedFile) Indent() {
- gf.indentLevel++
+func (gc *generatedContents) Indent() {
+ gc.indentLevel++
}
-func (gf *generatedFile) Dedent() {
- gf.indentLevel--
+func (gc *generatedContents) Dedent() {
+ gc.indentLevel--
}
-func (gf *generatedFile) Printfln(format string, args ...interface{}) {
+func (gc *generatedContents) Printfln(format string, args ...interface{}) {
// ninja consumes newline characters in rspfile_content. Prevent it by
// escaping the backslash in the newline character. The extra backslash
// is removed when the rspfile is written to the actual script file
- fmt.Fprintf(&(gf.content), strings.Repeat(" ", gf.indentLevel)+format+"\\n", args...)
+ fmt.Fprintf(&(gc.content), strings.Repeat(" ", gc.indentLevel)+format+"\\n", args...)
}
func (gf *generatedFile) build(pctx android.PackageContext, ctx android.BuilderContext, implicits android.Paths) {
@@ -239,15 +243,19 @@
snapshotDir := android.PathForModuleOut(ctx, "snapshot")
bp := newGeneratedFile(ctx, "snapshot", "Android.bp")
- bp.Printfln("// This is auto-generated. DO NOT EDIT.")
- bp.Printfln("")
+
+ bpFile := &bpFile{
+ modules: make(map[string]*bpModule),
+ }
builder := &snapshotBuilder{
- ctx: ctx,
- version: "current",
- snapshotDir: snapshotDir.OutputPath,
- filesToZip: []android.Path{bp.path},
- androidBpFile: bp,
+ ctx: ctx,
+ sdk: s,
+ version: "current",
+ snapshotDir: snapshotDir.OutputPath,
+ filesToZip: []android.Path{bp.path},
+ bpFile: bpFile,
+ prebuiltModules: make(map[string]*bpModule),
}
s.builderForTests = builder
@@ -269,41 +277,38 @@
buildSharedNativeLibSnapshot(ctx, info, builder)
}
- // generate Android.bp
+ for _, unversioned := range builder.prebuiltOrder {
+ // Copy the unversioned module so it can be modified to make it versioned.
+ versioned := unversioned.copy()
+ name := versioned.properties["name"].(string)
+ versioned.setProperty("name", builder.versionedSdkMemberName(name))
+ versioned.insertAfter("name", "sdk_member_name", name)
+ bpFile.AddModule(versioned)
- bp.Printfln("sdk_snapshot {")
- bp.Indent()
- bp.Printfln("name: %q,", ctx.ModuleName()+string(android.SdkVersionSeparator)+builder.version)
+ // Set prefer: false - this is not strictly required as that is the default.
+ unversioned.insertAfter("name", "prefer", false)
+ bpFile.AddModule(unversioned)
+ }
+
+ // Create the snapshot module.
+ snapshotName := ctx.ModuleName() + string(android.SdkVersionSeparator) + builder.version
+ snapshotModule := bpFile.newModule("sdk_snapshot")
+ snapshotModule.AddProperty("name", snapshotName)
+ addHostDeviceSupportedProperties(&s.ModuleBase, snapshotModule)
if len(s.properties.Java_libs) > 0 {
- bp.Printfln("java_libs: [")
- bp.Indent()
- for _, m := range s.properties.Java_libs {
- bp.Printfln("%q,", builder.VersionedSdkMemberName(m))
- }
- bp.Dedent()
- bp.Printfln("],") // java_libs
+ snapshotModule.AddProperty("java_libs", builder.versionedSdkMemberNames(s.properties.Java_libs))
}
if len(s.properties.Stubs_sources) > 0 {
- bp.Printfln("stubs_sources: [")
- bp.Indent()
- for _, m := range s.properties.Stubs_sources {
- bp.Printfln("%q,", builder.VersionedSdkMemberName(m))
- }
- bp.Dedent()
- bp.Printfln("],") // stubs_sources
+ snapshotModule.AddProperty("stubs_sources", builder.versionedSdkMemberNames(s.properties.Stubs_sources))
}
if len(s.properties.Native_shared_libs) > 0 {
- bp.Printfln("native_shared_libs: [")
- bp.Indent()
- for _, m := range s.properties.Native_shared_libs {
- bp.Printfln("%q,", builder.VersionedSdkMemberName(m))
- }
- bp.Dedent()
- bp.Printfln("],") // native_shared_libs
+ snapshotModule.AddProperty("native_shared_libs", builder.versionedSdkMemberNames(s.properties.Native_shared_libs))
}
- bp.Dedent()
- bp.Printfln("}") // sdk_snapshot
- bp.Printfln("")
+ bpFile.AddModule(snapshotModule)
+
+ // generate Android.bp
+ bp = newGeneratedFile(ctx, "snapshot", "Android.bp")
+ generateBpContents(&bp.generatedContents, bpFile)
bp.build(pctx, ctx, nil)
@@ -351,8 +356,61 @@
return outputZipFile
}
+func generateBpContents(contents *generatedContents, bpFile *bpFile) {
+ contents.Printfln("// This is auto-generated. DO NOT EDIT.")
+ for _, bpModule := range bpFile.order {
+ contents.Printfln("")
+ contents.Printfln("%s {", bpModule.moduleType)
+ outputPropertySet(contents, &bpModule.bpPropertySet)
+ contents.Printfln("}")
+ }
+ contents.Printfln("")
+}
+
+func outputPropertySet(contents *generatedContents, set *bpPropertySet) {
+ contents.Indent()
+ for _, name := range set.order {
+ value := set.properties[name]
+
+ reflectedValue := reflect.ValueOf(value)
+ t := reflectedValue.Type()
+
+ kind := t.Kind()
+ switch kind {
+ case reflect.Slice:
+ length := reflectedValue.Len()
+ if length > 1 {
+ contents.Printfln("%s: [", name)
+ contents.Indent()
+ for i := 0; i < length; i = i + 1 {
+ contents.Printfln("%q,", reflectedValue.Index(i).Interface())
+ }
+ contents.Dedent()
+ contents.Printfln("],")
+ } else if length == 0 {
+ contents.Printfln("%s: [],", name)
+ } else {
+ contents.Printfln("%s: [%q],", name, reflectedValue.Index(0).Interface())
+ }
+ case reflect.Bool:
+ contents.Printfln("%s: %t,", name, reflectedValue.Bool())
+
+ case reflect.Ptr:
+ contents.Printfln("%s: {", name)
+ outputPropertySet(contents, reflectedValue.Interface().(*bpPropertySet))
+ contents.Printfln("},")
+
+ default:
+ contents.Printfln("%s: %q,", name, value)
+ }
+ }
+ contents.Dedent()
+}
+
func (s *sdk) GetAndroidBpContentsForTests() string {
- return s.builderForTests.androidBpFile.content.String()
+ contents := &generatedContents{}
+ generateBpContents(contents, s.builderForTests.bpFile)
+ return contents.content.String()
}
func buildSharedNativeLibSnapshot(ctx android.ModuleContext, info *nativeLibInfo, builder android.SnapshotBuilder) {
@@ -406,81 +464,58 @@
}
}
- info.generatePrebuiltLibrary(ctx, builder, true)
-
- // This module is for the case when the source tree for the unversioned module
- // doesn't exist (i.e. building in an unbundled tree). "prefer:" is set to false
- // so that this module does not eclipse the unversioned module if it exists.
- info.generatePrebuiltLibrary(ctx, builder, false)
+ info.generatePrebuiltLibrary(ctx, builder)
}
-func (info *nativeLibInfo) generatePrebuiltLibrary(ctx android.ModuleContext, builder android.SnapshotBuilder, versioned bool) {
- bp := builder.AndroidBpFile()
- bp.Printfln("cc_prebuilt_library_shared {")
- bp.Indent()
- name := info.name
- if versioned {
- bp.Printfln("name: %q,", builder.VersionedSdkMemberName(name))
- bp.Printfln("sdk_member_name: %q,", name)
- } else {
- bp.Printfln("name: %q,", name)
- bp.Printfln("prefer: false,")
- }
+func (info *nativeLibInfo) generatePrebuiltLibrary(ctx android.ModuleContext, builder android.SnapshotBuilder) {
// a function for emitting include dirs
- printExportedDirsForNativeLibs := func(lib archSpecificNativeLibInfo, systemInclude bool) {
+ addExportedDirsForNativeLibs := func(lib archSpecificNativeLibInfo, properties android.BpPropertySet, systemInclude bool) {
includeDirs := nativeIncludeDirPathsFor(ctx, lib, systemInclude, info.hasArchSpecificFlags)
if len(includeDirs) == 0 {
return
}
+ var propertyName string
if !systemInclude {
- bp.Printfln("export_include_dirs: [")
+ propertyName = "export_include_dirs"
} else {
- bp.Printfln("export_system_include_dirs: [")
+ propertyName = "export_system_include_dirs"
}
- bp.Indent()
- for _, dir := range includeDirs {
- bp.Printfln("%q,", dir)
- }
- bp.Dedent()
- bp.Printfln("],")
+ properties.AddProperty(propertyName, includeDirs)
}
+ pbm := builder.AddPrebuiltModule(info.name, "cc_prebuilt_library_shared")
+
if !info.hasArchSpecificFlags {
- printExportedDirsForNativeLibs(info.archVariants[0], false /*systemInclude*/)
- printExportedDirsForNativeLibs(info.archVariants[0], true /*systemInclude*/)
+ addExportedDirsForNativeLibs(info.archVariants[0], pbm, false /*systemInclude*/)
+ addExportedDirsForNativeLibs(info.archVariants[0], pbm, true /*systemInclude*/)
}
- bp.Printfln("arch: {")
- bp.Indent()
+ archProperties := pbm.AddPropertySet("arch")
for _, av := range info.archVariants {
- bp.Printfln("%s: {", av.archType)
- bp.Indent()
- bp.Printfln("srcs: [%q],", nativeStubFilePathFor(av))
+ archTypeProperties := archProperties.AddPropertySet(av.archType)
+ archTypeProperties.AddProperty("srcs", []string{nativeStubFilePathFor(av)})
if info.hasArchSpecificFlags {
// export_* properties are added inside the arch: {<arch>: {...}} block
- printExportedDirsForNativeLibs(av, false /*systemInclude*/)
- printExportedDirsForNativeLibs(av, true /*systemInclude*/)
+ addExportedDirsForNativeLibs(av, archTypeProperties, false /*systemInclude*/)
+ addExportedDirsForNativeLibs(av, archTypeProperties, true /*systemInclude*/)
}
- bp.Dedent()
- bp.Printfln("},") // <arch>
}
- bp.Dedent()
- bp.Printfln("},") // arch
- bp.Printfln("stl: \"none\",")
- bp.Printfln("system_shared_libs: [],")
- bp.Dedent()
- bp.Printfln("}") // cc_prebuilt_library_shared
- bp.Printfln("")
+ pbm.AddProperty("stl", "none")
+ pbm.AddProperty("system_shared_libs", []string{})
}
type snapshotBuilder struct {
- ctx android.ModuleContext
- version string
- snapshotDir android.OutputPath
- androidBpFile *generatedFile
- filesToZip android.Paths
- zipsToMerge android.Paths
+ ctx android.ModuleContext
+ sdk *sdk
+ version string
+ snapshotDir android.OutputPath
+ bpFile *bpFile
+ filesToZip android.Paths
+ zipsToMerge android.Paths
+
+ prebuiltModules map[string]*bpModule
+ prebuiltOrder []*bpModule
}
func (s *snapshotBuilder) CopyToSnapshot(src android.Path, dest string) {
@@ -512,10 +547,38 @@
s.zipsToMerge = append(s.zipsToMerge, tmpZipPath)
}
-func (s *snapshotBuilder) AndroidBpFile() android.GeneratedSnapshotFile {
- return s.androidBpFile
+func (s *snapshotBuilder) AddPrebuiltModule(name string, moduleType string) android.BpModule {
+ if s.prebuiltModules[name] != nil {
+ panic(fmt.Sprintf("Duplicate module detected, module %s has already been added", name))
+ }
+
+ m := s.bpFile.newModule(moduleType)
+ m.AddProperty("name", name)
+ addHostDeviceSupportedProperties(&s.sdk.ModuleBase, m)
+
+ s.prebuiltModules[name] = m
+ s.prebuiltOrder = append(s.prebuiltOrder, m)
+ return m
}
-func (s *snapshotBuilder) VersionedSdkMemberName(unversionedName string) interface{} {
+func addHostDeviceSupportedProperties(module *android.ModuleBase, bpModule *bpModule) {
+ if !module.DeviceSupported() {
+ bpModule.AddProperty("device_supported", false)
+ }
+ if module.HostSupported() {
+ bpModule.AddProperty("host_supported", true)
+ }
+}
+
+// Get a versioned name appropriate for the SDK snapshot version being taken.
+func (s *snapshotBuilder) versionedSdkMemberName(unversionedName string) string {
return versionedSdkMemberName(s.ctx, unversionedName, s.version)
}
+
+func (s *snapshotBuilder) versionedSdkMemberNames(members []string) []string {
+ var references []string = nil
+ for _, m := range members {
+ references = append(references, s.versionedSdkMemberName(m))
+ }
+ return references
+}
diff --git a/sysprop/sysprop_library.go b/sysprop/sysprop_library.go
index a876341..1fc94db 100644
--- a/sysprop/sysprop_library.go
+++ b/sysprop/sysprop_library.go
@@ -375,8 +375,8 @@
if isProduct {
// product can't own any sysprop_library now, so product must use public scope
scope = "public"
- } else if isVendor && !isOwnerPlatform {
- // vendor and odm can't use system's internal property.
+ } else if isVendor && isOwnerPlatform {
+ // vendor and odm can only use the public properties from the platform
scope = "public"
}
diff --git a/tradefed/autogen.go b/tradefed/autogen.go
index 905acfa..c35d8b9 100644
--- a/tradefed/autogen.go
+++ b/tradefed/autogen.go
@@ -197,11 +197,14 @@
return path
}
-func AutoGenRustHostTestConfig(ctx android.ModuleContext, name string, testConfigProp *string,
+func AutoGenRustTestConfig(ctx android.ModuleContext, name string, testConfigProp *string,
testConfigTemplateProp *string, testSuites []string, autoGenConfig *bool) android.Path {
path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites, autoGenConfig)
if autogenPath != nil {
templatePathString := "${RustHostTestConfigTemplate}"
+ if ctx.Device() {
+ templatePathString = "${RustDeviceTestConfigTemplate}"
+ }
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
if templatePath.Valid() {
templatePathString = templatePath.String()
diff --git a/tradefed/config.go b/tradefed/config.go
index 8249ffe..a289073 100644
--- a/tradefed/config.go
+++ b/tradefed/config.go
@@ -31,6 +31,7 @@
pctx.SourcePathVariable("NativeHostTestConfigTemplate", "build/make/core/native_host_test_config_template.xml")
pctx.SourcePathVariable("NativeTestConfigTemplate", "build/make/core/native_test_config_template.xml")
pctx.SourcePathVariable("PythonBinaryHostTestConfigTemplate", "build/make/core/python_binary_host_test_config_template.xml")
+ pctx.SourcePathVariable("RustDeviceTestConfigTemplate", "build/make/core/rust_device_test_config_template.xml")
pctx.SourcePathVariable("RustHostTestConfigTemplate", "build/make/core/rust_host_test_config_template.xml")
pctx.SourcePathVariable("EmptyTestConfig", "build/make/core/empty_test_config.xml")
diff --git a/tradefed/makevars.go b/tradefed/makevars.go
index e6b88ea..d4cf7a8 100644
--- a/tradefed/makevars.go
+++ b/tradefed/makevars.go
@@ -31,6 +31,7 @@
ctx.Strict("NATIVE_HOST_TEST_CONFIG_TEMPLATE", "${NativeHostTestConfigTemplate}")
ctx.Strict("NATIVE_TEST_CONFIG_TEMPLATE", "${NativeTestConfigTemplate}")
ctx.Strict("PYTHON_BINARY_HOST_TEST_CONFIG_TEMPLATE", "${PythonBinaryHostTestConfigTemplate}")
+ ctx.Strict("RUST_DEVICE_TEST_CONFIG_TEMPLATE", "${RustDeviceTestConfigTemplate}")
ctx.Strict("RUST_HOST_TEST_CONFIG_TEMPLATE", "${RustHostTestConfigTemplate}")
ctx.Strict("EMPTY_TEST_CONFIG", "${EmptyTestConfig}")
diff --git a/ui/build/build.go b/ui/build/build.go
index 6a19314..7dfb900 100644
--- a/ui/build/build.go
+++ b/ui/build/build.go
@@ -33,6 +33,15 @@
// can be parsed as ninja output.
ensureEmptyFileExists(ctx, filepath.Join(config.OutDir(), "ninja_build"))
ensureEmptyFileExists(ctx, filepath.Join(config.OutDir(), ".out-dir"))
+
+ if buildDateTimeFile, ok := config.environ.Get("BUILD_DATETIME_FILE"); ok {
+ err := ioutil.WriteFile(buildDateTimeFile, []byte(config.buildDateTime), 0777)
+ if err != nil {
+ ctx.Fatalln("Failed to write BUILD_DATETIME to file:", err)
+ }
+ } else {
+ ctx.Fatalln("Missing BUILD_DATETIME_FILE")
+ }
}
var combinedBuildNinjaTemplate = template.Must(template.New("combined").Parse(`
diff --git a/ui/build/config.go b/ui/build/config.go
index 876bfe0..565f033 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -15,7 +15,6 @@
package build
import (
- "io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -30,10 +29,11 @@
type configImpl struct {
// From the environment
- arguments []string
- goma bool
- environ *Environment
- distDir string
+ arguments []string
+ goma bool
+ environ *Environment
+ distDir string
+ buildDateTime string
// From the arguments
parallel int
@@ -244,18 +244,14 @@
outDir := ret.OutDir()
buildDateTimeFile := filepath.Join(outDir, "build_date.txt")
- var content string
if buildDateTime, ok := ret.environ.Get("BUILD_DATETIME"); ok && buildDateTime != "" {
- content = buildDateTime
+ ret.buildDateTime = buildDateTime
} else {
- content = strconv.FormatInt(time.Now().Unix(), 10)
+ ret.buildDateTime = strconv.FormatInt(time.Now().Unix(), 10)
}
+
if ctx.Metrics != nil {
- ctx.Metrics.SetBuildDateTime(content)
- }
- err := ioutil.WriteFile(buildDateTimeFile, []byte(content), 0777)
- if err != nil {
- ctx.Fatalln("Failed to write BUILD_DATETIME to file:", err)
+ ctx.Metrics.SetBuildDateTime(ret.buildDateTime)
}
ret.environ.Set("BUILD_DATETIME_FILE", buildDateTimeFile)
diff --git a/ui/metrics/metrics.go b/ui/metrics/metrics.go
index bc86f0a..64bbbf3 100644
--- a/ui/metrics/metrics.go
+++ b/ui/metrics/metrics.go
@@ -19,9 +19,9 @@
"os"
"strconv"
- "android/soong/ui/metrics/metrics_proto"
-
"github.com/golang/protobuf/proto"
+
+ soong_metrics_proto "android/soong/ui/metrics/metrics_proto"
)
const (
@@ -137,13 +137,32 @@
}
}
-func (m *Metrics) Serialize() (data []byte, err error) {
- return proto.Marshal(&m.metrics)
-}
-
// exports the output to the file at outputPath
func (m *Metrics) Dump(outputPath string) (err error) {
- data, err := m.Serialize()
+ return writeMessageToFile(&m.metrics, outputPath)
+}
+
+type CriticalUserJourneysMetrics struct {
+ cujs soong_metrics_proto.CriticalUserJourneysMetrics
+}
+
+func NewCriticalUserJourneysMetrics() *CriticalUserJourneysMetrics {
+ return &CriticalUserJourneysMetrics{}
+}
+
+func (c *CriticalUserJourneysMetrics) Add(name string, metrics *Metrics) {
+ c.cujs.Cujs = append(c.cujs.Cujs, &soong_metrics_proto.CriticalUserJourneyMetrics{
+ Name: proto.String(name),
+ Metrics: &metrics.metrics,
+ })
+}
+
+func (c *CriticalUserJourneysMetrics) Dump(outputPath string) (err error) {
+ return writeMessageToFile(&c.cujs, outputPath)
+}
+
+func writeMessageToFile(pb proto.Message, outputPath string) (err error) {
+ data, err := proto.Marshal(pb)
if err != nil {
return err
}
diff --git a/ui/metrics/metrics_proto/metrics.pb.go b/ui/metrics/metrics_proto/metrics.pb.go
index 5486ec1..0fe5a0d 100644
--- a/ui/metrics/metrics_proto/metrics.pb.go
+++ b/ui/metrics/metrics_proto/metrics.pb.go
@@ -509,6 +509,95 @@
return 0
}
+type CriticalUserJourneyMetrics struct {
+ // The name of a critical user journey test.
+ Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+ // The metrics produced when running the critical user journey test.
+ Metrics *MetricsBase `protobuf:"bytes,2,opt,name=metrics" json:"metrics,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *CriticalUserJourneyMetrics) Reset() { *m = CriticalUserJourneyMetrics{} }
+func (m *CriticalUserJourneyMetrics) String() string { return proto.CompactTextString(m) }
+func (*CriticalUserJourneyMetrics) ProtoMessage() {}
+func (*CriticalUserJourneyMetrics) Descriptor() ([]byte, []int) {
+ return fileDescriptor_6039342a2ba47b72, []int{3}
+}
+
+func (m *CriticalUserJourneyMetrics) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_CriticalUserJourneyMetrics.Unmarshal(m, b)
+}
+func (m *CriticalUserJourneyMetrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_CriticalUserJourneyMetrics.Marshal(b, m, deterministic)
+}
+func (m *CriticalUserJourneyMetrics) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_CriticalUserJourneyMetrics.Merge(m, src)
+}
+func (m *CriticalUserJourneyMetrics) XXX_Size() int {
+ return xxx_messageInfo_CriticalUserJourneyMetrics.Size(m)
+}
+func (m *CriticalUserJourneyMetrics) XXX_DiscardUnknown() {
+ xxx_messageInfo_CriticalUserJourneyMetrics.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_CriticalUserJourneyMetrics proto.InternalMessageInfo
+
+func (m *CriticalUserJourneyMetrics) GetName() string {
+ if m != nil && m.Name != nil {
+ return *m.Name
+ }
+ return ""
+}
+
+func (m *CriticalUserJourneyMetrics) GetMetrics() *MetricsBase {
+ if m != nil {
+ return m.Metrics
+ }
+ return nil
+}
+
+type CriticalUserJourneysMetrics struct {
+ // A set of metrics from a run of the critical user journey tests.
+ Cujs []*CriticalUserJourneyMetrics `protobuf:"bytes,1,rep,name=cujs" json:"cujs,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *CriticalUserJourneysMetrics) Reset() { *m = CriticalUserJourneysMetrics{} }
+func (m *CriticalUserJourneysMetrics) String() string { return proto.CompactTextString(m) }
+func (*CriticalUserJourneysMetrics) ProtoMessage() {}
+func (*CriticalUserJourneysMetrics) Descriptor() ([]byte, []int) {
+ return fileDescriptor_6039342a2ba47b72, []int{4}
+}
+
+func (m *CriticalUserJourneysMetrics) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_CriticalUserJourneysMetrics.Unmarshal(m, b)
+}
+func (m *CriticalUserJourneysMetrics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_CriticalUserJourneysMetrics.Marshal(b, m, deterministic)
+}
+func (m *CriticalUserJourneysMetrics) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_CriticalUserJourneysMetrics.Merge(m, src)
+}
+func (m *CriticalUserJourneysMetrics) XXX_Size() int {
+ return xxx_messageInfo_CriticalUserJourneysMetrics.Size(m)
+}
+func (m *CriticalUserJourneysMetrics) XXX_DiscardUnknown() {
+ xxx_messageInfo_CriticalUserJourneysMetrics.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_CriticalUserJourneysMetrics proto.InternalMessageInfo
+
+func (m *CriticalUserJourneysMetrics) GetCujs() []*CriticalUserJourneyMetrics {
+ if m != nil {
+ return m.Cujs
+ }
+ return nil
+}
+
func init() {
proto.RegisterEnum("soong_build_metrics.MetricsBase_BuildVariant", MetricsBase_BuildVariant_name, MetricsBase_BuildVariant_value)
proto.RegisterEnum("soong_build_metrics.MetricsBase_Arch", MetricsBase_Arch_name, MetricsBase_Arch_value)
@@ -516,59 +605,65 @@
proto.RegisterType((*MetricsBase)(nil), "soong_build_metrics.MetricsBase")
proto.RegisterType((*PerfInfo)(nil), "soong_build_metrics.PerfInfo")
proto.RegisterType((*ModuleTypeInfo)(nil), "soong_build_metrics.ModuleTypeInfo")
+ proto.RegisterType((*CriticalUserJourneyMetrics)(nil), "soong_build_metrics.CriticalUserJourneyMetrics")
+ proto.RegisterType((*CriticalUserJourneysMetrics)(nil), "soong_build_metrics.CriticalUserJourneysMetrics")
}
func init() { proto.RegisterFile("metrics.proto", fileDescriptor_6039342a2ba47b72) }
var fileDescriptor_6039342a2ba47b72 = []byte{
- // 769 bytes of a gzipped FileDescriptorProto
+ // 834 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x6f, 0x6b, 0xdb, 0x46,
- 0x18, 0xaf, 0x62, 0x25, 0x96, 0x1e, 0xc5, 0xae, 0x7a, 0xc9, 0xa8, 0xca, 0x08, 0x33, 0x66, 0x1d,
- 0x7e, 0xb1, 0xba, 0xc5, 0x14, 0x53, 0x4c, 0x19, 0xd8, 0x89, 0x29, 0x25, 0xd8, 0x2e, 0x4a, 0xdc,
- 0x95, 0xed, 0xc5, 0xa1, 0x4a, 0xe7, 0x46, 0x9b, 0xa5, 0x13, 0x77, 0xa7, 0x32, 0x7f, 0x88, 0x7d,
-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 0xac, 0xe0, 0xfb, 0xb1, 0x48, 0x55,
+ 0x1a, 0x47, 0xab, 0x85, 0x64, 0xe2, 0x57, 0x5e, 0x8a, 0x9c, 0xad, 0xab, 0xdb, 0xbe, 0x39, 0x74,
+ 0xab, 0x71, 0xe8, 0x23, 0x68, 0x57, 0x5d, 0x62, 0x4a, 0x77, 0xd8, 0xff, 0xda, 0xc0, 0x08, 0x6b,
+ 0x41, 0x70, 0x0d, 0x4f, 0xb7, 0xec, 0x26, 0xeb, 0xed, 0xc6, 0x60, 0xc7, 0xe5, 0x67, 0xe9, 0x5b,
+ 0xf8, 0xb1, 0x6e, 0x3f, 0xd9, 0xff, 0x4f, 0x1b, 0xa2, 0xf8, 0xec, 0xbb, 0xdf, 0xab, 0xff, 0x61,
+ 0xa5, 0xa0, 0xf8, 0x93, 0xfc, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x20, 0x07, 0xbc, 0xf0, 0x34, 0x07,
+ 0x00, 0x00,
}
diff --git a/ui/metrics/metrics_proto/metrics.proto b/ui/metrics/metrics_proto/metrics.proto
index 93034eb..1ea24bf 100644
--- a/ui/metrics/metrics_proto/metrics.proto
+++ b/ui/metrics/metrics_proto/metrics.proto
@@ -125,3 +125,16 @@
// The number of logical modules.
optional uint32 num_of_modules = 3;
}
+
+message CriticalUserJourneyMetrics {
+ // The name of a critical user journey test.
+ optional string name = 1;
+
+ // The metrics produced when running the critical user journey test.
+ optional MetricsBase metrics = 2;
+}
+
+message CriticalUserJourneysMetrics {
+ // A set of metrics from a run of the critical user journey tests.
+ repeated CriticalUserJourneyMetrics cujs = 1;
+}
\ No newline at end of file
diff --git a/ui/status/log.go b/ui/status/log.go
index 9090f49..d407248 100644
--- a/ui/status/log.go
+++ b/ui/status/log.go
@@ -180,12 +180,12 @@
func (e *errorProtoLog) Flush() {
data, err := proto.Marshal(&e.errorProto)
if err != nil {
- e.log.Println("Failed to marshal build status proto: %v", err)
+ e.log.Printf("Failed to marshal build status proto: %v\n", err)
return
}
err = ioutil.WriteFile(e.filename, []byte(data), 0644)
if err != nil {
- e.log.Println("Failed to write file %s: %v", e.errorProto, err)
+ e.log.Printf("Failed to write file %s: %v\n", e.filename, err)
}
}