Skip to content

feat(cli): write a wrapper from --mps-home without Gradle - #233

Merged
sergej-koscejev merged 2 commits into
mainfrom
feat/wrapper-without-gradle
Nov 12, 2026
Merged

sergej-koscejev merged 2 commits into
mainfrom
feat/wrapper-without-gradle

Conversation

@sergej-koscejev

Copy link
Copy Markdown
Member

Summary

mops wrapper now works in an MPS project that has no Gradle build. When the global option --mps-home is given, it skips Gradle discovery and writes the wrapper from the given homes. Without --java-home, it uses the Java runtime bundled with MPS, the same as other commands.

 WrapperCommand.call
-  GradleHomeDiscovery.discover
-  pick runtime and targets
+  if --mps-home given
+    givenRuntime
+      project = --project-root, or nearest .mps at or above PATH / working dir
+      homes  = root.resolveMpsHome(), root.resolveJavaHome(mpsHome)
+  else
+    discoveredRuntime   # Gradle discovery, unchanged
   print homes, warn about unusable homes
   writeWrappers        # shared: --output, --macro, executable bit

The MPS project stands in for the Gradle project, so the wrapper goes in <MPS project>/build/mopsw. --output and --macro work as before. MopsCommand.resolveJavaHome now holds the "--java-home, or else the JBR bundled with MPS" rule for both daemon startup and mops wrapper.

Help text, README, the setup examples page, and the mops skill mention the new mode. docs/reference/ and skills/mops/references/ are regenerated.

Left for later: when a home in a wrapper is gone, RuntimeHomeNotFoundException still suggests mops wrapper --project-root X. For a wrapper written without Gradle, that command fails with "No Gradle build found ... Pass --mps-home ... to write the wrapper without Gradle", so the user still gets to the fix, in two steps.

Evidence

  • Before: in a plain MPS 2024.1.6 project (copy of mops-demo/planning-a):

    $ mops --mps-home ~/.cache/mps-platform-cache/mps/2024.1.6 --java-home .../jbr_jcef/.../Contents/Home wrapper
    No Gradle build found at or above .../planning-a.
    

    After:

    $ mops --mps-home ... --java-home ... wrapper
    Source: --mps-home and --java-home
    MPS home: ...
    Java home: ...
    Project root: .
    Wrapper: build/mopsw
    $ build/mopsw diagnose project
    modules	45/45 loaded	0 failed
    
  • New tests in WrapperCommandTest (failed with "No Gradle build found" before, pass now):

    • given homes write build/mopsw with the full expected text, executable, from inside .mps/
    • homes that do not exist yet still write the wrapper (to --output) with the usual warnings
    • --mps-home alone writes the bundled JBR as the Java home
  • New WrapperIntegrationTest case: mops wrapper with given homes on a project without Gradle, then code run through the written mopsw. Passes on MPS 2024.1.6, next to the existing Gradle case.

  • Ran: :cli:test, detektMain, checkReference, :cli:integrationTestMps2024.1.6 --tests '*WrapperIntegrationTest'. Not run: full ./gradlew check, integration tests on other MPS versions.

Merge Danger

Blast Radius: small

mops wrapper --mps-home X used to ignore --mps-home and run Gradle discovery. Now it uses the given home and does not run Gradle. Commands other than mops wrapper behave as before; their homes are now normalize()d.

@sergej-koscejev
sergej-koscejev added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 7f22d22 Nov 12, 2026
15 checks passed
@sergej-koscejev
sergej-koscejev deleted the feat/wrapper-without-gradle branch November 12, 2026 21:10
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.

1 participant