Skip to content

Commit e41440e

Browse files
timothyklimcopybara-github
authored andcommitted
Support symlinks for Android SDK repository
For example, NixOS create a symlink for Android platform like: ``` ls -la /nix/store/azw6n236rgfkbmvfrbak4cnbcd4glbxn-androidsdk/libexec/android-sdk/platforms total 0 dr-xr-xr-x 2 root root 24 Jan 1 1970 . dr-xr-xr-x 7 root root 141 Jan 1 1970 .. lrwxrwxrwx 1 root root 97 Jan 1 1970 android-29 -> /nix/store/2lll753i9y9j37b7mpsz5b81mspmpnnv-platforms-29/libexec/android-sdk/platforms/android-29 ``` Closes #12626. PiperOrigin-RevId: 346204845
1 parent 06c83d2 commit e41440e

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎src/main/java/com/google/devtools/build/lib/bazel/rules/android/AndroidRepositoryFunction.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ final DirectoryListingValue getDirectoryListing(Path root, PathFragment dirPath,
8383
static final ImmutableSortedSet<Integer> getApiLevels(Dirents platformsDirectories) {
8484
ImmutableSortedSet.Builder<Integer> apiLevels = ImmutableSortedSet.reverseOrder();
8585
for (Dirent platformDirectory : platformsDirectories) {
86-
if (platformDirectory.getType() != Dirent.Type.DIRECTORY) {
87-
continue;
88-
}
89-
Matcher matcher = PLATFORMS_API_LEVEL_PATTERN.matcher(platformDirectory.getName());
90-
if (matcher.matches()) {
91-
apiLevels.add(Integer.parseInt(matcher.group(1)));
86+
if (platformDirectory.getType() == Dirent.Type.DIRECTORY
87+
|| platformDirectory.getType() == Dirent.Type.SYMLINK) {
88+
Matcher matcher = PLATFORMS_API_LEVEL_PATTERN.matcher(platformDirectory.getName());
89+
if (matcher.matches()) {
90+
apiLevels.add(Integer.parseInt(matcher.group(1)));
91+
}
9292
}
9393
}
9494
return apiLevels.build();

0 commit comments

Comments
 (0)