MCPcopy Index your code
hub / github.com/apache/groovy / process

Method process

src/main/java/groovy/ui/GroovyMain.java:274–343  ·  view source on GitHub ↗

Process the users request. @param parser the parsed command line. Used when the user input was invalid. @throws ParameterException if the user input was invalid

(CommandLine parser)

Source from the content-addressed store, hash-verified

272 * @throws ParameterException if the user input was invalid
273 */
274 boolean process(CommandLine parser) throws ParameterException, IOException {
275 for (Map.Entry<String, String> entry : systemProperties.entrySet()) {
276 System.setProperty(entry.getKey(), entry.getValue());
277 }
278
279 final GroovyMain main = new GroovyMain();
280
281 // add the ability to parse scripts with a specified encoding
282 if (encoding != null) main.conf.setSourceEncoding(encoding);
283
284 main.debug = debug;
285 main.conf.setDebug(main.debug);
286 main.conf.setParameters(parameterMetadata);
287 main.conf.setPreviewFeatures(previewFeatures);
288 main.processFiles = lineByLine || lineByLinePrint;
289 main.autoOutput = lineByLinePrint;
290 main.editFiles = extension != null;
291 if (main.editFiles) {
292 main.backupExtension = extension;
293 }
294
295 main.autoSplit = splitPattern != null;
296 if (main.autoSplit) {
297 main.splitPattern = splitPattern;
298 }
299
300 main.isScriptFile = script == null;
301 if (main.isScriptFile) {
302 if (arguments.isEmpty()) {
303 throw new ParameterException(parser, "error: neither -e or filename provided");
304 }
305 main.script = arguments.remove(0);
306 if (main.script.endsWith(".java")) {
307 throw new ParameterException(parser, "error: cannot compile file with .java extension: " + main.script);
308 }
309 } else {
310 main.script = script;
311 }
312
313 main.processSockets = port != null;
314 if (main.processSockets) {
315 String p = !port.trim().isEmpty() ? port : "1960"; // default port to listen to
316 main.port = Integer.parseInt(p);
317 }
318
319 for (String optimization : disableopt) {
320 main.conf.getOptimizationOptions().put(optimization, false);
321 }
322
323 if (scriptBaseClass != null) {
324 main.conf.setScriptBaseClass(scriptBaseClass);
325 }
326
327 final List<String> transformations = new ArrayList<>();
328 if (compileStatic) {
329 transformations.add("ast(groovy.transform.CompileStatic)");
330 }
331 if (typeChecked) {

Callers 1

processArgsMethod · 0.95

Calls 15

getConfigScriptsMethod · 0.95
runMethod · 0.95
setSourceEncodingMethod · 0.80
trimMethod · 0.80
parseIntMethod · 0.80
buildConfigScriptTextMethod · 0.80
processConfigScriptsMethod · 0.80
setPropertyMethod · 0.65
getKeyMethod · 0.65
getValueMethod · 0.65

Tested by

no test coverage detected