diff options
author | 2017-04-17 20:37:14 +0200 | |
---|---|---|
committer | 2017-04-18 11:33:24 +0200 | |
commit | b9a2e9ded67bdf6fff0a611d174096269f68a981 (patch) | |
tree | e1f50f526952e9a20d82865cef04c03fea6d27a5 /src/test/java/com/google | |
parent | d470a32e641b0aa407ffbff2022f44636d204f67 (diff) |
Add /sdk/extras/m2repository the list of Android SDK embedded Maven repositories.
Fixes https://github.com/bazelbuild/bazel/issues/2830
RELNOTES: None
PiperOrigin-RevId: 153367521
Diffstat (limited to 'src/test/java/com/google')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryTest.java | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryTest.java b/src/test/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryTest.java index 47554ecdca..7f90e4297a 100644 --- a/src/test/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryTest.java +++ b/src/test/java/com/google/devtools/build/lib/bazel/rules/android/AndroidSdkRepositoryTest.java @@ -60,10 +60,12 @@ public class AndroidSdkRepositoryTest extends BuildViewTestCase { } private void scratchExtrasLibrary( - String groupId, String artifactId, String version, String packaging) throws Exception { + String mavenRepoPath, String groupId, String artifactId, String version, String packaging) + throws Exception { scratch.file( String.format( - "/sdk/extras/google/m2repository/%s/%s/%s/%s.pom", + "/sdk/%s/%s/%s/%s/%s.pom", + mavenRepoPath, groupId.replace(".", "/"), artifactId, version, @@ -80,7 +82,7 @@ public class AndroidSdkRepositoryTest extends BuildViewTestCase { public void testGeneratedAarImport() throws Exception { scratchPlatformsDirectories(25); scratchBuildToolsDirectories("25.0.0"); - scratchExtrasLibrary("com.google.android", "foo", "1.0.0", "aar"); + scratchExtrasLibrary("extras/google/m2repository", "com.google.android", "foo", "1.0.0", "aar"); FileSystemUtils.appendIsoLatin1(scratch.resolve("WORKSPACE"), "local_repository(name = 'bazel_tools', path = '/bazel_tools_workspace')", "android_sdk_repository(", @@ -100,7 +102,7 @@ public class AndroidSdkRepositoryTest extends BuildViewTestCase { public void testExportsExtrasLibraryArtifacts() throws Exception { scratchPlatformsDirectories(25); scratchBuildToolsDirectories("25.0.0"); - scratchExtrasLibrary("com.google.android", "foo", "1.0.0", "aar"); + scratchExtrasLibrary("extras/google/m2repository", "com.google.android", "foo", "1.0.0", "aar"); FileSystemUtils.appendIsoLatin1(scratch.resolve("WORKSPACE"), "local_repository(name = 'bazel_tools', path = '/bazel_tools_workspace')", "android_sdk_repository(", @@ -115,6 +117,35 @@ public class AndroidSdkRepositoryTest extends BuildViewTestCase { } @Test + public void testKnownSdkMavenRepositories() throws Exception { + scratchPlatformsDirectories(25); + scratchBuildToolsDirectories("25.0.0"); + scratchExtrasLibrary("extras/google/m2repository", "com.google.android", "a", "1.0.0", "jar"); + scratchExtrasLibrary("extras/android/m2repository", "com.android.support", "b", "1.0.0", "aar"); + scratchExtrasLibrary("extras/m2repository", "com.android.support", "c", "1.0.1", "aar"); + FileSystemUtils.appendIsoLatin1(scratch.resolve("WORKSPACE"), + "local_repository(name = 'bazel_tools', path = '/bazel_tools_workspace')", + "android_sdk_repository(", + " name = 'androidsdk',", + " path = '/sdk',", + ")"); + invalidatePackages(); + + assertThat( + getConfiguredTarget( + "@androidsdk//:extras/google/m2repository/com/google/android/a/1.0.0/a.jar")) + .isNotNull(); + assertThat( + getConfiguredTarget( + "@androidsdk//:extras/android/m2repository/com/android/support/b/1.0.0/b.aar")) + .isNotNull(); + assertThat( + getConfiguredTarget( + "@androidsdk//:extras/m2repository/com/android/support/c/1.0.1/c.aar")) + .isNotNull(); + } + + @Test public void testSystemImageDirectoriesAreFound() throws Exception { scratchPlatformsDirectories(25); scratchBuildToolsDirectories("25.0.0"); |