Skip to content

Limit playground builds to requested platform dependencies#10

Merged
gioneill merged 2 commits intoSnapchat:mainfrom
gioneill:goneill/platform-scope-playground-bazel
Apr 2, 2026
Merged

Limit playground builds to requested platform dependencies#10
gioneill merged 2 commits intoSnapchat:mainfrom
gioneill:goneill/platform-scope-playground-bazel

Conversation

@gioneill
Copy link
Copy Markdown
Collaborator

@gioneill gioneill commented Apr 2, 2026

Summary

Problem this solves: don't build use platform level stuff that I'm not trying to build (Android NDK when building Mac OS app, example)

  • Scope Valdi workspace initialization to the selected platform by wiring platform_dependency_rule and VALDI_PLATFORM_DEPENDENCIES into WORKSPACE.
  • Use platform Bazel configs (--config=ios|android|macos|web) and switch playground scripts to those configs.
  • Prevent non-Android builds from resolving Android toolchain dependencies indirectly.

Changes

  • WORKSPACE
    • Add platform_dependency_rule and VALDI_PLATFORM_DEPENDENCIES.
    • Call valdi_initialize_workspace(VALDI_PLATFORM_DEPENDENCIES).
  • .bazelrc
    • Add build:ios, build:android, build:macos, build:web repo env mappings.
  • Playground scripts
    • scripts/bazel_ios_install.sh
    • scripts/bazel_android_install.sh
    • scripts/bazel_macos_run.sh
    • scripts/bazel_web_serve.sh

Verification

  • bazel build --config=macos --nobuild //valdi_modules/playground:app_macos
  • bazel build --config=web //valdi_modules/playground:playground_export_npm

@gioneill gioneill force-pushed the goneill/platform-scope-playground-bazel branch from 24e35cb to 073727a Compare April 2, 2026 17:42
@gioneill gioneill requested a review from clholgat April 2, 2026 17:42
@gioneill
Copy link
Copy Markdown
Collaborator Author

gioneill commented Apr 2, 2026

Valdi_Widgets is where this surfaced, but the interesting part is that Valdi already seems to provide the intended pattern for handling this. In Valdi’s own WORKSPACE, the repo does not call valdi_initialize_workspace() bare; it first creates platform_check, loads VALDI_PLATFORM_DEPENDENCIES, and then passes that through to valdi_initialize_workspace(...) from workspace_init.bzl. By contrast, the old Valdi_Widgets setup was effectively:

load("@valdi//bzl:workspace_init.bzl", "valdi_initialize_workspace")

valdi_initialize_workspace()

whereas Valdi’s own repo uses the more explicit pattern:

load("//bzl:workspace_init.bzl", "platform_dependency_rule", "valdi_initialize_workspace")

platform_dependency_rule(name = "platform_check")
load("@platform_check//:target_platform.bzl", "VALDI_PLATFORM_DEPENDENCIES")

valdi_initialize_workspace(VALDI_PLATFORM_DEPENDENCIES)

So my read is not necessarily that Valdi needs new semantics here, but that downstream repos like Valdi_Widgets should follow the same platform-scoped initialization pattern that Valdi itself already uses. This PR does that, and it fixes the case where a non-Android build like //valdi_modules/playground:app_macos can otherwise end up pulling Android workspace dependencies unnecessarily.

@gioneill gioneill merged commit 91a710c into Snapchat:main Apr 2, 2026
2 checks passed
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.

2 participants