summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go29
1 files changed, 15 insertions, 14 deletions
diff --git a/java/java.go b/java/java.go
index d7077d1bb..d043a12fe 100644
--- a/java/java.go
+++ b/java/java.go
@@ -54,6 +54,18 @@ func init() {
android.RegisterSingletonType("kythe_java_extract", kytheExtractJavaFactory)
}
+func (j *Module) checkSdkVersion(ctx android.ModuleContext) {
+ if j.SocSpecific() || j.DeviceSpecific() ||
+ (j.ProductSpecific() && ctx.Config().EnforceProductPartitionInterface()) {
+ if sc, ok := ctx.Module().(sdkContext); ok {
+ if sc.sdkVersion() == "" {
+ ctx.PropertyErrorf("sdk_version",
+ "sdk_version must have a value when the module is located at vendor or product(only if PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE is set).")
+ }
+ }
+ }
+}
+
func (j *Module) checkPlatformAPI(ctx android.ModuleContext) {
if sc, ok := ctx.Module().(sdkContext); ok {
usePlatformAPI := proptools.Bool(j.deviceProperties.Platform_apis)
@@ -447,18 +459,6 @@ var (
usesLibTag = dependencyTag{name: "uses-library"}
)
-func defaultSdkVersion(ctx checkVendorModuleContext) string {
- if ctx.SocSpecific() || ctx.DeviceSpecific() {
- return "system_current"
- }
- return ""
-}
-
-type checkVendorModuleContext interface {
- SocSpecific() bool
- DeviceSpecific() bool
-}
-
type sdkDep struct {
useModule, useFiles, useDefaultLibs, invalidVersion bool
@@ -505,7 +505,7 @@ func (j *Module) shouldInstrumentStatic(ctx android.BaseModuleContext) bool {
}
func (j *Module) sdkVersion() string {
- return proptools.StringDefault(j.deviceProperties.Sdk_version, defaultSdkVersion(j))
+ return String(j.deviceProperties.Sdk_version)
}
func (j *Module) systemModules() string {
@@ -1635,6 +1635,7 @@ func shouldUncompressDex(ctx android.ModuleContext, dexpreopter *dexpreopter) bo
}
func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ j.checkSdkVersion(ctx)
j.dexpreopter.installPath = android.PathForModuleInstall(ctx, "framework", j.Stem()+".jar")
j.dexpreopter.isSDKLibrary = j.deviceProperties.IsSDKLibrary
j.dexpreopter.isInstallable = Bool(j.properties.Installable)
@@ -1978,7 +1979,7 @@ type Import struct {
}
func (j *Import) sdkVersion() string {
- return proptools.StringDefault(j.properties.Sdk_version, defaultSdkVersion(j))
+ return String(j.properties.Sdk_version)
}
func (j *Import) minSdkVersion() string {