Revert "Add SkipToTransitiveDepsTag interface for dependency tags"

This reverts commit 1fb7c35129.

Change-Id: Ib4c5815a06785cd876caa37acc0522adc26bc495
This commit is contained in:
Jiyong Park 2024-05-15 02:09:42 +09:00
parent cd9dca20a0
commit 1d4907e027
3 changed files with 5 additions and 73 deletions

View file

@ -44,21 +44,6 @@ func IsInstallDepNeededTag(tag blueprint.DependencyTag) bool {
return false
}
// Dependency tags can implement this interface and return true from SkipToTransitiveDeps to
// annotate that this dependency isn't installed, but its transitive dependencies are. This is
// useful when a module is built into another module (ex: static linking) but the module still has
// runtime dependencies.
type SkipToTransitiveDepsTag interface {
SkipToTransitiveDeps() bool
}
func IsSkipToTransitiveDepsTag(tag blueprint.DependencyTag) bool {
if i, ok := tag.(SkipToTransitiveDepsTag); ok {
return i.SkipToTransitiveDeps()
}
return false
}
type PropagateAconfigValidationDependencyTag interface {
PropagateAconfigValidation() bool
}

View file

@ -1470,27 +1470,15 @@ func (m *ModuleBase) computeInstallDeps(ctx ModuleContext) ([]*DepSet[InstallPat
var installDeps []*DepSet[InstallPath]
var packagingSpecs []*DepSet[PackagingSpec]
ctx.VisitDirectDeps(func(dep Module) {
depTag := ctx.OtherModuleDependencyTag(dep)
// If this is true, the direct outputs from the module is not gathered, but its
// transitive deps are still gathered.
skipToTransitive := IsSkipToTransitiveDepsTag(depTag)
if isInstallDepNeeded(dep, depTag) || skipToTransitive {
if isInstallDepNeeded(dep, ctx.OtherModuleDependencyTag(dep)) {
// Installation is still handled by Make, so anything hidden from Make is not
// installable.
if !dep.IsHideFromMake() && !dep.IsSkipInstall() {
if skipToTransitive {
installDeps = append(installDeps, dep.base().installFilesDepSet.transitive...)
} else {
installDeps = append(installDeps, dep.base().installFilesDepSet)
}
installDeps = append(installDeps, dep.base().installFilesDepSet)
}
// Add packaging deps even when the dependency is not installed so that uninstallable
// modules can still be packaged. Often the package will be installed instead.
if skipToTransitive {
packagingSpecs = append(packagingSpecs, dep.base().packagingSpecsDepSet.transitive...)
} else {
packagingSpecs = append(packagingSpecs, dep.base().packagingSpecsDepSet)
}
packagingSpecs = append(packagingSpecs, dep.base().packagingSpecsDepSet)
}
})

View file

@ -25,9 +25,8 @@ import (
type componentTestModule struct {
ModuleBase
props struct {
Deps []string
Build_only_deps []string
Skip_install *bool
Deps []string
Skip_install *bool
}
}
@ -37,18 +36,6 @@ type installDepTag struct {
InstallAlwaysNeededDependencyTag
}
// dep tag for build_only_deps
type buildOnlyDepTag struct {
blueprint.BaseDependencyTag
InstallAlwaysNeededDependencyTag
}
var _ SkipToTransitiveDepsTag = (*buildOnlyDepTag)(nil)
func (tag buildOnlyDepTag) SkipToTransitiveDeps() bool {
return true
}
func componentTestModuleFactory() Module {
m := &componentTestModule{}
m.AddProperties(&m.props)
@ -58,7 +45,6 @@ func componentTestModuleFactory() Module {
func (m *componentTestModule) DepsMutator(ctx BottomUpMutatorContext) {
ctx.AddDependency(ctx.Module(), installDepTag{}, m.props.Deps...)
ctx.AddDependency(ctx.Module(), buildOnlyDepTag{}, m.props.Build_only_deps...)
}
func (m *componentTestModule) GenerateAndroidBuildActions(ctx ModuleContext) {
@ -412,30 +398,3 @@ func TestPackagingWithSkipInstallDeps(t *testing.T) {
}
`, []string{"lib64/foo", "lib64/bar", "lib64/baz"})
}
func TestPackagingWithSkipToTransitvDeps(t *testing.T) {
// packag -[deps]-> foo -[build_only_deps]-> bar -[deps]-> baz
// bar isn't installed, but it brings baz to its parent.
multiTarget := false
runPackagingTest(t, multiTarget,
`
component {
name: "foo",
build_only_deps: ["bar"],
}
component {
name: "bar",
deps: ["baz"],
}
component {
name: "baz",
}
package_module {
name: "package",
deps: ["foo"],
}
`, []string{"lib64/foo", "lib64/baz"})
}