Merge "Allow missing java_sdk_library files in AllowMissingDependencies builds" am: 90463fe8cb

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1714750

Change-Id: I1140332f8e45a4cf1e5cf04fa60b435b85e98123
This commit is contained in:
Colin Cross
2021-05-21 15:27:12 +00:00
committed by Automerger Merge Worker
2 changed files with 7 additions and 2 deletions

View File

@@ -104,6 +104,7 @@ type DefaultableHookContext interface {
EarlyModuleContext
CreateModule(ModuleFactory, ...interface{}) Module
AddMissingDependencies(missingDeps []string)
}
type DefaultableHook func(ctx DefaultableHookContext)

View File

@@ -1629,8 +1629,12 @@ func (module *SdkLibrary) CreateInternalModules(mctx android.DefaultableHookCont
path := path.Join(mctx.ModuleDir(), apiDir, scope.apiFilePrefix+api)
p := android.ExistentPathForSource(mctx, path)
if !p.Valid() {
mctx.ModuleErrorf("Current api file %#v doesn't exist", path)
missingCurrentApi = true
if mctx.Config().AllowMissingDependencies() {
mctx.AddMissingDependencies([]string{path})
} else {
mctx.ModuleErrorf("Current api file %#v doesn't exist", path)
missingCurrentApi = true
}
}
}
}