diff options
author | Jeongik Cha <jeongik@google.com> | 2019-07-31 01:09:35 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-07-31 01:09:35 +0000 |
commit | 8a64f8c907b764bb581e34c344f77d622cb1d6e6 (patch) | |
tree | 58ec7142815d897f90cadc36f0da9b4f585376ce /java/java.go | |
parent | 1eee154c3b6e67c4b3c4c9fe4853dd432e7b590e (diff) | |
parent | 538c0d0c29fdb4508d00a30bdc4fa222b31d598f (diff) |
Merge "Add a rule about platform_apis"
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 fb2ddf917..fea38b51f 100644 --- a/java/java.go +++ b/java/java.go @@ -53,6 +53,20 @@ func init() { android.RegisterSingletonType("kythe_java_extract", kytheExtractJavaFactory) } +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 @@ -179,8 +193,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. @@ -191,7 +205,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 { |