From d48f3c3885d0b0ce00a3a58a1492a2bc46f23e5a Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Fri, 23 Aug 2019 11:18:57 +0900 Subject: soong: Add tests for depending on disabled module This will check if direct deps of android.Module type is "Enabled()". Previously, this is checked only if a module calls VisitDeps*() functions in GenerateAndroidBuildActions(). Most modules call VisitDeps*() in GenerateAndroidBuildActions(), but some modules don't. For example, "apex" module calls WalkDepsBlueprint() or VisitDirectDepsBlueprint() since it exceptionally depends on non-android.Module modules. Therefore, when an apex module depends on disabled(enabled:false) module, build fails with panic, which is fixed by this change. Test: m # runs soong tests Change-Id: I81c5c148bbd51a253d2904690eb76ae7b6df1a0f --- android/module.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'android/module.go') diff --git a/android/module.go b/android/module.go index 0ab9be777..dda526f09 100644 --- a/android/module.go +++ b/android/module.go @@ -1038,6 +1038,13 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) } if m.Enabled() { + // ensure all direct android.Module deps are enabled + ctx.VisitDirectDepsBlueprint(func(bm blueprint.Module) { + if _, ok := bm.(Module); ok { + ctx.validateAndroidModule(bm, ctx.baseModuleContext.strictVisitDeps) + } + }) + notice := proptools.StringDefault(m.commonProperties.Notice, "NOTICE") if module := SrcIsModule(notice); module != "" { m.noticeFile = ctx.ExpandOptionalSource(¬ice, "notice") -- cgit v1.2.3-59-g8ed1b