Update DepSet references
Update all references to depset to use blueprint/depset, and to use DepSet instead of *DepSet. Bug: 375276086 Test: all soong tests pass Flag: EXEMPT refactor Change-Id: I59a7836d0975366ddc336225fb770ac7e6e0c8ea
This commit is contained in:
parent
11d0c38a2b
commit
a14fb6a73e
23 changed files with 216 additions and 257 deletions
|
|
@ -20,6 +20,7 @@ bootstrap_go_package {
|
|||
name: "soong-aidl-library",
|
||||
pkgPath: "android/soong/aidl_library",
|
||||
deps: [
|
||||
"blueprint-depset",
|
||||
"soong-android",
|
||||
],
|
||||
srcs: [
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ package aidl_library
|
|||
import (
|
||||
"android/soong/android"
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/depset"
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
||||
|
|
@ -58,17 +59,17 @@ type AidlLibraryInfo struct {
|
|||
// The direct aidl files of the module
|
||||
Srcs android.Paths
|
||||
// The include dirs to the direct aidl files and those provided from transitive aidl_library deps
|
||||
IncludeDirs android.DepSet[android.Path]
|
||||
IncludeDirs depset.DepSet[android.Path]
|
||||
// The direct hdrs and hdrs from transitive deps
|
||||
Hdrs android.DepSet[android.Path]
|
||||
Hdrs depset.DepSet[android.Path]
|
||||
}
|
||||
|
||||
// AidlLibraryProvider provides the srcs and the transitive include dirs
|
||||
var AidlLibraryProvider = blueprint.NewProvider[AidlLibraryInfo]()
|
||||
|
||||
func (lib *AidlLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
includeDirsDepSetBuilder := android.NewDepSetBuilder[android.Path](android.PREORDER)
|
||||
hdrsDepSetBuilder := android.NewDepSetBuilder[android.Path](android.PREORDER)
|
||||
includeDirsDepSetBuilder := depset.NewBuilder[android.Path](depset.PREORDER)
|
||||
hdrsDepSetBuilder := depset.NewBuilder[android.Path](depset.PREORDER)
|
||||
|
||||
if len(lib.properties.Srcs) == 0 && len(lib.properties.Hdrs) == 0 {
|
||||
ctx.ModuleErrorf("at least srcs or hdrs prop must be non-empty")
|
||||
|
|
@ -100,15 +101,15 @@ func (lib *AidlLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
|
||||
for _, dep := range ctx.GetDirectDepsWithTag(aidlLibraryTag) {
|
||||
if info, ok := android.OtherModuleProvider(ctx, dep, AidlLibraryProvider); ok {
|
||||
includeDirsDepSetBuilder.Transitive(&info.IncludeDirs)
|
||||
hdrsDepSetBuilder.Transitive(&info.Hdrs)
|
||||
includeDirsDepSetBuilder.Transitive(info.IncludeDirs)
|
||||
hdrsDepSetBuilder.Transitive(info.Hdrs)
|
||||
}
|
||||
}
|
||||
|
||||
android.SetProvider(ctx, AidlLibraryProvider, AidlLibraryInfo{
|
||||
Srcs: srcs,
|
||||
IncludeDirs: *includeDirsDepSetBuilder.Build(),
|
||||
Hdrs: *hdrsDepSetBuilder.Build(),
|
||||
IncludeDirs: includeDirsDepSetBuilder.Build(),
|
||||
Hdrs: hdrsDepSetBuilder.Build(),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ bootstrap_go_package {
|
|||
deps: [
|
||||
"blueprint",
|
||||
"blueprint-bootstrap",
|
||||
"blueprint-depset",
|
||||
"blueprint-metrics",
|
||||
"sbox_proto",
|
||||
"soong",
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
package android
|
||||
|
||||
import (
|
||||
"github.com/google/blueprint/depset"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
|
|
@ -61,7 +62,7 @@ func buildLicenseMetadata(ctx *moduleContext, licenseMetadataFile WritablePath)
|
|||
var allDepMetadataFiles Paths
|
||||
var allDepMetadataArgs []string
|
||||
var allDepOutputFiles Paths
|
||||
var allDepMetadataDepSets []*DepSet[Path]
|
||||
var allDepMetadataDepSets []depset.DepSet[Path]
|
||||
|
||||
ctx.VisitDirectDeps(func(dep Module) {
|
||||
if !dep.Enabled(ctx) {
|
||||
|
|
@ -133,7 +134,7 @@ func buildLicenseMetadata(ctx *moduleContext, licenseMetadataFile WritablePath)
|
|||
JoinWithPrefix(proptools.NinjaAndShellEscapeListIncludingSpaces(base.commonProperties.Effective_license_text.Strings()), "-n "))
|
||||
|
||||
if isContainer {
|
||||
transitiveDeps := Paths(NewDepSet[Path](TOPOLOGICAL, nil, allDepMetadataDepSets).ToList())
|
||||
transitiveDeps := Paths(depset.New[Path](depset.TOPOLOGICAL, nil, allDepMetadataDepSets).ToList())
|
||||
args = append(args,
|
||||
JoinWithPrefix(proptools.NinjaAndShellEscapeListIncludingSpaces(transitiveDeps.Strings()), "-d "))
|
||||
orderOnlyDeps = append(orderOnlyDeps, transitiveDeps...)
|
||||
|
|
@ -176,7 +177,7 @@ func buildLicenseMetadata(ctx *moduleContext, licenseMetadataFile WritablePath)
|
|||
|
||||
SetProvider(ctx, LicenseMetadataProvider, &LicenseMetadataInfo{
|
||||
LicenseMetadataPath: licenseMetadataFile,
|
||||
LicenseMetadataDepSet: NewDepSet(TOPOLOGICAL, Paths{licenseMetadataFile}, allDepMetadataDepSets),
|
||||
LicenseMetadataDepSet: depset.New(depset.TOPOLOGICAL, Paths{licenseMetadataFile}, allDepMetadataDepSets),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -204,7 +205,7 @@ var LicenseMetadataProvider = blueprint.NewProvider[*LicenseMetadataInfo]()
|
|||
// LicenseMetadataInfo stores the license metadata path for a module.
|
||||
type LicenseMetadataInfo struct {
|
||||
LicenseMetadataPath Path
|
||||
LicenseMetadataDepSet *DepSet[Path]
|
||||
LicenseMetadataDepSet depset.DepSet[Path]
|
||||
}
|
||||
|
||||
// licenseAnnotationsFromTag returns the LicenseAnnotations for a tag (if any) converted into
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ package android
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/google/blueprint/depset"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
|
|
@ -1437,9 +1438,9 @@ func (m *ModuleBase) EffectiveLicenseFiles() Paths {
|
|||
|
||||
// computeInstallDeps finds the installed paths of all dependencies that have a dependency
|
||||
// tag that is annotated as needing installation via the isInstallDepNeeded method.
|
||||
func (m *ModuleBase) computeInstallDeps(ctx ModuleContext) ([]*DepSet[InstallPath], []*DepSet[PackagingSpec]) {
|
||||
var installDeps []*DepSet[InstallPath]
|
||||
var packagingSpecs []*DepSet[PackagingSpec]
|
||||
func (m *ModuleBase) computeInstallDeps(ctx ModuleContext) ([]depset.DepSet[InstallPath], []depset.DepSet[PackagingSpec]) {
|
||||
var installDeps []depset.DepSet[InstallPath]
|
||||
var packagingSpecs []depset.DepSet[PackagingSpec]
|
||||
ctx.VisitDirectDeps(func(dep Module) {
|
||||
if isInstallDepNeeded(dep, ctx.OtherModuleDependencyTag(dep)) {
|
||||
// Installation is still handled by Make, so anything hidden from Make is not
|
||||
|
|
@ -1772,12 +1773,12 @@ type InstallFilesInfo struct {
|
|||
KatiInstalls katiInstalls
|
||||
KatiSymlinks katiInstalls
|
||||
TestData []DataPath
|
||||
TransitivePackagingSpecs *DepSet[PackagingSpec]
|
||||
TransitivePackagingSpecs depset.DepSet[PackagingSpec]
|
||||
LicenseMetadataFile WritablePath
|
||||
|
||||
// The following fields are private before, make it private again once we have
|
||||
// better solution.
|
||||
TransitiveInstallFiles *DepSet[InstallPath]
|
||||
TransitiveInstallFiles depset.DepSet[InstallPath]
|
||||
// katiInitRcInstalls and katiVintfInstalls track the install rules created by Soong that are
|
||||
// allowed to have duplicates across modules and variants.
|
||||
KatiInitRcInstalls katiInstalls
|
||||
|
|
@ -1843,7 +1844,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
|||
// set the TransitiveInstallFiles to only the transitive dependencies to be used as the dependencies
|
||||
// of installed files of this module. It will be replaced by a depset including the installed
|
||||
// files of this module at the end for use by modules that depend on this one.
|
||||
ctx.TransitiveInstallFiles = NewDepSet[InstallPath](TOPOLOGICAL, nil, dependencyInstallFiles)
|
||||
ctx.TransitiveInstallFiles = depset.New[InstallPath](depset.TOPOLOGICAL, nil, dependencyInstallFiles)
|
||||
|
||||
// Temporarily continue to call blueprintCtx.GetMissingDependencies() to maintain the previous behavior of never
|
||||
// reporting missing dependency errors in Blueprint when AllowMissingDependencies == true.
|
||||
|
|
@ -2002,9 +2003,9 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
|||
}
|
||||
}
|
||||
|
||||
ctx.TransitiveInstallFiles = NewDepSet[InstallPath](TOPOLOGICAL, ctx.installFiles, dependencyInstallFiles)
|
||||
ctx.TransitiveInstallFiles = depset.New[InstallPath](depset.TOPOLOGICAL, ctx.installFiles, dependencyInstallFiles)
|
||||
installFiles.TransitiveInstallFiles = ctx.TransitiveInstallFiles
|
||||
installFiles.TransitivePackagingSpecs = NewDepSet[PackagingSpec](TOPOLOGICAL, ctx.packagingSpecs, dependencyPackagingSpecs)
|
||||
installFiles.TransitivePackagingSpecs = depset.New[PackagingSpec](depset.TOPOLOGICAL, ctx.packagingSpecs, dependencyPackagingSpecs)
|
||||
|
||||
SetProvider(ctx, InstallFilesProvider, installFiles)
|
||||
buildLicenseMetadata(ctx, ctx.licenseMetadataFile)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ package android
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/google/blueprint/depset"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
|
@ -261,7 +262,7 @@ type moduleContext struct {
|
|||
// the OutputFilesProvider in GenerateBuildActions
|
||||
outputFiles OutputFilesInfo
|
||||
|
||||
TransitiveInstallFiles *DepSet[InstallPath]
|
||||
TransitiveInstallFiles depset.DepSet[InstallPath]
|
||||
|
||||
// set of dependency module:location mappings used to populate the license metadata for
|
||||
// apex containers.
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ bootstrap_go_package {
|
|||
pkgPath: "android/soong/cc",
|
||||
deps: [
|
||||
"blueprint",
|
||||
"blueprint-depset",
|
||||
"blueprint-pathtools",
|
||||
"soong",
|
||||
"soong-aconfig",
|
||||
|
|
|
|||
13
cc/cc.go
13
cc/cc.go
|
|
@ -27,6 +27,7 @@ import (
|
|||
"android/soong/testing"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/depset"
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
"android/soong/aidl_library"
|
||||
|
|
@ -169,7 +170,7 @@ type PathDeps struct {
|
|||
RustRlibDeps []RustRlibDep
|
||||
|
||||
// Transitive static library dependencies of static libraries for use in ordering.
|
||||
TranstiveStaticLibrariesForOrdering *android.DepSet[android.Path]
|
||||
TranstiveStaticLibrariesForOrdering depset.DepSet[android.Path]
|
||||
|
||||
// Paths to .o files
|
||||
Objs Objects
|
||||
|
|
@ -3376,19 +3377,17 @@ func ChooseStubOrImpl(ctx android.ModuleContext, dep android.Module) (SharedLibr
|
|||
|
||||
// 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
|
||||
// direct shared libraries. It returns the ordered static dependencies, and a depset.DepSet
|
||||
// of the transitive dependencies.
|
||||
func orderStaticModuleDeps(staticDeps []StaticLibraryInfo, sharedDeps []SharedLibraryInfo) (ordered android.Paths, transitive *android.DepSet[android.Path]) {
|
||||
transitiveStaticLibsBuilder := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL)
|
||||
func orderStaticModuleDeps(staticDeps []StaticLibraryInfo, sharedDeps []SharedLibraryInfo) (ordered android.Paths, transitive depset.DepSet[android.Path]) {
|
||||
transitiveStaticLibsBuilder := depset.NewBuilder[android.Path](depset.TOPOLOGICAL)
|
||||
var staticPaths android.Paths
|
||||
for _, staticDep := range staticDeps {
|
||||
staticPaths = append(staticPaths, staticDep.StaticLibrary)
|
||||
transitiveStaticLibsBuilder.Transitive(staticDep.TransitiveStaticLibrariesForOrdering)
|
||||
}
|
||||
for _, sharedDep := range sharedDeps {
|
||||
if sharedDep.TransitiveStaticLibrariesForOrdering != nil {
|
||||
transitiveStaticLibsBuilder.Transitive(sharedDep.TransitiveStaticLibrariesForOrdering)
|
||||
}
|
||||
transitiveStaticLibsBuilder.Transitive(sharedDep.TransitiveStaticLibrariesForOrdering)
|
||||
}
|
||||
transitiveStaticLibs := transitiveStaticLibsBuilder.Build()
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import (
|
|||
"android/soong/android"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/depset"
|
||||
"github.com/google/blueprint/pathtools"
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
|
@ -1017,7 +1018,7 @@ func (library *libraryDecorator) linkStatic(ctx ModuleContext,
|
|||
Objects: library.objects,
|
||||
WholeStaticLibsFromPrebuilts: library.wholeStaticLibsFromPrebuilts,
|
||||
|
||||
TransitiveStaticLibrariesForOrdering: android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).
|
||||
TransitiveStaticLibrariesForOrdering: depset.NewBuilder[android.Path](depset.TOPOLOGICAL).
|
||||
Direct(outputFile).
|
||||
Transitive(deps.TranstiveStaticLibrariesForOrdering).
|
||||
Build(),
|
||||
|
|
@ -1182,7 +1183,7 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
|
|||
library.coverageOutputFile = transformCoverageFilesToZip(ctx, objs, library.getLibName(ctx))
|
||||
library.linkSAbiDumpFiles(ctx, deps, objs, fileName, unstrippedOutputFile)
|
||||
|
||||
var transitiveStaticLibrariesForOrdering *android.DepSet[android.Path]
|
||||
var transitiveStaticLibrariesForOrdering depset.DepSet[android.Path]
|
||||
if static := ctx.GetDirectDepsWithTag(staticVariantTag); len(static) > 0 {
|
||||
s, _ := android.OtherModuleProvider(ctx, static[0], StaticLibraryInfoProvider)
|
||||
transitiveStaticLibrariesForOrdering = s.TransitiveStaticLibrariesForOrdering
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import (
|
|||
"android/soong/fuzz"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/depset"
|
||||
)
|
||||
|
||||
// PlatformSanitizeable is an interface for sanitizing platform modules.
|
||||
|
|
@ -319,7 +320,7 @@ type SharedLibraryInfo struct {
|
|||
TableOfContents android.OptionalPath
|
||||
|
||||
// should be obtained from static analogue
|
||||
TransitiveStaticLibrariesForOrdering *android.DepSet[android.Path]
|
||||
TransitiveStaticLibrariesForOrdering depset.DepSet[android.Path]
|
||||
}
|
||||
|
||||
var SharedLibraryInfoProvider = blueprint.NewProvider[SharedLibraryInfo]()
|
||||
|
|
@ -361,7 +362,7 @@ type StaticLibraryInfo struct {
|
|||
// 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[android.Path]
|
||||
TransitiveStaticLibrariesForOrdering depset.DepSet[android.Path]
|
||||
}
|
||||
|
||||
var StaticLibraryInfoProvider = blueprint.NewProvider[StaticLibraryInfo]()
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/google/blueprint/depset"
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
"android/soong/android"
|
||||
|
|
@ -156,7 +157,7 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext,
|
|||
}
|
||||
|
||||
if p.static() {
|
||||
depSet := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(in).Build()
|
||||
depSet := depset.NewBuilder[android.Path](depset.TOPOLOGICAL).Direct(in).Build()
|
||||
android.SetProvider(ctx, StaticLibraryInfoProvider, StaticLibraryInfo{
|
||||
StaticLibrary: in,
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ bootstrap_go_package {
|
|||
pkgPath: "android/soong/java",
|
||||
deps: [
|
||||
"blueprint",
|
||||
"blueprint-depset",
|
||||
"blueprint-pathtools",
|
||||
"soong",
|
||||
"soong-aconfig",
|
||||
|
|
|
|||
89
java/aar.go
89
java/aar.go
|
|
@ -25,14 +25,15 @@ import (
|
|||
"android/soong/dexpreopt"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/depset"
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
||||
type AndroidLibraryDependency interface {
|
||||
ExportPackage() android.Path
|
||||
ResourcesNodeDepSet() *android.DepSet[*resourcesNode]
|
||||
RRODirsDepSet() *android.DepSet[rroDir]
|
||||
ManifestsDepSet() *android.DepSet[android.Path]
|
||||
ResourcesNodeDepSet() depset.DepSet[*resourcesNode]
|
||||
RRODirsDepSet() depset.DepSet[rroDir]
|
||||
ManifestsDepSet() depset.DepSet[android.Path]
|
||||
SetRROEnforcedForDependent(enforce bool)
|
||||
IsRROEnforced(ctx android.BaseModuleContext) bool
|
||||
}
|
||||
|
|
@ -136,9 +137,9 @@ type aapt struct {
|
|||
|
||||
aaptProperties aaptProperties
|
||||
|
||||
resourcesNodesDepSet *android.DepSet[*resourcesNode]
|
||||
rroDirsDepSet *android.DepSet[rroDir]
|
||||
manifestsDepSet *android.DepSet[android.Path]
|
||||
resourcesNodesDepSet depset.DepSet[*resourcesNode]
|
||||
rroDirsDepSet depset.DepSet[rroDir]
|
||||
manifestsDepSet depset.DepSet[android.Path]
|
||||
|
||||
manifestValues struct {
|
||||
applicationId string
|
||||
|
|
@ -232,15 +233,15 @@ func (a *aapt) filterProduct() string {
|
|||
func (a *aapt) ExportPackage() android.Path {
|
||||
return a.exportPackage
|
||||
}
|
||||
func (a *aapt) ResourcesNodeDepSet() *android.DepSet[*resourcesNode] {
|
||||
func (a *aapt) ResourcesNodeDepSet() depset.DepSet[*resourcesNode] {
|
||||
return a.resourcesNodesDepSet
|
||||
}
|
||||
|
||||
func (a *aapt) RRODirsDepSet() *android.DepSet[rroDir] {
|
||||
func (a *aapt) RRODirsDepSet() depset.DepSet[rroDir] {
|
||||
return a.rroDirsDepSet
|
||||
}
|
||||
|
||||
func (a *aapt) ManifestsDepSet() *android.DepSet[android.Path] {
|
||||
func (a *aapt) ManifestsDepSet() depset.DepSet[android.Path] {
|
||||
return a.manifestsDepSet
|
||||
}
|
||||
|
||||
|
|
@ -639,7 +640,7 @@ func (a *aapt) buildActions(ctx android.ModuleContext, opts aaptBuildActionOptio
|
|||
a.extraAaptPackagesFile = extraPackages
|
||||
a.rTxt = rTxt
|
||||
a.splits = splits
|
||||
a.resourcesNodesDepSet = android.NewDepSetBuilder[*resourcesNode](android.TOPOLOGICAL).
|
||||
a.resourcesNodesDepSet = depset.NewBuilder[*resourcesNode](depset.TOPOLOGICAL).
|
||||
Direct(&resourcesNode{
|
||||
resPackage: a.exportPackage,
|
||||
manifest: a.manifestPath,
|
||||
|
|
@ -651,10 +652,10 @@ func (a *aapt) buildActions(ctx android.ModuleContext, opts aaptBuildActionOptio
|
|||
usedResourceProcessor: a.useResourceProcessorBusyBox(ctx),
|
||||
}).
|
||||
Transitive(staticResourcesNodesDepSet).Build()
|
||||
a.rroDirsDepSet = android.NewDepSetBuilder[rroDir](android.TOPOLOGICAL).
|
||||
a.rroDirsDepSet = depset.NewBuilder[rroDir](depset.TOPOLOGICAL).
|
||||
Direct(rroDirs...).
|
||||
Transitive(staticRRODirsDepSet).Build()
|
||||
a.manifestsDepSet = android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).
|
||||
a.manifestsDepSet = depset.NewBuilder[android.Path](depset.TOPOLOGICAL).
|
||||
Direct(a.manifestPath).
|
||||
DirectSlice(additionalManifests).
|
||||
Transitive(staticManifestsDepSet).Build()
|
||||
|
|
@ -773,8 +774,8 @@ func (t transitiveAarDeps) assets() android.Paths {
|
|||
// aaptLibs collects libraries from dependencies and sdk_version and converts them into paths
|
||||
func aaptLibs(ctx android.ModuleContext, sdkContext android.SdkContext,
|
||||
classLoaderContexts dexpreopt.ClassLoaderContextMap, usesLibrary *usesLibrary) (
|
||||
staticResourcesNodes, sharedResourcesNodes *android.DepSet[*resourcesNode], staticRRODirs *android.DepSet[rroDir],
|
||||
staticManifests *android.DepSet[android.Path], sharedLibs android.Paths, flags []string) {
|
||||
staticResourcesNodes, sharedResourcesNodes depset.DepSet[*resourcesNode], staticRRODirs depset.DepSet[rroDir],
|
||||
staticManifests depset.DepSet[android.Path], sharedLibs android.Paths, flags []string) {
|
||||
|
||||
if classLoaderContexts == nil {
|
||||
// Not all callers need to compute class loader context, those who don't just pass nil.
|
||||
|
|
@ -787,10 +788,10 @@ func aaptLibs(ctx android.ModuleContext, sdkContext android.SdkContext,
|
|||
sharedLibs = append(sharedLibs, sdkDep.jars...)
|
||||
}
|
||||
|
||||
var staticResourcesNodeDepSets []*android.DepSet[*resourcesNode]
|
||||
var sharedResourcesNodeDepSets []*android.DepSet[*resourcesNode]
|
||||
rroDirsDepSetBuilder := android.NewDepSetBuilder[rroDir](android.TOPOLOGICAL)
|
||||
manifestsDepSetBuilder := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL)
|
||||
var staticResourcesNodeDepSets []depset.DepSet[*resourcesNode]
|
||||
var sharedResourcesNodeDepSets []depset.DepSet[*resourcesNode]
|
||||
rroDirsDepSetBuilder := depset.NewBuilder[rroDir](depset.TOPOLOGICAL)
|
||||
manifestsDepSetBuilder := depset.NewBuilder[android.Path](depset.TOPOLOGICAL)
|
||||
|
||||
ctx.VisitDirectDeps(func(module android.Module) {
|
||||
depTag := ctx.OtherModuleDependencyTag(module)
|
||||
|
|
@ -834,9 +835,9 @@ func aaptLibs(ctx android.ModuleContext, sdkContext android.SdkContext,
|
|||
// dependencies) the highest priority dependency is listed first, but for resources the highest priority
|
||||
// dependency has to be listed last. This is also inconsistent with the way manifests from the same
|
||||
// transitive dependencies are merged.
|
||||
staticResourcesNodes = android.NewDepSet(android.TOPOLOGICAL, nil,
|
||||
staticResourcesNodes = depset.New(depset.TOPOLOGICAL, nil,
|
||||
android.ReverseSliceInPlace(staticResourcesNodeDepSets))
|
||||
sharedResourcesNodes = android.NewDepSet(android.TOPOLOGICAL, nil,
|
||||
sharedResourcesNodes = depset.New(depset.TOPOLOGICAL, nil,
|
||||
android.ReverseSliceInPlace(sharedResourcesNodeDepSets))
|
||||
|
||||
staticRRODirs = rroDirsDepSetBuilder.Build()
|
||||
|
|
@ -1064,8 +1065,8 @@ type AARImport struct {
|
|||
rTxt android.Path
|
||||
rJar android.Path
|
||||
|
||||
resourcesNodesDepSet *android.DepSet[*resourcesNode]
|
||||
manifestsDepSet *android.DepSet[android.Path]
|
||||
resourcesNodesDepSet depset.DepSet[*resourcesNode]
|
||||
manifestsDepSet depset.DepSet[android.Path]
|
||||
|
||||
hideApexVariantFromMake bool
|
||||
|
||||
|
|
@ -1111,15 +1112,15 @@ var _ AndroidLibraryDependency = (*AARImport)(nil)
|
|||
func (a *AARImport) ExportPackage() android.Path {
|
||||
return a.exportPackage
|
||||
}
|
||||
func (a *AARImport) ResourcesNodeDepSet() *android.DepSet[*resourcesNode] {
|
||||
func (a *AARImport) ResourcesNodeDepSet() depset.DepSet[*resourcesNode] {
|
||||
return a.resourcesNodesDepSet
|
||||
}
|
||||
|
||||
func (a *AARImport) RRODirsDepSet() *android.DepSet[rroDir] {
|
||||
return android.NewDepSet[rroDir](android.TOPOLOGICAL, nil, nil)
|
||||
func (a *AARImport) RRODirsDepSet() depset.DepSet[rroDir] {
|
||||
return depset.New[rroDir](depset.TOPOLOGICAL, nil, nil)
|
||||
}
|
||||
|
||||
func (a *AARImport) ManifestsDepSet() *android.DepSet[android.Path] {
|
||||
func (a *AARImport) ManifestsDepSet() depset.DepSet[android.Path] {
|
||||
return a.manifestsDepSet
|
||||
}
|
||||
|
||||
|
|
@ -1233,13 +1234,13 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
proguardFlags := extractedAARDir.Join(ctx, "proguard.txt")
|
||||
transitiveProguardFlags, transitiveUnconditionalExportedFlags := collectDepProguardSpecInfo(ctx)
|
||||
android.SetProvider(ctx, ProguardSpecInfoProvider, ProguardSpecInfo{
|
||||
ProguardFlagsFiles: android.NewDepSet[android.Path](
|
||||
android.POSTORDER,
|
||||
ProguardFlagsFiles: depset.New[android.Path](
|
||||
depset.POSTORDER,
|
||||
android.Paths{proguardFlags},
|
||||
transitiveProguardFlags,
|
||||
),
|
||||
UnconditionallyExportedProguardFlags: android.NewDepSet[android.Path](
|
||||
android.POSTORDER,
|
||||
UnconditionallyExportedProguardFlags: depset.New[android.Path](
|
||||
depset.POSTORDER,
|
||||
nil,
|
||||
transitiveUnconditionalExportedFlags,
|
||||
),
|
||||
|
|
@ -1320,7 +1321,7 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
aapt2ExtractExtraPackages(ctx, extraAaptPackagesFile, a.rJar)
|
||||
a.extraAaptPackagesFile = extraAaptPackagesFile
|
||||
|
||||
resourcesNodesDepSetBuilder := android.NewDepSetBuilder[*resourcesNode](android.TOPOLOGICAL)
|
||||
resourcesNodesDepSetBuilder := depset.NewBuilder[*resourcesNode](depset.TOPOLOGICAL)
|
||||
resourcesNodesDepSetBuilder.Direct(&resourcesNode{
|
||||
resPackage: a.exportPackage,
|
||||
manifest: a.manifest,
|
||||
|
|
@ -1333,7 +1334,7 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
resourcesNodesDepSetBuilder.Transitive(staticResourcesNodesDepSet)
|
||||
a.resourcesNodesDepSet = resourcesNodesDepSetBuilder.Build()
|
||||
|
||||
manifestDepSetBuilder := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(a.manifest)
|
||||
manifestDepSetBuilder := depset.NewBuilder[android.Path](depset.TOPOLOGICAL).Direct(a.manifest)
|
||||
manifestDepSetBuilder.Transitive(staticManifestsDepSet)
|
||||
a.manifestsDepSet = manifestDepSetBuilder.Build()
|
||||
|
||||
|
|
@ -1352,9 +1353,9 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
var staticJars android.Paths
|
||||
var staticHeaderJars android.Paths
|
||||
var staticResourceJars android.Paths
|
||||
var transitiveStaticLibsHeaderJars []*android.DepSet[android.Path]
|
||||
var transitiveStaticLibsImplementationJars []*android.DepSet[android.Path]
|
||||
var transitiveStaticLibsResourceJars []*android.DepSet[android.Path]
|
||||
var transitiveStaticLibsHeaderJars []depset.DepSet[android.Path]
|
||||
var transitiveStaticLibsImplementationJars []depset.DepSet[android.Path]
|
||||
var transitiveStaticLibsResourceJars []depset.DepSet[android.Path]
|
||||
|
||||
ctx.VisitDirectDeps(func(module android.Module) {
|
||||
if dep, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok {
|
||||
|
|
@ -1364,24 +1365,18 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
staticJars = append(staticJars, dep.ImplementationJars...)
|
||||
staticHeaderJars = append(staticHeaderJars, dep.HeaderJars...)
|
||||
staticResourceJars = append(staticResourceJars, dep.ResourceJars...)
|
||||
if dep.TransitiveStaticLibsHeaderJars != nil {
|
||||
transitiveStaticLibsHeaderJars = append(transitiveStaticLibsHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
}
|
||||
if dep.TransitiveStaticLibsImplementationJars != nil {
|
||||
transitiveStaticLibsImplementationJars = append(transitiveStaticLibsImplementationJars, dep.TransitiveStaticLibsImplementationJars)
|
||||
}
|
||||
if dep.TransitiveStaticLibsResourceJars != nil {
|
||||
transitiveStaticLibsResourceJars = append(transitiveStaticLibsResourceJars, dep.TransitiveStaticLibsResourceJars)
|
||||
}
|
||||
transitiveStaticLibsHeaderJars = append(transitiveStaticLibsHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
transitiveStaticLibsImplementationJars = append(transitiveStaticLibsImplementationJars, dep.TransitiveStaticLibsImplementationJars)
|
||||
transitiveStaticLibsResourceJars = append(transitiveStaticLibsResourceJars, dep.TransitiveStaticLibsResourceJars)
|
||||
}
|
||||
}
|
||||
addCLCFromDep(ctx, module, a.classLoaderContexts)
|
||||
addMissingOptionalUsesLibsFromDep(ctx, module, &a.usesLibrary)
|
||||
})
|
||||
|
||||
completeStaticLibsHeaderJars := android.NewDepSet(android.PREORDER, android.Paths{classpathFile}, transitiveStaticLibsHeaderJars)
|
||||
completeStaticLibsImplementationJars := android.NewDepSet(android.PREORDER, android.Paths{classpathFile}, transitiveStaticLibsImplementationJars)
|
||||
completeStaticLibsResourceJars := android.NewDepSet(android.PREORDER, nil, transitiveStaticLibsResourceJars)
|
||||
completeStaticLibsHeaderJars := depset.New(depset.PREORDER, android.Paths{classpathFile}, transitiveStaticLibsHeaderJars)
|
||||
completeStaticLibsImplementationJars := depset.New(depset.PREORDER, android.Paths{classpathFile}, transitiveStaticLibsImplementationJars)
|
||||
completeStaticLibsResourceJars := depset.New(depset.PREORDER, nil, transitiveStaticLibsResourceJars)
|
||||
|
||||
var implementationJarFile android.Path
|
||||
var combineJars android.Paths
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import (
|
|||
"android/soong/testing"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/depset"
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
"android/soong/android"
|
||||
|
|
@ -227,7 +228,7 @@ func (a *AndroidApp) IsInstallable() bool {
|
|||
return Bool(a.properties.Installable)
|
||||
}
|
||||
|
||||
func (a *AndroidApp) ResourcesNodeDepSet() *android.DepSet[*resourcesNode] {
|
||||
func (a *AndroidApp) ResourcesNodeDepSet() depset.DepSet[*resourcesNode] {
|
||||
return a.aapt.resourcesNodesDepSet
|
||||
}
|
||||
|
||||
|
|
|
|||
130
java/base.go
130
java/base.go
|
|
@ -24,6 +24,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/depset"
|
||||
"github.com/google/blueprint/pathtools"
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
|
|
@ -471,7 +472,7 @@ type Module struct {
|
|||
srcJarDeps android.Paths
|
||||
|
||||
// the source files of this module and all its static dependencies
|
||||
transitiveSrcFiles *android.DepSet[android.Path]
|
||||
transitiveSrcFiles depset.DepSet[android.Path]
|
||||
|
||||
// jar file containing implementation classes and resources including static library
|
||||
// dependencies
|
||||
|
|
@ -1276,7 +1277,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||
android.SetProvider(ctx, JavaInfoProvider, &JavaInfo{
|
||||
HeaderJars: android.PathsIfNonNil(j.headerJarFile),
|
||||
LocalHeaderJars: localHeaderJars,
|
||||
TransitiveStaticLibsHeaderJars: android.NewDepSet(android.PREORDER, localHeaderJars, transitiveStaticLibsHeaderJars),
|
||||
TransitiveStaticLibsHeaderJars: depset.New(depset.PREORDER, localHeaderJars, transitiveStaticLibsHeaderJars),
|
||||
TransitiveLibsHeaderJarsForR8: j.transitiveLibsHeaderJarsForR8,
|
||||
TransitiveStaticLibsHeaderJarsForR8: j.transitiveStaticLibsHeaderJarsForR8,
|
||||
AidlIncludeDirs: j.exportAidlIncludeDirs,
|
||||
|
|
@ -1535,7 +1536,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||
localResourceJars = append(localResourceJars, servicesJar)
|
||||
}
|
||||
|
||||
completeStaticLibsResourceJars := android.NewDepSet(android.PREORDER, localResourceJars, deps.transitiveStaticLibsResourceJars)
|
||||
completeStaticLibsResourceJars := depset.New(depset.PREORDER, localResourceJars, deps.transitiveStaticLibsResourceJars)
|
||||
|
||||
var combinedResourceJar android.Path
|
||||
var resourceJars android.Paths
|
||||
|
|
@ -1562,7 +1563,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||
// classes.jar. If there is only one input jar this step will be skipped.
|
||||
var outputFile android.Path
|
||||
|
||||
completeStaticLibsImplementationJars := android.NewDepSet(android.PREORDER, localImplementationJars, deps.transitiveStaticLibsImplementationJars)
|
||||
completeStaticLibsImplementationJars := depset.New(depset.PREORDER, localImplementationJars, deps.transitiveStaticLibsImplementationJars)
|
||||
|
||||
var jars android.Paths
|
||||
if ctx.Config().UseTransitiveJarsInClasspath() {
|
||||
|
|
@ -1592,7 +1593,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||
Input: jars[0],
|
||||
Output: copiedJar,
|
||||
})
|
||||
completeStaticLibsImplementationJars = android.NewDepSet(android.PREORDER, android.Paths{copiedJar}, nil)
|
||||
completeStaticLibsImplementationJars = depset.New(depset.PREORDER, android.Paths{copiedJar}, nil)
|
||||
outputFile = copiedJar
|
||||
} else {
|
||||
outputFile = jars[0]
|
||||
|
|
@ -1608,7 +1609,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||
jarjarFile, jarjarred := j.jarjarIfNecessary(ctx, outputFile, jarName, "")
|
||||
if jarjarred {
|
||||
localImplementationJars = android.Paths{jarjarFile}
|
||||
completeStaticLibsImplementationJars = android.NewDepSet(android.PREORDER, localImplementationJars, nil)
|
||||
completeStaticLibsImplementationJars = depset.New(depset.PREORDER, localImplementationJars, nil)
|
||||
}
|
||||
outputFile = jarjarFile
|
||||
|
||||
|
|
@ -1618,7 +1619,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||
combinedResourceJar = resourceJarJarFile
|
||||
if jarjarred {
|
||||
localResourceJars = android.Paths{resourceJarJarFile}
|
||||
completeStaticLibsResourceJars = android.NewDepSet(android.PREORDER, localResourceJars, nil)
|
||||
completeStaticLibsResourceJars = depset.New(depset.PREORDER, localResourceJars, nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1636,14 +1637,14 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||
TransformRavenizer(ctx, ravenizerOutput, ravenizerInput, ravenizerArgs)
|
||||
outputFile = ravenizerOutput
|
||||
localImplementationJars = android.Paths{ravenizerOutput}
|
||||
completeStaticLibsImplementationJars = android.NewDepSet(android.PREORDER, localImplementationJars, nil)
|
||||
completeStaticLibsImplementationJars = depset.New(depset.PREORDER, localImplementationJars, nil)
|
||||
if combinedResourceJar != nil {
|
||||
ravenizerInput = combinedResourceJar
|
||||
ravenizerOutput = android.PathForModuleOut(ctx, "ravenizer", "resources", jarName)
|
||||
TransformRavenizer(ctx, ravenizerOutput, ravenizerInput, ravenizerArgs)
|
||||
combinedResourceJar = ravenizerOutput
|
||||
localResourceJars = android.Paths{ravenizerOutput}
|
||||
completeStaticLibsResourceJars = android.NewDepSet(android.PREORDER, localResourceJars, nil)
|
||||
completeStaticLibsResourceJars = depset.New(depset.PREORDER, localResourceJars, nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1658,7 +1659,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||
})
|
||||
outputFile = apiMapperFile
|
||||
localImplementationJars = android.Paths{apiMapperFile}
|
||||
completeStaticLibsImplementationJars = android.NewDepSet(android.PREORDER, localImplementationJars, nil)
|
||||
completeStaticLibsImplementationJars = depset.New(depset.PREORDER, localImplementationJars, nil)
|
||||
}
|
||||
|
||||
// Check package restrictions if necessary.
|
||||
|
|
@ -1681,7 +1682,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||
})
|
||||
outputFile = packageCheckOutputFile
|
||||
localImplementationJars = android.Paths{packageCheckOutputFile}
|
||||
completeStaticLibsImplementationJars = android.NewDepSet(android.PREORDER, localImplementationJars, nil)
|
||||
completeStaticLibsImplementationJars = depset.New(depset.PREORDER, localImplementationJars, nil)
|
||||
|
||||
// Check packages and create a timestamp file when complete.
|
||||
CheckJarPackages(ctx, pkgckFile, outputFile, j.properties.Permitted_packages)
|
||||
|
|
@ -1719,7 +1720,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||
|
||||
if j.shouldInstrument(ctx) {
|
||||
instrumentedOutputFile := j.instrument(ctx, flags, outputFile, jarName, specs)
|
||||
completeStaticLibsImplementationJarsToCombine = android.NewDepSet(android.PREORDER, android.Paths{instrumentedOutputFile}, nil)
|
||||
completeStaticLibsImplementationJarsToCombine = depset.New(depset.PREORDER, android.Paths{instrumentedOutputFile}, nil)
|
||||
outputFile = instrumentedOutputFile
|
||||
}
|
||||
|
||||
|
|
@ -1898,7 +1899,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||
RepackagedHeaderJars: android.PathsIfNonNil(repackagedHeaderJarFile),
|
||||
|
||||
LocalHeaderJars: localHeaderJars,
|
||||
TransitiveStaticLibsHeaderJars: android.NewDepSet(android.PREORDER, localHeaderJars, transitiveStaticLibsHeaderJars),
|
||||
TransitiveStaticLibsHeaderJars: depset.New(depset.PREORDER, localHeaderJars, transitiveStaticLibsHeaderJars),
|
||||
TransitiveStaticLibsImplementationJars: completeStaticLibsImplementationJars,
|
||||
TransitiveStaticLibsResourceJars: completeStaticLibsResourceJars,
|
||||
|
||||
|
|
@ -1927,17 +1928,15 @@ func (j *Module) useCompose(ctx android.BaseModuleContext) bool {
|
|||
return android.InList("androidx.compose.runtime_runtime", j.staticLibs(ctx))
|
||||
}
|
||||
|
||||
func collectDepProguardSpecInfo(ctx android.ModuleContext) (transitiveProguardFlags, transitiveUnconditionalExportedFlags []*android.DepSet[android.Path]) {
|
||||
func collectDepProguardSpecInfo(ctx android.ModuleContext) (transitiveProguardFlags, transitiveUnconditionalExportedFlags []depset.DepSet[android.Path]) {
|
||||
ctx.VisitDirectDeps(func(m android.Module) {
|
||||
depProguardInfo, _ := android.OtherModuleProvider(ctx, m, ProguardSpecInfoProvider)
|
||||
depTag := ctx.OtherModuleDependencyTag(m)
|
||||
|
||||
if depProguardInfo.UnconditionallyExportedProguardFlags != nil {
|
||||
transitiveUnconditionalExportedFlags = append(transitiveUnconditionalExportedFlags, depProguardInfo.UnconditionallyExportedProguardFlags)
|
||||
transitiveProguardFlags = append(transitiveProguardFlags, depProguardInfo.UnconditionallyExportedProguardFlags)
|
||||
}
|
||||
transitiveUnconditionalExportedFlags = append(transitiveUnconditionalExportedFlags, depProguardInfo.UnconditionallyExportedProguardFlags)
|
||||
transitiveProguardFlags = append(transitiveProguardFlags, depProguardInfo.UnconditionallyExportedProguardFlags)
|
||||
|
||||
if depTag == staticLibTag && depProguardInfo.ProguardFlagsFiles != nil {
|
||||
if depTag == staticLibTag {
|
||||
transitiveProguardFlags = append(transitiveProguardFlags, depProguardInfo.ProguardFlagsFiles)
|
||||
}
|
||||
})
|
||||
|
|
@ -1959,13 +1958,13 @@ func (j *Module) collectProguardSpecInfo(ctx android.ModuleContext) ProguardSpec
|
|||
|
||||
return ProguardSpecInfo{
|
||||
Export_proguard_flags_files: exportUnconditionally,
|
||||
ProguardFlagsFiles: android.NewDepSet[android.Path](
|
||||
android.POSTORDER,
|
||||
ProguardFlagsFiles: depset.New[android.Path](
|
||||
depset.POSTORDER,
|
||||
proguardFlagsForThisModule,
|
||||
transitiveProguardFlags,
|
||||
),
|
||||
UnconditionallyExportedProguardFlags: android.NewDepSet[android.Path](
|
||||
android.POSTORDER,
|
||||
UnconditionallyExportedProguardFlags: depset.New[android.Path](
|
||||
depset.POSTORDER,
|
||||
directUnconditionalExportedFlags,
|
||||
transitiveUnconditionalExportedFlags,
|
||||
),
|
||||
|
|
@ -2057,7 +2056,7 @@ func (j *Module) compileJavaHeader(ctx android.ModuleContext, srcFiles, srcJars
|
|||
// one input jar this step will be skipped.
|
||||
var jars android.Paths
|
||||
if ctx.Config().UseTransitiveJarsInClasspath() {
|
||||
depSet := android.NewDepSet(android.PREORDER, localHeaderJars, deps.transitiveStaticLibsHeaderJars)
|
||||
depSet := depset.New(depset.PREORDER, localHeaderJars, deps.transitiveStaticLibsHeaderJars)
|
||||
jars = depSet.ToList()
|
||||
} else {
|
||||
jars = append(slices.Clone(localHeaderJars), deps.staticHeaderJars...)
|
||||
|
|
@ -2087,9 +2086,9 @@ func (j *Module) instrument(ctx android.ModuleContext, flags javaBuilderFlags,
|
|||
|
||||
type providesTransitiveHeaderJarsForR8 struct {
|
||||
// set of header jars for all transitive libs deps
|
||||
transitiveLibsHeaderJarsForR8 *android.DepSet[android.Path]
|
||||
transitiveLibsHeaderJarsForR8 depset.DepSet[android.Path]
|
||||
// set of header jars for all transitive static libs deps
|
||||
transitiveStaticLibsHeaderJarsForR8 *android.DepSet[android.Path]
|
||||
transitiveStaticLibsHeaderJarsForR8 depset.DepSet[android.Path]
|
||||
}
|
||||
|
||||
// collectTransitiveHeaderJarsForR8 visits direct dependencies and collects all transitive libs and static_libs
|
||||
|
|
@ -2099,8 +2098,8 @@ type providesTransitiveHeaderJarsForR8 struct {
|
|||
func (j *providesTransitiveHeaderJarsForR8) collectTransitiveHeaderJarsForR8(ctx android.ModuleContext) {
|
||||
directLibs := android.Paths{}
|
||||
directStaticLibs := android.Paths{}
|
||||
transitiveLibs := []*android.DepSet[android.Path]{}
|
||||
transitiveStaticLibs := []*android.DepSet[android.Path]{}
|
||||
transitiveLibs := []depset.DepSet[android.Path]{}
|
||||
transitiveStaticLibs := []depset.DepSet[android.Path]{}
|
||||
ctx.VisitDirectDeps(func(module android.Module) {
|
||||
// don't add deps of the prebuilt version of the same library
|
||||
if ctx.ModuleName() == android.RemoveOptionalPrebuiltPrefix(module.Name()) {
|
||||
|
|
@ -2119,17 +2118,12 @@ func (j *providesTransitiveHeaderJarsForR8) collectTransitiveHeaderJarsForR8(ctx
|
|||
return
|
||||
}
|
||||
|
||||
if dep.TransitiveLibsHeaderJarsForR8 != nil {
|
||||
transitiveLibs = append(transitiveLibs, dep.TransitiveLibsHeaderJarsForR8)
|
||||
}
|
||||
if dep.TransitiveStaticLibsHeaderJarsForR8 != nil {
|
||||
transitiveStaticLibs = append(transitiveStaticLibs, dep.TransitiveStaticLibsHeaderJarsForR8)
|
||||
}
|
||||
|
||||
transitiveLibs = append(transitiveLibs, dep.TransitiveLibsHeaderJarsForR8)
|
||||
transitiveStaticLibs = append(transitiveStaticLibs, dep.TransitiveStaticLibsHeaderJarsForR8)
|
||||
}
|
||||
})
|
||||
j.transitiveLibsHeaderJarsForR8 = android.NewDepSet(android.POSTORDER, directLibs, transitiveLibs)
|
||||
j.transitiveStaticLibsHeaderJarsForR8 = android.NewDepSet(android.POSTORDER, directStaticLibs, transitiveStaticLibs)
|
||||
j.transitiveLibsHeaderJarsForR8 = depset.New(depset.POSTORDER, directLibs, transitiveLibs)
|
||||
j.transitiveStaticLibsHeaderJarsForR8 = depset.New(depset.POSTORDER, directStaticLibs, transitiveStaticLibs)
|
||||
}
|
||||
|
||||
func (j *Module) HeaderJars() android.Paths {
|
||||
|
|
@ -2229,19 +2223,17 @@ func (j *Module) JacocoReportClassesFile() android.Path {
|
|||
}
|
||||
|
||||
func (j *Module) collectTransitiveSrcFiles(ctx android.ModuleContext, mine android.Paths) {
|
||||
var fromDeps []*android.DepSet[android.Path]
|
||||
var fromDeps []depset.DepSet[android.Path]
|
||||
ctx.VisitDirectDeps(func(module android.Module) {
|
||||
tag := ctx.OtherModuleDependencyTag(module)
|
||||
if tag == staticLibTag {
|
||||
if depInfo, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok {
|
||||
if depInfo.TransitiveSrcFiles != nil {
|
||||
fromDeps = append(fromDeps, depInfo.TransitiveSrcFiles)
|
||||
}
|
||||
fromDeps = append(fromDeps, depInfo.TransitiveSrcFiles)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
j.transitiveSrcFiles = android.NewDepSet(android.POSTORDER, mine, fromDeps)
|
||||
j.transitiveSrcFiles = depset.New(depset.POSTORDER, mine, fromDeps)
|
||||
}
|
||||
|
||||
func (j *Module) IsInstallable() bool {
|
||||
|
|
@ -2375,12 +2367,12 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
|
|||
|
||||
j.collectTransitiveHeaderJarsForR8(ctx)
|
||||
|
||||
var transitiveBootClasspathHeaderJars []*android.DepSet[android.Path]
|
||||
var transitiveClasspathHeaderJars []*android.DepSet[android.Path]
|
||||
var transitiveJava9ClasspathHeaderJars []*android.DepSet[android.Path]
|
||||
var transitiveStaticJarsHeaderLibs []*android.DepSet[android.Path]
|
||||
var transitiveStaticJarsImplementationLibs []*android.DepSet[android.Path]
|
||||
var transitiveStaticJarsResourceLibs []*android.DepSet[android.Path]
|
||||
var transitiveBootClasspathHeaderJars []depset.DepSet[android.Path]
|
||||
var transitiveClasspathHeaderJars []depset.DepSet[android.Path]
|
||||
var transitiveJava9ClasspathHeaderJars []depset.DepSet[android.Path]
|
||||
var transitiveStaticJarsHeaderLibs []depset.DepSet[android.Path]
|
||||
var transitiveStaticJarsImplementationLibs []depset.DepSet[android.Path]
|
||||
var transitiveStaticJarsResourceLibs []depset.DepSet[android.Path]
|
||||
|
||||
ctx.VisitDirectDeps(func(module android.Module) {
|
||||
otherName := ctx.OtherModuleName(module)
|
||||
|
|
@ -2414,9 +2406,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
|
|||
switch tag {
|
||||
case bootClasspathTag:
|
||||
deps.bootClasspath = append(deps.bootClasspath, dep.HeaderJars...)
|
||||
if dep.TransitiveStaticLibsHeaderJars != nil {
|
||||
transitiveBootClasspathHeaderJars = append(transitiveBootClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
}
|
||||
transitiveBootClasspathHeaderJars = append(transitiveBootClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
case sdkLibTag, libTag, instrumentationForTag:
|
||||
if _, ok := module.(*Plugin); ok {
|
||||
ctx.ModuleErrorf("a java_plugin (%s) cannot be used as a libs dependency", otherName)
|
||||
|
|
@ -2431,14 +2421,10 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
|
|||
addPlugins(&deps, dep.ExportedPlugins, dep.ExportedPluginClasses...)
|
||||
deps.disableTurbine = deps.disableTurbine || dep.ExportedPluginDisableTurbine
|
||||
|
||||
if dep.TransitiveStaticLibsHeaderJars != nil {
|
||||
transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
}
|
||||
transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
case java9LibTag:
|
||||
deps.java9Classpath = append(deps.java9Classpath, dep.HeaderJars...)
|
||||
if dep.TransitiveStaticLibsHeaderJars != nil {
|
||||
transitiveJava9ClasspathHeaderJars = append(transitiveJava9ClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
}
|
||||
transitiveJava9ClasspathHeaderJars = append(transitiveJava9ClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
case staticLibTag:
|
||||
if _, ok := module.(*Plugin); ok {
|
||||
ctx.ModuleErrorf("a java_plugin (%s) cannot be used as a static_libs dependency", otherName)
|
||||
|
|
@ -2455,16 +2441,10 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
|
|||
deps.disableTurbine = deps.disableTurbine || dep.ExportedPluginDisableTurbine
|
||||
deps.aconfigProtoFiles = append(deps.aconfigProtoFiles, dep.AconfigIntermediateCacheOutputPaths...)
|
||||
|
||||
if dep.TransitiveStaticLibsHeaderJars != nil {
|
||||
transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
transitiveStaticJarsHeaderLibs = append(transitiveStaticJarsHeaderLibs, dep.TransitiveStaticLibsHeaderJars)
|
||||
}
|
||||
if dep.TransitiveStaticLibsImplementationJars != nil {
|
||||
transitiveStaticJarsImplementationLibs = append(transitiveStaticJarsImplementationLibs, dep.TransitiveStaticLibsImplementationJars)
|
||||
}
|
||||
if dep.TransitiveStaticLibsResourceJars != nil {
|
||||
transitiveStaticJarsResourceLibs = append(transitiveStaticJarsResourceLibs, dep.TransitiveStaticLibsResourceJars)
|
||||
}
|
||||
transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
transitiveStaticJarsHeaderLibs = append(transitiveStaticJarsHeaderLibs, dep.TransitiveStaticLibsHeaderJars)
|
||||
transitiveStaticJarsImplementationLibs = append(transitiveStaticJarsImplementationLibs, dep.TransitiveStaticLibsImplementationJars)
|
||||
transitiveStaticJarsResourceLibs = append(transitiveStaticJarsResourceLibs, dep.TransitiveStaticLibsResourceJars)
|
||||
case pluginTag:
|
||||
if plugin, ok := module.(*Plugin); ok {
|
||||
if plugin.pluginProperties.Processor_class != nil {
|
||||
|
|
@ -2514,14 +2494,14 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
|
|||
deps.classpath = append(deps.classpath, dep.Srcs()...)
|
||||
deps.dexClasspath = append(deps.classpath, dep.Srcs()...)
|
||||
transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars,
|
||||
android.NewDepSet(android.PREORDER, dep.Srcs(), nil))
|
||||
depset.New(depset.PREORDER, dep.Srcs(), nil))
|
||||
case staticLibTag:
|
||||
checkProducesJars(ctx, dep)
|
||||
deps.classpath = append(deps.classpath, dep.Srcs()...)
|
||||
deps.staticJars = append(deps.staticJars, dep.Srcs()...)
|
||||
deps.staticHeaderJars = append(deps.staticHeaderJars, dep.Srcs()...)
|
||||
|
||||
depHeaderJars := android.NewDepSet(android.PREORDER, dep.Srcs(), nil)
|
||||
depHeaderJars := depset.New(depset.PREORDER, dep.Srcs(), nil)
|
||||
transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, depHeaderJars)
|
||||
transitiveStaticJarsHeaderLibs = append(transitiveStaticJarsHeaderLibs, depHeaderJars)
|
||||
transitiveStaticJarsImplementationLibs = append(transitiveStaticJarsImplementationLibs, depHeaderJars)
|
||||
|
|
@ -2538,10 +2518,8 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
|
|||
// then add its libs to the bootclasspath.
|
||||
if sm, ok := android.OtherModuleProvider(ctx, module, SystemModulesProvider); ok {
|
||||
deps.bootClasspath = append(deps.bootClasspath, sm.HeaderJars...)
|
||||
if sm.TransitiveStaticLibsHeaderJars != nil {
|
||||
transitiveBootClasspathHeaderJars = append(transitiveBootClasspathHeaderJars,
|
||||
sm.TransitiveStaticLibsHeaderJars)
|
||||
}
|
||||
transitiveBootClasspathHeaderJars = append(transitiveBootClasspathHeaderJars,
|
||||
sm.TransitiveStaticLibsHeaderJars)
|
||||
} else {
|
||||
ctx.PropertyErrorf("boot classpath dependency %q does not provide SystemModulesProvider",
|
||||
ctx.OtherModuleName(module))
|
||||
|
|
@ -2577,11 +2555,11 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
|
|||
deps.transitiveStaticLibsResourceJars = transitiveStaticJarsResourceLibs
|
||||
|
||||
if ctx.Config().UseTransitiveJarsInClasspath() {
|
||||
depSet := android.NewDepSet(android.PREORDER, nil, transitiveClasspathHeaderJars)
|
||||
depSet := depset.New(depset.PREORDER, nil, transitiveClasspathHeaderJars)
|
||||
deps.classpath = depSet.ToList()
|
||||
depSet = android.NewDepSet(android.PREORDER, nil, transitiveBootClasspathHeaderJars)
|
||||
depSet = depset.New(depset.PREORDER, nil, transitiveBootClasspathHeaderJars)
|
||||
deps.bootClasspath = depSet.ToList()
|
||||
depSet = android.NewDepSet(android.PREORDER, nil, transitiveJava9ClasspathHeaderJars)
|
||||
depSet = depset.New(depset.PREORDER, nil, transitiveJava9ClasspathHeaderJars)
|
||||
deps.java9Classpath = depSet.ToList()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ import (
|
|||
|
||||
"android/soong/android"
|
||||
"android/soong/dexpreopt"
|
||||
|
||||
"github.com/google/blueprint/depset"
|
||||
)
|
||||
|
||||
type DeviceHostConverter struct {
|
||||
|
|
@ -96,9 +98,9 @@ func (d *DeviceHostConverter) GenerateAndroidBuildActions(ctx android.ModuleCont
|
|||
ctx.PropertyErrorf("libs", "at least one dependency is required")
|
||||
}
|
||||
|
||||
var transitiveHeaderJars []*android.DepSet[android.Path]
|
||||
var transitiveImplementationJars []*android.DepSet[android.Path]
|
||||
var transitiveResourceJars []*android.DepSet[android.Path]
|
||||
var transitiveHeaderJars []depset.DepSet[android.Path]
|
||||
var transitiveImplementationJars []depset.DepSet[android.Path]
|
||||
var transitiveResourceJars []depset.DepSet[android.Path]
|
||||
|
||||
ctx.VisitDirectDepsWithTag(deviceHostConverterDepTag, func(m android.Module) {
|
||||
if dep, ok := android.OtherModuleProvider(ctx, m, JavaInfoProvider); ok {
|
||||
|
|
@ -110,15 +112,9 @@ func (d *DeviceHostConverter) GenerateAndroidBuildActions(ctx android.ModuleCont
|
|||
d.srcJarArgs = append(d.srcJarArgs, dep.SrcJarArgs...)
|
||||
d.srcJarDeps = append(d.srcJarDeps, dep.SrcJarDeps...)
|
||||
|
||||
if dep.TransitiveStaticLibsHeaderJars != nil {
|
||||
transitiveHeaderJars = append(transitiveHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
}
|
||||
if dep.TransitiveStaticLibsImplementationJars != nil {
|
||||
transitiveImplementationJars = append(transitiveImplementationJars, dep.TransitiveStaticLibsImplementationJars)
|
||||
}
|
||||
if dep.TransitiveStaticLibsResourceJars != nil {
|
||||
transitiveResourceJars = append(transitiveResourceJars, dep.TransitiveStaticLibsResourceJars)
|
||||
}
|
||||
transitiveHeaderJars = append(transitiveHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
transitiveImplementationJars = append(transitiveImplementationJars, dep.TransitiveStaticLibsImplementationJars)
|
||||
transitiveResourceJars = append(transitiveResourceJars, dep.TransitiveStaticLibsResourceJars)
|
||||
} else {
|
||||
ctx.PropertyErrorf("libs", "module %q cannot be used as a dependency", ctx.OtherModuleName(m))
|
||||
}
|
||||
|
|
@ -147,9 +143,9 @@ func (d *DeviceHostConverter) GenerateAndroidBuildActions(ctx android.ModuleCont
|
|||
android.SetProvider(ctx, JavaInfoProvider, &JavaInfo{
|
||||
HeaderJars: d.headerJars,
|
||||
LocalHeaderJars: d.headerJars,
|
||||
TransitiveStaticLibsHeaderJars: android.NewDepSet(android.PREORDER, nil, transitiveHeaderJars),
|
||||
TransitiveStaticLibsImplementationJars: android.NewDepSet(android.PREORDER, nil, transitiveImplementationJars),
|
||||
TransitiveStaticLibsResourceJars: android.NewDepSet(android.PREORDER, nil, transitiveResourceJars),
|
||||
TransitiveStaticLibsHeaderJars: depset.New(depset.PREORDER, nil, transitiveHeaderJars),
|
||||
TransitiveStaticLibsImplementationJars: depset.New(depset.PREORDER, nil, transitiveImplementationJars),
|
||||
TransitiveStaticLibsResourceJars: depset.New(depset.PREORDER, nil, transitiveResourceJars),
|
||||
ImplementationAndResourcesJars: d.implementationAndResourceJars,
|
||||
ImplementationJars: d.implementationJars,
|
||||
ResourceJars: d.resourceJars,
|
||||
|
|
|
|||
18
java/dex.go
18
java/dex.go
|
|
@ -324,20 +324,16 @@ func (d *dexer) r8Flags(ctx android.ModuleContext, dexParams *compileDexParams)
|
|||
r8Deps = append(r8Deps, flags.dexClasspath...)
|
||||
|
||||
transitiveStaticLibsLookupMap := map[android.Path]bool{}
|
||||
if d.transitiveStaticLibsHeaderJarsForR8 != nil {
|
||||
for _, jar := range d.transitiveStaticLibsHeaderJarsForR8.ToList() {
|
||||
transitiveStaticLibsLookupMap[jar] = true
|
||||
}
|
||||
for _, jar := range d.transitiveStaticLibsHeaderJarsForR8.ToList() {
|
||||
transitiveStaticLibsLookupMap[jar] = true
|
||||
}
|
||||
transitiveHeaderJars := android.Paths{}
|
||||
if d.transitiveLibsHeaderJarsForR8 != nil {
|
||||
for _, jar := range d.transitiveLibsHeaderJarsForR8.ToList() {
|
||||
if _, ok := transitiveStaticLibsLookupMap[jar]; ok {
|
||||
// don't include a lib if it is already packaged in the current JAR as a static lib
|
||||
continue
|
||||
}
|
||||
transitiveHeaderJars = append(transitiveHeaderJars, jar)
|
||||
for _, jar := range d.transitiveLibsHeaderJarsForR8.ToList() {
|
||||
if _, ok := transitiveStaticLibsLookupMap[jar]; ok {
|
||||
// don't include a lib if it is already packaged in the current JAR as a static lib
|
||||
continue
|
||||
}
|
||||
transitiveHeaderJars = append(transitiveHeaderJars, jar)
|
||||
}
|
||||
transitiveClasspath := classpath(transitiveHeaderJars)
|
||||
r8Flags = append(r8Flags, transitiveClasspath.FormJavaClassPath("-libraryjars"))
|
||||
|
|
|
|||
69
java/java.go
69
java/java.go
|
|
@ -29,6 +29,7 @@ import (
|
|||
"android/soong/testing"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/depset"
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
"android/soong/android"
|
||||
|
|
@ -242,10 +243,10 @@ type ProguardSpecInfo struct {
|
|||
// TransitiveDepsProguardSpecFiles is a depset of paths to proguard flags files that are exported from
|
||||
// all transitive deps. This list includes all proguard flags files from transitive static dependencies,
|
||||
// and all proguard flags files from transitive libs dependencies which set `export_proguard_spec: true`.
|
||||
ProguardFlagsFiles *android.DepSet[android.Path]
|
||||
ProguardFlagsFiles depset.DepSet[android.Path]
|
||||
|
||||
// implementation detail to store transitive proguard flags files from exporting shared deps
|
||||
UnconditionallyExportedProguardFlags *android.DepSet[android.Path]
|
||||
UnconditionallyExportedProguardFlags depset.DepSet[android.Path]
|
||||
}
|
||||
|
||||
var ProguardSpecInfoProvider = blueprint.NewProvider[ProguardSpecInfo]()
|
||||
|
|
@ -260,19 +261,19 @@ type JavaInfo struct {
|
|||
RepackagedHeaderJars android.Paths
|
||||
|
||||
// set of header jars for all transitive libs deps
|
||||
TransitiveLibsHeaderJarsForR8 *android.DepSet[android.Path]
|
||||
TransitiveLibsHeaderJarsForR8 depset.DepSet[android.Path]
|
||||
|
||||
// set of header jars for all transitive static libs deps
|
||||
TransitiveStaticLibsHeaderJarsForR8 *android.DepSet[android.Path]
|
||||
TransitiveStaticLibsHeaderJarsForR8 depset.DepSet[android.Path]
|
||||
|
||||
// depset of header jars for this module and all transitive static dependencies
|
||||
TransitiveStaticLibsHeaderJars *android.DepSet[android.Path]
|
||||
TransitiveStaticLibsHeaderJars depset.DepSet[android.Path]
|
||||
|
||||
// depset of implementation jars for this module and all transitive static dependencies
|
||||
TransitiveStaticLibsImplementationJars *android.DepSet[android.Path]
|
||||
TransitiveStaticLibsImplementationJars depset.DepSet[android.Path]
|
||||
|
||||
// depset of resource jars for this module and all transitive static dependencies
|
||||
TransitiveStaticLibsResourceJars *android.DepSet[android.Path]
|
||||
TransitiveStaticLibsResourceJars depset.DepSet[android.Path]
|
||||
|
||||
// ImplementationAndResourceJars is a list of jars that contain the implementations of classes
|
||||
// in the module as well as any resources included in the module.
|
||||
|
|
@ -300,7 +301,7 @@ type JavaInfo struct {
|
|||
SrcJarDeps android.Paths
|
||||
|
||||
// The source files of this module and all its transitive static dependencies.
|
||||
TransitiveSrcFiles *android.DepSet[android.Path]
|
||||
TransitiveSrcFiles depset.DepSet[android.Path]
|
||||
|
||||
// ExportedPlugins is a list of paths that should be used as annotation processors for any
|
||||
// module that depends on this module.
|
||||
|
|
@ -586,9 +587,9 @@ type deps struct {
|
|||
|
||||
disableTurbine bool
|
||||
|
||||
transitiveStaticLibsHeaderJars []*android.DepSet[android.Path]
|
||||
transitiveStaticLibsImplementationJars []*android.DepSet[android.Path]
|
||||
transitiveStaticLibsResourceJars []*android.DepSet[android.Path]
|
||||
transitiveStaticLibsHeaderJars []depset.DepSet[android.Path]
|
||||
transitiveStaticLibsImplementationJars []depset.DepSet[android.Path]
|
||||
transitiveStaticLibsResourceJars []depset.DepSet[android.Path]
|
||||
}
|
||||
|
||||
func checkProducesJars(ctx android.ModuleContext, dep android.SourceFileProducer) {
|
||||
|
|
@ -2396,8 +2397,8 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
android.SetProvider(ctx, JavaInfoProvider, &JavaInfo{
|
||||
HeaderJars: android.PathsIfNonNil(al.stubsJar),
|
||||
LocalHeaderJars: android.PathsIfNonNil(al.stubsJar),
|
||||
TransitiveStaticLibsHeaderJars: android.NewDepSet(android.PREORDER, android.PathsIfNonNil(al.stubsJar), nil),
|
||||
TransitiveStaticLibsImplementationJars: android.NewDepSet(android.PREORDER, android.PathsIfNonNil(al.stubsJar), nil),
|
||||
TransitiveStaticLibsHeaderJars: depset.New(depset.PREORDER, android.PathsIfNonNil(al.stubsJar), nil),
|
||||
TransitiveStaticLibsImplementationJars: depset.New(depset.PREORDER, android.PathsIfNonNil(al.stubsJar), nil),
|
||||
ImplementationAndResourcesJars: android.PathsIfNonNil(al.stubsJar),
|
||||
ImplementationJars: android.PathsIfNonNil(al.stubsJar),
|
||||
AidlIncludeDirs: android.Paths{},
|
||||
|
|
@ -2661,11 +2662,11 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
|
||||
var flags javaBuilderFlags
|
||||
|
||||
var transitiveClasspathHeaderJars []*android.DepSet[android.Path]
|
||||
var transitiveBootClasspathHeaderJars []*android.DepSet[android.Path]
|
||||
var transitiveStaticLibsHeaderJars []*android.DepSet[android.Path]
|
||||
var transitiveStaticLibsImplementationJars []*android.DepSet[android.Path]
|
||||
var transitiveStaticLibsResourceJars []*android.DepSet[android.Path]
|
||||
var transitiveClasspathHeaderJars []depset.DepSet[android.Path]
|
||||
var transitiveBootClasspathHeaderJars []depset.DepSet[android.Path]
|
||||
var transitiveStaticLibsHeaderJars []depset.DepSet[android.Path]
|
||||
var transitiveStaticLibsImplementationJars []depset.DepSet[android.Path]
|
||||
var transitiveStaticLibsResourceJars []depset.DepSet[android.Path]
|
||||
|
||||
j.collectTransitiveHeaderJarsForR8(ctx)
|
||||
var staticJars android.Paths
|
||||
|
|
@ -2678,29 +2679,19 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
case libTag, sdkLibTag:
|
||||
flags.classpath = append(flags.classpath, dep.HeaderJars...)
|
||||
flags.dexClasspath = append(flags.dexClasspath, dep.HeaderJars...)
|
||||
if dep.TransitiveStaticLibsHeaderJars != nil {
|
||||
transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
}
|
||||
transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
case staticLibTag:
|
||||
flags.classpath = append(flags.classpath, dep.HeaderJars...)
|
||||
staticJars = append(staticJars, dep.ImplementationJars...)
|
||||
staticResourceJars = append(staticResourceJars, dep.ResourceJars...)
|
||||
staticHeaderJars = append(staticHeaderJars, dep.HeaderJars...)
|
||||
if dep.TransitiveStaticLibsHeaderJars != nil {
|
||||
transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
transitiveStaticLibsHeaderJars = append(transitiveStaticLibsHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
}
|
||||
if dep.TransitiveStaticLibsImplementationJars != nil {
|
||||
transitiveStaticLibsImplementationJars = append(transitiveStaticLibsImplementationJars, dep.TransitiveStaticLibsImplementationJars)
|
||||
}
|
||||
if dep.TransitiveStaticLibsResourceJars != nil {
|
||||
transitiveStaticLibsResourceJars = append(transitiveStaticLibsResourceJars, dep.TransitiveStaticLibsResourceJars)
|
||||
}
|
||||
transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
transitiveStaticLibsHeaderJars = append(transitiveStaticLibsHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
transitiveStaticLibsImplementationJars = append(transitiveStaticLibsImplementationJars, dep.TransitiveStaticLibsImplementationJars)
|
||||
transitiveStaticLibsResourceJars = append(transitiveStaticLibsResourceJars, dep.TransitiveStaticLibsResourceJars)
|
||||
case bootClasspathTag:
|
||||
flags.bootClasspath = append(flags.bootClasspath, dep.HeaderJars...)
|
||||
if dep.TransitiveStaticLibsHeaderJars != nil {
|
||||
transitiveBootClasspathHeaderJars = append(transitiveBootClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
}
|
||||
transitiveBootClasspathHeaderJars = append(transitiveBootClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
}
|
||||
} else if _, ok := android.OtherModuleProvider(ctx, module, SdkLibraryInfoProvider); ok {
|
||||
switch tag {
|
||||
|
|
@ -2725,9 +2716,9 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
false, j.properties.Exclude_files, j.properties.Exclude_dirs)
|
||||
localStrippedJars := android.Paths{localCombinedHeaderJar}
|
||||
|
||||
completeStaticLibsHeaderJars := android.NewDepSet(android.PREORDER, localStrippedJars, transitiveStaticLibsHeaderJars)
|
||||
completeStaticLibsImplementationJars := android.NewDepSet(android.PREORDER, localStrippedJars, transitiveStaticLibsImplementationJars)
|
||||
completeStaticLibsResourceJars := android.NewDepSet(android.PREORDER, nil, transitiveStaticLibsResourceJars)
|
||||
completeStaticLibsHeaderJars := depset.New(depset.PREORDER, localStrippedJars, transitiveStaticLibsHeaderJars)
|
||||
completeStaticLibsImplementationJars := depset.New(depset.PREORDER, localStrippedJars, transitiveStaticLibsImplementationJars)
|
||||
completeStaticLibsResourceJars := depset.New(depset.PREORDER, nil, transitiveStaticLibsResourceJars)
|
||||
|
||||
// Always pass the input jars to TransformJarsToJar, even if there is only a single jar, we need the output
|
||||
// file of the module to be named jarName.
|
||||
|
|
@ -2788,8 +2779,8 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
|
||||
// Enabling jetifier requires modifying classes from transitive dependencies, disable transitive
|
||||
// classpath and use the combined header jar instead.
|
||||
completeStaticLibsHeaderJars = android.NewDepSet(android.PREORDER, android.Paths{headerJar}, nil)
|
||||
completeStaticLibsImplementationJars = android.NewDepSet(android.PREORDER, android.Paths{outputFile}, nil)
|
||||
completeStaticLibsHeaderJars = depset.New(depset.PREORDER, android.Paths{headerJar}, nil)
|
||||
completeStaticLibsImplementationJars = depset.New(depset.PREORDER, android.Paths{outputFile}, nil)
|
||||
}
|
||||
|
||||
implementationJarFile := outputFile
|
||||
|
|
|
|||
37
java/lint.go
37
java/lint.go
|
|
@ -20,6 +20,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/depset"
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
"android/soong/android"
|
||||
|
|
@ -101,19 +102,19 @@ type linter struct {
|
|||
}
|
||||
|
||||
type LintDepSets struct {
|
||||
HTML, Text, XML, Baseline *android.DepSet[android.Path]
|
||||
HTML, Text, XML, Baseline depset.DepSet[android.Path]
|
||||
}
|
||||
|
||||
type LintDepSetsBuilder struct {
|
||||
HTML, Text, XML, Baseline *android.DepSetBuilder[android.Path]
|
||||
HTML, Text, XML, Baseline *depset.Builder[android.Path]
|
||||
}
|
||||
|
||||
func NewLintDepSetBuilder() LintDepSetsBuilder {
|
||||
return LintDepSetsBuilder{
|
||||
HTML: android.NewDepSetBuilder[android.Path](android.POSTORDER),
|
||||
Text: android.NewDepSetBuilder[android.Path](android.POSTORDER),
|
||||
XML: android.NewDepSetBuilder[android.Path](android.POSTORDER),
|
||||
Baseline: android.NewDepSetBuilder[android.Path](android.POSTORDER),
|
||||
HTML: depset.NewBuilder[android.Path](depset.POSTORDER),
|
||||
Text: depset.NewBuilder[android.Path](depset.POSTORDER),
|
||||
XML: depset.NewBuilder[android.Path](depset.POSTORDER),
|
||||
Baseline: depset.NewBuilder[android.Path](depset.POSTORDER),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -128,18 +129,10 @@ func (l LintDepSetsBuilder) Direct(html, text, xml android.Path, baseline androi
|
|||
}
|
||||
|
||||
func (l LintDepSetsBuilder) Transitive(info *LintInfo) LintDepSetsBuilder {
|
||||
if info.TransitiveHTML != nil {
|
||||
l.HTML.Transitive(info.TransitiveHTML)
|
||||
}
|
||||
if info.TransitiveText != nil {
|
||||
l.Text.Transitive(info.TransitiveText)
|
||||
}
|
||||
if info.TransitiveXML != nil {
|
||||
l.XML.Transitive(info.TransitiveXML)
|
||||
}
|
||||
if info.TransitiveBaseline != nil {
|
||||
l.Baseline.Transitive(info.TransitiveBaseline)
|
||||
}
|
||||
l.HTML.Transitive(info.TransitiveHTML)
|
||||
l.Text.Transitive(info.TransitiveText)
|
||||
l.XML.Transitive(info.TransitiveXML)
|
||||
l.Baseline.Transitive(info.TransitiveBaseline)
|
||||
return l
|
||||
}
|
||||
|
||||
|
|
@ -204,10 +197,10 @@ type LintInfo struct {
|
|||
XML android.Path
|
||||
ReferenceBaseline android.Path
|
||||
|
||||
TransitiveHTML *android.DepSet[android.Path]
|
||||
TransitiveText *android.DepSet[android.Path]
|
||||
TransitiveXML *android.DepSet[android.Path]
|
||||
TransitiveBaseline *android.DepSet[android.Path]
|
||||
TransitiveHTML depset.DepSet[android.Path]
|
||||
TransitiveText depset.DepSet[android.Path]
|
||||
TransitiveXML depset.DepSet[android.Path]
|
||||
TransitiveBaseline depset.DepSet[android.Path]
|
||||
}
|
||||
|
||||
func (l *linter) enabled() bool {
|
||||
|
|
|
|||
|
|
@ -191,9 +191,7 @@ func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.Mo
|
|||
var transitiveSrcFiles android.Paths
|
||||
for _, module := range append(allModules, implLibModule...) {
|
||||
if depInfo, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok {
|
||||
if depInfo.TransitiveSrcFiles != nil {
|
||||
transitiveSrcFiles = append(transitiveSrcFiles, depInfo.TransitiveSrcFiles.ToList()...)
|
||||
}
|
||||
transitiveSrcFiles = append(transitiveSrcFiles, depInfo.TransitiveSrcFiles.ToList()...)
|
||||
}
|
||||
}
|
||||
jarArgs := resourcePathsToJarArgs(transitiveSrcFiles)
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/depset"
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
"android/soong/android"
|
||||
|
|
@ -129,7 +130,7 @@ type SystemModulesProviderInfo struct {
|
|||
OutputDirDeps android.Paths
|
||||
|
||||
// depset of header jars for this module and all transitive static dependencies
|
||||
TransitiveStaticLibsHeaderJars *android.DepSet[android.Path]
|
||||
TransitiveStaticLibsHeaderJars depset.DepSet[android.Path]
|
||||
}
|
||||
|
||||
var SystemModulesProvider = blueprint.NewProvider[*SystemModulesProviderInfo]()
|
||||
|
|
@ -152,13 +153,11 @@ type SystemModulesProperties struct {
|
|||
func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
var jars android.Paths
|
||||
|
||||
var transitiveStaticLibsHeaderJars []*android.DepSet[android.Path]
|
||||
var transitiveStaticLibsHeaderJars []depset.DepSet[android.Path]
|
||||
ctx.VisitDirectDepsWithTag(systemModulesLibsTag, func(module android.Module) {
|
||||
if dep, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok {
|
||||
jars = append(jars, dep.HeaderJars...)
|
||||
if dep.TransitiveStaticLibsHeaderJars != nil {
|
||||
transitiveStaticLibsHeaderJars = append(transitiveStaticLibsHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
}
|
||||
transitiveStaticLibsHeaderJars = append(transitiveStaticLibsHeaderJars, dep.TransitiveStaticLibsHeaderJars)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -168,7 +167,7 @@ func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleConte
|
|||
HeaderJars: jars,
|
||||
OutputDir: system.outputDir,
|
||||
OutputDirDeps: system.outputDeps,
|
||||
TransitiveStaticLibsHeaderJars: android.NewDepSet(android.PREORDER, nil, transitiveStaticLibsHeaderJars),
|
||||
TransitiveStaticLibsHeaderJars: depset.New(depset.PREORDER, nil, transitiveStaticLibsHeaderJars),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/depset"
|
||||
|
||||
"android/soong/android"
|
||||
"android/soong/cc"
|
||||
|
|
@ -620,7 +621,7 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
|
|||
}
|
||||
|
||||
if library.static() {
|
||||
depSet := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(outputFile).Build()
|
||||
depSet := depset.NewBuilder[android.Path](depset.TOPOLOGICAL).Direct(outputFile).Build()
|
||||
android.SetProvider(ctx, cc.StaticLibraryInfoProvider, cc.StaticLibraryInfo{
|
||||
StaticLibrary: outputFile,
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import (
|
|||
"android/soong/testing"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/depset"
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
"android/soong/android"
|
||||
|
|
@ -179,7 +180,7 @@ type Module struct {
|
|||
// For apex variants, this is set as apex.min_sdk_version
|
||||
apexSdkVersion android.ApiLevel
|
||||
|
||||
transitiveAndroidMkSharedLibs *android.DepSet[string]
|
||||
transitiveAndroidMkSharedLibs depset.DepSet[string]
|
||||
}
|
||||
|
||||
func (mod *Module) Header() bool {
|
||||
|
|
@ -1217,7 +1218,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||
|
||||
skipModuleList := map[string]bool{}
|
||||
|
||||
var transitiveAndroidMkSharedLibs []*android.DepSet[string]
|
||||
var transitiveAndroidMkSharedLibs []depset.DepSet[string]
|
||||
var directAndroidMkSharedLibs []string
|
||||
|
||||
ctx.VisitDirectDeps(func(dep android.Module) {
|
||||
|
|
@ -1453,7 +1454,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||
}
|
||||
})
|
||||
|
||||
mod.transitiveAndroidMkSharedLibs = android.NewDepSet[string](android.PREORDER, directAndroidMkSharedLibs, transitiveAndroidMkSharedLibs)
|
||||
mod.transitiveAndroidMkSharedLibs = depset.New[string](depset.PREORDER, directAndroidMkSharedLibs, transitiveAndroidMkSharedLibs)
|
||||
|
||||
var rlibDepFiles RustLibraries
|
||||
aliases := mod.compiler.Aliases()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue