-
Notifications
You must be signed in to change notification settings - Fork 30
MTA-1289 adding new mta cli commands: Analyze and Transform #792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+193
−0
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
910610a
adding new mta cli command modules
emarcusRH 80f1a44
update to cli analyze command module
emarcusRH c4b0270
update to cli transform command module, add new attribute cli-cmd
emarcusRH 365d4c4
add new attribute cli-cmd to new modules
emarcusRH 8a706e4
update global flags
emarcusRH 531a662
update mta-cli attribute
emarcusRH 3d7db1e
substitute attribute LC_PSN for windup
emarcusRH 97fdde5
updates to mta-cli commands
emarcusRH bdc569c
update to commands
emarcusRH a398200
update format
emarcusRH c49da60
update formatting
emarcusRH 2de019e
updating Analyze command options
emarcusRH 1b3cbf6
updates to new cli guide chapters
emarcusRH File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| // Module included in the following assemblies: | ||
| // | ||
| // * docs/cli-guide/master.adoc | ||
|
|
||
| :_content-type: CONCEPT | ||
| [id="mta-cli-analyze_{context}"] | ||
| = Performing analysis using the command line | ||
|
|
||
| `Analyze` allows running source code and binary analysis using `analyzer-lsp`. | ||
|
|
||
| .To run analysis on application source code, run the following command: | ||
|
|
||
| [source,terminal,subs="attributes+"] | ||
| ---- | ||
| {mta-cli} analyze --input=<path/to/source/code> --output=<path/to/output/dir> | ||
| ---- | ||
|
|
||
| All flags: | ||
|
|
||
| [source,terminal,subs="attributes+"] | ||
| ---- | ||
| Analyze application source code | ||
|
|
||
| Usage: | ||
| {mta-cli} analyze [flags] | ||
|
|
||
| Flags: | ||
| --analyze-known-libraries analyze known open-source libraries | ||
| -h, --help help for analyze | ||
| -i, --input string path to application source code or a binary | ||
| --json-output create analysis and dependency output as json | ||
| --list-sources list rules for available migration sources | ||
| --list-targets list rules for available migration targets | ||
| -l, --label-selector string run rules based on specified label selector expression | ||
| --maven-settings string path to a custom maven settings file to use | ||
| --overwrite overwrite output directory | ||
| --skip-static-report do not generate static report | ||
| -m, --mode string analysis mode. Must be one of 'full' or 'source-only' (default "full") | ||
| -o, --output string path to the directory for analysis output | ||
| --rules stringArray filename or directory containing rule files | ||
| --skip-static-report do not generate static report | ||
| -s, --source string source technology to consider for analysis. To specify multiple sources, repeat the parameter: --source <source_1> --source <source_2> etc. | ||
| -t, --target string target technology to consider for analysis. To specify multiple targets, repeat the parameter: --target <target_1> --target <target_2> etc. | ||
|
|
||
| Global Flags: | ||
| --log-level uint32 log level (default 4) | ||
| --no-cleanup do not cleanup temporary resources | ||
| ---- | ||
| .Usage example | ||
|
|
||
| . Get an example application to run analysis on. | ||
| . List available target technologies. | ||
| + | ||
| [source,terminal,subs="attributes+"] | ||
| ---- | ||
| {mta-cli} analyze --list-targets | ||
| ---- | ||
| . Run an analysis with a specified target technology, for example `cloud-readiness`. | ||
| + | ||
| [source,terminal,subs="attributes+"] | ||
| ---- | ||
| {mta-cli} analyze --input=<path-to/example-applications/example-1> --output=<path-to-output-dir> --target=cloud-readiness | ||
| ---- | ||
| . Several analysis reports are created in your specified output path: | ||
| + | ||
| [source,terminal,subs="attributes+"] | ||
|
|
||
| ---- | ||
| $ ls ./output/ -1 | ||
| analysis.log | ||
| dependencies.yaml | ||
| dependency.log | ||
| output.yaml | ||
| static-report | ||
| ---- | ||
|
|
||
| `output.yaml` is the file that contains the issues report. | ||
|
|
||
| `static-report` contains the static HTML report. | ||
|
|
||
| `dependencies.yaml` contains a dependencies report. | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| // Module included in the following assemblies: | ||
| // | ||
| // * docs/cli-guide/master.adoc | ||
|
|
||
| :_content-type: CONCEPT | ||
| [id="mta-cli-transform_{context}"] | ||
| = Performing transformation using the command line | ||
|
|
||
| Transform has two sub commands - `openrewrite` and `rules`. | ||
|
|
||
| [source,terminal,subs="attributes+"] | ||
| ---- | ||
| Transform application source code or {LC_PSN} XML rules | ||
|
|
||
| Usage: | ||
| {mta-cli} transform [flags] | ||
| {mta-cli} transform [command] | ||
|
|
||
| Available Commands: | ||
| openrewrite Transform application source code using OpenRewrite recipes | ||
| rules Convert XML rules to YAML | ||
|
|
||
| Flags: | ||
| -h, --help help for transform | ||
|
|
||
| Global Flags: | ||
| --log-level uint32 log level (default 4) | ||
| --no-cleanup do not cleanup temporary resources | ||
|
|
||
| Use "{mta-cli} transform [command] --help" for more information about a command. | ||
| ---- | ||
|
|
||
| == `OpenRewrite` | ||
|
|
||
| The `openrewrite` sub command allows running `OpenRewrite` recipes on source code. | ||
| [source,terminal,subs="attributes+"] | ||
| ---- | ||
| Transform application source code using OpenRewrite recipes | ||
|
|
||
| Usage: | ||
| {mta-cli} transform openrewrite [flags] | ||
|
|
||
| Flags: | ||
| -g, --goal string target goal (default "dryRun") | ||
| -h, --help help for openrewrite | ||
| -i, --input string path to application source code directory | ||
| -l, --list-targets list all available OpenRewrite recipes | ||
| -s, --maven-settings string path to a custom maven settings file to use | ||
| -t, --target string target openrewrite recipe to use. Run --list-targets to get a list of packaged recipes. | ||
|
|
||
| Global Flags: | ||
| --log-level uint32 log level (default 4) | ||
| --no-cleanup do not cleanup temporary resources | ||
| ---- | ||
|
|
||
| .To run `transform openrewrite` on application source code, run the following command: | ||
| [source,terminal,subs="attributes+"] | ||
| ---- | ||
| {mta-cli} transform openrewrite --input=<path/to/source/code> --target=<exactly_one_target_from_the_list> | ||
|
emarcusRH marked this conversation as resolved.
|
||
| ---- | ||
| [NOTE] | ||
| ==== | ||
| You can only use a single target to run the `transform overwrite` command. | ||
| ==== | ||
|
|
||
| == `Rules` | ||
|
|
||
| The `rules` sub command allows converting {LC_PSN} XML rules to analyzer-lsp YAML rules using `windup-shim`. | ||
| [source,terminal,subs="attributes+"] | ||
| ---- | ||
| Convert XML rules to YAML | ||
|
|
||
| Usage: | ||
| {mta-cli} transform rules [flags] | ||
|
|
||
| Flags: | ||
| -h, --help help for rules | ||
| -i, --input stringArray path to XML rule file(s) or directory | ||
| -o, --output string path to output directory | ||
|
|
||
| Global Flags: | ||
| --log-level int log level (default 5) | ||
|
emarcusRH marked this conversation as resolved.
|
||
| ---- | ||
|
|
||
| .To run `transform rules` on application source code, run the following: | ||
| [source,terminal,subs="attributes+"] | ||
| ---- | ||
| {mta-cli} transform rules --input=<path/to/xmlrules> --output=<path/to/output/dir> | ||
| ---- | ||
|
|
||
| .Usage example | ||
| . Get an example application to transform source code. | ||
| . View the available OpenRewrite recipes. | ||
| + | ||
| [source,terminal,subs="attributes+"] | ||
| ---- | ||
| {mta-cli} transform openrewrite --list-targets | ||
| ---- | ||
| . Run a recipe on the example application. | ||
| + | ||
| [source,terminal,subs="attributes+"] | ||
| ---- | ||
| {mta-cli} transform openrewrite --input=<path-to/jakartaee-duke> --target=jakarta-imports | ||
| ---- | ||
| Inspect the `jakartaee-duke` application source code diff to see the transformation | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.