build: per-module test execution via tycho-build extension (PoC)#1346
Draft
joaodinissf wants to merge 5 commits into
Draft
build: per-module test execution via tycho-build extension (PoC)#1346joaodinissf wants to merge 5 commits into
joaodinissf wants to merge 5 commits into
Conversation
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>
…output regardless of platform
Register `org.eclipse.tycho:tycho-build` as a Maven core extension via `.mvn/extensions.xml`. With this extension active, Maven's `--also-make` (`-am`) flag walks Tycho's OSGi requirements (`Require-Bundle`, `Import-Package`, target definitions) when computing the reactor — without it, only Maven `<dependency>` blocks are considered, which is nearly empty for this codebase since dependencies are declared in `MANIFEST.MF`. Empirical effect from `mvn -pl :com.avaloq.tools.ddk.check.core -am`: without the extension the reactor contains 1 project (the requested one) and the build either fails cold or succeeds only when stale `target/` jars happen to satisfy resolution; with the extension the reactor expands to 11 upstream bundles and succeeds cold. The version is sourced from `.mvn/maven.config` (`-Dtycho.version=5.0.2`) rather than hardcoded in `extensions.xml`, so both files draw from the same property. The parent POM's `<tycho.version>` should be kept in sync; an enforcement check is left for a follow-up. Known limitation: `mvnd` is incompatible with this extension — the embedded Takari SmartBuilder collides with tycho-build's dependency graph implementation (ClassCastException across ClassRealms). Use plain `mvn` for `-am` workflows; `mvnd` remains usable for full-reactor builds without `-am`. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Introduce `ddk.skipPerModuleTests` (default `true`) to gate optional per-module tycho-surefire execution. With the default value no behaviour changes — the aggregator in `com.avaloq.tools.ddk.xtext.test` remains the sole point of test execution and no test runs twice. This commit only declares the property; it has no consumer yet. A follow-up commit opts the first module in by binding its surefire `<skip>` to this property. Rationale: hardcoding `<skip>false</skip>` per-module would double- execute tests on default `mvn verify` runs, because the aggregator's JUnit `@Suite` discovers the same `*TestSuite` classes via its `Require-Bundle` aggregation. Gating the standalone surefire on a property defaulting to `true` keeps CI behaviour unchanged and lets developers opt in with one CLI flag for focused iteration. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add a full tycho-surefire-plugin and target-platform-configuration to
`com.avaloq.tools.ddk.xtext.export.test` so its tests can run standalone
via:
mvn verify -pl :com.avaloq.tools.ddk.xtext.export.test -am \
-Dddk.skipPerModuleTests=false -f ./ddk-parent/pom.xml
Default `mvn verify` is unchanged: the surefire `<skip>` is bound to
`${ddk.skipPerModuleTests}` which defaults to `true`. The aggregator in
`com.avaloq.tools.ddk.xtext.test` remains the sole executor of the
export tests on CI and full-reactor dev runs, preventing any double-
execution.
Configuration mirrors `xtext.test`'s surefire block (UI harness, IDE
workbench application, JVM args, target-platform extras for xtext.sdk,
pde, help, rcp, equinox.event) with two differences:
1. `<testClass>` points to `ExportTestSuite` rather than `AllTests`,
so the standalone run covers only the export tests.
2. `argLine` additionally exports `jdk.incubator.vector` via
`-Dorg.osgi.framework.system.packages.extra` so that
`org.eclipse.help.base` (transitive on Lucene 9.12) resolves on
macOS with Adoptium/Temurin JDKs.
Pilot module — the pattern can be extended to other `*.test` bundles by
copying this configuration and pointing `<testClass>` at the
corresponding `*TestSuite` class.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Stacked on #1283. The bottom commit is #1283 (
build: enable UI tests on macOS via Tycho profile + JRE docs). This PR contains 3 additional commits on top. CI failures here until #1283 lands are expected; rebase ontomasteronce #1283 merges.Summary
Proof of concept demonstrating that per-module Maven test execution is viable for this codebase via two changes:
tycho-buildas a Maven core extension so-amwalks OSGiRequire-Bundle/Import-Packagedependencies (Maven natively only walks<dependency>blocks, which are empty for Tycho bundles).ddk.skipPerModuleTests, defaulttrue) for per-module surefire blocks, so that opting modules in does not double-execute tests already discovered by the aggregator incom.avaloq.tools.ddk.xtext.test.The PoC pilots the pattern on
com.avaloq.tools.ddk.xtext.export.test(smallest blast radius). After this lands, the same shape can be applied to other*.testmodules on demand.Commits
build: add tycho-build extension—.mvn/extensions.xml+.mvn/maven.config. Version sourced from${tycho.version}to keep a single source of truth.build: add ddk.skipPerModuleTests property— declares the property inddk-parent. No behaviour change yet.build: opt xtext.export.test into per-module test execution— adds fulltycho-surefire-plugin+target-platform-configurationto the bundle, gated by the property.<testClass>points atExportTestSuite. Mirrorsxtext.test's surefire block, with one extraargLineflag (-Dorg.osgi.framework.system.packages.extra=jdk.incubator.vector) needed on macOS fororg.eclipse.help.baseto resolve.Verification (run on this branch, JDK 21, macOS aarch64)
find . -name target -type d -exec rm -rf {} + ; mvn -pl :check.core -am -DskipTests clean verifymvn verify -pl :xtext.export.test -am -Dddk.skipPerModuleTests=falseTests run: 14, Failures: 0; 21.2s wall clockmvn verify -pl :xtext.export.test -am(default property=true)[INFO] Skipping testslogged; export.test packaged in 1.0s (vs 7.0s when tests ran)mvn verify -Dddk.skipPerModuleTests=false(full 60-project reactor)Empirical findings worth highlighting
AGENTS.mdreflects pessimism, not measured behaviour.Tests run: 14(standalone) andTests run: 357(aggregator). 357 matches the baseline test count on master (CI run ond6897f240). The 14 extra are the export tests running a second time as standalone — confirming the gate's intent.macosxMaven profile, the standalone test runtime fetches SWT-win32 (target environments default towin32/win32/x86_64), which can't load on macOS →ClassNotFoundException: org.eclipse.swt.SWTError. With build: enable UI tests on macOS via Tycho profile + JRE docs #1283's macosx profile (setsosgi.os=macosx, osgi.ws=cocoa, osgi.arch=aarch64and appends-XstartOnFirstThread), the issue resolves cleanly. Documented as the stack dependency above.jdk.incubator.vectorcascade affects Maven surefire too, not just.launchfiles. Same root cause as the existing open work; same fix (-Dorg.osgi.framework.system.packages.extra=jdk.incubator.vector). The aggregator likely has the same latent issue on macOS but no one runs it via plainmvn verifyon Mac normally — CI is Linux, which doesn't trigger it. A broader fix is open as a follow-up.JAVA_HOMEpointing to JDK 21 (project's BREE —openjdk@21on Homebrew; the defaultopenjdkis 25 and has separatesun.misc.Unsafeissues), andWORKSPACE=$(pwd)(needed by the logback config path inddk-parent).Usage
CI (unchanged):
Focused dev iteration on export tests only:
Known limitation
tycho-buildis incompatible withmvnd— the embedded Takari SmartBuilder collides with tycho-build's dependency graph (DependencyGraphClassCastExceptionacrossClassRealms, independent of-bflag). Use plainmvnfor-amworkflows;mvndremains usable for full-reactor builds without-am.Test plan
mvn verify(default property) and aggregator tests pass without regression (357 tests, same as master baseline). Validates Scenario D under full CI load.mvn verify -pl :com.avaloq.tools.ddk.xtext.export.test -am -Dddk.skipPerModuleTests=falseand 14 export tests pass standalone. Validates Scenario C on Linux.Left by Claude at João's request.