diff --git a/docs/cli-guide/master.adoc b/docs/cli-guide/master.adoc index 1457a80fb2..fcbb1a21f2 100644 --- a/docs/cli-guide/master.adoc +++ b/docs/cli-guide/master.adoc @@ -33,6 +33,12 @@ include::topics/installing-web-console-or-cli-tool.adoc[leveloffset=+2] // Run the CLI include::topics/cli-run.adoc[leveloffset=+2] +// Analyze application source code +include::topics/mta-cli-analyze.adoc[leveloffset=+3] + +// Transform XML rules to YAML +include::topics/mta-cli-transform.adoc[leveloffset=+3] + // Use OpenRewrite recipes include::topics/using-openrewrite-recipes.adoc[leveloffset=+3] diff --git a/docs/topics/mta-cli-analyze.adoc b/docs/topics/mta-cli-analyze.adoc new file mode 100644 index 0000000000..d4469d1640 --- /dev/null +++ b/docs/topics/mta-cli-analyze.adoc @@ -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= --output= +---- + +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 etc. + -t, --target string target technology to consider for analysis. To specify multiple targets, repeat the parameter: --target --target 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= --output= --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. diff --git a/docs/topics/mta-cli-transform.adoc b/docs/topics/mta-cli-transform.adoc new file mode 100644 index 0000000000..ec49f4e80c --- /dev/null +++ b/docs/topics/mta-cli-transform.adoc @@ -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= --target= +---- +[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) +---- + +.To run `transform rules` on application source code, run the following: +[source,terminal,subs="attributes+"] +---- +{mta-cli} transform rules --input= --output= +---- + +.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= --target=jakarta-imports +---- +Inspect the `jakartaee-duke` application source code diff to see the transformation diff --git a/docs/topics/templates/document-attributes.adoc b/docs/topics/templates/document-attributes.adoc index 5edc923d7a..04fc219dd5 100644 --- a/docs/topics/templates/document-attributes.adoc +++ b/docs/topics/templates/document-attributes.adoc @@ -60,6 +60,7 @@ endif::[] // ******************* :CLIName: CLI :CLINameTitle: CLI +:mta-cli: mta-cli :MavenName: Maven plugin :MavenNameTitle: Maven Plugin