Delay invalid sdk_version error for AllowMissingDependencies
Unbundled builds set AllowMissingDependencies and attempt to use
prebuilts for some jars. Delay the errors for missing jars for
modules with invalid sdk_version values in unbundled builds so
that they only block the build if those modules are built.
Also fix some error messages to show the original sdk_version
value.
Bug: 146513037
Test: m TARGET_BUILD_APPS=Camera2
Change-Id: I1812ef6dc80895f7a2162a8bdbf2c5067755e9a0
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 5518d5d..9b30e2c 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -667,7 +667,11 @@
jar := filepath.Join(dir, module.BaseModuleName()+".jar")
jarPath := android.ExistentPathForSource(ctx, jar)
if !jarPath.Valid() {
- ctx.PropertyErrorf("sdk_library", "invalid sdk version %q, %q does not exist", v, jar)
+ if ctx.Config().AllowMissingDependencies() {
+ return android.Paths{android.PathForSource(ctx, jar)}
+ } else {
+ ctx.PropertyErrorf("sdk_library", "invalid sdk version %q, %q does not exist", sdkVersion, jar)
+ }
return nil
}
return android.Paths{jarPath.Path()}