Skip to content

Pls handle non-directory entries (e.g. .DS_Store for macos) in Android SDK system-images #386

@oscarthecat

Description

@oscarthecat

Hi, we’re using rules_android version 0.6.5 and we really appreciate it — thanks for the great work!

However, we noticed a minor issue when using it on macOS.

macOS can automatically generate .DS_Store files when a user opens a folder in Finder. For example, in our local environment we might see:

$ ls -l $ANDROID_SDK/system-images
total 0
drwxr-xr-x@  4 gongzhen  staff  128  Jul 11 12:32 ./
drwxr-xr-x@ 18 gongzhen  staff  576  Nov  2  2024 ../
-rw-r--r--@  1 gongzhen  staff    0  Jul 11 12:32 .DS_Store
drwxr-xr-x@  3 gongzhen  staff   96  Sep 19  2024 android-35/

This causes the following loop in rule.bzl to fail when .DS_Store is encountered:

# The directory structure needed is "system-images/android-API/apis-enabled/arch"
for api_entry in system_images_path.readdir():
    for enabled_entry in api_entry.readdir():
        for arch_entry in enabled_entry.readdir():

While we already check if api_entry is a directory at the root level (system-images/), the same issue can happen deeper in the directory tree if the user manually opens other folders. It doesn’t seem ideal to add is_dir checks at every level.

Is there a cleaner or recommended way to handle this within rules_android to avoid .DS_Store or other non-directory files causing the fetch to fail?

Thanks again for maintaining this project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions