From 1d4907e027518bbaecae3aa775d131d0269a56de Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Wed, 15 May 2024 02:09:42 +0900 Subject: [PATCH] Revert "Add SkipToTransitiveDepsTag interface for dependency tags" This reverts commit 1fb7c3512989311818af83d6aee246f171907a05. Change-Id: Ib4c5815a06785cd876caa37acc0522adc26bc495 --- android/deptag.go | 15 ------------- android/module.go | 18 +++------------- android/packaging_test.go | 45 ++------------------------------------- 3 files changed, 5 insertions(+), 73 deletions(-) diff --git a/android/deptag.go b/android/deptag.go index 77b9d6114..c7ba4d36f 100644 --- a/android/deptag.go +++ b/android/deptag.go @@ -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 } diff --git a/android/module.go b/android/module.go index d7f0537f7..738f5435b 100644 --- a/android/module.go +++ b/android/module.go @@ -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) } }) diff --git a/android/packaging_test.go b/android/packaging_test.go index 4b72c24f9..383343723 100644 --- a/android/packaging_test.go +++ b/android/packaging_test.go @@ -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"}) -}