Document Java migration tool#11385
Conversation
|
Waiting for runtime team review... |
Approved by Runtime Team |
|
@emirmx Is this for 11.12? |
It is a separate tool so not tied to 11.12 technically. |
|
@emirmx How long has it been available (as of which release)? If it is not tied to a specific release, can it be merged after review? |
The tool is not released yet. Should we ping you when the tool is released? |
|
@emirmx Yes, if it's not going out with 11.12 but is not yet live, then you can either leave a comment here or message me on Slack so I can merge the updates when it is available. Thank you! |
Thanks! |
52fb1a2 to
f54ff9a
Compare
f54ff9a to
604f3d8
Compare
|
We released the CLI tool to CDN, so this PR can be merged. |
MarkvanMents
left a comment
There was a problem hiding this comment.
Thanks for the PR @emirmx and @akkrishnakumar
I've proofread this here d85842a and have three questions/comments.
Please can you look at these and get back to me.
I'm OOO on Monday 6th but will be back on Tuesday 7th.
Please contact @quinntracy if this needs to be progressed on Monday.
| |---------|-------------| | ||
| | `version` | Display the tool version | | ||
| | `recipes` | List all available migration recipes | | ||
| | `rewrite <PATHS>` | Rewrite Java files that are in the given paths (files or folders) | |
There was a problem hiding this comment.
I think this could be clearer. Does it take files which are in /javasource and copy them to the rewrite PATHS or does it now only take files which are in rewrite <PATHS> and ignore all the others?
There was a problem hiding this comment.
rewrite is the command. <PATHS> is ,for example, /javasource folder. But it can really be any folder that contains .java files. But we don't want to mention that in the documentation.
only take files which are in rewrite and ignore all the others?
None of the files are copied to a different/temporary location. Hence, this is true
|
|
||
| Run the tool from a command prompt. Use the same Java version that the version of Studio Pro you are migrating to uses. You can find the Java installation path in Studio Pro's preferences. | ||
|
|
||
| The following example rewrites all Java files in the `javasource/` folder of your app to the target Studio Pro version: |
There was a problem hiding this comment.
And subfolders, or just the javasource folder
There was a problem hiding this comment.
All the .java files in javasource, including sub folders.
| {{% alert color="warning" %}} | ||
| Using `-p` and `-s` is strongly recommended. The tool relies on type binding resolution to apply recipes correctly. For example, it only rewrites `getMember` calls when it can confirm the receiver is an `IMendixObject`. Without these options, type information may be incomplete and recipes may not be applied. | ||
|
|
||
| For the same reason, the Java code in your project must be error-free as much as possible before running the tool. Missing imports, unresolved types, or variables declared without a fully qualified type name can prevent a recipe from recognizing a valid call site. |
There was a problem hiding this comment.
What does "as much as possible" mean here? Do you mean "only have errors related to deprecated and missing APIs?"
There was a problem hiding this comment.
We presume that the project was compiled/run in a prior version of Studio Pro and that the code is working. Then you do a model upgrade by downloading, let say, Mx 11.12.
In the new version, some APIs may have been refactored, some APIs may have been removed. If you try to compile the project with a removed API, the app will not start. But this is not a problem for the rewrite tool and it can still perform the rewrite
The tool may face some issues during rewrite if the project was not compiled and run correctly in a pervious version. There could be a chance that a recipe is applicable, but the rewrite will not be performed due to type check failures.
Hence, we mention "As much as possible". Because having a missing API is technically a compilation issue for Studio Pro. But not for the Java migration tool.
I hope that I made myself clear. There isn't a better way to put this without a demo.
|
@MarkvanMents The team requested this PR was merged ASAP. Due to reviews being completed and no obvious changes being requested, I merged it. However, feel free to take a look when you are back tomorrow and clarify with @akkrishnakumar as necessary. |
No description provided.