Merge "Make test api extend system in sdk_library.go"
diff --git a/android/apex.go b/android/apex.go
index c01b716..3039e79 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -145,11 +145,6 @@
// check-platform-availability mutator in the apex package.
SetNotAvailableForPlatform()
- // Returns the highest version which is <= maxSdkVersion.
- // For example, with maxSdkVersion is 10 and versionList is [9,11]
- // it returns 9 as string
- ChooseSdkVersion(ctx BaseModuleContext, versionList []string, maxSdkVersion ApiLevel) (string, error)
-
// List of APEXes that this module tests. The module has access to
// the private part of the listed APEXes even when it is not included in the
// APEXes.
@@ -310,20 +305,6 @@
return true
}
-func (m *ApexModuleBase) ChooseSdkVersion(ctx BaseModuleContext, versionList []string, maxSdkVersion ApiLevel) (string, error) {
- for i := range versionList {
- version := versionList[len(versionList)-i-1]
- ver, err := ApiLevelFromUser(ctx, version)
- if err != nil {
- return "", err
- }
- if ver.LessThanOrEqualTo(maxSdkVersion) {
- return version, nil
- }
- }
- return "", fmt.Errorf("not found a version(<=%s) in versionList: %v", maxSdkVersion, versionList)
-}
-
func (m *ApexModuleBase) checkApexAvailableProperty(mctx BaseModuleContext) {
for _, n := range m.ApexProperties.Apex_available {
if n == AvailableToPlatform || n == AvailableToAnyApex || n == AvailableToGkiApex {
diff --git a/android/depset.go b/android/depset.go
index f707094..60ebcac 100644
--- a/android/depset.go
+++ b/android/depset.go
@@ -71,24 +71,26 @@
// NewDepSet returns an immutable DepSet with the given order, direct and transitive contents.
func NewDepSet(order DepSetOrder, direct Paths, transitive []*DepSet) *DepSet {
var directCopy Paths
- var transitiveCopy []*DepSet
+ transitiveCopy := make([]*DepSet, 0, len(transitive))
+
+ for _, dep := range transitive {
+ if dep != nil {
+ if dep.order != order {
+ panic(fmt.Errorf("incompatible order, new DepSet is %s but transitive DepSet is %s",
+ order, dep.order))
+ }
+ transitiveCopy = append(transitiveCopy, dep)
+ }
+ }
+
if order == TOPOLOGICAL {
directCopy = ReversePaths(direct)
- transitiveCopy = reverseDepSets(transitive)
+ reverseDepSetsInPlace(transitiveCopy)
} else {
// Use copy instead of append(nil, ...) to make a slice that is exactly the size of the input
// slice. The DepSet is immutable, there is no need for additional capacity.
directCopy = make(Paths, len(direct))
copy(directCopy, direct)
- transitiveCopy = make([]*DepSet, len(transitive))
- copy(transitiveCopy, transitive)
- }
-
- for _, dep := range transitive {
- if dep.order != order {
- panic(fmt.Errorf("incompatible order, new DepSet is %s but transitive DepSet is %s",
- order, dep.order))
- }
}
return &DepSet{
@@ -157,6 +159,9 @@
// its transitive dependencies, in which case the ordering of the duplicated element is not
// guaranteed).
func (d *DepSet) ToList() Paths {
+ if d == nil {
+ return nil
+ }
var list Paths
d.walk(func(paths Paths) {
list = append(list, paths...)
@@ -181,10 +186,9 @@
}
}
-func reverseDepSets(list []*DepSet) []*DepSet {
- ret := make([]*DepSet, len(list))
- for i := range list {
- ret[i] = list[len(list)-1-i]
+func reverseDepSetsInPlace(list []*DepSet) {
+ for i, j := 0, len(list)-1; i < j; i, j = i+1, j-1 {
+ list[i], list[j] = list[j], list[i]
}
- return ret
+
}
diff --git a/android/prebuilt.go b/android/prebuilt.go
index 734871b..294a6e0 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -93,7 +93,7 @@
// more modules like this.
func (p *Prebuilt) SingleSourcePath(ctx ModuleContext) Path {
if p.srcsSupplier != nil {
- srcs := p.srcsSupplier()
+ srcs := p.srcsSupplier(ctx)
if len(srcs) == 0 {
ctx.PropertyErrorf(p.srcsPropertyName, "missing prebuilt source file")
@@ -122,7 +122,7 @@
// Called to provide the srcs value for the prebuilt module.
//
// Return the src value or nil if it is not available.
-type PrebuiltSrcsSupplier func() []string
+type PrebuiltSrcsSupplier func(ctx BaseModuleContext) []string
// Initialize the module as a prebuilt module that uses the provided supplier to access the
// prebuilt sources of the module.
@@ -156,7 +156,7 @@
panic(fmt.Errorf("srcs must not be nil"))
}
- srcsSupplier := func() []string {
+ srcsSupplier := func(ctx BaseModuleContext) []string {
return *srcs
}
@@ -177,7 +177,7 @@
srcFieldIndex := srcStructField.Index
srcPropertyName := proptools.PropertyNameForField(srcField)
- srcsSupplier := func() []string {
+ srcsSupplier := func(ctx BaseModuleContext) []string {
value := srcPropsValue.FieldByIndex(srcFieldIndex)
if value.Kind() == reflect.Ptr {
value = value.Elem()
@@ -287,7 +287,7 @@
// usePrebuilt returns true if a prebuilt should be used instead of the source module. The prebuilt
// will be used if it is marked "prefer" or if the source module is disabled.
func (p *Prebuilt) usePrebuilt(ctx TopDownMutatorContext, source Module) bool {
- if p.srcsSupplier != nil && len(p.srcsSupplier()) == 0 {
+ if p.srcsSupplier != nil && len(p.srcsSupplier(ctx)) == 0 {
return false
}
diff --git a/android/variable.go b/android/variable.go
index d752aec..a9495cc 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -390,7 +390,7 @@
AAPTPrebuiltDPI: []string{"xhdpi", "xxhdpi"},
Malloc_not_svelte: boolPtr(true),
- Malloc_zero_contents: boolPtr(false),
+ Malloc_zero_contents: boolPtr(true),
Malloc_pattern_fill_contents: boolPtr(false),
Safestack: boolPtr(false),
}
diff --git a/apex/apex_test.go b/apex/apex_test.go
index cf2c953..c52fd04 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -1319,6 +1319,7 @@
cc_library {
name: "mylib",
srcs: ["mylib.cpp"],
+ system_shared_libs: ["libc", "libm"],
shared_libs: ["libdl#27"],
stl: "none",
apex_available: [ "myapex" ],
@@ -5597,6 +5598,36 @@
ensureMatches(t, copyCmds[2], "^unzip .*-d .*/app/AppSet .*/AppSet.zip$")
}
+func TestAppSetBundlePrebuilt(t *testing.T) {
+ ctx, _ := testApex(t, "", func(fs map[string][]byte, config android.Config) {
+ bp := `
+ apex_set {
+ name: "myapex",
+ filename: "foo_v2.apex",
+ sanitized: {
+ none: { set: "myapex.apks", },
+ hwaddress: { set: "myapex.hwasan.apks", },
+ },
+ }`
+ fs["Android.bp"] = []byte(bp)
+
+ config.TestProductVariables.SanitizeDevice = []string{"hwaddress"}
+ })
+
+ m := ctx.ModuleForTests("myapex", "android_common")
+ extractedApex := m.Output(buildDir + "/.intermediates/myapex/android_common/foo_v2.apex")
+
+ actual := extractedApex.Inputs
+ if len(actual) != 1 {
+ t.Errorf("expected a single input")
+ }
+
+ expected := "myapex.hwasan.apks"
+ if actual[0].String() != expected {
+ t.Errorf("expected %s, got %s", expected, actual[0].String())
+ }
+}
+
func testNoUpdatableJarsInBootImage(t *testing.T, errmsg string, transformDexpreoptConfig func(*dexpreopt.GlobalConfig)) {
t.Helper()
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index 9f6c8ad..ce16d73 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -50,6 +50,10 @@
properties prebuiltCommonProperties
}
+type sanitizedPrebuilt interface {
+ hasSanitizedSource(sanitizer string) bool
+}
+
type prebuiltCommonProperties struct {
ForceDisable bool `blueprint:"mutated"`
}
@@ -75,9 +79,10 @@
forceDisable = forceDisable || ctx.DeviceConfig().NativeCoverageEnabled()
forceDisable = forceDisable || ctx.Config().IsEnvTrue("EMMA_INSTRUMENT")
- // b/137216042 don't use prebuilts when address sanitizer is on
- forceDisable = forceDisable || android.InList("address", ctx.Config().SanitizeDevice()) ||
- android.InList("hwaddress", ctx.Config().SanitizeDevice())
+ // b/137216042 don't use prebuilts when address sanitizer is on, unless the prebuilt has a sanitized source
+ sanitized := ctx.Module().(sanitizedPrebuilt)
+ forceDisable = forceDisable || (android.InList("address", ctx.Config().SanitizeDevice()) && !sanitized.hasSanitizedSource("address"))
+ forceDisable = forceDisable || (android.InList("hwaddress", ctx.Config().SanitizeDevice()) && !sanitized.hasSanitizedSource("hwaddress"))
if forceDisable && p.prebuilt.SourceExists() {
p.properties.ForceDisable = true
@@ -135,6 +140,10 @@
Overrides []string
}
+func (a *Prebuilt) hasSanitizedSource(sanitizer string) bool {
+ return false
+}
+
func (p *Prebuilt) installable() bool {
return p.properties.Installable == nil || proptools.Bool(p.properties.Installable)
}
@@ -266,6 +275,18 @@
// the .apks file path that contains prebuilt apex files to be extracted.
Set *string
+ Sanitized struct {
+ None struct {
+ Set *string
+ }
+ Address struct {
+ Set *string
+ }
+ Hwaddress struct {
+ Set *string
+ }
+ }
+
// whether the extracted apex file installable.
Installable *bool
@@ -284,6 +305,41 @@
Prerelease *bool
}
+func (a *ApexSet) prebuiltSrcs(ctx android.BaseModuleContext) []string {
+ var srcs []string
+ if a.properties.Set != nil {
+ srcs = append(srcs, *a.properties.Set)
+ }
+
+ var sanitizers []string
+ if ctx.Host() {
+ sanitizers = ctx.Config().SanitizeHost()
+ } else {
+ sanitizers = ctx.Config().SanitizeDevice()
+ }
+
+ if android.InList("address", sanitizers) && a.properties.Sanitized.Address.Set != nil {
+ srcs = append(srcs, *a.properties.Sanitized.Address.Set)
+ } else if android.InList("hwaddress", sanitizers) && a.properties.Sanitized.Hwaddress.Set != nil {
+ srcs = append(srcs, *a.properties.Sanitized.Hwaddress.Set)
+ } else if a.properties.Sanitized.None.Set != nil {
+ srcs = append(srcs, *a.properties.Sanitized.None.Set)
+ }
+
+ return srcs
+}
+
+func (a *ApexSet) hasSanitizedSource(sanitizer string) bool {
+ if sanitizer == "address" {
+ return a.properties.Sanitized.Address.Set != nil
+ }
+ if sanitizer == "hwaddress" {
+ return a.properties.Sanitized.Hwaddress.Set != nil
+ }
+
+ return false
+}
+
func (a *ApexSet) installable() bool {
return a.properties.Installable == nil || proptools.Bool(a.properties.Installable)
}
@@ -304,7 +360,12 @@
func apexSetFactory() android.Module {
module := &ApexSet{}
module.AddProperties(&module.properties)
- android.InitSingleSourcePrebuiltModule(module, &module.properties, "Set")
+
+ srcsSupplier := func(ctx android.BaseModuleContext) []string {
+ return module.prebuiltSrcs(ctx)
+ }
+
+ android.InitPrebuiltModuleWithSrcSupplier(module, srcsSupplier, "set")
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
return module
}
diff --git a/cc/androidmk.go b/cc/androidmk.go
index a2549b8..e58a172 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -186,17 +186,17 @@
}
func (library *libraryDecorator) androidMkWriteExportedFlags(entries *android.AndroidMkEntries) {
- exportedFlags := library.exportedFlags()
- for _, dir := range library.exportedDirs() {
+ exportedFlags := library.flagExporter.flags
+ for _, dir := range library.flagExporter.dirs {
exportedFlags = append(exportedFlags, "-I"+dir.String())
}
- for _, dir := range library.exportedSystemDirs() {
+ for _, dir := range library.flagExporter.systemDirs {
exportedFlags = append(exportedFlags, "-isystem "+dir.String())
}
if len(exportedFlags) > 0 {
entries.AddStrings("LOCAL_EXPORT_CFLAGS", exportedFlags...)
}
- exportedDeps := library.exportedDeps()
+ exportedDeps := library.flagExporter.deps
if len(exportedDeps) > 0 {
entries.AddStrings("LOCAL_EXPORT_C_INCLUDE_DEPS", exportedDeps.Strings()...)
}
@@ -442,6 +442,11 @@
entries.SubName = ndkLibrarySuffix + "." + c.apiLevel.String()
entries.Class = "SHARED_LIBRARIES"
+ if !c.buildStubs() {
+ entries.Disabled = true
+ return
+ }
+
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
path, file := filepath.Split(c.installPath.String())
stem, suffix, _ := android.SplitFileExt(file)
diff --git a/cc/cc.go b/cc/cc.go
index 8188550..dbe6346 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -45,7 +45,6 @@
ctx.BottomUp("sdk", sdkMutator).Parallel()
ctx.BottomUp("vndk", VndkMutator).Parallel()
ctx.BottomUp("link", LinkageMutator).Parallel()
- ctx.BottomUp("ndk_api", NdkApiMutator).Parallel()
ctx.BottomUp("test_per_src", TestPerSrcMutator).Parallel()
ctx.BottomUp("version_selector", versionSelectorMutator).Parallel()
ctx.BottomUp("version", versionMutator).Parallel()
@@ -130,6 +129,9 @@
// Paths to .a files
StaticLibs, LateStaticLibs, WholeStaticLibs android.Paths
+ // Transitive static library dependencies of static libraries for use in ordering.
+ TranstiveStaticLibrariesForOrdering *android.DepSet
+
// Paths to .o files
Objs Objects
// Paths to .o files in dependencies that provide them. Note that these lists
@@ -546,9 +548,7 @@
dataLibDepTag = dependencyTag{name: "data lib"}
runtimeDepTag = dependencyTag{name: "runtime lib"}
testPerSrcDepTag = dependencyTag{name: "test_per_src"}
- testForDepTag = dependencyTag{name: "test for apex"}
-
- stubImplDepTag = copyDirectlyInAnyApexDependencyTag{name: "stub_impl"}
+ stubImplDepTag = dependencyTag{name: "stub_impl"}
)
type copyDirectlyInAnyApexDependencyTag dependencyTag
@@ -618,13 +618,8 @@
// Flags used to compile this module
flags Flags
- // When calling a linker, if module A depends on module B, then A must precede B in its command
- // line invocation. depsInLinkOrder stores the proper ordering of all of the transitive
- // deps of this module
- depsInLinkOrder android.Paths
-
// only non-nil when this is a shared library that reuses the objects of a static library
- staticVariant LinkableInterface
+ staticAnalogue *StaticLibraryInfo
makeLinkType string
// Kythe (source file indexer) paths for this compilation module
@@ -722,42 +717,9 @@
return c.Properties.AlwaysSdk || Bool(c.Properties.Sdk_variant_only)
}
-func (c *Module) IncludeDirs() android.Paths {
- if c.linker != nil {
- if library, ok := c.linker.(exportedFlagsProducer); ok {
- return library.exportedDirs()
- }
- }
- panic(fmt.Errorf("IncludeDirs called on non-exportedFlagsProducer module: %q", c.BaseModuleName()))
-}
-
-func (c *Module) HasStaticVariant() bool {
- if c.staticVariant != nil {
- return true
- }
- return false
-}
-
-func (c *Module) GetStaticVariant() LinkableInterface {
- return c.staticVariant
-}
-
-func (c *Module) SetDepsInLinkOrder(depsInLinkOrder []android.Path) {
- c.depsInLinkOrder = depsInLinkOrder
-}
-
-func (c *Module) GetDepsInLinkOrder() []android.Path {
- return c.depsInLinkOrder
-}
-
-func (c *Module) StubsVersions() []string {
- if c.linker != nil {
- if library, ok := c.linker.(*libraryDecorator); ok {
- return library.Properties.Stubs.Versions
- }
- if library, ok := c.linker.(*prebuiltLibraryLinker); ok {
- return library.Properties.Stubs.Versions
- }
+func (c *Module) StubsVersions(ctx android.BaseMutatorContext) []string {
+ if versioned, ok := c.linker.(versionedInterface); ok {
+ return versioned.stubsVersions(ctx)
}
panic(fmt.Errorf("StubsVersions called on non-library module: %q", c.BaseModuleName()))
}
@@ -786,100 +748,48 @@
}
func (c *Module) SetBuildStubs() {
- if c.linker != nil {
- if library, ok := c.linker.(*libraryDecorator); ok {
- library.MutatedProperties.BuildStubs = true
- c.Properties.HideFromMake = true
- c.sanitize = nil
- c.stl = nil
- c.Properties.PreventInstall = true
- return
- }
- if library, ok := c.linker.(*prebuiltLibraryLinker); ok {
- library.MutatedProperties.BuildStubs = true
- c.Properties.HideFromMake = true
- c.sanitize = nil
- c.stl = nil
- c.Properties.PreventInstall = true
- return
- }
- if _, ok := c.linker.(*llndkStubDecorator); ok {
- c.Properties.HideFromMake = true
- return
- }
+ if versioned, ok := c.linker.(versionedInterface); ok {
+ versioned.setBuildStubs()
+ c.Properties.HideFromMake = true
+ c.sanitize = nil
+ c.stl = nil
+ c.Properties.PreventInstall = true
+ return
}
panic(fmt.Errorf("SetBuildStubs called on non-library module: %q", c.BaseModuleName()))
}
func (c *Module) BuildStubs() bool {
- if c.linker != nil {
- if library, ok := c.linker.(*libraryDecorator); ok {
- return library.buildStubs()
- }
- if library, ok := c.linker.(*prebuiltLibraryLinker); ok {
- return library.buildStubs()
- }
+ if versioned, ok := c.linker.(versionedInterface); ok {
+ return versioned.buildStubs()
}
panic(fmt.Errorf("BuildStubs called on non-library module: %q", c.BaseModuleName()))
}
func (c *Module) SetAllStubsVersions(versions []string) {
- if library, ok := c.linker.(*libraryDecorator); ok {
- library.MutatedProperties.AllStubsVersions = versions
- return
- }
- if library, ok := c.linker.(*prebuiltLibraryLinker); ok {
- library.MutatedProperties.AllStubsVersions = versions
- return
- }
- if llndk, ok := c.linker.(*llndkStubDecorator); ok {
- llndk.libraryDecorator.MutatedProperties.AllStubsVersions = versions
- return
+ if versioned, ok := c.linker.(versionedInterface); ok {
+ versioned.setAllStubsVersions(versions)
}
}
func (c *Module) AllStubsVersions() []string {
- if library, ok := c.linker.(*libraryDecorator); ok {
- return library.MutatedProperties.AllStubsVersions
- }
- if library, ok := c.linker.(*prebuiltLibraryLinker); ok {
- return library.MutatedProperties.AllStubsVersions
- }
- if llndk, ok := c.linker.(*llndkStubDecorator); ok {
- return llndk.libraryDecorator.MutatedProperties.AllStubsVersions
+ if versioned, ok := c.linker.(versionedInterface); ok {
+ return versioned.allStubsVersions()
}
return nil
}
func (c *Module) SetStubsVersion(version string) {
- if c.linker != nil {
- if library, ok := c.linker.(*libraryDecorator); ok {
- library.MutatedProperties.StubsVersion = version
- return
- }
- if library, ok := c.linker.(*prebuiltLibraryLinker); ok {
- library.MutatedProperties.StubsVersion = version
- return
- }
- if llndk, ok := c.linker.(*llndkStubDecorator); ok {
- llndk.libraryDecorator.MutatedProperties.StubsVersion = version
- return
- }
+ if versioned, ok := c.linker.(versionedInterface); ok {
+ versioned.setStubsVersion(version)
+ return
}
panic(fmt.Errorf("SetStubsVersion called on non-library module: %q", c.BaseModuleName()))
}
func (c *Module) StubsVersion() string {
- if c.linker != nil {
- if library, ok := c.linker.(*libraryDecorator); ok {
- return library.MutatedProperties.StubsVersion
- }
- if library, ok := c.linker.(*prebuiltLibraryLinker); ok {
- return library.MutatedProperties.StubsVersion
- }
- if llndk, ok := c.linker.(*llndkStubDecorator); ok {
- return llndk.libraryDecorator.MutatedProperties.StubsVersion
- }
+ if versioned, ok := c.linker.(versionedInterface); ok {
+ return versioned.stubsVersion()
}
panic(fmt.Errorf("StubsVersion called on non-library module: %q", c.BaseModuleName()))
}
@@ -1117,22 +1027,15 @@
}
func (c *Module) IsStubs() bool {
- if library, ok := c.linker.(*libraryDecorator); ok {
- return library.buildStubs()
- } else if library, ok := c.linker.(*prebuiltLibraryLinker); ok {
- return library.buildStubs()
- } else if _, ok := c.linker.(*llndkStubDecorator); ok {
- return true
+ if versioned, ok := c.linker.(versionedInterface); ok {
+ return versioned.buildStubs()
}
return false
}
func (c *Module) HasStubsVariants() bool {
- if library, ok := c.linker.(*libraryDecorator); ok {
- return len(library.Properties.Stubs.Versions) > 0
- }
- if library, ok := c.linker.(*prebuiltLibraryLinker); ok {
- return len(library.Properties.Stubs.Versions) > 0
+ if versioned, ok := c.linker.(versionedInterface); ok {
+ return versioned.hasStubsVariants()
}
return false
}
@@ -1156,41 +1059,6 @@
return false
}
-func (c *Module) ExportedIncludeDirs() android.Paths {
- if flagsProducer, ok := c.linker.(exportedFlagsProducer); ok {
- return flagsProducer.exportedDirs()
- }
- return nil
-}
-
-func (c *Module) ExportedSystemIncludeDirs() android.Paths {
- if flagsProducer, ok := c.linker.(exportedFlagsProducer); ok {
- return flagsProducer.exportedSystemDirs()
- }
- return nil
-}
-
-func (c *Module) ExportedFlags() []string {
- if flagsProducer, ok := c.linker.(exportedFlagsProducer); ok {
- return flagsProducer.exportedFlags()
- }
- return nil
-}
-
-func (c *Module) ExportedDeps() android.Paths {
- if flagsProducer, ok := c.linker.(exportedFlagsProducer); ok {
- return flagsProducer.exportedDeps()
- }
- return nil
-}
-
-func (c *Module) ExportedGeneratedHeaders() android.Paths {
- if flagsProducer, ok := c.linker.(exportedFlagsProducer); ok {
- return flagsProducer.exportedGeneratedHeaders()
- }
- return nil
-}
-
func (c *Module) ExcludeFromVendorSnapshot() bool {
return Bool(c.Properties.Exclude_from_vendor_snapshot)
}
@@ -1454,65 +1322,6 @@
return nil
}
-// orderDeps reorders dependencies into a list such that if module A depends on B, then
-// A will precede B in the resultant list.
-// This is convenient for passing into a linker.
-// Note that directSharedDeps should be the analogous static library for each shared lib dep
-func orderDeps(directStaticDeps []android.Path, directSharedDeps []android.Path, allTransitiveDeps map[android.Path][]android.Path) (orderedAllDeps []android.Path, orderedDeclaredDeps []android.Path) {
- // If A depends on B, then
- // Every list containing A will also contain B later in the list
- // So, after concatenating all lists, the final instance of B will have come from the same
- // original list as the final instance of A
- // So, the final instance of B will be later in the concatenation than the final A
- // So, keeping only the final instance of A and of B ensures that A is earlier in the output
- // list than B
- for _, dep := range directStaticDeps {
- orderedAllDeps = append(orderedAllDeps, dep)
- orderedAllDeps = append(orderedAllDeps, allTransitiveDeps[dep]...)
- }
- for _, dep := range directSharedDeps {
- orderedAllDeps = append(orderedAllDeps, dep)
- orderedAllDeps = append(orderedAllDeps, allTransitiveDeps[dep]...)
- }
-
- orderedAllDeps = android.LastUniquePaths(orderedAllDeps)
-
- // We don't want to add any new dependencies into directStaticDeps (to allow the caller to
- // intentionally exclude or replace any unwanted transitive dependencies), so we limit the
- // resultant list to only what the caller has chosen to include in directStaticDeps
- _, orderedDeclaredDeps = android.FilterPathList(orderedAllDeps, directStaticDeps)
-
- return orderedAllDeps, orderedDeclaredDeps
-}
-
-func orderStaticModuleDeps(module LinkableInterface, staticDeps []LinkableInterface, sharedDeps []LinkableInterface) (results []android.Path) {
- // convert Module to Path
- var depsInLinkOrder []android.Path
- allTransitiveDeps := make(map[android.Path][]android.Path, len(staticDeps))
- staticDepFiles := []android.Path{}
- for _, dep := range staticDeps {
- // The OutputFile may not be valid for a variant not present, and the AllowMissingDependencies flag is set.
- if dep.OutputFile().Valid() {
- allTransitiveDeps[dep.OutputFile().Path()] = dep.GetDepsInLinkOrder()
- staticDepFiles = append(staticDepFiles, dep.OutputFile().Path())
- }
- }
- sharedDepFiles := []android.Path{}
- for _, sharedDep := range sharedDeps {
- if sharedDep.HasStaticVariant() {
- staticAnalogue := sharedDep.GetStaticVariant()
- allTransitiveDeps[staticAnalogue.OutputFile().Path()] = staticAnalogue.GetDepsInLinkOrder()
- sharedDepFiles = append(sharedDepFiles, staticAnalogue.OutputFile().Path())
- }
- }
-
- // reorder the dependencies based on transitive dependencies
- depsInLinkOrder, results = orderDeps(staticDepFiles, sharedDepFiles, allTransitiveDeps)
- module.SetDepsInLinkOrder(depsInLinkOrder)
-
- return results
-}
-
func (c *Module) IsTestPerSrcAllTestsVariation() bool {
test, ok := c.linker.(testPerSrc)
return ok && test.isAllTestsVariation()
@@ -1878,7 +1687,7 @@
if m.UseSdk() {
return []blueprint.Variation{
{Mutator: "sdk", Variation: "sdk"},
- {Mutator: "ndk_api", Variation: m.SdkVersion()},
+ {Mutator: "version", Variation: m.SdkVersion()},
}
}
return []blueprint.Variation{
@@ -1896,29 +1705,11 @@
variations = append(variations, blueprint.Variation{Mutator: "version", Variation: version})
depTag.explicitlyVersioned = true
}
- var deps []blueprint.Module
- if far {
- deps = ctx.AddFarVariationDependencies(variations, depTag, name)
- } else {
- deps = ctx.AddVariationDependencies(variations, depTag, name)
- }
- // If the version is not specified, add dependency to all stubs libraries.
- // The stubs library will be used when the depending module is built for APEX and
- // the dependent module is not in the same APEX.
- if version == "" && CanBeOrLinkAgainstVersionVariants(c) {
- if dep, ok := deps[0].(*Module); ok {
- for _, ver := range dep.AllStubsVersions() {
- // Note that depTag.ExplicitlyVersioned is false in this case.
- versionVariations := append(variations,
- blueprint.Variation{Mutator: "version", Variation: ver})
- if far {
- ctx.AddFarVariationDependencies(versionVariations, depTag, name)
- } else {
- ctx.AddVariationDependencies(versionVariations, depTag, name)
- }
- }
- }
+ if far {
+ ctx.AddFarVariationDependencies(variations, depTag, name)
+ } else {
+ ctx.AddVariationDependencies(variations, depTag, name)
}
}
@@ -2016,16 +1807,9 @@
}
buildStubs := false
- if c.linker != nil {
- if library, ok := c.linker.(*libraryDecorator); ok {
- if library.buildStubs() {
- buildStubs = true
- }
- }
- if library, ok := c.linker.(*prebuiltLibraryLinker); ok {
- if library.buildStubs() {
- buildStubs = true
- }
+ if versioned, ok := c.linker.(versionedInterface); ok {
+ if versioned.buildStubs() {
+ buildStubs = true
}
}
@@ -2169,11 +1953,10 @@
actx.AddDependency(c, depTag, gen)
}
- actx.AddVariationDependencies(nil, objDepTag, deps.ObjFiles...)
-
vendorSnapshotObjects := vendorSnapshotObjects(actx.Config())
crtVariations := GetCrtVariations(ctx, c)
+ actx.AddVariationDependencies(crtVariations, objDepTag, deps.ObjFiles...)
if deps.CrtBegin != "" {
actx.AddVariationDependencies(crtVariations, CrtBeginDepTag,
rewriteSnapshotLibs(deps.CrtBegin, vendorSnapshotObjects))
@@ -2193,13 +1976,13 @@
ndkStubDepTag := libraryDependencyTag{Kind: sharedLibraryDependency, ndk: true, makeSuffix: "." + version}
actx.AddVariationDependencies([]blueprint.Variation{
- {Mutator: "ndk_api", Variation: version},
+ {Mutator: "version", Variation: version},
{Mutator: "link", Variation: "shared"},
}, ndkStubDepTag, variantNdkLibs...)
ndkLateStubDepTag := libraryDependencyTag{Kind: sharedLibraryDependency, Order: lateLibraryDependency, ndk: true, makeSuffix: "." + version}
actx.AddVariationDependencies([]blueprint.Variation{
- {Mutator: "ndk_api", Variation: version},
+ {Mutator: "version", Variation: version},
{Mutator: "link", Variation: "shared"},
}, ndkLateStubDepTag, variantLateNdkLibs...)
@@ -2384,19 +2167,49 @@
}
}
+// Returns the highest version which is <= maxSdkVersion.
+// For example, with maxSdkVersion is 10 and versionList is [9,11]
+// it returns 9 as string. The list of stubs must be in order from
+// oldest to newest.
+func (c *Module) chooseSdkVersion(ctx android.PathContext, stubsInfo []SharedLibraryStubsInfo,
+ maxSdkVersion android.ApiLevel) (SharedLibraryStubsInfo, error) {
+
+ for i := range stubsInfo {
+ stubInfo := stubsInfo[len(stubsInfo)-i-1]
+ var ver android.ApiLevel
+ if stubInfo.Version == "" {
+ ver = android.FutureApiLevel
+ } else {
+ var err error
+ ver, err = android.ApiLevelFromUser(ctx, stubInfo.Version)
+ if err != nil {
+ return SharedLibraryStubsInfo{}, err
+ }
+ }
+ if ver.LessThanOrEqualTo(maxSdkVersion) {
+ return stubInfo, nil
+ }
+ }
+ var versionList []string
+ for _, stubInfo := range stubsInfo {
+ versionList = append(versionList, stubInfo.Version)
+ }
+ return SharedLibraryStubsInfo{}, fmt.Errorf("not found a version(<=%s) in versionList: %v", maxSdkVersion.String(), versionList)
+}
+
// Convert dependencies to paths. Returns a PathDeps containing paths
func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
var depPaths PathDeps
- directStaticDeps := []LinkableInterface{}
- directSharedDeps := []LinkableInterface{}
+ var directStaticDeps []StaticLibraryInfo
+ var directSharedDeps []SharedLibraryInfo
- reexportExporter := func(exporter exportedFlagsProducer) {
- depPaths.ReexportedDirs = append(depPaths.ReexportedDirs, exporter.exportedDirs()...)
- depPaths.ReexportedSystemDirs = append(depPaths.ReexportedSystemDirs, exporter.exportedSystemDirs()...)
- depPaths.ReexportedFlags = append(depPaths.ReexportedFlags, exporter.exportedFlags()...)
- depPaths.ReexportedDeps = append(depPaths.ReexportedDeps, exporter.exportedDeps()...)
- depPaths.ReexportedGeneratedHeaders = append(depPaths.ReexportedGeneratedHeaders, exporter.exportedGeneratedHeaders()...)
+ reexportExporter := func(exporter FlagExporterInfo) {
+ depPaths.ReexportedDirs = append(depPaths.ReexportedDirs, exporter.IncludeDirs...)
+ depPaths.ReexportedSystemDirs = append(depPaths.ReexportedSystemDirs, exporter.SystemIncludeDirs...)
+ depPaths.ReexportedFlags = append(depPaths.ReexportedFlags, exporter.Flags...)
+ depPaths.ReexportedDeps = append(depPaths.ReexportedDeps, exporter.Deps...)
+ depPaths.ReexportedGeneratedHeaders = append(depPaths.ReexportedGeneratedHeaders, exporter.GeneratedHeaders...)
}
// For the dependency from platform to apex, use the latest stubs
@@ -2481,24 +2294,14 @@
return
}
- // re-exporting flags
if depTag == reuseObjTag {
// reusing objects only make sense for cc.Modules.
- if ccReuseDep, ok := ccDep.(*Module); ok && ccDep.CcLibraryInterface() {
- c.staticVariant = ccDep
- objs, exporter := ccReuseDep.compiler.(libraryInterface).reuseObjs()
- depPaths.Objs = depPaths.Objs.Append(objs)
- reexportExporter(exporter)
- return
- }
- }
-
- if depTag == staticVariantTag {
- // staticVariants are a cc.Module specific concept.
- if _, ok := ccDep.(*Module); ok && ccDep.CcLibraryInterface() {
- c.staticVariant = ccDep
- return
- }
+ staticAnalogue := ctx.OtherModuleProvider(dep, StaticLibraryInfoProvider).(StaticLibraryInfo)
+ objs := staticAnalogue.ReuseObjects
+ depPaths.Objs = depPaths.Objs.Append(objs)
+ depExporterInfo := ctx.OtherModuleProvider(dep, FlagExporterInfoProvider).(FlagExporterInfo)
+ reexportExporter(depExporterInfo)
+ return
}
checkLinkType(ctx, c, ccDep, depTag)
@@ -2511,103 +2314,7 @@
return
}
- if ccDep.CcLibrary() && !libDepTag.static() {
- depIsStubs := ccDep.BuildStubs()
- depHasStubs := CanBeOrLinkAgainstVersionVariants(c) && ccDep.HasStubsVariants()
- depInSameApexes := android.DirectlyInAllApexes(apexInfo, depName)
- depInPlatform := !dep.(android.ApexModule).AnyVariantDirectlyInAnyApex()
-
- var useThisDep bool
- if depIsStubs && libDepTag.explicitlyVersioned {
- // Always respect dependency to the versioned stubs (i.e. libX#10)
- useThisDep = true
- } else if !depHasStubs {
- // Use non-stub variant if that is the only choice
- // (i.e. depending on a lib without stubs.version property)
- useThisDep = true
- } else if apexInfo.IsForPlatform() {
- // If not building for APEX, use stubs only when it is from
- // an APEX (and not from platform)
- useThisDep = (depInPlatform != depIsStubs)
- if c.bootstrap() {
- // However, for host, ramdisk, recovery or bootstrap modules,
- // always link to non-stub variant
- useThisDep = !depIsStubs
- }
- // Another exception: if this module is bundled with an APEX, then
- // it is linked with the non-stub variant of a module in the APEX
- // as if this is part of the APEX.
- testFor := ctx.Provider(android.ApexTestForInfoProvider).(android.ApexTestForInfo)
- for _, apexContents := range testFor.ApexContents {
- if apexContents.DirectlyInApex(depName) {
- useThisDep = !depIsStubs
- break
- }
- }
- } else {
- // If building for APEX, use stubs when the parent is in any APEX that
- // the child is not in.
- useThisDep = (depInSameApexes != depIsStubs)
- }
-
- // when to use (unspecified) stubs, check min_sdk_version and choose the right one
- if useThisDep && depIsStubs && !libDepTag.explicitlyVersioned {
- versionToUse, err := c.ChooseSdkVersion(ctx, ccDep.StubsVersions(), c.apexSdkVersion)
- if err != nil {
- ctx.OtherModuleErrorf(dep, err.Error())
- return
- }
- if versionToUse != ccDep.StubsVersion() {
- useThisDep = false
- }
- }
-
- if !useThisDep {
- return // stop processing this dep
- }
- }
- if c.UseVndk() {
- if m, ok := ccDep.(*Module); ok && m.IsStubs() { // LLNDK
- // by default, use current version of LLNDK
- versionToUse := ""
- versions := m.AllStubsVersions()
- if apexInfo.ApexVariationName != "" && len(versions) > 0 {
- // if this is for use_vendor apex && dep has stubsVersions
- // apply the same rule of apex sdk enforcement to choose right version
- var err error
- versionToUse, err = c.ChooseSdkVersion(ctx, versions, c.apexSdkVersion)
- if err != nil {
- ctx.OtherModuleErrorf(dep, err.Error())
- return
- }
- }
- if versionToUse != ccDep.StubsVersion() {
- return
- }
- }
- }
-
- depPaths.IncludeDirs = append(depPaths.IncludeDirs, ccDep.IncludeDirs()...)
-
- // Exporting flags only makes sense for cc.Modules
- if _, ok := ccDep.(*Module); ok {
- if i, ok := ccDep.(*Module).linker.(exportedFlagsProducer); ok {
- depPaths.SystemIncludeDirs = append(depPaths.SystemIncludeDirs, i.exportedSystemDirs()...)
- depPaths.GeneratedDeps = append(depPaths.GeneratedDeps, i.exportedDeps()...)
- depPaths.Flags = append(depPaths.Flags, i.exportedFlags()...)
-
- if libDepTag.reexportFlags {
- reexportExporter(i)
- // Add these re-exported flags to help header-abi-dumper to infer the abi exported by a library.
- // Re-exported shared library headers must be included as well since they can help us with type information
- // about template instantiations (instantiated from their headers).
- // -isystem headers are not included since for bionic libraries, abi-filtering is taken care of by version
- // scripts.
- c.sabi.Properties.ReexportedIncludes = append(
- c.sabi.Properties.ReexportedIncludes, i.exportedDirs().Strings()...)
- }
- }
- }
+ depExporterInfo := ctx.OtherModuleProvider(dep, FlagExporterInfoProvider).(FlagExporterInfo)
var ptr *android.Paths
var depPtr *android.Paths
@@ -2618,6 +2325,64 @@
case libDepTag.header():
// nothing
case libDepTag.shared():
+ if !ctx.OtherModuleHasProvider(dep, SharedLibraryInfoProvider) {
+ if !ctx.Config().AllowMissingDependencies() {
+ ctx.ModuleErrorf("module %q is not a shared library", depName)
+ } else {
+ ctx.AddMissingDependencies([]string{depName})
+ }
+ return
+ }
+ sharedLibraryInfo := ctx.OtherModuleProvider(dep, SharedLibraryInfoProvider).(SharedLibraryInfo)
+ sharedLibraryStubsInfo := ctx.OtherModuleProvider(dep, SharedLibraryImplementationStubsInfoProvider).(SharedLibraryImplementationStubsInfo)
+
+ if !libDepTag.explicitlyVersioned && len(sharedLibraryStubsInfo.SharedLibraryStubsInfos) > 0 {
+ useStubs := false
+ if m, ok := ccDep.(*Module); ok && m.IsStubs() && c.UseVndk() { // LLNDK
+ if !apexInfo.IsForPlatform() {
+ // For platform libraries, use current version of LLNDK
+ // If this is for use_vendor apex we will apply the same rules
+ // of apex sdk enforcement below to choose right version.
+ useStubs = true
+ }
+ } else if apexInfo.IsForPlatform() {
+ // If not building for APEX, use stubs only when it is from
+ // an APEX (and not from platform)
+ // However, for host, ramdisk, recovery or bootstrap modules,
+ // always link to non-stub variant
+ useStubs = dep.(android.ApexModule).AnyVariantDirectlyInAnyApex() && !c.bootstrap()
+ // Another exception: if this module is bundled with an APEX, then
+ // it is linked with the non-stub variant of a module in the APEX
+ // as if this is part of the APEX.
+ testFor := ctx.Provider(android.ApexTestForInfoProvider).(android.ApexTestForInfo)
+ for _, apexContents := range testFor.ApexContents {
+ if apexContents.DirectlyInApex(depName) {
+ useStubs = false
+ break
+ }
+ }
+ } else {
+ // If building for APEX, use stubs when the parent is in any APEX that
+ // the child is not in.
+ useStubs = !android.DirectlyInAllApexes(apexInfo, depName)
+ }
+
+ // when to use (unspecified) stubs, check min_sdk_version and choose the right one
+ if useStubs {
+ sharedLibraryStubsInfo, err :=
+ c.chooseSdkVersion(ctx, sharedLibraryStubsInfo.SharedLibraryStubsInfos, c.apexSdkVersion)
+ if err != nil {
+ ctx.OtherModuleErrorf(dep, err.Error())
+ return
+ }
+ sharedLibraryInfo = sharedLibraryStubsInfo.SharedLibraryInfo
+ depExporterInfo = sharedLibraryStubsInfo.FlagExporterInfo
+ }
+ }
+
+ linkFile = android.OptionalPathForPath(sharedLibraryInfo.SharedLibrary)
+ depFile = sharedLibraryInfo.TableOfContents
+
ptr = &depPaths.SharedLibs
switch libDepTag.Order {
case earlyLibraryDependency:
@@ -2626,47 +2391,41 @@
case normalLibraryDependency:
ptr = &depPaths.SharedLibs
depPtr = &depPaths.SharedLibsDeps
- directSharedDeps = append(directSharedDeps, ccDep)
+ directSharedDeps = append(directSharedDeps, sharedLibraryInfo)
case lateLibraryDependency:
ptr = &depPaths.LateSharedLibs
depPtr = &depPaths.LateSharedLibsDeps
default:
panic(fmt.Errorf("unexpected library dependency order %d", libDepTag.Order))
}
- depFile = ccDep.Toc()
case libDepTag.static():
+ if !ctx.OtherModuleHasProvider(dep, StaticLibraryInfoProvider) {
+ if !ctx.Config().AllowMissingDependencies() {
+ ctx.ModuleErrorf("module %q is not a static library", depName)
+ } else {
+ ctx.AddMissingDependencies([]string{depName})
+ }
+ return
+ }
+ staticLibraryInfo := ctx.OtherModuleProvider(dep, StaticLibraryInfoProvider).(StaticLibraryInfo)
+ linkFile = android.OptionalPathForPath(staticLibraryInfo.StaticLibrary)
if libDepTag.wholeStatic {
ptr = &depPaths.WholeStaticLibs
- if !ccDep.CcLibraryInterface() || !ccDep.Static() {
- ctx.ModuleErrorf("module %q not a static library", depName)
- return
- }
-
- // Because the static library objects are included, this only makes sense
- // in the context of proper cc.Modules.
- if ccWholeStaticLib, ok := ccDep.(*Module); ok {
- staticLib := ccWholeStaticLib.linker.(libraryInterface)
- if objs := staticLib.objs(); len(objs.objFiles) > 0 {
- depPaths.WholeStaticLibObjs = depPaths.WholeStaticLibObjs.Append(objs)
- } else {
- // This case normally catches prebuilt static
- // libraries, but it can also occur when
- // AllowMissingDependencies is on and the
- // dependencies has no sources of its own
- // but has a whole_static_libs dependency
- // on a missing library. We want to depend
- // on the .a file so that there is something
- // in the dependency tree that contains the
- // error rule for the missing transitive
- // dependency.
- depPaths.WholeStaticLibsFromPrebuilts = append(depPaths.WholeStaticLibsFromPrebuilts, linkFile.Path())
- }
+ if len(staticLibraryInfo.Objects.objFiles) > 0 {
+ depPaths.WholeStaticLibObjs = depPaths.WholeStaticLibObjs.Append(staticLibraryInfo.Objects)
} else {
- ctx.ModuleErrorf(
- "non-cc.Modules cannot be included as whole static libraries.", depName)
- return
+ // This case normally catches prebuilt static
+ // libraries, but it can also occur when
+ // AllowMissingDependencies is on and the
+ // dependencies has no sources of its own
+ // but has a whole_static_libs dependency
+ // on a missing library. We want to depend
+ // on the .a file so that there is something
+ // in the dependency tree that contains the
+ // error rule for the missing transitive
+ // dependency.
+ depPaths.WholeStaticLibsFromPrebuilts = append(depPaths.WholeStaticLibsFromPrebuilts, linkFile.Path())
}
-
} else {
switch libDepTag.Order {
case earlyLibraryDependency:
@@ -2675,7 +2434,7 @@
// static dependencies will be handled separately so they can be ordered
// using transitive dependencies.
ptr = nil
- directStaticDeps = append(directStaticDeps, ccDep)
+ directStaticDeps = append(directStaticDeps, staticLibraryInfo)
case lateLibraryDependency:
ptr = &depPaths.LateStaticLibs
default:
@@ -2699,10 +2458,10 @@
staticLib.objs().coverageFiles...)
depPaths.StaticLibObjs.sAbiDumpFiles = append(depPaths.StaticLibObjs.sAbiDumpFiles,
staticLib.objs().sAbiDumpFiles...)
- } else if c, ok := ccDep.(LinkableInterface); ok {
+ } else {
// Handle non-CC modules here
depPaths.StaticLibObjs.coverageFiles = append(depPaths.StaticLibObjs.coverageFiles,
- c.CoverageFiles()...)
+ ccDep.CoverageFiles()...)
}
}
@@ -2726,6 +2485,22 @@
*depPtr = append(*depPtr, dep.Path())
}
+ depPaths.IncludeDirs = append(depPaths.IncludeDirs, depExporterInfo.IncludeDirs...)
+ depPaths.SystemIncludeDirs = append(depPaths.SystemIncludeDirs, depExporterInfo.SystemIncludeDirs...)
+ depPaths.GeneratedDeps = append(depPaths.GeneratedDeps, depExporterInfo.Deps...)
+ depPaths.Flags = append(depPaths.Flags, depExporterInfo.Flags...)
+
+ if libDepTag.reexportFlags {
+ reexportExporter(depExporterInfo)
+ // Add these re-exported flags to help header-abi-dumper to infer the abi exported by a library.
+ // Re-exported shared library headers must be included as well since they can help us with type information
+ // about template instantiations (instantiated from their headers).
+ // -isystem headers are not included since for bionic libraries, abi-filtering is taken care of by version
+ // scripts.
+ c.sabi.Properties.ReexportedIncludes = append(
+ c.sabi.Properties.ReexportedIncludes, depExporterInfo.IncludeDirs.Strings()...)
+ }
+
makeLibName := c.makeLibName(ctx, ccDep, depName) + libDepTag.makeSuffix
switch {
case libDepTag.header():
@@ -2779,7 +2554,9 @@
})
// use the ordered dependencies as this module's dependencies
- depPaths.StaticLibs = append(depPaths.StaticLibs, orderStaticModuleDeps(c, directStaticDeps, directSharedDeps)...)
+ orderedStaticPaths, transitiveStaticLibs := orderStaticModuleDeps(directStaticDeps, directSharedDeps)
+ depPaths.TranstiveStaticLibrariesForOrdering = transitiveStaticLibs
+ depPaths.StaticLibs = append(depPaths.StaticLibs, orderedStaticPaths...)
// Dedup exported flags from dependencies
depPaths.Flags = android.FirstUniqueStrings(depPaths.Flags)
@@ -2799,6 +2576,38 @@
return depPaths
}
+// orderStaticModuleDeps rearranges the order of the static library dependencies of the module
+// to match the topological order of the dependency tree, including any static analogues of
+// direct shared libraries. It returns the ordered static dependencies, and an android.DepSet
+// of the transitive dependencies.
+func orderStaticModuleDeps(staticDeps []StaticLibraryInfo, sharedDeps []SharedLibraryInfo) (ordered android.Paths, transitive *android.DepSet) {
+ transitiveStaticLibsBuilder := android.NewDepSetBuilder(android.TOPOLOGICAL)
+ var staticPaths android.Paths
+ for _, staticDep := range staticDeps {
+ staticPaths = append(staticPaths, staticDep.StaticLibrary)
+ transitiveStaticLibsBuilder.Transitive(staticDep.TransitiveStaticLibrariesForOrdering)
+ }
+ for _, sharedDep := range sharedDeps {
+ if sharedDep.StaticAnalogue != nil {
+ transitiveStaticLibsBuilder.Transitive(sharedDep.StaticAnalogue.TransitiveStaticLibrariesForOrdering)
+ }
+ }
+ transitiveStaticLibs := transitiveStaticLibsBuilder.Build()
+
+ orderedTransitiveStaticLibs := transitiveStaticLibs.ToList()
+
+ // reorder the dependencies based on transitive dependencies
+ staticPaths = android.FirstUniquePaths(staticPaths)
+ _, orderedStaticPaths := android.FilterPathList(orderedTransitiveStaticLibs, staticPaths)
+
+ if len(orderedStaticPaths) != len(staticPaths) {
+ missing, _ := android.FilterPathList(staticPaths, orderedStaticPaths)
+ panic(fmt.Errorf("expected %d ordered static paths , got %d, missing %q %q %q", len(staticPaths), len(orderedStaticPaths), missing, orderedStaticPaths, staticPaths))
+ }
+
+ return orderedStaticPaths, transitiveStaticLibs
+}
+
// baseLibName trims known prefixes and suffixes
func baseLibName(depName string) string {
libName := strings.TrimSuffix(depName, llndkLibrarySuffix)
@@ -3096,8 +2905,8 @@
return false
}
}
- if depTag == llndkImplDep {
- // We don't track beyond LLNDK
+ if depTag == stubImplDepTag || depTag == llndkImplDep {
+ // We don't track beyond LLNDK or from an implementation library to its stubs.
return false
}
return true
diff --git a/cc/cc_test.go b/cc/cc_test.go
index e0d4640..d1780cd 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -20,7 +20,6 @@
"os"
"path/filepath"
"reflect"
- "sort"
"strings"
"testing"
@@ -2890,59 +2889,6 @@
return modulesInOrder, allDeps
}
-func TestLinkReordering(t *testing.T) {
- for _, testCase := range staticLinkDepOrderTestCases {
- errs := []string{}
-
- // parse testcase
- _, givenTransitiveDeps := parseModuleDeps(testCase.inStatic)
- expectedModuleNames, expectedTransitiveDeps := parseModuleDeps(testCase.outOrdered)
- if testCase.allOrdered == "" {
- // allow the test case to skip specifying allOrdered
- testCase.allOrdered = testCase.outOrdered
- }
- _, expectedAllDeps := parseModuleDeps(testCase.allOrdered)
- _, givenAllSharedDeps := parseModuleDeps(testCase.inShared)
-
- // For each module whose post-reordered dependencies were specified, validate that
- // reordering the inputs produces the expected outputs.
- for _, moduleName := range expectedModuleNames {
- moduleDeps := givenTransitiveDeps[moduleName]
- givenSharedDeps := givenAllSharedDeps[moduleName]
- orderedAllDeps, orderedDeclaredDeps := orderDeps(moduleDeps, givenSharedDeps, givenTransitiveDeps)
-
- correctAllOrdered := expectedAllDeps[moduleName]
- if !reflect.DeepEqual(orderedAllDeps, correctAllOrdered) {
- errs = append(errs, fmt.Sprintf("orderDeps returned incorrect orderedAllDeps."+
- "\nin static:%q"+
- "\nin shared:%q"+
- "\nmodule: %v"+
- "\nexpected: %s"+
- "\nactual: %s",
- testCase.inStatic, testCase.inShared, moduleName, correctAllOrdered, orderedAllDeps))
- }
-
- correctOutputDeps := expectedTransitiveDeps[moduleName]
- if !reflect.DeepEqual(correctOutputDeps, orderedDeclaredDeps) {
- errs = append(errs, fmt.Sprintf("orderDeps returned incorrect orderedDeclaredDeps."+
- "\nin static:%q"+
- "\nin shared:%q"+
- "\nmodule: %v"+
- "\nexpected: %s"+
- "\nactual: %s",
- testCase.inStatic, testCase.inShared, moduleName, correctOutputDeps, orderedDeclaredDeps))
- }
- }
-
- if len(errs) > 0 {
- sort.Strings(errs)
- for _, err := range errs {
- t.Error(err)
- }
- }
- }
-}
-
func getOutputPaths(ctx *android.TestContext, variant string, moduleNames []string) (paths android.Paths) {
for _, moduleName := range moduleNames {
module := ctx.ModuleForTests(moduleName, variant).Module().(*Module)
@@ -2977,8 +2923,8 @@
variant := "android_arm64_armv8-a_static"
moduleA := ctx.ModuleForTests("a", variant).Module().(*Module)
- actual := moduleA.depsInLinkOrder
- expected := getOutputPaths(ctx, variant, []string{"c", "b", "d"})
+ actual := ctx.ModuleProvider(moduleA, StaticLibraryInfoProvider).(StaticLibraryInfo).TransitiveStaticLibrariesForOrdering.ToList()
+ expected := getOutputPaths(ctx, variant, []string{"a", "c", "b", "d"})
if !reflect.DeepEqual(actual, expected) {
t.Errorf("staticDeps orderings were not propagated correctly"+
@@ -3011,8 +2957,8 @@
variant := "android_arm64_armv8-a_static"
moduleA := ctx.ModuleForTests("a", variant).Module().(*Module)
- actual := moduleA.depsInLinkOrder
- expected := getOutputPaths(ctx, variant, []string{"c", "b"})
+ actual := ctx.ModuleProvider(moduleA, StaticLibraryInfoProvider).(StaticLibraryInfo).TransitiveStaticLibrariesForOrdering.ToList()
+ expected := getOutputPaths(ctx, variant, []string{"a", "c", "b"})
if !reflect.DeepEqual(actual, expected) {
t.Errorf("staticDeps orderings did not account for shared libs"+
@@ -3048,12 +2994,12 @@
`)
actual := ctx.ModuleVariantsForTests("libllndk.llndk")
expected := []string{
- "android_vendor.VER_arm64_armv8-a_shared",
"android_vendor.VER_arm64_armv8-a_shared_1",
"android_vendor.VER_arm64_armv8-a_shared_2",
- "android_vendor.VER_arm_armv7-a-neon_shared",
+ "android_vendor.VER_arm64_armv8-a_shared",
"android_vendor.VER_arm_armv7-a-neon_shared_1",
"android_vendor.VER_arm_armv7-a-neon_shared_2",
+ "android_vendor.VER_arm_armv7-a-neon_shared",
}
checkEquals(t, "variants for llndk stubs", expected, actual)
@@ -3582,7 +3528,7 @@
cc_binary {
name: "mybin",
srcs: ["foo.c"],
- static_libs: ["libfooB"],
+ static_libs: ["libfooC", "libfooB"],
static_executable: true,
stl: "none",
}
@@ -3603,8 +3549,8 @@
},
}`)
- mybin := ctx.ModuleForTests("mybin", "android_arm64_armv8-a").Module().(*Module)
- actual := mybin.depsInLinkOrder
+ mybin := ctx.ModuleForTests("mybin", "android_arm64_armv8-a").Rule("ld")
+ actual := mybin.Implicits[:2]
expected := getOutputPaths(ctx, "android_arm64_armv8-a_static", []string{"libfooB", "libfooC"})
if !reflect.DeepEqual(actual, expected) {
diff --git a/cc/kernel_headers.go b/cc/kernel_headers.go
index 796de62..9ea988a 100644
--- a/cc/kernel_headers.go
+++ b/cc/kernel_headers.go
@@ -26,6 +26,7 @@
if ctx.Device() {
f := &stub.libraryDecorator.flagExporter
f.reexportSystemDirs(android.PathsForSource(ctx, ctx.DeviceConfig().DeviceKernelHeaderDirs())...)
+ f.setProvider(ctx)
}
return stub.libraryDecorator.linkStatic(ctx, flags, deps, objs)
}
diff --git a/cc/library.go b/cc/library.go
index 35828aa..090abf9 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -121,7 +121,10 @@
}
type StaticOrSharedProperties struct {
- Srcs []string `android:"path,arch_variant"`
+ Srcs []string `android:"path,arch_variant"`
+
+ Sanitized Sanitized `android:"arch_variant"`
+
Cflags []string `android:"arch_variant"`
Enabled *bool `android:"arch_variant"`
@@ -291,36 +294,16 @@
f.headers = append(f.headers, headers...)
}
-func (f *flagExporter) exportedDirs() android.Paths {
- return f.dirs
+func (f *flagExporter) setProvider(ctx android.ModuleContext) {
+ ctx.SetProvider(FlagExporterInfoProvider, FlagExporterInfo{
+ IncludeDirs: f.dirs,
+ SystemIncludeDirs: f.systemDirs,
+ Flags: f.flags,
+ Deps: f.deps,
+ GeneratedHeaders: f.headers,
+ })
}
-func (f *flagExporter) exportedSystemDirs() android.Paths {
- return f.systemDirs
-}
-
-func (f *flagExporter) exportedFlags() []string {
- return f.flags
-}
-
-func (f *flagExporter) exportedDeps() android.Paths {
- return f.deps
-}
-
-func (f *flagExporter) exportedGeneratedHeaders() android.Paths {
- return f.headers
-}
-
-type exportedFlagsProducer interface {
- exportedDirs() android.Paths
- exportedSystemDirs() android.Paths
- exportedFlags() []string
- exportedDeps() android.Paths
- exportedGeneratedHeaders() android.Paths
-}
-
-var _ exportedFlagsProducer = (*flagExporter)(nil)
-
// libraryDecorator wraps baseCompiler, baseLinker and baseInstaller to provide library-specific
// functionality: static vs. shared linkage, reusing object files for shared libraries
type libraryDecorator struct {
@@ -366,7 +349,7 @@
// Location of the file that should be copied to dist dir when requested
distFile android.Path
- versionScriptPath android.ModuleGenPath
+ versionScriptPath android.OptionalPath
post_install_cmds []string
@@ -375,6 +358,8 @@
useCoreVariant bool
checkSameCoreVariant bool
+ skipAPIDefine bool
+
// Decorated interfaces
*baseCompiler
*baseLinker
@@ -396,7 +381,7 @@
// can't be globbed, and they should be manually collected.
// So, we first filter out intermediate directories (which contains generated headers)
// from exported directories, and then glob headers under remaining directories.
- for _, path := range append(l.exportedDirs(), l.exportedSystemDirs()...) {
+ for _, path := range append(android.CopyOfPaths(l.flagExporter.dirs), l.flagExporter.systemDirs...) {
dir := path.String()
// Skip if dir is for generated headers
if strings.HasPrefix(dir, android.PathForOutput(ctx).String()) {
@@ -448,7 +433,7 @@
}
// Collect generated headers
- for _, header := range append(l.exportedGeneratedHeaders(), l.exportedDeps()...) {
+ for _, header := range append(android.CopyOfPaths(l.flagExporter.headers), l.flagExporter.deps...) {
// TODO(b/148123511): remove exportedDeps after cleaning up genrule
if strings.HasSuffix(header.Base(), "-phony") {
continue
@@ -628,7 +613,7 @@
func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
if library.buildStubs() {
objs, versionScript := compileStubLibrary(ctx, flags, String(library.Properties.Stubs.Symbol_file), library.MutatedProperties.StubsVersion, "--apex")
- library.versionScriptPath = versionScript
+ library.versionScriptPath = android.OptionalPathForPath(versionScript)
return objs
}
@@ -678,10 +663,12 @@
}
type libraryInterface interface {
+ versionedInterface
+
static() bool
shared() bool
objs() Objects
- reuseObjs() (Objects, exportedFlagsProducer)
+ reuseObjs() Objects
toc() android.OptionalPath
// Returns true if the build options for the module have selected a static or shared build
@@ -698,6 +685,21 @@
availableFor(string) bool
}
+type versionedInterface interface {
+ buildStubs() bool
+ setBuildStubs()
+ hasStubsVariants() bool
+ setStubsVersion(string)
+ stubsVersion() string
+
+ stubsVersions(ctx android.BaseMutatorContext) []string
+ setAllStubsVersions([]string)
+ allStubsVersions() []string
+}
+
+var _ libraryInterface = (*libraryDecorator)(nil)
+var _ versionedInterface = (*libraryDecorator)(nil)
+
func (library *libraryDecorator) getLibNameHelper(baseModuleName string, useVndk bool) string {
name := library.libName
if name == "" {
@@ -886,6 +888,17 @@
ctx.CheckbuildFile(outputFile)
+ ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{
+ StaticLibrary: outputFile,
+ ReuseObjects: library.reuseObjects,
+ Objects: library.objects,
+
+ TransitiveStaticLibrariesForOrdering: android.NewDepSetBuilder(android.TOPOLOGICAL).
+ Direct(outputFile).
+ Transitive(deps.TranstiveStaticLibrariesForOrdering).
+ Build(),
+ })
+
return outputFile
}
@@ -922,15 +935,15 @@
linkerDeps = append(linkerDeps, forceWeakSymbols.Path())
}
}
- if library.buildStubs() {
+ if library.versionScriptPath.Valid() {
linkerScriptFlags := "-Wl,--version-script," + library.versionScriptPath.String()
flags.Local.LdFlags = append(flags.Local.LdFlags, linkerScriptFlags)
- linkerDeps = append(linkerDeps, library.versionScriptPath)
+ linkerDeps = append(linkerDeps, library.versionScriptPath.Path())
}
fileName := library.getLibName(ctx) + flags.Toolchain.ShlibSuffix()
outputFile := android.PathForModuleOut(ctx, fileName)
- ret := outputFile
+ unstrippedOutputFile := outputFile
var implicitOutputs android.WritablePaths
if ctx.Windows() {
@@ -1012,9 +1025,42 @@
objs.sAbiDumpFiles = append(objs.sAbiDumpFiles, deps.WholeStaticLibObjs.sAbiDumpFiles...)
library.coverageOutputFile = TransformCoverageFilesToZip(ctx, objs, library.getLibName(ctx))
- library.linkSAbiDumpFiles(ctx, objs, fileName, ret)
+ library.linkSAbiDumpFiles(ctx, objs, fileName, unstrippedOutputFile)
- return ret
+ var staticAnalogue *StaticLibraryInfo
+ if static := ctx.GetDirectDepsWithTag(staticVariantTag); len(static) > 0 {
+ s := ctx.OtherModuleProvider(static[0], StaticLibraryInfoProvider).(StaticLibraryInfo)
+ staticAnalogue = &s
+ }
+
+ ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
+ TableOfContents: android.OptionalPathForPath(tocFile),
+ SharedLibrary: unstrippedOutputFile,
+ UnstrippedSharedLibrary: library.unstrippedOutputFile,
+ CoverageSharedLibrary: library.coverageOutputFile,
+ StaticAnalogue: staticAnalogue,
+ })
+
+ stubs := ctx.GetDirectDepsWithTag(stubImplDepTag)
+ if len(stubs) > 0 {
+ var stubsInfo []SharedLibraryStubsInfo
+ for _, stub := range stubs {
+ stubInfo := ctx.OtherModuleProvider(stub, SharedLibraryInfoProvider).(SharedLibraryInfo)
+ flagInfo := ctx.OtherModuleProvider(stub, FlagExporterInfoProvider).(FlagExporterInfo)
+ stubsInfo = append(stubsInfo, SharedLibraryStubsInfo{
+ Version: stub.(*Module).StubsVersion(),
+ SharedLibraryInfo: stubInfo,
+ FlagExporterInfo: flagInfo,
+ })
+ }
+ ctx.SetProvider(SharedLibraryImplementationStubsInfoProvider, SharedLibraryImplementationStubsInfo{
+ SharedLibraryStubsInfos: stubsInfo,
+
+ IsLLNDK: ctx.isLlndk(ctx.Config()),
+ })
+ }
+
+ return unstrippedOutputFile
}
func (library *libraryDecorator) unstrippedOutputFilePath() android.Path {
@@ -1158,10 +1204,12 @@
library.addExportedGeneratedHeaders(library.baseCompiler.pathDeps...)
}
- if library.buildStubs() {
- library.reexportFlags("-D" + versioningMacroName(ctx.ModuleName()) + "=" + library.stubsVersion())
+ if library.buildStubs() && !library.skipAPIDefine {
+ library.reexportFlags("-D" + versioningMacroName(ctx.baseModuleName()) + "=" + library.stubsVersion())
}
+ library.flagExporter.setProvider(ctx)
+
return out
}
@@ -1179,8 +1227,8 @@
return library.objects
}
-func (library *libraryDecorator) reuseObjs() (Objects, exportedFlagsProducer) {
- return library.reuseObjects, &library.flagExporter
+func (library *libraryDecorator) reuseObjs() Objects {
+ return library.reuseObjects
}
func (library *libraryDecorator) toc() android.OptionalPath {
@@ -1324,10 +1372,34 @@
return nil
}
+func (library *libraryDecorator) hasStubsVariants() bool {
+ return len(library.Properties.Stubs.Versions) > 0
+}
+
+func (library *libraryDecorator) stubsVersions(ctx android.BaseMutatorContext) []string {
+ return library.Properties.Stubs.Versions
+}
+
+func (library *libraryDecorator) setStubsVersion(version string) {
+ library.MutatedProperties.StubsVersion = version
+}
+
func (library *libraryDecorator) stubsVersion() string {
return library.MutatedProperties.StubsVersion
}
+func (library *libraryDecorator) setBuildStubs() {
+ library.MutatedProperties.BuildStubs = true
+}
+
+func (library *libraryDecorator) setAllStubsVersions(versions []string) {
+ library.MutatedProperties.AllStubsVersions = versions
+}
+
+func (library *libraryDecorator) allStubsVersions() []string {
+ return library.MutatedProperties.AllStubsVersions
+}
+
func (library *libraryDecorator) isLatestStubVersion() bool {
versions := library.Properties.Stubs.Versions
return versions[len(versions)-1] == library.stubsVersion()
@@ -1423,10 +1495,10 @@
sharedCompiler.baseCompiler.Properties.Srcs
sharedCompiler.baseCompiler.Properties.Srcs = nil
sharedCompiler.baseCompiler.Properties.Generated_sources = nil
- } else {
- // This dep is just to reference static variant from shared variant
- mctx.AddInterVariantDependency(staticVariantTag, shared, static)
}
+
+ // This dep is just to reference static variant from shared variant
+ mctx.AddInterVariantDependency(staticVariantTag, shared, static)
}
}
@@ -1525,15 +1597,15 @@
func createVersionVariations(mctx android.BottomUpMutatorContext, versions []string) {
// "" is for the non-stubs (implementation) variant.
- variants := append([]string{""}, versions...)
+ variants := append(android.CopyOf(versions), "")
modules := mctx.CreateLocalVariations(variants...)
for i, m := range modules {
if variants[i] != "" {
m.(LinkableInterface).SetBuildStubs()
m.(LinkableInterface).SetStubsVersion(variants[i])
- // The stubs depend on the implementation
- mctx.AddInterVariantDependency(stubImplDepTag, modules[i], modules[0])
+ // The implementation depends on the stubs
+ mctx.AddInterVariantDependency(stubImplDepTag, modules[len(modules)-1], modules[i])
}
}
mctx.AliasVariation("")
@@ -1544,20 +1616,33 @@
mctx.CreateAliasVariation("latest", latestVersion)
}
+func createPerApiVersionVariations(mctx android.BottomUpMutatorContext, minSdkVersion string) {
+ from, err := nativeApiLevelFromUser(mctx, minSdkVersion)
+ if err != nil {
+ mctx.PropertyErrorf("min_sdk_version", err.Error())
+ return
+ }
+
+ versionStrs := ndkLibraryVersions(mctx, from)
+ modules := mctx.CreateLocalVariations(versionStrs...)
+
+ for i, module := range modules {
+ module.(*Module).Properties.Sdk_version = StringPtr(versionStrs[i])
+ }
+}
+
func CanBeOrLinkAgainstVersionVariants(module interface {
Host() bool
InRamdisk() bool
InRecovery() bool
- UseSdk() bool
}) bool {
- return !module.Host() && !module.InRamdisk() && !module.InRecovery() && !module.UseSdk()
+ return !module.Host() && !module.InRamdisk() && !module.InRecovery()
}
func CanBeVersionVariant(module interface {
Host() bool
InRamdisk() bool
InRecovery() bool
- UseSdk() bool
CcLibraryInterface() bool
Shared() bool
Static() bool
@@ -1570,29 +1655,18 @@
// and propagates the value from implementation libraries to llndk libraries with the same name.
func versionSelectorMutator(mctx android.BottomUpMutatorContext) {
if library, ok := mctx.Module().(LinkableInterface); ok && CanBeVersionVariant(library) {
-
- if library.CcLibrary() && library.BuildSharedVariant() && len(library.StubsVersions()) > 0 &&
- !library.IsSdkVariant() {
-
- versions := library.StubsVersions()
- normalizeVersions(mctx, versions)
- if mctx.Failed() {
+ if library.CcLibraryInterface() && library.BuildSharedVariant() {
+ versions := library.StubsVersions(mctx)
+ if len(versions) > 0 {
+ normalizeVersions(mctx, versions)
+ if mctx.Failed() {
+ return
+ }
+ // Set the versions on the pre-mutated module so they can be read by any llndk modules that
+ // depend on the implementation library and haven't been mutated yet.
+ library.SetAllStubsVersions(versions)
return
}
- // Set the versions on the pre-mutated module so they can be read by any llndk modules that
- // depend on the implementation library and haven't been mutated yet.
- library.SetAllStubsVersions(versions)
- return
- }
-
- if c, ok := library.(*Module); ok && c.IsStubs() {
- // Get the versions from the implementation module.
- impls := mctx.GetDirectDepsWithTag(llndkImplDep)
- if len(impls) > 1 {
- panic(fmt.Errorf("Expected single implmenetation library, got %d", len(impls)))
- } else if len(impls) == 1 {
- c.SetAllStubsVersions(impls[0].(*Module).AllStubsVersions())
- }
}
}
}
@@ -1602,6 +1676,16 @@
func versionMutator(mctx android.BottomUpMutatorContext) {
if library, ok := mctx.Module().(LinkableInterface); ok && CanBeVersionVariant(library) {
createVersionVariations(mctx, library.AllStubsVersions())
+ return
+ }
+
+ if m, ok := mctx.Module().(*Module); ok {
+ if m.SplitPerApiLevel() && m.IsSdkVariant() {
+ if mctx.Os() != android.Android {
+ return
+ }
+ createPerApiVersionVariations(mctx, m.MinSdkVersion())
+ }
}
}
diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go
index 765fe71..fcf6069 100644
--- a/cc/library_sdk_member.go
+++ b/cc/library_sdk_member.go
@@ -391,10 +391,12 @@
p.outputFile = getRequiredMemberOutputFile(ctx, ccModule)
}
+ exportedInfo := ctx.SdkModuleContext().OtherModuleProvider(variant, FlagExporterInfoProvider).(FlagExporterInfo)
+
// Separate out the generated include dirs (which are arch specific) from the
// include dirs (which may not be).
exportedIncludeDirs, exportedGeneratedIncludeDirs := android.FilterPathListPredicate(
- ccModule.ExportedIncludeDirs(), isGeneratedHeaderDirectory)
+ exportedInfo.IncludeDirs, isGeneratedHeaderDirectory)
p.name = variant.Name()
p.archType = ccModule.Target().Arch.ArchType.String()
@@ -405,10 +407,10 @@
// Take a copy before filtering out duplicates to avoid changing the slice owned by the
// ccModule.
- dirs := append(android.Paths(nil), ccModule.ExportedSystemIncludeDirs()...)
+ dirs := append(android.Paths(nil), exportedInfo.SystemIncludeDirs...)
p.ExportedSystemIncludeDirs = android.FirstUniquePaths(dirs)
- p.ExportedFlags = ccModule.ExportedFlags()
+ p.ExportedFlags = exportedInfo.Flags
if ccModule.linker != nil {
specifiedDeps := specifiedDeps{}
specifiedDeps = ccModule.linker.linkerSpecifiedDeps(specifiedDeps)
@@ -419,7 +421,7 @@
}
p.SystemSharedLibs = specifiedDeps.systemSharedLibs
}
- p.exportedGeneratedHeaders = ccModule.ExportedGeneratedHeaders()
+ p.exportedGeneratedHeaders = exportedInfo.GeneratedHeaders
if ccModule.HasStubsVariants() {
// TODO(b/169373910): 1. Only output the specific version (from
diff --git a/cc/linkable.go b/cc/linkable.go
index a67cd4e..4eb7220 100644
--- a/cc/linkable.go
+++ b/cc/linkable.go
@@ -14,16 +14,9 @@
OutputFile() android.OptionalPath
CoverageFiles() android.Paths
- IncludeDirs() android.Paths
- SetDepsInLinkOrder([]android.Path)
- GetDepsInLinkOrder() []android.Path
-
- HasStaticVariant() bool
- GetStaticVariant() LinkableInterface
-
NonCcVariants() bool
- StubsVersions() []string
+ StubsVersions(android.BaseMutatorContext) []string
BuildStubs() bool
SetBuildStubs()
SetStubsVersion(string)
@@ -80,3 +73,54 @@
func StaticDepTag() blueprint.DependencyTag {
return libraryDependencyTag{Kind: staticLibraryDependency}
}
+
+type SharedLibraryInfo struct {
+ SharedLibrary android.Path
+ UnstrippedSharedLibrary android.Path
+
+ TableOfContents android.OptionalPath
+ CoverageSharedLibrary android.OptionalPath
+
+ StaticAnalogue *StaticLibraryInfo
+}
+
+var SharedLibraryInfoProvider = blueprint.NewProvider(SharedLibraryInfo{})
+
+type SharedLibraryImplementationStubsInfo struct {
+ SharedLibraryStubsInfos []SharedLibraryStubsInfo
+
+ IsLLNDK bool
+}
+
+var SharedLibraryImplementationStubsInfoProvider = blueprint.NewProvider(SharedLibraryImplementationStubsInfo{})
+
+type SharedLibraryStubsInfo struct {
+ Version string
+ SharedLibraryInfo SharedLibraryInfo
+ FlagExporterInfo FlagExporterInfo
+}
+
+var SharedLibraryStubsInfoProvider = blueprint.NewProvider(SharedLibraryStubsInfo{})
+
+type StaticLibraryInfo struct {
+ StaticLibrary android.Path
+ Objects Objects
+ ReuseObjects Objects
+
+ // This isn't the actual transitive DepSet, shared library dependencies have been
+ // converted into static library analogues. It is only used to order the static
+ // library dependencies that were specified for the current module.
+ TransitiveStaticLibrariesForOrdering *android.DepSet
+}
+
+var StaticLibraryInfoProvider = blueprint.NewProvider(StaticLibraryInfo{})
+
+type FlagExporterInfo struct {
+ IncludeDirs android.Paths
+ SystemIncludeDirs android.Paths
+ Flags []string
+ Deps android.Paths
+ GeneratedHeaders android.Paths
+}
+
+var FlagExporterInfoProvider = blueprint.NewProvider(FlagExporterInfo{})
diff --git a/cc/llndk_library.go b/cc/llndk_library.go
index a429063..4425a10 100644
--- a/cc/llndk_library.go
+++ b/cc/llndk_library.go
@@ -15,17 +15,14 @@
package cc
import (
+ "fmt"
"path/filepath"
"strings"
"android/soong/android"
-
- "github.com/google/blueprint"
)
-var llndkImplDep = struct {
- blueprint.DependencyTag
-}{}
+var llndkImplDep = dependencyTag{name: "llndk impl"}
var (
llndkLibrarySuffix = ".llndk"
@@ -72,9 +69,6 @@
Properties llndkLibraryProperties
- exportHeadersTimestamp android.OptionalPath
- versionScriptPath android.ModuleGenPath
-
movedToApex bool
}
@@ -93,7 +87,9 @@
vndkVer = stub.stubsVersion()
}
objs, versionScript := compileStubLibrary(ctx, flags, String(stub.Properties.Symbol_file), vndkVer, "--llndk")
- stub.versionScriptPath = versionScript
+ if !Bool(stub.Properties.Unversioned) {
+ stub.versionScriptPath = android.OptionalPathForPath(versionScript)
+ }
return objs
}
@@ -142,12 +138,6 @@
stub.movedToApex = implApexModule.DirectlyInAnyApex()
}
- if !Bool(stub.Properties.Unversioned) {
- linkerScriptFlag := "-Wl,--version-script," + stub.versionScriptPath.String()
- flags.Local.LdFlags = append(flags.Local.LdFlags, linkerScriptFlag)
- flags.LdFlagsDeps = append(flags.LdFlagsDeps, stub.versionScriptPath)
- }
-
if len(stub.Properties.Export_preprocessed_headers) > 0 {
genHeaderOutDir := android.PathForModuleGen(ctx, "include")
@@ -170,10 +160,6 @@
stub.libraryDecorator.flagExporter.Properties.Export_include_dirs = []string{}
}
- if stub.stubsVersion() != "" {
- stub.reexportFlags("-D" + versioningMacroName(ctx.baseModuleName()) + "=" + stub.stubsVersion())
- }
-
return stub.libraryDecorator.link(ctx, flags, deps, objs)
}
@@ -181,6 +167,21 @@
return false
}
+func (stub *llndkStubDecorator) buildStubs() bool {
+ return true
+}
+
+func (stub *llndkStubDecorator) stubsVersions(ctx android.BaseMutatorContext) []string {
+ // Get the versions from the implementation module.
+ impls := ctx.GetDirectDepsWithTag(llndkImplDep)
+ if len(impls) > 1 {
+ panic(fmt.Errorf("Expected single implmenetation library, got %d", len(impls)))
+ } else if len(impls) == 1 {
+ return impls[0].(*Module).AllStubsVersions()
+ }
+ return nil
+}
+
func NewLLndkStubLibrary() *Module {
module, library := NewLibrary(android.DeviceSupported)
library.BuildOnlyShared()
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index 5682d1c..f2ad652 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -80,9 +80,6 @@
// https://github.com/android-ndk/ndk/issues/265.
Unversioned_until *string
- // Use via apiLevel on the stubDecorator.
- ApiLevel string `blueprint:"mutated"`
-
// True if this API is not yet ready to be shipped in the NDK. It will be
// available in the platform for testing, but will be excluded from the
// sysroot provided to the NDK proper.
@@ -107,9 +104,7 @@
return stub.apiLevel.GreaterThanOrEqualTo(stub.unversionedUntil)
}
-func generatePerApiVariants(ctx android.BottomUpMutatorContext, m *Module,
- from android.ApiLevel, perSplit func(*Module, android.ApiLevel)) {
-
+func ndkLibraryVersions(ctx android.BaseMutatorContext, from android.ApiLevel) []string {
var versions []android.ApiLevel
versionStrs := []string{}
for _, version := range ctx.Config().AllSupportedApiLevels() {
@@ -118,56 +113,26 @@
versionStrs = append(versionStrs, version.String())
}
}
- versions = append(versions, android.FutureApiLevel)
versionStrs = append(versionStrs, android.FutureApiLevel.String())
- modules := ctx.CreateVariations(versionStrs...)
- for i, module := range modules {
- perSplit(module.(*Module), versions[i])
- }
+ return versionStrs
}
-func NdkApiMutator(ctx android.BottomUpMutatorContext) {
- if m, ok := ctx.Module().(*Module); ok {
- if m.Enabled() {
- if compiler, ok := m.compiler.(*stubDecorator); ok {
- if ctx.Os() != android.Android {
- // These modules are always android.DeviceEnabled only, but
- // those include Fuchsia devices, which we don't support.
- ctx.Module().Disable()
- return
- }
- firstVersion, err := nativeApiLevelFromUser(ctx,
- String(compiler.properties.First_version))
- if err != nil {
- ctx.PropertyErrorf("first_version", err.Error())
- return
- }
- generatePerApiVariants(ctx, m, firstVersion,
- func(m *Module, version android.ApiLevel) {
- m.compiler.(*stubDecorator).properties.ApiLevel =
- version.String()
- })
- } else if m.SplitPerApiLevel() && m.IsSdkVariant() {
- if ctx.Os() != android.Android {
- return
- }
- from, err := nativeApiLevelFromUser(ctx, m.MinSdkVersion())
- if err != nil {
- ctx.PropertyErrorf("min_sdk_version", err.Error())
- return
- }
- generatePerApiVariants(ctx, m, from,
- func(m *Module, version android.ApiLevel) {
- m.Properties.Sdk_version = StringPtr(version.String())
- })
- }
- }
+func (this *stubDecorator) stubsVersions(ctx android.BaseMutatorContext) []string {
+ if !ctx.Module().Enabled() {
+ return nil
}
+ firstVersion, err := nativeApiLevelFromUser(ctx,
+ String(this.properties.First_version))
+ if err != nil {
+ ctx.PropertyErrorf("first_version", err.Error())
+ return nil
+ }
+ return ndkLibraryVersions(ctx, firstVersion)
}
func (this *stubDecorator) initializeProperties(ctx BaseModuleContext) bool {
- this.apiLevel = nativeApiLevelOrPanic(ctx, this.properties.ApiLevel)
+ this.apiLevel = nativeApiLevelOrPanic(ctx, this.stubsVersion())
var err error
this.firstVersion, err = nativeApiLevelFromUser(ctx,
@@ -280,6 +245,11 @@
ctx.PropertyErrorf("symbol_file", "must end with .map.txt")
}
+ if !c.buildStubs() {
+ // NDK libraries have no implementation variant, nothing to do
+ return Objects{}
+ }
+
if !c.initializeProperties(ctx) {
// Emits its own errors, so we don't need to.
return Objects{}
@@ -311,12 +281,18 @@
func (stub *stubDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps,
objs Objects) android.Path {
+ if !stub.buildStubs() {
+ // NDK libraries have no implementation variant, nothing to do
+ return nil
+ }
+
if shouldUseVersionScript(ctx, stub) {
linkerScriptFlag := "-Wl,--version-script," + stub.versionScriptPath.String()
flags.Local.LdFlags = append(flags.Local.LdFlags, linkerScriptFlag)
flags.LdFlagsDeps = append(flags.LdFlagsDeps, stub.versionScriptPath)
}
+ stub.libraryDecorator.skipAPIDefine = true
return stub.libraryDecorator.link(ctx, flags, deps, objs)
}
diff --git a/cc/ndk_prebuilt.go b/cc/ndk_prebuilt.go
index acdc581..793ab37 100644
--- a/cc/ndk_prebuilt.go
+++ b/cc/ndk_prebuilt.go
@@ -166,7 +166,7 @@
ctx.ModuleErrorf("NDK prebuilt libraries must have an ndk_lib prefixed name")
}
- ndk.exportIncludesAsSystem(ctx)
+ ndk.libraryDecorator.flagExporter.exportIncludesAsSystem(ctx)
libName := strings.TrimPrefix(ctx.ModuleName(), "ndk_")
libExt := flags.Toolchain.ShlibSuffix()
@@ -175,5 +175,23 @@
}
libDir := getNdkStlLibDir(ctx)
- return libDir.Join(ctx, libName+libExt)
+ lib := libDir.Join(ctx, libName+libExt)
+
+ ndk.libraryDecorator.flagExporter.setProvider(ctx)
+
+ if ndk.static() {
+ depSet := android.NewDepSetBuilder(android.TOPOLOGICAL).Direct(lib).Build()
+ ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{
+ StaticLibrary: lib,
+
+ TransitiveStaticLibrariesForOrdering: depSet,
+ })
+ } else {
+ ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
+ SharedLibrary: lib,
+ UnstrippedSharedLibrary: lib,
+ })
+ }
+
+ return lib
}
diff --git a/cc/ndk_sysroot.go b/cc/ndk_sysroot.go
index 56fd54b..b6733c2 100644
--- a/cc/ndk_sysroot.go
+++ b/cc/ndk_sysroot.go
@@ -131,7 +131,7 @@
}
if m, ok := module.(*Module); ok {
- if installer, ok := m.installer.(*stubDecorator); ok {
+ if installer, ok := m.installer.(*stubDecorator); ok && m.BuildStubs() {
if ctx.Config().ExcludeDraftNdkApis() &&
installer.properties.Draft {
return
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index 9d1b016..45d3eb1 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -38,10 +38,11 @@
}
type prebuiltLinkerProperties struct {
-
// a prebuilt library or binary. Can reference a genrule module that generates an executable file.
Srcs []string `android:"path,arch_variant"`
+ Sanitized Sanitized `android:"arch_variant"`
+
// Check the prebuilt ELF files (e.g. DT_SONAME, DT_NEEDED, resolution of undefined
// symbols, etc), default true.
Check_elf_files *bool
@@ -97,15 +98,17 @@
func (p *prebuiltLibraryLinker) link(ctx ModuleContext,
flags Flags, deps PathDeps, objs Objects) android.Path {
- p.libraryDecorator.exportIncludes(ctx)
- p.libraryDecorator.reexportDirs(deps.ReexportedDirs...)
- p.libraryDecorator.reexportSystemDirs(deps.ReexportedSystemDirs...)
- p.libraryDecorator.reexportFlags(deps.ReexportedFlags...)
- p.libraryDecorator.reexportDeps(deps.ReexportedDeps...)
- p.libraryDecorator.addExportedGeneratedHeaders(deps.ReexportedGeneratedHeaders...)
+ p.libraryDecorator.flagExporter.exportIncludes(ctx)
+ p.libraryDecorator.flagExporter.reexportDirs(deps.ReexportedDirs...)
+ p.libraryDecorator.flagExporter.reexportSystemDirs(deps.ReexportedSystemDirs...)
+ p.libraryDecorator.flagExporter.reexportFlags(deps.ReexportedFlags...)
+ p.libraryDecorator.flagExporter.reexportDeps(deps.ReexportedDeps...)
+ p.libraryDecorator.flagExporter.addExportedGeneratedHeaders(deps.ReexportedGeneratedHeaders...)
+
+ p.libraryDecorator.flagExporter.setProvider(ctx)
// TODO(ccross): verify shared library dependencies
- srcs := p.prebuiltSrcs()
+ srcs := p.prebuiltSrcs(ctx)
if len(srcs) > 0 {
builderFlags := flagsToBuilderFlags(flags)
@@ -117,6 +120,12 @@
in := android.PathForModuleSrc(ctx, srcs[0])
if p.static() {
+ depSet := android.NewDepSetBuilder(android.TOPOLOGICAL).Direct(in).Build()
+ ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{
+ StaticLibrary: in,
+
+ TransitiveStaticLibrariesForOrdering: depSet,
+ })
return in
}
@@ -170,6 +179,13 @@
},
})
+ ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
+ SharedLibrary: outputFile,
+ UnstrippedSharedLibrary: p.unstrippedOutputFile,
+
+ TableOfContents: p.tocFile,
+ })
+
return outputFile
}
}
@@ -177,15 +193,18 @@
return nil
}
-func (p *prebuiltLibraryLinker) prebuiltSrcs() []string {
+func (p *prebuiltLibraryLinker) prebuiltSrcs(ctx android.BaseModuleContext) []string {
+ sanitize := ctx.Module().(*Module).sanitize
srcs := p.properties.Srcs
+ srcs = append(srcs, srcsForSanitizer(sanitize, p.properties.Sanitized)...)
if p.static() {
srcs = append(srcs, p.libraryDecorator.StaticProperties.Static.Srcs...)
+ srcs = append(srcs, srcsForSanitizer(sanitize, p.libraryDecorator.StaticProperties.Static.Sanitized)...)
}
if p.shared() {
srcs = append(srcs, p.libraryDecorator.SharedProperties.Shared.Srcs...)
+ srcs = append(srcs, srcsForSanitizer(sanitize, p.libraryDecorator.SharedProperties.Shared.Sanitized)...)
}
-
return srcs
}
@@ -212,8 +231,8 @@
module.AddProperties(&prebuilt.properties)
- srcsSupplier := func() []string {
- return prebuilt.prebuiltSrcs()
+ srcsSupplier := func(ctx android.BaseModuleContext) []string {
+ return prebuilt.prebuiltSrcs(ctx)
}
android.InitPrebuiltModuleWithSrcSupplier(module, srcsSupplier, "srcs")
@@ -425,3 +444,28 @@
android.InitPrebuiltModule(module, &prebuilt.properties.Srcs)
return module, binary
}
+
+type Sanitized struct {
+ None struct {
+ Srcs []string `android:"path,arch_variant"`
+ } `android:"arch_variant"`
+ Address struct {
+ Srcs []string `android:"path,arch_variant"`
+ } `android:"arch_variant"`
+ Hwaddress struct {
+ Srcs []string `android:"path,arch_variant"`
+ } `android:"arch_variant"`
+}
+
+func srcsForSanitizer(sanitize *sanitize, sanitized Sanitized) []string {
+ if sanitize == nil {
+ return nil
+ }
+ if Bool(sanitize.Properties.Sanitize.Address) && sanitized.Address.Srcs != nil {
+ return sanitized.Address.Srcs
+ }
+ if Bool(sanitize.Properties.Sanitize.Hwaddress) && sanitized.Hwaddress.Srcs != nil {
+ return sanitized.Hwaddress.Srcs
+ }
+ return sanitized.None.Srcs
+}
diff --git a/cc/prebuilt_test.go b/cc/prebuilt_test.go
index 52416ac..1f070a5 100644
--- a/cc/prebuilt_test.go
+++ b/cc/prebuilt_test.go
@@ -23,7 +23,7 @@
"github.com/google/blueprint"
)
-func testPrebuilt(t *testing.T, bp string, fs map[string][]byte) *android.TestContext {
+func testPrebuilt(t *testing.T, bp string, fs map[string][]byte, handlers ...configCustomizer) *android.TestContext {
config := TestConfig(buildDir, android.Android, nil, bp, fs)
ctx := CreateTestContext()
@@ -34,6 +34,10 @@
android.RegisterAndroidMkBuildComponents(ctx)
android.SetInMakeForTests(config)
+ for _, handler := range handlers {
+ handler(config)
+ }
+
ctx.Register(config)
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
android.FailIfErrored(t, errs)
@@ -42,6 +46,8 @@
return ctx
}
+type configCustomizer func(config android.Config)
+
func TestPrebuilt(t *testing.T) {
bp := `
cc_library {
@@ -321,3 +327,62 @@
assertString(t, libfooDep.String(),
filepath.Join(buildDir, ".intermediates/libfoo/linux_glibc_x86_64_shared/libfoo.so"))
}
+
+func TestPrebuiltLibrarySanitized(t *testing.T) {
+ bp := `cc_prebuilt_library {
+ name: "libtest",
+ static: {
+ sanitized: { none: { srcs: ["libf.a"], }, hwaddress: { srcs: ["libf.hwasan.a"], }, },
+ },
+ shared: {
+ sanitized: { none: { srcs: ["libf.so"], }, hwaddress: { srcs: ["hwasan/libf.so"], }, },
+ },
+ }
+ cc_prebuilt_library_static {
+ name: "libtest_static",
+ sanitized: { none: { srcs: ["libf.a"], }, hwaddress: { srcs: ["libf.hwasan.a"], }, },
+ }
+ cc_prebuilt_library_shared {
+ name: "libtest_shared",
+ sanitized: { none: { srcs: ["libf.so"], }, hwaddress: { srcs: ["hwasan/libf.so"], }, },
+ }`
+
+ fs := map[string][]byte{
+ "libf.a": nil,
+ "libf.hwasan.a": nil,
+ "libf.so": nil,
+ "hwasan/libf.so": nil,
+ }
+
+ // Without SANITIZE_TARGET.
+ ctx := testPrebuilt(t, bp, fs)
+
+ shared_rule := ctx.ModuleForTests("libtest", "android_arm64_armv8-a_shared").Rule("android/soong/cc.strip")
+ assertString(t, shared_rule.Input.String(), "libf.so")
+
+ static := ctx.ModuleForTests("libtest", "android_arm64_armv8-a_static").Module().(*Module)
+ assertString(t, static.OutputFile().Path().Base(), "libf.a")
+
+ shared_rule2 := ctx.ModuleForTests("libtest_shared", "android_arm64_armv8-a_shared").Rule("android/soong/cc.strip")
+ assertString(t, shared_rule2.Input.String(), "libf.so")
+
+ static2 := ctx.ModuleForTests("libtest_static", "android_arm64_armv8-a_static").Module().(*Module)
+ assertString(t, static2.OutputFile().Path().Base(), "libf.a")
+
+ // With SANITIZE_TARGET=hwaddress
+ ctx = testPrebuilt(t, bp, fs, func(config android.Config) {
+ config.TestProductVariables.SanitizeDevice = []string{"hwaddress"}
+ })
+
+ shared_rule = ctx.ModuleForTests("libtest", "android_arm64_armv8-a_shared_hwasan").Rule("android/soong/cc.strip")
+ assertString(t, shared_rule.Input.String(), "hwasan/libf.so")
+
+ static = ctx.ModuleForTests("libtest", "android_arm64_armv8-a_static_hwasan").Module().(*Module)
+ assertString(t, static.OutputFile().Path().Base(), "libf.hwasan.a")
+
+ shared_rule2 = ctx.ModuleForTests("libtest_shared", "android_arm64_armv8-a_shared_hwasan").Rule("android/soong/cc.strip")
+ assertString(t, shared_rule2.Input.String(), "hwasan/libf.so")
+
+ static2 = ctx.ModuleForTests("libtest_static", "android_arm64_armv8-a_static_hwasan").Module().(*Module)
+ assertString(t, static2.OutputFile().Path().Base(), "libf.hwasan.a")
+}
diff --git a/cc/snapshot_utils.go b/cc/snapshot_utils.go
index b72af44..238508d 100644
--- a/cc/snapshot_utils.go
+++ b/cc/snapshot_utils.go
@@ -22,7 +22,6 @@
)
type snapshotLibraryInterface interface {
- exportedFlagsProducer
libraryInterface
collectHeadersForSnapshot(ctx android.ModuleContext)
snapshotHeaders() android.Paths
diff --git a/cc/toolchain_library.go b/cc/toolchain_library.go
index 19f5ea4..8c546c5 100644
--- a/cc/toolchain_library.go
+++ b/cc/toolchain_library.go
@@ -84,24 +84,31 @@
}
srcPath := android.PathForSource(ctx, *library.Properties.Src)
-
- if library.stripper.StripProperties.Strip.Keep_symbols_list != nil {
- fileName := ctx.ModuleName() + staticLibraryExtension
- outputFile := android.PathForModuleOut(ctx, fileName)
- stripFlags := flagsToStripFlags(flags)
- library.stripper.StripStaticLib(ctx, srcPath, outputFile, stripFlags)
- return outputFile
- }
+ outputFile := android.Path(srcPath)
if library.Properties.Repack_objects_to_keep != nil {
fileName := ctx.ModuleName() + staticLibraryExtension
- outputFile := android.PathForModuleOut(ctx, fileName)
- TransformArchiveRepack(ctx, srcPath, outputFile, library.Properties.Repack_objects_to_keep)
-
- return outputFile
+ repackedPath := android.PathForModuleOut(ctx, fileName)
+ TransformArchiveRepack(ctx, outputFile, repackedPath, library.Properties.Repack_objects_to_keep)
+ outputFile = repackedPath
}
- return srcPath
+ if library.stripper.StripProperties.Strip.Keep_symbols_list != nil {
+ fileName := ctx.ModuleName() + staticLibraryExtension
+ strippedPath := android.PathForModuleOut(ctx, fileName)
+ stripFlags := flagsToStripFlags(flags)
+ library.stripper.StripStaticLib(ctx, outputFile, strippedPath, stripFlags)
+ outputFile = strippedPath
+ }
+
+ depSet := android.NewDepSetBuilder(android.TOPOLOGICAL).Direct(outputFile).Build()
+ ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{
+ StaticLibrary: outputFile,
+
+ TransitiveStaticLibrariesForOrdering: depSet,
+ })
+
+ return outputFile
}
func (library *toolchainLibraryDecorator) nativeCoverage() bool {
diff --git a/cc/vendor_snapshot.go b/cc/vendor_snapshot.go
index 529ed60..4c206e6 100644
--- a/cc/vendor_snapshot.go
+++ b/cc/vendor_snapshot.go
@@ -223,6 +223,22 @@
tocFile := android.PathForModuleOut(ctx, libName+".toc")
p.tocFile = android.OptionalPathForPath(tocFile)
TransformSharedObjectToToc(ctx, in, tocFile, builderFlags)
+
+ ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
+ SharedLibrary: in,
+ UnstrippedSharedLibrary: p.unstrippedOutputFile,
+
+ TableOfContents: p.tocFile,
+ })
+ }
+
+ if p.static() {
+ depSet := android.NewDepSetBuilder(android.TOPOLOGICAL).Direct(in).Build()
+ ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{
+ StaticLibrary: in,
+
+ TransitiveStaticLibrariesForOrdering: depSet,
+ })
}
return in
@@ -735,13 +751,14 @@
var propOut string
if l, ok := m.linker.(snapshotLibraryInterface); ok {
+ exporterInfo := ctx.ModuleProvider(m, FlagExporterInfoProvider).(FlagExporterInfo)
// library flags
- prop.ExportedFlags = l.exportedFlags()
- for _, dir := range l.exportedDirs() {
+ prop.ExportedFlags = exporterInfo.Flags
+ for _, dir := range exporterInfo.IncludeDirs {
prop.ExportedDirs = append(prop.ExportedDirs, filepath.Join("include", dir.String()))
}
- for _, dir := range l.exportedSystemDirs() {
+ for _, dir := range exporterInfo.SystemIncludeDirs {
prop.ExportedSystemDirs = append(prop.ExportedSystemDirs, filepath.Join("include", dir.String()))
}
// shared libs dependencies aren't meaningful on static or header libs
diff --git a/cc/vndk.go b/cc/vndk.go
index 4169e21..981e039 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -620,7 +620,7 @@
var headers android.Paths
- installVndkSnapshotLib := func(m *Module, l snapshotLibraryInterface, vndkType string) (android.Paths, bool) {
+ installVndkSnapshotLib := func(m *Module, vndkType string) (android.Paths, bool) {
var ret android.Paths
targetArch := "arch-" + m.Target().Arch.ArchType.String()
@@ -639,9 +639,10 @@
ExportedFlags []string `json:",omitempty"`
RelativeInstallPath string `json:",omitempty"`
}{}
- prop.ExportedFlags = l.exportedFlags()
- prop.ExportedDirs = l.exportedDirs().Strings()
- prop.ExportedSystemDirs = l.exportedSystemDirs().Strings()
+ exportedInfo := ctx.ModuleProvider(m, FlagExporterInfoProvider).(FlagExporterInfo)
+ prop.ExportedFlags = exportedInfo.Flags
+ prop.ExportedDirs = exportedInfo.IncludeDirs.Strings()
+ prop.ExportedSystemDirs = exportedInfo.SystemIncludeDirs.Strings()
prop.RelativeInstallPath = m.RelativeInstallPath()
propOut := snapshotLibOut + ".json"
@@ -671,7 +672,7 @@
// install .so files for appropriate modules.
// Also install .json files if VNDK_SNAPSHOT_BUILD_ARTIFACTS
- libs, ok := installVndkSnapshotLib(m, l, vndkType)
+ libs, ok := installVndkSnapshotLib(m, vndkType)
if !ok {
return
}
diff --git a/cc/vndk_prebuilt.go b/cc/vndk_prebuilt.go
index 9484760..7c47ef4 100644
--- a/cc/vndk_prebuilt.go
+++ b/cc/vndk_prebuilt.go
@@ -162,6 +162,13 @@
p.androidMkSuffix = ""
}
+ ctx.SetProvider(SharedLibraryInfoProvider, SharedLibraryInfo{
+ SharedLibrary: in,
+ UnstrippedSharedLibrary: p.unstrippedOutputFile,
+
+ TableOfContents: p.tocFile,
+ })
+
return in
}
diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go
index 8e35679..664cb51 100644
--- a/etc/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -214,6 +214,13 @@
Output: p.outputFilePath,
Input: p.sourceFilePath,
})
+
+ if p.Installable() {
+ installPath := ctx.InstallFile(p.installDirPath, p.outputFilePath.Base(), p.outputFilePath)
+ for _, sl := range p.properties.Symlinks {
+ ctx.InstallSymlink(p.installDirPath, sl, installPath)
+ }
+ }
}
func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries {
diff --git a/java/droiddoc.go b/java/droiddoc.go
index 923a263..344b15e 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -1016,7 +1016,8 @@
annotationsZip android.WritablePath
apiVersionsXml android.WritablePath
- apiFilePath android.Path
+ apiFilePath android.Path
+ removedApiFilePath android.Path
metadataZip android.WritablePath
metadataDir android.WritablePath
@@ -1059,7 +1060,7 @@
case ".api.txt":
return android.Paths{d.apiFilePath}, nil
case ".removed-api.txt":
- return android.Paths{d.removedApiFile}, nil
+ return android.Paths{d.removedApiFilePath}, nil
case ".annotations.zip":
return android.Paths{d.annotationsZip}, nil
case ".api_versions.xml":
@@ -1074,7 +1075,7 @@
}
func (d *Droidstubs) RemovedApiFilePath() android.Path {
- return d.removedApiFile
+ return d.removedApiFilePath
}
func (d *Droidstubs) StubsSrcJar() android.Path {
@@ -1125,6 +1126,9 @@
d.apiFile = android.PathForModuleOut(ctx, filename)
cmd.FlagWithOutput("--api ", d.apiFile)
d.apiFilePath = d.apiFile
+ } else if sourceApiFile := proptools.String(d.properties.Check_api.Current.Api_file); sourceApiFile != "" {
+ // If check api is disabled then make the source file available for export.
+ d.apiFilePath = android.PathForModuleSrc(ctx, sourceApiFile)
}
if apiCheckEnabled(ctx, d.properties.Check_api.Current, "current") ||
@@ -1133,6 +1137,10 @@
filename := proptools.StringDefault(d.properties.Removed_api_filename, ctx.ModuleName()+"_removed.txt")
d.removedApiFile = android.PathForModuleOut(ctx, filename)
cmd.FlagWithOutput("--removed-api ", d.removedApiFile)
+ d.removedApiFilePath = d.removedApiFile
+ } else if sourceRemovedApiFile := proptools.String(d.properties.Check_api.Current.Removed_api_file); sourceRemovedApiFile != "" {
+ // If check api is disabled then make the source removed api file available for export.
+ d.removedApiFilePath = android.PathForModuleSrc(ctx, sourceRemovedApiFile)
}
if String(d.properties.Removed_dex_api_filename) != "" {
diff --git a/rust/config/allowed_list.go b/rust/config/allowed_list.go
index 678f822..b9a879a 100644
--- a/rust/config/allowed_list.go
+++ b/rust/config/allowed_list.go
@@ -2,7 +2,7 @@
var (
// When adding a new path below, add a rustfmt.toml file at the root of
- // the repository and enable the rustfmt repo hook. See aosp/1347562
+ // the repository and enable the rustfmt repo hook. See aosp/1458238
// for an example.
// TODO(b/160223496): enable rustfmt globally.
RustAllowedPaths = []string{
@@ -11,6 +11,7 @@
"external/crosvm",
"external/adhd",
"frameworks/native/libs/binder/rust",
+ "packages/modules/Virtualization",
"prebuilts/rust",
"system/extras/profcollectd",
"system/hardware/interfaces/keystore2",
diff --git a/rust/library.go b/rust/library.go
index 3bba089..ae33f0f 100644
--- a/rust/library.go
+++ b/rust/library.go
@@ -20,6 +20,7 @@
"strings"
"android/soong/android"
+ "android/soong/cc"
)
var (
@@ -484,11 +485,35 @@
library.coverageOutputZipFile = TransformCoverageFilesToZip(ctx, coverageFiles, library.getStem(ctx))
if library.rlib() || library.dylib() {
- library.exportLinkDirs(deps.linkDirs...)
- library.exportDepFlags(deps.depFlags...)
- library.exportLinkObjects(deps.linkObjects...)
+ library.flagExporter.exportLinkDirs(deps.linkDirs...)
+ library.flagExporter.exportDepFlags(deps.depFlags...)
+ library.flagExporter.exportLinkObjects(deps.linkObjects...)
}
+ if library.static() || library.shared() {
+ ctx.SetProvider(cc.FlagExporterInfoProvider, cc.FlagExporterInfo{
+ IncludeDirs: library.includeDirs,
+ })
+ }
+
+ if library.shared() {
+ ctx.SetProvider(cc.SharedLibraryInfoProvider, cc.SharedLibraryInfo{
+ SharedLibrary: outputFile,
+ UnstrippedSharedLibrary: outputFile,
+ })
+ }
+
+ if library.static() {
+ depSet := android.NewDepSetBuilder(android.TOPOLOGICAL).Direct(outputFile).Build()
+ ctx.SetProvider(cc.StaticLibraryInfoProvider, cc.StaticLibraryInfo{
+ StaticLibrary: outputFile,
+
+ TransitiveStaticLibrariesForOrdering: depSet,
+ })
+ }
+
+ library.flagExporter.setProvider(ctx)
+
return outputFile
}
diff --git a/rust/prebuilt.go b/rust/prebuilt.go
index f9c8934..94fe1e5 100644
--- a/rust/prebuilt.go
+++ b/rust/prebuilt.go
@@ -93,7 +93,8 @@
}
func (prebuilt *prebuiltLibraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path {
- prebuilt.exportLinkDirs(android.PathsForModuleSrc(ctx, prebuilt.Properties.Link_dirs).Strings()...)
+ prebuilt.flagExporter.exportLinkDirs(android.PathsForModuleSrc(ctx, prebuilt.Properties.Link_dirs).Strings()...)
+ prebuilt.flagExporter.setProvider(ctx)
srcPath, paths := srcPathFromModuleSrcs(ctx, prebuilt.prebuiltSrcs())
if len(paths) > 0 {
diff --git a/rust/rust.go b/rust/rust.go
index ba8673c..4496e33 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -302,9 +302,6 @@
}
type exportedFlagsProducer interface {
- exportedLinkDirs() []string
- exportedDepFlags() []string
- exportedLinkObjects() []string
exportLinkDirs(...string)
exportDepFlags(...string)
exportLinkObjects(...string)
@@ -316,18 +313,6 @@
linkObjects []string
}
-func (flagExporter *flagExporter) exportedLinkDirs() []string {
- return flagExporter.linkDirs
-}
-
-func (flagExporter *flagExporter) exportedDepFlags() []string {
- return flagExporter.depFlags
-}
-
-func (flagExporter *flagExporter) exportedLinkObjects() []string {
- return flagExporter.linkObjects
-}
-
func (flagExporter *flagExporter) exportLinkDirs(dirs ...string) {
flagExporter.linkDirs = android.FirstUniqueStrings(append(flagExporter.linkDirs, dirs...))
}
@@ -340,16 +325,28 @@
flagExporter.linkObjects = android.FirstUniqueStrings(append(flagExporter.linkObjects, flags...))
}
+func (flagExporter *flagExporter) setProvider(ctx ModuleContext) {
+ ctx.SetProvider(FlagExporterInfoProvider, FlagExporterInfo{
+ Flags: flagExporter.depFlags,
+ LinkDirs: flagExporter.linkDirs,
+ LinkObjects: flagExporter.linkObjects,
+ })
+}
+
var _ exportedFlagsProducer = (*flagExporter)(nil)
func NewFlagExporter() *flagExporter {
- return &flagExporter{
- depFlags: []string{},
- linkDirs: []string{},
- linkObjects: []string{},
- }
+ return &flagExporter{}
}
+type FlagExporterInfo struct {
+ Flags []string
+ LinkDirs []string // TODO: this should be android.Paths
+ LinkObjects []string // TODO: this should be android.Paths
+}
+
+var FlagExporterInfoProvider = blueprint.NewProvider(FlagExporterInfo{})
+
func (mod *Module) isCoverageVariant() bool {
return mod.coverage.Properties.IsCoverageVariant
}
@@ -499,22 +496,11 @@
panic(fmt.Errorf("BuildSharedVariant called on non-library module: %q", mod.BaseModuleName()))
}
-// Rust module deps don't have a link order (?)
-func (mod *Module) SetDepsInLinkOrder([]android.Path) {}
-
-func (mod *Module) GetDepsInLinkOrder() []android.Path {
- return []android.Path{}
-}
-
-func (mod *Module) GetStaticVariant() cc.LinkableInterface {
- return nil
-}
-
func (mod *Module) Module() android.Module {
return mod
}
-func (mod *Module) StubsVersions() []string {
+func (mod *Module) StubsVersions(ctx android.BaseMutatorContext) []string {
// For now, Rust has no stubs versions.
if mod.compiler != nil {
if _, ok := mod.compiler.(libraryInterface); ok {
@@ -532,12 +518,6 @@
// For now, Rust has no notion of the recovery image
return false
}
-func (mod *Module) HasStaticVariant() bool {
- if mod.GetStaticVariant() != nil {
- return true
- }
- return false
-}
func (mod *Module) CoverageFiles() android.Paths {
if mod.compiler != nil {
@@ -701,11 +681,6 @@
if mod.compiler.(libraryInterface).source() {
mod.sourceProvider.GenerateSource(ctx, deps)
mod.sourceProvider.setSubName(ctx.ModuleSubDir())
- if lib, ok := mod.compiler.(*libraryDecorator); ok {
- lib.flagExporter.linkDirs = nil
- lib.flagExporter.linkObjects = nil
- lib.flagExporter.depFlags = nil
- }
} else {
sourceMod := actx.GetDirectDepWithTag(mod.Name(), sourceDepTag)
sourceLib := sourceMod.(*Module).compiler.(*libraryDecorator)
@@ -846,10 +821,11 @@
}
//Append the dependencies exportedDirs, except for proc-macros which target a different arch/OS
- if lib, ok := rustDep.compiler.(exportedFlagsProducer); ok && depTag != procMacroDepTag {
- depPaths.linkDirs = append(depPaths.linkDirs, lib.exportedLinkDirs()...)
- depPaths.depFlags = append(depPaths.depFlags, lib.exportedDepFlags()...)
- depPaths.linkObjects = append(depPaths.linkObjects, lib.exportedLinkObjects()...)
+ if depTag != procMacroDepTag {
+ exportedInfo := ctx.OtherModuleProvider(dep, FlagExporterInfoProvider).(FlagExporterInfo)
+ depPaths.linkDirs = append(depPaths.linkDirs, exportedInfo.LinkDirs...)
+ depPaths.depFlags = append(depPaths.depFlags, exportedInfo.Flags...)
+ depPaths.linkObjects = append(depPaths.linkObjects, exportedInfo.LinkObjects...)
}
if depTag == dylibDepTag || depTag == rlibDepTag || depTag == procMacroDepTag {
@@ -889,24 +865,22 @@
case cc.IsStaticDepTag(depTag):
depPaths.linkDirs = append(depPaths.linkDirs, linkPath)
depPaths.linkObjects = append(depPaths.linkObjects, linkObject.String())
- depPaths.depIncludePaths = append(depPaths.depIncludePaths, ccDep.IncludeDirs()...)
- if mod, ok := ccDep.(*cc.Module); ok {
- depPaths.depSystemIncludePaths = append(depPaths.depSystemIncludePaths, mod.ExportedSystemIncludeDirs()...)
- depPaths.depClangFlags = append(depPaths.depClangFlags, mod.ExportedFlags()...)
- depPaths.depGeneratedHeaders = append(depPaths.depGeneratedHeaders, mod.ExportedGeneratedHeaders()...)
- }
+ exportedInfo := ctx.OtherModuleProvider(dep, cc.FlagExporterInfoProvider).(cc.FlagExporterInfo)
+ depPaths.depIncludePaths = append(depPaths.depIncludePaths, exportedInfo.IncludeDirs...)
+ depPaths.depSystemIncludePaths = append(depPaths.depSystemIncludePaths, exportedInfo.SystemIncludeDirs...)
+ depPaths.depClangFlags = append(depPaths.depClangFlags, exportedInfo.Flags...)
+ depPaths.depGeneratedHeaders = append(depPaths.depGeneratedHeaders, exportedInfo.GeneratedHeaders...)
depPaths.coverageFiles = append(depPaths.coverageFiles, ccDep.CoverageFiles()...)
directStaticLibDeps = append(directStaticLibDeps, ccDep)
mod.Properties.AndroidMkStaticLibs = append(mod.Properties.AndroidMkStaticLibs, depName)
case cc.IsSharedDepTag(depTag):
depPaths.linkDirs = append(depPaths.linkDirs, linkPath)
depPaths.linkObjects = append(depPaths.linkObjects, linkObject.String())
- depPaths.depIncludePaths = append(depPaths.depIncludePaths, ccDep.IncludeDirs()...)
- if mod, ok := ccDep.(*cc.Module); ok {
- depPaths.depSystemIncludePaths = append(depPaths.depSystemIncludePaths, mod.ExportedSystemIncludeDirs()...)
- depPaths.depClangFlags = append(depPaths.depClangFlags, mod.ExportedFlags()...)
- depPaths.depGeneratedHeaders = append(depPaths.depGeneratedHeaders, mod.ExportedGeneratedHeaders()...)
- }
+ exportedInfo := ctx.OtherModuleProvider(dep, cc.FlagExporterInfoProvider).(cc.FlagExporterInfo)
+ depPaths.depIncludePaths = append(depPaths.depIncludePaths, exportedInfo.IncludeDirs...)
+ depPaths.depSystemIncludePaths = append(depPaths.depSystemIncludePaths, exportedInfo.SystemIncludeDirs...)
+ depPaths.depClangFlags = append(depPaths.depClangFlags, exportedInfo.Flags...)
+ depPaths.depGeneratedHeaders = append(depPaths.depGeneratedHeaders, exportedInfo.GeneratedHeaders...)
directSharedLibDeps = append(directSharedLibDeps, ccDep)
mod.Properties.AndroidMkSharedLibs = append(mod.Properties.AndroidMkSharedLibs, depName)
exportDep = true
diff --git a/ui/build/config.go b/ui/build/config.go
index fe74ace..fbe5cd2 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -303,6 +303,12 @@
UseRbe: proto.Bool(config.UseRBE()),
}
ctx.Metrics.BuildConfig(b)
+
+ s := &smpb.SystemResourceInfo{
+ TotalPhysicalMemory: proto.Uint64(config.TotalRAM()),
+ AvailableCpus: proto.Int32(int32(runtime.NumCPU())),
+ }
+ ctx.Metrics.SystemResourceInfo(s)
}
// getConfigArgs processes the command arguments based on the build action and creates a set of new
diff --git a/ui/metrics/metrics.go b/ui/metrics/metrics.go
index f5552a3..35d1976 100644
--- a/ui/metrics/metrics.go
+++ b/ui/metrics/metrics.go
@@ -70,6 +70,10 @@
m.metrics.BuildConfig = b
}
+func (m *Metrics) SystemResourceInfo(b *soong_metrics_proto.SystemResourceInfo) {
+ m.metrics.SystemResourceInfo = b
+}
+
func (m *Metrics) SetMetadataMetrics(metadata map[string]string) {
for k, v := range metadata {
switch k {
@@ -139,7 +143,12 @@
}
// exports the output to the file at outputPath
-func (m *Metrics) Dump(outputPath string) (err error) {
+func (m *Metrics) Dump(outputPath string) error {
+ // ignore the error if the hostname could not be retrieved as it
+ // is not a critical metric to extract.
+ if hostname, err := os.Hostname(); err == nil {
+ m.metrics.Hostname = proto.String(hostname)
+ }
m.metrics.HostOs = proto.String(runtime.GOOS)
return writeMessageToFile(&m.metrics, outputPath)
}
diff --git a/ui/metrics/metrics_proto/metrics.pb.go b/ui/metrics/metrics_proto/metrics.pb.go
index 05efe13..e824f6b 100644
--- a/ui/metrics/metrics_proto/metrics.pb.go
+++ b/ui/metrics/metrics_proto/metrics.pb.go
@@ -152,7 +152,7 @@
}
func (ModuleTypeInfo_BuildSystem) EnumDescriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{3, 0}
+ return fileDescriptor_6039342a2ba47b72, []int{4, 0}
}
type MetricsBase struct {
@@ -197,12 +197,16 @@
// The metrics for calling Ninja.
NinjaRuns []*PerfInfo `protobuf:"bytes,20,rep,name=ninja_runs,json=ninjaRuns" json:"ninja_runs,omitempty"`
// The metrics for the whole build
- Total *PerfInfo `protobuf:"bytes,21,opt,name=total" json:"total,omitempty"`
- SoongBuildMetrics *SoongBuildMetrics `protobuf:"bytes,22,opt,name=soong_build_metrics,json=soongBuildMetrics" json:"soong_build_metrics,omitempty"`
- BuildConfig *BuildConfig `protobuf:"bytes,23,opt,name=build_config,json=buildConfig" json:"build_config,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
+ Total *PerfInfo `protobuf:"bytes,21,opt,name=total" json:"total,omitempty"`
+ SoongBuildMetrics *SoongBuildMetrics `protobuf:"bytes,22,opt,name=soong_build_metrics,json=soongBuildMetrics" json:"soong_build_metrics,omitempty"`
+ BuildConfig *BuildConfig `protobuf:"bytes,23,opt,name=build_config,json=buildConfig" json:"build_config,omitempty"`
+ // The hostname of the machine.
+ Hostname *string `protobuf:"bytes,24,opt,name=hostname" json:"hostname,omitempty"`
+ // The system resource information such as total physical memory.
+ SystemResourceInfo *SystemResourceInfo `protobuf:"bytes,25,opt,name=system_resource_info,json=systemResourceInfo" json:"system_resource_info,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
}
func (m *MetricsBase) Reset() { *m = MetricsBase{} }
@@ -396,6 +400,20 @@
return nil
}
+func (m *MetricsBase) GetHostname() string {
+ if m != nil && m.Hostname != nil {
+ return *m.Hostname
+ }
+ return ""
+}
+
+func (m *MetricsBase) GetSystemResourceInfo() *SystemResourceInfo {
+ if m != nil {
+ return m.SystemResourceInfo
+ }
+ return nil
+}
+
type BuildConfig struct {
UseGoma *bool `protobuf:"varint,1,opt,name=use_goma,json=useGoma" json:"use_goma,omitempty"`
UseRbe *bool `protobuf:"varint,2,opt,name=use_rbe,json=useRbe" json:"use_rbe,omitempty"`
@@ -451,6 +469,55 @@
return false
}
+type SystemResourceInfo struct {
+ // The total physical memory in bytes.
+ TotalPhysicalMemory *uint64 `protobuf:"varint,1,opt,name=total_physical_memory,json=totalPhysicalMemory" json:"total_physical_memory,omitempty"`
+ // The total of available cores for building
+ AvailableCpus *int32 `protobuf:"varint,2,opt,name=available_cpus,json=availableCpus" json:"available_cpus,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *SystemResourceInfo) Reset() { *m = SystemResourceInfo{} }
+func (m *SystemResourceInfo) String() string { return proto.CompactTextString(m) }
+func (*SystemResourceInfo) ProtoMessage() {}
+func (*SystemResourceInfo) Descriptor() ([]byte, []int) {
+ return fileDescriptor_6039342a2ba47b72, []int{2}
+}
+
+func (m *SystemResourceInfo) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_SystemResourceInfo.Unmarshal(m, b)
+}
+func (m *SystemResourceInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_SystemResourceInfo.Marshal(b, m, deterministic)
+}
+func (m *SystemResourceInfo) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_SystemResourceInfo.Merge(m, src)
+}
+func (m *SystemResourceInfo) XXX_Size() int {
+ return xxx_messageInfo_SystemResourceInfo.Size(m)
+}
+func (m *SystemResourceInfo) XXX_DiscardUnknown() {
+ xxx_messageInfo_SystemResourceInfo.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_SystemResourceInfo proto.InternalMessageInfo
+
+func (m *SystemResourceInfo) GetTotalPhysicalMemory() uint64 {
+ if m != nil && m.TotalPhysicalMemory != nil {
+ return *m.TotalPhysicalMemory
+ }
+ return 0
+}
+
+func (m *SystemResourceInfo) GetAvailableCpus() int32 {
+ if m != nil && m.AvailableCpus != nil {
+ return *m.AvailableCpus
+ }
+ return 0
+}
+
type PerfInfo struct {
// The description for the phase/action/part while the tool running.
Desc *string `protobuf:"bytes,1,opt,name=desc" json:"desc,omitempty"`
@@ -473,7 +540,7 @@
func (m *PerfInfo) String() string { return proto.CompactTextString(m) }
func (*PerfInfo) ProtoMessage() {}
func (*PerfInfo) Descriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{2}
+ return fileDescriptor_6039342a2ba47b72, []int{3}
}
func (m *PerfInfo) XXX_Unmarshal(b []byte) error {
@@ -545,7 +612,7 @@
func (m *ModuleTypeInfo) String() string { return proto.CompactTextString(m) }
func (*ModuleTypeInfo) ProtoMessage() {}
func (*ModuleTypeInfo) Descriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{3}
+ return fileDescriptor_6039342a2ba47b72, []int{4}
}
func (m *ModuleTypeInfo) XXX_Unmarshal(b []byte) error {
@@ -603,7 +670,7 @@
func (m *CriticalUserJourneyMetrics) String() string { return proto.CompactTextString(m) }
func (*CriticalUserJourneyMetrics) ProtoMessage() {}
func (*CriticalUserJourneyMetrics) Descriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{4}
+ return fileDescriptor_6039342a2ba47b72, []int{5}
}
func (m *CriticalUserJourneyMetrics) XXX_Unmarshal(b []byte) error {
@@ -650,7 +717,7 @@
func (m *CriticalUserJourneysMetrics) String() string { return proto.CompactTextString(m) }
func (*CriticalUserJourneysMetrics) ProtoMessage() {}
func (*CriticalUserJourneysMetrics) Descriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{5}
+ return fileDescriptor_6039342a2ba47b72, []int{6}
}
func (m *CriticalUserJourneysMetrics) XXX_Unmarshal(b []byte) error {
@@ -698,7 +765,7 @@
func (m *SoongBuildMetrics) String() string { return proto.CompactTextString(m) }
func (*SoongBuildMetrics) ProtoMessage() {}
func (*SoongBuildMetrics) Descriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{6}
+ return fileDescriptor_6039342a2ba47b72, []int{7}
}
func (m *SoongBuildMetrics) XXX_Unmarshal(b []byte) error {
@@ -760,6 +827,7 @@
proto.RegisterEnum("soong_build_metrics.ModuleTypeInfo_BuildSystem", ModuleTypeInfo_BuildSystem_name, ModuleTypeInfo_BuildSystem_value)
proto.RegisterType((*MetricsBase)(nil), "soong_build_metrics.MetricsBase")
proto.RegisterType((*BuildConfig)(nil), "soong_build_metrics.BuildConfig")
+ proto.RegisterType((*SystemResourceInfo)(nil), "soong_build_metrics.SystemResourceInfo")
proto.RegisterType((*PerfInfo)(nil), "soong_build_metrics.PerfInfo")
proto.RegisterType((*ModuleTypeInfo)(nil), "soong_build_metrics.ModuleTypeInfo")
proto.RegisterType((*CriticalUserJourneyMetrics)(nil), "soong_build_metrics.CriticalUserJourneyMetrics")
@@ -772,70 +840,76 @@
}
var fileDescriptor_6039342a2ba47b72 = []byte{
- // 1036 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xef, 0x4e, 0x1b, 0x47,
- 0x10, 0xcf, 0x61, 0x83, 0x7d, 0x73, 0xd8, 0x1c, 0x0b, 0x29, 0x97, 0x44, 0xa8, 0x96, 0xd5, 0x44,
- 0xa8, 0x6a, 0x48, 0x44, 0x23, 0x14, 0xa1, 0xa8, 0x12, 0x18, 0x44, 0x53, 0x04, 0x8e, 0x16, 0x4c,
- 0xa3, 0xf6, 0xc3, 0x69, 0x7d, 0xb7, 0x86, 0x4b, 0x7d, 0xb7, 0xd6, 0xee, 0x5e, 0x04, 0x79, 0x87,
- 0x3e, 0x55, 0x9f, 0xa5, 0xaf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 0xfb, 0x26, 0xde, 0x33, 0x61, 0xb2,
- 0x05, 0x7e, 0x95, 0xab, 0x92, 0x4f, 0x65, 0xd3, 0xb5, 0x67, 0xd4, 0xf3, 0xe4, 0x13, 0x37, 0x9f,
- 0x88, 0x94, 0xdd, 0x84, 0xd7, 0x9c, 0x4d, 0x2c, 0xcd, 0x76, 0x9f, 0x97, 0xb2, 0x9b, 0x1f, 0x39,
- 0x9b, 0x18, 0xce, 0xc1, 0xc3, 0x5f, 0x8a, 0x29, 0x54, 0xd4, 0x1d, 0xe2, 0xbf, 0xa4, 0xbf, 0x03,
- 0x00, 0x00, 0xff, 0xff, 0x85, 0xc5, 0xe0, 0x4b, 0x35, 0x09, 0x00, 0x00,
+ // 1130 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x6f, 0x6f, 0xd4, 0x46,
+ 0x13, 0xc7, 0xc9, 0x25, 0x77, 0x1e, 0xe7, 0x0e, 0x67, 0x13, 0x1e, 0x0c, 0x08, 0x3d, 0x91, 0x55,
+ 0x68, 0x54, 0x95, 0x80, 0xae, 0x28, 0x42, 0x11, 0xaa, 0x94, 0x1c, 0x11, 0xa5, 0xe8, 0x72, 0x68,
+ 0xc3, 0x51, 0xda, 0xbe, 0xb0, 0xf6, 0xec, 0xbd, 0xc4, 0xd4, 0xf6, 0x5a, 0xbb, 0x6b, 0xc4, 0xf1,
+ 0x1d, 0xfa, 0xa9, 0xfa, 0x59, 0xfa, 0x11, 0xfa, 0xbe, 0xda, 0x59, 0xfb, 0xee, 0x28, 0xd7, 0x82,
+ 0x78, 0x77, 0x9e, 0xdf, 0x9f, 0x9d, 0x19, 0x8f, 0x67, 0x0f, 0xba, 0x39, 0xd7, 0x32, 0x8d, 0xd5,
+ 0x41, 0x29, 0x85, 0x16, 0x64, 0x47, 0x09, 0x51, 0x5c, 0x44, 0x93, 0x2a, 0xcd, 0x92, 0x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x9a, 0x5a, 0xac, 0x82, 0x56, 0x5c, 0xbd,
+ 0x51, 0x81, 0x83, 0xfb, 0x6c, 0x75, 0x67, 0xff, 0x3d, 0x5b, 0x8a, 0xe2, 0xf0, 0x0f, 0x07, 0xb6,
+ 0x3f, 0x5a, 0x3c, 0x24, 0x80, 0x76, 0xd3, 0x37, 0x07, 0xfb, 0xd6, 0x3c, 0x9a, 0xd5, 0x51, 0xdf,
+ 0xcc, 0xb6, 0xa0, 0x2e, 0x9d, 0x3f, 0x93, 0x6f, 0x60, 0xdb, 0x0e, 0x3c, 0xcb, 0x32, 0x11, 0x47,
+ 0xb1, 0xa8, 0x0a, 0x5d, 0xcf, 0xd9, 0x55, 0x04, 0x8e, 0x4d, 0x7c, 0x60, 0xc2, 0x64, 0x1f, 0xfc,
+ 0x65, 0xae, 0x4a, 0xdf, 0x37, 0x43, 0xd7, 0x5b, 0x50, 0xcf, 0xd3, 0xf7, 0xdc, 0x5c, 0x85, 0x39,
+ 0x7b, 0x17, 0x5d, 0x72, 0x56, 0x5a, 0x9a, 0x9d, 0x3e, 0x2f, 0x67, 0xef, 0x7e, 0xe0, 0xac, 0x34,
+ 0x9c, 0x93, 0x6b, 0xbf, 0xd4, 0xdb, 0xb6, 0xae, 0x3b, 0xc2, 0x7f, 0x83, 0x7f, 0x07, 0x00, 0x00,
+ 0xff, 0xff, 0xa3, 0xdd, 0xbb, 0xb3, 0x1d, 0x0a, 0x00, 0x00,
}
diff --git a/ui/metrics/metrics_proto/metrics.proto b/ui/metrics/metrics_proto/metrics.proto
index 4d6118b..3586be0 100644
--- a/ui/metrics/metrics_proto/metrics.proto
+++ b/ui/metrics/metrics_proto/metrics.proto
@@ -96,6 +96,12 @@
optional SoongBuildMetrics soong_build_metrics = 22;
optional BuildConfig build_config = 23;
+
+ // The hostname of the machine.
+ optional string hostname = 24;
+
+ // The system resource information such as total physical memory.
+ optional SystemResourceInfo system_resource_info = 25;
}
message BuildConfig {
@@ -106,6 +112,14 @@
optional bool force_use_goma = 3;
}
+message SystemResourceInfo {
+ // The total physical memory in bytes.
+ optional uint64 total_physical_memory = 1;
+
+ // The total of available cores for building
+ optional int32 available_cpus = 2;
+}
+
message PerfInfo {
// The description for the phase/action/part while the tool running.
optional string desc = 1;