|
15 | 15 | import java.io.File; |
16 | 16 | import java.nio.file.Path; |
17 | 17 | import java.nio.file.Paths; |
| 18 | + |
18 | 19 | import org.eclipse.osgi.util.NLS; |
19 | 20 |
|
20 | 21 | import io.openliberty.tools.eclipse.logging.Trace; |
@@ -42,38 +43,38 @@ private CommandBuilder(String projectPath, String pathEnv, boolean isMaven) { |
42 | 43 | } |
43 | 44 |
|
44 | 45 | /** |
45 | | - * Returns the full Maven command to run on the terminal. |
| 46 | + * Returns the full Maven command to run. |
46 | 47 | * |
47 | 48 | * @param projectPath The project's path. |
48 | 49 | * @param cmdArgs The mvn command args |
49 | 50 | * @param pathEnv The PATH env var |
50 | 51 | * |
51 | | - * @return The full Maven command to run on the terminal. |
| 52 | + * @return The full Maven command to run. |
52 | 53 | * |
53 | 54 | * @throws CommandNotFoundException |
54 | 55 | */ |
55 | | - public static String getMavenCommandLine(String projectPath, String cmdArgs, String pathEnv, boolean printCmd) |
| 56 | + public static String getMavenCommandLine(String projectPath, String cmdArgs, String pathEnv) |
56 | 57 | throws CommandBuilder.CommandNotFoundException { |
57 | 58 | if (Trace.isEnabled()) { |
58 | 59 | Trace.getTracer().traceEntry(Trace.TRACE_TOOLS, new Object[] { projectPath, cmdArgs }); |
59 | 60 | } |
60 | 61 | CommandBuilder builder = new CommandBuilder(projectPath, pathEnv, true); |
61 | 62 | String cmd = builder.getCommand(); |
62 | | - String cmdLine = builder.getCommandLineFromArgs(cmd, cmdArgs, printCmd); |
| 63 | + String cmdLine = builder.getCommandLineFromArgs(cmd, cmdArgs); |
63 | 64 | if (Trace.isEnabled()) { |
64 | 65 | Trace.getTracer().traceExit(Trace.TRACE_TOOLS, cmdLine); |
65 | 66 | } |
66 | 67 | return cmdLine; |
67 | 68 | } |
68 | 69 |
|
69 | | - public static String getGradleCommandLine(String projectPath, String cmdArgs, String pathEnv, boolean printCmd) |
| 70 | + public static String getGradleCommandLine(String projectPath, String cmdArgs, String pathEnv) |
70 | 71 | throws CommandBuilder.CommandNotFoundException { |
71 | 72 | if (Trace.isEnabled()) { |
72 | 73 | Trace.getTracer().traceEntry(Trace.TRACE_TOOLS, new Object[] { projectPath, cmdArgs }); |
73 | 74 | } |
74 | 75 | CommandBuilder builder = new CommandBuilder(projectPath, pathEnv, false); |
75 | 76 | String cmd = builder.getCommand(); |
76 | | - String cmdLine = builder.getCommandLineFromArgs(cmd, cmdArgs, printCmd); |
| 77 | + String cmdLine = builder.getCommandLineFromArgs(cmd, cmdArgs); |
77 | 78 | if (Trace.isEnabled()) { |
78 | 79 | Trace.getTracer().traceExit(Trace.TRACE_TOOLS, cmdLine); |
79 | 80 | } |
@@ -150,14 +151,15 @@ private String getCommandFromPreferences() throws IllegalStateException { |
150 | 151 | String installLocPref = getInstallLocationPreferenceString(); |
151 | 152 | if (installLocPref == null || installLocPref.isBlank() || installLocPref.isEmpty()) { |
152 | 153 | if (Trace.isEnabled()) { |
153 | | - Trace.getTracer().trace(Trace.TRACE_TOOLS, "The mvn/gradle preference path: " + installLocPref + " was null, blank, or empty"); |
| 154 | + Trace.getTracer().trace(Trace.TRACE_TOOLS, |
| 155 | + "The mvn/gradle preference path: " + installLocPref + " was null, blank, or empty"); |
154 | 156 | } |
155 | 157 | return null; |
156 | | - } |
157 | | - |
| 158 | + } |
| 159 | + |
158 | 160 | File tempCmdFile = new File(installLocPref + File.separator + "bin" + File.separator + getExecBaseName()); |
159 | 161 | String cmdPathStr = tempCmdFile.getPath(); |
160 | | - |
| 162 | + |
161 | 163 | if (tempCmdFile.exists()) { |
162 | 164 | if (Trace.isEnabled()) { |
163 | 165 | Trace.getTracer().trace(Trace.TRACE_TOOLS, "Found mvn/gradle from preference at path: " + cmdPathStr); |
@@ -202,20 +204,10 @@ private String getCommandFromPathEnvVar() throws IllegalStateException { |
202 | 204 | return foundCmd; |
203 | 205 | } |
204 | 206 |
|
205 | | - private String getCommandLineFromArgs(String cmd, String cmdArgs, boolean printCmd) { |
| 207 | + private String getCommandLineFromArgs(String cmd, String cmdArgs) { |
206 | 208 | // Put it all together. |
207 | 209 | StringBuilder sb = new StringBuilder(); |
208 | 210 | if (cmd != null) { |
209 | | - if (printCmd) { |
210 | | - if (Utils.isWindows()) { |
211 | | - sb.append("/c "); |
212 | | - sb.append("echo && "); |
213 | | - sb.append("echo Liberty Tools running command: " + cmd + " " + cmdArgs); |
214 | | - sb.append(" from directory: " + projectPath + " && "); |
215 | | - } else { |
216 | | - sb.append(" -x "); |
217 | | - } |
218 | | - } |
219 | 211 | sb.append(cmd).append(" ").append(cmdArgs); |
220 | 212 | } |
221 | 213 |
|
|
0 commit comments