diff options
author | Jeongik Cha <jeongik@google.com> | 2019-07-11 15:54:27 +0900 |
---|---|---|
committer | Jeongik Cha <jeongik@google.com> | 2019-07-29 20:48:30 +0900 |
commit | 538c0d0c29fdb4508d00a30bdc4fa222b31d598f (patch) | |
tree | 9fedadbb74d873298f25fe774f6186629940a020 /java/java.go | |
parent | c89fe6253f67810e4340c595e63fb25c0ff7d09b (diff) |
Add a rule about platform_apis
As sdk_check.mk checks, soong starts to check every app.
If sdk_version is empty, platform_apis must be true.
If sdk_version is not empty, platform_apis must be false.
Test: soong test
Test: m
Bug: 132780927
Change-Id: I7ba702d616404d155f8ac40cd008828663ad1488
Diffstat (limited to 'java/java.go')
-rw-r--r-- | java/java.go | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/java/java.go b/java/java.go index 5f4a09093..ecafa1e22 100644 --- a/java/java.go +++ b/java/java.go @@ -52,6 +52,20 @@ func init() { android.RegisterSingletonType("logtags", LogtagsSingleton) } +func (j *Module) checkPlatformAPI(ctx android.ModuleContext) { + if sc, ok := ctx.Module().(sdkContext); ok { + usePlatformAPI := proptools.Bool(j.deviceProperties.Platform_apis) + if usePlatformAPI != (sc.sdkVersion() == "") { + if usePlatformAPI { + ctx.PropertyErrorf("platform_apis", "platform_apis must be false when sdk_version is not empty.") + } else { + ctx.PropertyErrorf("platform_apis", "platform_apis must be true when sdk_version is empty.") + } + } + + } +} + // TODO: // Autogenerated files: // Renderscript @@ -178,8 +192,8 @@ type CompilerDeviceProperties struct { // list of module-specific flags that will be used for dex compiles Dxflags []string `android:"arch_variant"` - // if not blank, set to the version of the sdk to compile against. Defaults to compiling against the current - // sdk if platform_apis is not set. + // if not blank, set to the version of the sdk to compile against. + // Defaults to compiling against the current platform. Sdk_version *string // if not blank, set the minimum version of the sdk that the compiled artifacts will run against. @@ -190,7 +204,8 @@ type CompilerDeviceProperties struct { // Defaults to sdk_version if not set. Target_sdk_version *string - // if true, compile against the platform APIs instead of an SDK. + // It must be true only if sdk_version is empty. + // This field works in only android_app, otherwise nothing happens. Platform_apis *bool Aidl struct { |