aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java
index 14b05372df..8b3c32b42d 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryFunction.java
@@ -20,6 +20,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Maps.EntryTransformer;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
@@ -62,6 +63,11 @@ public class AndroidSdkRepositoryFunction extends RepositoryFunction {
private static final Revision MIN_BUILD_TOOLS_REVISION = new Revision(24, 0, 3);
private static final String PATH_ENV_VAR = "ANDROID_HOME";
private static final ImmutableList<String> PATH_ENV_VAR_AS_LIST = ImmutableList.of(PATH_ENV_VAR);
+ private static final ImmutableList<String> LOCAL_MAVEN_REPOSITORIES =
+ ImmutableList.of(
+ "extras/android/m2repository",
+ "extras/google/m2repository",
+ "extras/m2repository");
@Override
public boolean isLocal(Rule rule) {
@@ -79,7 +85,7 @@ public class AndroidSdkRepositoryFunction extends RepositoryFunction {
}
@Override
- public RepositoryDirectoryValue.Builder fetch(Rule rule, Path outputDirectory,
+ public RepositoryDirectoryValue.Builder fetch(Rule rule, final Path outputDirectory,
BlazeDirectories directories, Environment env, Map<String, String> markerData)
throws SkyFunctionException, InterruptedException {
Map<String, String> environ =
@@ -221,9 +227,15 @@ public class AndroidSdkRepositoryFunction extends RepositoryFunction {
// All local maven repositories that are shipped in the Android SDK.
// TODO(ajmichael): Create SkyKeys so that if the SDK changes, this function will get rerun.
- Iterable<Path> localMavenRepositories = ImmutableList.of(
- outputDirectory.getRelative("extras/android/m2repository"),
- outputDirectory.getRelative("extras/google/m2repository"));
+ Iterable<Path> localMavenRepositories =
+ Lists.transform(
+ LOCAL_MAVEN_REPOSITORIES,
+ new Function<String, Path>() {
+ @Override
+ public Path apply(String pathFragment) {
+ return outputDirectory.getRelative(pathFragment);
+ }
+ });
try {
SdkMavenRepository sdkExtrasRepository =
SdkMavenRepository.create(Iterables.filter(localMavenRepositories, new Predicate<Path>() {