Commit 81ecb64
Pass resolvers to JS/Python RPC so PrepareRecipe callbacks can resolve Maven recipes (#6742)
* Fall back to RecipeLoader when ecosystem resolver is missing
When the PrepareRecipe handler finds a recipe in the marketplace but
listing.prepare() throws because no resolver matches the bundle's
ecosystem (e.g., a "maven"-bundled recipe when only a "runtime" resolver
is available), the handler now catches the exception and falls through
to RecipeLoader. This allows recipes that are already on the classpath
to be loaded by class name instead of failing outright.
This fixes recipe runs on Node.js repositories where JS recipes use
preconditions like usesType() or usesMethod() that call back to the
Java side to prepare Java recipes. Without a Maven resolver wired into
the RPC endpoint, these callbacks previously failed with
"No available resolver for 'maven' ecosystem".
* Accept resolvers in JavaScriptRewriteRpc and PythonRewriteRpc
Both RPC classes were calling the 2-arg RewriteRpc constructor which
passes emptyList() for resolvers. When a JS/Python recipe's
preconditions reference Java recipes bundled under the "maven"
ecosystem, the PrepareRecipe callback fails with "No available resolver
for 'maven' ecosystem".
Add a resolvers field to both Builders (defaulting to emptyList() for
backward compatibility) and pass them through to the 3-arg super
constructor.
* Polish
* Remove no longer valid test case as well
* Add missing RecipeBundleResolver import to PythonRewriteRpc
---------
Co-authored-by: Shannon Pamperl <shannon@moderne.io>
Co-authored-by: Shannon Pamperl <shanman190@gmail.com>
Co-authored-by: Jonathan Schneider <jkschneider@gmail.com>1 parent 6b5d958 commit 81ecb64
File tree
3 files changed
+21
-6
lines changed- rewrite-core/src/test/java/org/openrewrite/rpc
- rewrite-javascript/src/main/java/org/openrewrite/javascript/rpc
- rewrite-python/src/main/java/org/openrewrite/python/rpc
3 files changed
+21
-6
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
60 | | - | |
61 | | - | |
| 61 | + | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| |||
199 | 200 | | |
200 | 201 | | |
201 | 202 | | |
| 203 | + | |
202 | 204 | | |
203 | 205 | | |
204 | 206 | | |
| |||
218 | 220 | | |
219 | 221 | | |
220 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
221 | 228 | | |
222 | 229 | | |
223 | 230 | | |
| |||
382 | 389 | | |
383 | 390 | | |
384 | 391 | | |
385 | | - | |
| 392 | + | |
386 | 393 | | |
387 | 394 | | |
388 | 395 | | |
| |||
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | | - | |
67 | | - | |
| 67 | + | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
351 | 352 | | |
352 | 353 | | |
353 | 354 | | |
| 355 | + | |
354 | 356 | | |
355 | 357 | | |
356 | 358 | | |
| |||
396 | 398 | | |
397 | 399 | | |
398 | 400 | | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
399 | 406 | | |
400 | 407 | | |
401 | 408 | | |
| |||
565 | 572 | | |
566 | 573 | | |
567 | 574 | | |
568 | | - | |
| 575 | + | |
569 | 576 | | |
570 | 577 | | |
571 | 578 | | |
| |||
0 commit comments