Skip to content

Conversation

@VivekLumbhani
Copy link

Description

This PR fixes issue #34 where iOS-only developers were forced to install Android Studio and set up ANDROID_NDK_HOME, even though they don't need Android dependencies.

Problem

Currently, valdi_initialize_workspace() unconditionally registers Android dependencies by calling _register_android_deps(). This causes the build to fail with:

ERROR: Either the ANDROID_NDK_HOME environment variable or the path attribute of android_ndk_repository must be set.

This is frustrating for developers who only want to build iOS apps and don't want to install the entire Android toolchain.

Solution

Added an enable_android parameter to valdi_initialize_workspace() with smart defaults:

  • enable_android = None (default): Auto-detects based on target_platform

    • Disables Android for iOS/macOS-only builds
    • Enables Android for other platforms or multi-platform builds
  • enable_android = False: Explicitly skips Android dependencies

    • Perfect for iOS-only projects
    • No Android Studio or NDK required
  • enable_android = True: Explicitly enables Android dependencies

    • For Android or multi-platform projects

Changes Made

Code Changes

  • bzl/workspace_init.bzl:
    • Added enable_android parameter to valdi_initialize_workspace()
    • Added auto-detection logic based on target_platform
    • Made _register_android_deps() conditional
    • Added comprehensive documentation

Documentation

  • docs/[your-doc-file].md: (adjust based on what you actually updated)
    • Added iOS-only setup instructions
    • Provided examples for different platform configurations
    • Explained when to use enable_android = False

Usage Examples

iOS-only project (no Android Studio needed)

valdi_initialize_workspace(enable_android = False)

Android-only project

valdi_initialize_workspace(target_platform = "android")

Multi-platform project (default behavior unchanged)

valdi_initialize_workspace()

Testing

Tested by:

  • ✅ Building iOS-only project without ANDROID_NDK_HOME set
  • ✅ Verifying Android dependencies are skipped when enable_android = False
  • ✅ Confirming multi-platform builds still work (backward compatible)

Backward Compatibility

Fully backward compatible - existing WORKSPACE files will continue to work exactly as before. The default behavior is unchanged for multi-platform projects.

Fixes

Closes #34

Checklist

  • Code changes made
  • Documentation updated
  • Tested iOS-only build
  • Backward compatibility verified
  • Maintainer review requested

Note to reviewers: This is a quality-of-life improvement that removes unnecessary setup friction for iOS developers while maintaining full backward compatibility.

- Auto-detect package manager (apt/dnf/yum)
- Map package names for different distros
- Handle libtinfo5 installation for both Ubuntu and Fedora
- Fix Java package names for different distros
- Fixes Snapchat#38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error on valdi install ios

1 participant