diff options
author | Colin Cross <ccross@android.com> | 2017-10-02 14:22:08 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-10-02 23:18:32 -0700 |
commit | 47ff2521c6479c44c5b7b0874948346b04c682df (patch) | |
tree | d54098c2b719ba1be5657a5b13c586f2ebf4b9a6 /java/java.go | |
parent | d5934c8bb7c17e324a9db7b28dcac14a8b727474 (diff) |
Relax SDK checks for unbundled builds
Unbundled builds might not have the prebuilt/sdk files, allow
the build to continue and then fail if the module is actually
built.
Test: m -j checkbuild
Change-Id: I21163778f1cc50945c7a12e57da0e39ba963aa7c
Diffstat (limited to 'java/java.go')
-rw-r--r-- | java/java.go | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/java/java.go b/java/java.go index 1ca392831..d8bc0c2cb 100644 --- a/java/java.go +++ b/java/java.go @@ -195,10 +195,11 @@ var ( ) type sdkDep struct { - useModule, useFiles, useDefaultLibs bool - module string - jar android.Path - aidl android.Path + useModule, useFiles, useDefaultLibs, invalidVersion bool + + module string + jar android.Path + aidl android.Path } func decodeSdkDep(ctx android.BaseContext, v string) sdkDep { @@ -218,14 +219,24 @@ func decodeSdkDep(ctx android.BaseContext, v string) sdkDep { aidl := filepath.Join(dir, "framework.aidl") jarPath := android.ExistentPathForSource(ctx, "sdkdir", jar) aidlPath := android.ExistentPathForSource(ctx, "sdkdir", aidl) + + if (!jarPath.Valid() || !aidlPath.Valid()) && ctx.AConfig().AllowMissingDependencies() { + return sdkDep{ + invalidVersion: true, + module: "sdk_v" + v, + } + } + if !jarPath.Valid() { ctx.PropertyErrorf("sdk_version", "invalid sdk version %q, %q does not exist", v, jar) return sdkDep{} } + if !aidlPath.Valid() { ctx.PropertyErrorf("sdk_version", "invalid sdk version %q, %q does not exist", v, aidl) return sdkDep{} } + return sdkDep{ useFiles: true, jar: jarPath.Path(), @@ -323,7 +334,9 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps { var deps deps sdkDep := decodeSdkDep(ctx, j.deviceProperties.Sdk_version) - if sdkDep.useFiles { + if sdkDep.invalidVersion { + ctx.AddMissingDependencies([]string{sdkDep.module}) + } else if sdkDep.useFiles { deps.classpath = append(deps.classpath, sdkDep.jar) deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, sdkDep.aidl) } |