(Options options)
| 77 | } |
| 78 | |
| 79 | private static Plan processConfigs(Options options) { |
| 80 | InputStream content = Configs.getAnalysisConfig(); |
| 81 | List<AnalysisConfig> analysisConfigs = AnalysisConfig.parseConfigs(content); |
| 82 | ConfigManager manager = new ConfigManager(analysisConfigs); |
| 83 | AnalysisPlanner planner = new AnalysisPlanner( |
| 84 | manager, options.getKeepResult()); |
| 85 | boolean reachableScope = options.getScope().equals(Scope.REACHABLE); |
| 86 | if (!options.getAnalyses().isEmpty()) { |
| 87 | // Analyses are specified by options |
| 88 | List<PlanConfig> planConfigs = PlanConfig.readConfigs(options); |
| 89 | manager.overwriteOptions(planConfigs); |
| 90 | Plan plan = planner.expandPlan( |
| 91 | planConfigs, reachableScope); |
| 92 | // Output analysis plan to file. |
| 93 | // For outputting purpose, we first convert AnalysisConfigs |
| 94 | // in the expanded plan to PlanConfigs |
| 95 | planConfigs = Lists.map(plan.analyses(), |
| 96 | ac -> new PlanConfig(ac.getId(), ac.getOptions())); |
| 97 | // TODO: turn off output in testing? |
| 98 | PlanConfig.writeConfigs(planConfigs, options.getOutputDir()); |
| 99 | if (!options.isOnlyGenPlan()) { |
| 100 | // This run not only generates plan file but also executes it |
| 101 | return plan; |
| 102 | } |
| 103 | } else if (options.getPlanFile() != null) { |
| 104 | // Analyses are specified by file |
| 105 | List<PlanConfig> planConfigs = PlanConfig.readConfigs(options.getPlanFile()); |
| 106 | manager.overwriteOptions(planConfigs); |
| 107 | return planner.makePlan(planConfigs, reachableScope); |
| 108 | } |
| 109 | // No analyses are specified |
| 110 | return Plan.emptyPlan(); |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * Convenient method for building the world from String arguments. |
no test coverage detected