From 300f038848024a51fd32883e50e05ccb06831290 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 6 Mar 2018 13:11:51 -0800 Subject: [PATCH] Only add SDK file dependencies on device builds Dependencies on sdk_vcurrent, etc. should only be added to java modules that are building for the device. Test: aosp-build-tools build Change-Id: I01abba94fed8b470085529092263f4634dec229c --- java/java.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/java/java.go b/java/java.go index 3bd07df30..c4c07f7c9 100644 --- a/java/java.go +++ b/java/java.go @@ -571,13 +571,15 @@ func checkLinkType(ctx android.ModuleContext, from *Module, to *Library, tag dep func (j *Module) collectDeps(ctx android.ModuleContext) deps { var deps deps - sdkDep := decodeSdkDep(ctx, String(j.deviceProperties.Sdk_version)) - if sdkDep.invalidVersion { - ctx.AddMissingDependencies([]string{sdkDep.module}) - } else if sdkDep.useFiles { - // sdkDep.jar is actually equivalent to turbine header.jar. - deps.classpath = append(deps.classpath, sdkDep.jar) - deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, sdkDep.aidl) + if ctx.Device() { + sdkDep := decodeSdkDep(ctx, String(j.deviceProperties.Sdk_version)) + if sdkDep.invalidVersion { + ctx.AddMissingDependencies([]string{sdkDep.module}) + } else if sdkDep.useFiles { + // sdkDep.jar is actually equivalent to turbine header.jar. + deps.classpath = append(deps.classpath, sdkDep.jar) + deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, sdkDep.aidl) + } } ctx.VisitDirectDeps(func(module android.Module) {