Skip to content

Fix the Windows and macOS build against current GPUI CE - #3

Closed
tarc wants to merge 2 commits into
gpui-ce:mainfrom
tarc:fix/native-menu-asset-registry
Closed

tarc wants to merge 2 commits into
gpui-ce:mainfrom
tarc:fix/native-menu-asset-registry

Conversation

@tarc

@tarc tarc commented Oct 1, 2026

Copy link
Copy Markdown

Follow-up to #1, which made the crate build against current GPUI CE on Linux. On Windows and macOS it still fails to compile, and since #1 merged, GPUI CE has renamed one more window method.

Changes

  1. The native menu takes the AssetRegistry. App::asset_source() was replaced by App::assets() in gpui-ce Toggle stripe and number of rows in Table Story longbridge/gpui-kit#259. The native context menu only builds on Windows and macOS, so the Linux build never saw the old call:

    error[E0599]: no method named `asset_source` found for mutable reference `&mut gpui::App` in the current scope
       --> crates\ui\src\native_menu\mod.rs:211:20
    

    AssetRegistry does not implement AssetSource (its load returns an Option), so native_menu now takes the registry. The icon tests build a registry that holds the test icon, because AssetRegistry::from(source) only registers the paths the source lists. Three html.rs tests also needed .into() on relative(..), like value_to_length itself. This is the patch from my comment on Update components for current GPUI CE APIs #1.

  2. Window::activate_window() → Window::activate(). This was renamed in gpui-ce calendar: Add to support Sized longbridge/gpui-kit#272, merged the day after Update components for current GPUI CE APIs #1, and breaks the crate on every platform. The shell's script API keeps its window.activate_window() name.

Testing

main depends on gpui-ce 0.2.2, which on crates.io predates these APIs. So I tested against gpui-ce main (94db357) through a local [patch.crates-io] that isn't part of this PR.

Windows 11 (MSVC, Rust 1.98) Linux (flake shell, Rust 1.95 beta)
main (801f75f) does not compile: asset_source and activate_window does not compile: activate_window
cargo test -p gpui_ce_components --lib 472 passed, 1 failed* 469 passed, 1 failed*
cargo clippy -p gpui_ce_components --all-targets -- -D warnings clean —

The Windows test count includes the native menu's icon resolution tests, which only exist on Windows and macOS.

* The failing test is popover::tests::the_enter_motion_starts_over_every_time_the_dropdown_opens. It fails with or without this PR: it passes with gpui-ce at 4cde195 and fails from f763dab on, gpui-ce longbridge#284 ("Migrate Animation back to Motion"), where the dropdown no longer slides in (from Point { x: 8px, y: 128px } to Point { x: 8px, y: 128px }). That belongs in gpui-ce or in a separate change here.

Not covered

  • macOS. I could not build it. macos.rs gets the same signature change as windows.rs.
  • story, shell and the examples. The activate() rename there is mechanical, but I couldn't compile these crates against gpui-ce main because of API drift outside this PR, which I'd leave for a separate change:
    • gpui_ce_components_fps enables gpui/profiler, which doesn't compile on gpui-ce main: debug_overlay.rs builds a Quad without the newer border_dashed_*, corner_smoothing and padding fields. Even with that patched locally, crates/fps/src/sampler.rs:56 no longer matches the profiler API (FrameEvent vs FrameTiming). story, shell and fps_monitor depend on it.
    • gpui_ce_components_base builds as a library, but its tests and showcase examples don't: Hitbox has a new tags field, PaintQuad has the dashed-border fields, and several colors are now Background rather than Hsla.

AI disclosure: the testing, the second commit and this description were done with Claude (an AI assistant). I reviewed them.

🤖 Generated with Claude Code

https://claude.ai/code/session_01J7JQV1YRa9p7viwjBUskzm

tarc and others added 2 commits October 1, 2026 15:01
App::asset_source() was replaced by App::assets(), which returns an
AssetRegistry (gpui-ce longbridge#259). The native context menu only builds on
Windows and macOS, so the Linux build never saw the old call, and the
crate stopped compiling on both. AssetRegistry does not implement
AssetSource (its load returns an Option), so the menu now takes the
registry. The icon resolution tests build a registry holding the test
icon, since AssetRegistry::from(source) only registers the paths the
source lists.

Three html.rs tests still expected relative(..) to be a DefiniteLength;
like value_to_length, they now convert it with .into().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J7JQV1YRa9p7viwjBUskzm
gpui-ce longbridge#272 renamed Window::activate_window to Window::activate. The
shell's script API keeps its window.activate_window() name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J7JQV1YRa9p7viwjBUskzm
philocalyst pushed a commit that referenced this pull request Oct 1, 2026
🤖 Auto-generated by Endless task
[#3](https://endless.longbridge-inc.com/projects/gpui-component/tasks/3).
Initiated by: huacnlee@longbridge-inc.com
Worker agent: Claude Code (claude_code · lboneapi · claude-sonnet-5)

## Commits

- **website: migrate from VitePress to Astro 5**
  Replace the VitePress 2 alpha documentation site with a full Astro 5.x
implementation. Preserves all content, routes, CSS design tokens (58
tokens
  light + dark), dual-language support (EN / zh-CN), and functionality.
  
  Key changes:
  - Astro 5 static output with @astrojs/vue for Vue islands
  - Tailwind v4 via @tailwindcss/vite (no PostCSS)
- 6 Content Collections (docs, shell, base x EN/zh-CN) with dynamic
routes
  - Custom TypeScript sidebar generator replacing vitepress-sidebar
- All Vue components ported: useData/withBase/VPFlyout removed, props
added
  - HomeApp.vue: self-contained Vue island (nav + sections + EN/ZH copy)
  - AppsApp/ContributorsApp/SkillsApp: lightweight Vue islands
  - Pagefind search (build-time index) with CmdK modal trigger
  - llms-full.txt static endpoint at /gpui-component/llms-full.txt
  - WASM dev server middleware ported from VitePress config.mts
  - 58 CSS tokens copied verbatim, .vp-doc renamed to .doc-content

- **chore(website): remove residual .vitepress directory after Astro
migration**
The .vitepress/ directory was retained from the pre-migration VitePress
source. Per PRD §6.3 (maintainability), it must not appear in the
migrated
  website/. 32 files removed.

- **feat(review): remove legacy Vue website pages and unused data
files**
  

- **feat(dev): update website/, base/[...slug], docs/[...slug]**
  

- **website: update GitHub repo links from gpui-component to gpui-kit**
  Repo was renamed on GitHub; update all website content and Vue/Astro
  components that link back to it.
  

- **website: restore a mobile fallback for the docs nav links**
  The mobile media query hid .site-nav__links (Components/Shell/Base/App
Stories plus the entire Resources dropdown) with no replacement,
dead-ending
phone users in violation of DESIGN.md's own no-hide-without-fallback
rule.
Add a burger button that toggles a drawer, flatten the Resources
dropdown
into stacked items on mobile, and drop an unused import/variable found
while
  in the file.
  

- **website: derive the nav language-switch path from base, not a
literal**
langSwitchHref hardcoded /gpui-component/ in a regex instead of using
the
base import.meta.env already exposes, so it would silently break if the
  base path ever changes.
  

- **website: de-duplicate the SITE_URL constant into one module**
  BaseLayout.astro and DocsLayout.astro each hardcoded the same
https://longbridge.github.io/gpui-component literal, so a domain change
  would need to be edited in two places and could drift.
  

- **website: update DESIGN.md for the Astro file layout**
DESIGN.md still described the VitePress theme
(.vitepress/theme/style.css,
index.vue, apps.vue, the .VPNavBar/.VPNav blur split, repo.data.js, the
transformPageData OG hook) after the migration replaced all of it. Point
every reference at the real Astro files and describe the docs nav's
actual
  767px drawer behavior, restored by the previous commit.
  

- **website: fix stale token comment in global.css**
  The header comment pointed at .vitepress/theme/style.css (deleted) and
  claimed 58 tokens; the file actually carries 64 (chart-1..5 and
shadow-dialog were never in the PRD's manual count, but both existed in
  the pre-migration source and are correctly present here).
  

- **website: derive base-path literals from BASE_URL instead of
hardcoding**
  sidebar.ts and llms.ts each hardcoded `/gpui-component` as a literal
  base path, duplicating astro.config.mjs's `base` value. Derive both
  from import.meta.env.BASE_URL so a future base-path change only needs
  to touch the config.
  

- **website: pass base path into the favicon inline script via
define:vars**
  The script looked up document.querySelector('base')?.href, but no
  <base> element exists in the page, so that lookup always failed and
  the hardcoded /gpui-component/ fallback was the only path ever taken.
  Pass the already-computed `base` value through define:vars instead of
  duplicating it as a second literal.
  

- **website: pass the site base path into the WASM dev-server
middleware**
  wasmExamplesDevServer() hardcoded /gpui-component as a third copy of
  astro.config.mjs's base value. Pass it in as a parameter instead.
  

- **website: derive the contributors-page background image from
BASE_URL**
  The public/contributors.svg background was referenced by a hardcoded
  /gpui-component/ literal in a Vue SFC <style> block. Compute the URL
  from import.meta.env.BASE_URL in <script setup> and bind it in with
  v-bind() instead.
  

- **website: remove unused LanguageSwitcher.vue**
  Nav.astro implements language switching inline; this component was not
  imported anywhere and had drifted out of sync (it still used the
brittle /gpui-component/ regex replacement that Nav.astro's version was
  already fixed to avoid).
  

- **website: port the GPUI Kit rebrand (main longbridge#2927) into the Astro
site**
main's rebrand PR landed on VitePress before this branch's Astro
migration
merged, so port its website-facing substance by hand instead of a
literal
rebase: base path -> `/`, site domain -> gpui-kit.com with a CNAME, and
every
"GPUI Component" -> "GPUI Kit" brand mention that the original commit
swapped
  (nav/footer/titles, docs/index intro's new three-crate layout summary,
component doc examples, logo/architecture SVGs, OG template). Sentences
about
the gpui-component crate itself are left untouched, matching upstream's
own
distinction. Also fixes the WASM dev-server middleware and the two
example
vite configs for the new empty base prefix, and the docs/index.astro
fallback
  literal that would otherwise have pointed at the old base path.

---------

Co-authored-by: Huacnlee (Li Huashun) <huacnlee@longbridge-inc.com>
Co-authored-by: Jason Lee <huacnlee@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Codex <codex@openai.com>
@tarc

tarc commented Oct 1, 2026

Copy link
Copy Markdown
Author

Closing this as superseded by #4. main now targets gpui-ce 0.2.2 from crates.io, which still has App::asset_source() and Window::activate_window(), so neither change here is needed. The files have also moved (crates/ui → crates/component).

I built main (c082069) natively on Windows 11 (MSVC) to confirm the Windows break is gone:

  • cargo check --locked --workspace --all-targets passes, including the native context menu.
  • cargo test --locked --workspace passes, about 1,980 tests in total, among them gpui_component (616) and gpui_base (1,225).
  • The only failure is cargo clippy -- -D warnings, on three unused ev bindings in resize_handle.rs. Those fail CI on every platform and are fixed in Fix CI on main: drop unused event bindings in the resize handle #5.

When this repository moves to a GPUI CE release newer than 0.2.2, the AssetRegistry and Window::activate() changes from this PR will be needed again.

@tarc tarc closed this Oct 1, 2026
@philocalyst

Copy link
Copy Markdown

Ah, thank you! It may help to contribute back into -CE to make some of these things harder to mess up/confuse

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