MCPcopy Create free account
hub / github.com/LFYSec/MScan / postProcess

Method postProcess

src/main/java/pascal/taie/config/Options.java:335–370  ·  view source on GitHub ↗

Validates input options and do some post-process on it. @return the Options object after post-process.

(Options options)

Source from the content-addressed store, hash-verified

333 * @return the Options object after post-process.
334 */
335 private static Options postProcess(Options options) {
336 if (options.optionsFile != null) {
337 // If options file is given, we ignore other options,
338 // and instead read options from the file.
339 options = readRawOptions(options.optionsFile);
340 }
341 if (options.prependJVM) {
342 options.javaVersion = getCurrentJavaVersion();
343 }
344 if (!options.analyses.isEmpty() && options.planFile != null) {
345 // The user should choose either options or plan file to
346 // specify analyses to be executed.
347 throw new ConfigException("Conflict options: " +
348 "--analysis and --plan-file should not be used simultaneously");
349 }
350 if (false && options.getClassPath() != null
351 && options.mainClass == null
352 && options.inputClasses.isEmpty()
353 && options.getAppClassPath() == null) {
354 throw new ConfigException("Missing options: " +
355 "at least one of --main-class, --input-classes " +
356 "or --app-class-path should be specified");
357 }
358 // mkdir for output dir
359 if (!options.outputDir.exists()) {
360 options.outputDir.mkdirs();
361 }
362 logger.info("Output directory: {}",
363 options.outputDir.getAbsolutePath());
364 // TODO: turn off output in testing?
365 if (options.optionsFile == null) {
366 // write options to file only when it is not given
367 writeOptions(options, new File(options.outputDir, OPTIONS_FILE));
368 }
369 return options;
370 }
371
372 /**
373 * Reads options from file.

Callers 1

parseMethod · 0.95

Calls 6

readRawOptionsMethod · 0.95
getCurrentJavaVersionMethod · 0.95
writeOptionsMethod · 0.95
getAppClassPathMethod · 0.80
isEmptyMethod · 0.65
getClassPathMethod · 0.45

Tested by

no test coverage detected