Allow missing java_sdk_library files in AllowMissingDependencies builds
java_sdk_library modules in builds with AllowMissingDependencies may be missing defaults modules that cause them to look for api files that they normally wouldn't need. Move the error to runtime so it doesn't block the build unless the branch tries to build that module. Test: prebuilts/build-tools/build-prebuilts.sh in aosp-build-tools Change-Id: I279b0cd8493779f972c0ac02235967c10b35a5a0
This commit is contained in:
parent
c3a800f611
commit
18f840c45e
2 changed files with 7 additions and 2 deletions
|
@ -104,6 +104,7 @@ type DefaultableHookContext interface {
|
|||
EarlyModuleContext
|
||||
|
||||
CreateModule(ModuleFactory, ...interface{}) Module
|
||||
AddMissingDependencies(missingDeps []string)
|
||||
}
|
||||
|
||||
type DefaultableHook func(ctx DefaultableHookContext)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue