Skip to content

build: enable UI tests on macOS via Tycho profile + JRE docs#1283

Merged
joaodinissf merged 1 commit into
dsldevkit:masterfrom
joaodinissf:fix/start-on-first-thread
May 18, 2026
Merged

build: enable UI tests on macOS via Tycho profile + JRE docs#1283
joaodinissf merged 1 commit into
dsldevkit:masterfrom
joaodinissf:fix/start-on-first-thread

Conversation

@joaodinissf
Copy link
Copy Markdown
Collaborator

@joaodinissf joaodinissf commented Mar 7, 2026

Enables UI tests to run on macOS without modifying cross-platform .launch files.

Background

SWT on Cocoa requires the Display to be created on the main thread. UI tests on macOS need -XstartOnFirstThread; without it they fail with SWTException: Invalid thread access. But the same flag is rejected as Unrecognized VM option by the JVM on Windows and Linux.

Approach

Following the same pattern as Eclipse Platform's own UI test launches (eclipse-platform/eclipse.platform), which keep .launch files cross-platform and rely on per-developer JRE configuration for the macOS flag:

  • CI / mvn verify: a new macosx profile in ddk-parent/pom.xml, activated on family=mac, sets the OSGi target environment (macosx/cocoa/aarch64) and appends -XstartOnFirstThread to test.javaOptions. No manual setup needed for CI.
  • Local Eclipse launches: developers add -XstartOnFirstThread to their JRE's default VM arguments once (Window > Preferences > Java > Installed JREs > Edit > Default VM arguments). PDE launches with append.args=true (all of ours) inherit it on macOS. Documented in AGENTS.md.
  • .launch files are not modified, so Windows and Linux developers see no Unrecognized VM option regression.

🤖 Generated with Claude Code

@joaodinissf joaodinissf marked this pull request as draft March 7, 2026 12:10
@joaodinissf joaodinissf force-pushed the fix/start-on-first-thread branch from faa451c to 7bce3ca Compare March 7, 2026 12:51
@joaodinissf joaodinissf force-pushed the fix/start-on-first-thread branch from 7bce3ca to 9973822 Compare April 4, 2026 11:39
@joaodinissf
Copy link
Copy Markdown
Collaborator Author

Note to self: Test the launch configs on Windows before merging — -XstartOnFirstThread is macOS-specific and the JVM may reject it on other platforms. The POM profile handles this correctly for CI, but the .launch files hardcode the flag unconditionally.

@joaodinissf joaodinissf force-pushed the fix/start-on-first-thread branch from 9973822 to d305681 Compare April 6, 2026 22:13
@joaodinissf joaodinissf force-pushed the fix/start-on-first-thread branch 2 times, most recently from 86d7aad to 9f3063a Compare April 20, 2026 08:21
@joaodinissf joaodinissf force-pushed the fix/start-on-first-thread branch 6 times, most recently from 51088b6 to 8accb3d Compare May 16, 2026 20:12
@joaodinissf joaodinissf force-pushed the fix/start-on-first-thread branch from 8accb3d to cfce73c Compare May 16, 2026 21:03
@joaodinissf joaodinissf changed the title fix: add -XstartOnFirstThread to UI launch configs for macOS build: enable UI tests on macOS via Tycho profile + JRE docs May 16, 2026
Add a `macosx` Maven profile in ddk-parent/pom.xml, activated on
family=mac, that sets the OSGi target environment
(macosx/cocoa/aarch64) and appends -XstartOnFirstThread to
test.javaOptions. SWT on Cocoa requires the Display to be created on
the main thread; without the flag, UI tests fail with "SWTException:
Invalid thread access".

The same flag is needed when developers run UI test launches from
Eclipse on macOS, but -XstartOnFirstThread is rejected as an
"Unrecognized VM option" by the JVM on Windows and Linux. Eclipse's
own .launch files (e.g. in eclipse-platform/eclipse.platform) omit
it entirely and rely on the launching JRE's default VM arguments to
add it on macOS. Adopt the same pattern: document the one-time
per-JRE setup in AGENTS.md instead of hardcoding the flag in
cross-platform .launch files.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@joaodinissf joaodinissf force-pushed the fix/start-on-first-thread branch from cfce73c to 0b7a7cc Compare May 16, 2026 21:05
@joaodinissf
Copy link
Copy Markdown
Collaborator Author

Note to self: Test the launch configs on Windows before merging — -XstartOnFirstThread is macOS-specific and the JVM may reject it on other platforms. The POM profile handles this correctly for CI, but the .launch files hardcode the flag unconditionally.

Confirmed this doesn't work, pivoting the PR to something compatible instead.

@joaodinissf joaodinissf marked this pull request as ready for review May 16, 2026 21:06
@joaodinissf joaodinissf enabled auto-merge (rebase) May 16, 2026 21:06
@joaodinissf joaodinissf removed the request for review from markdomeng May 16, 2026 21:07
@joaodinissf joaodinissf merged commit 940596f into dsldevkit:master May 18, 2026
4 checks passed
@joaodinissf joaodinissf deleted the fix/start-on-first-thread branch May 19, 2026 13:22
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