private ClosureConfig fillClosureConfig() throws MojoFailureException { DependencyOptions dependencyOptions = new DependencyOptions(); dependencyOptions.setDependencySorting(closureSortDependencies); List<SourceFile> externs = new ArrayList<>(); for (String extern : closureExterns) { externs.add(SourceFile.fromFile(webappSourceDir + File.separator + extern, Charset.forName(charset))); } Map<DiagnosticGroup, CheckLevel> warningLevels = new HashMap<>(); DiagnosticGroups diagnosticGroups = new DiagnosticGroups(); for (Map.Entry<String, String> warningLevel : closureWarningLevels.entrySet()) { DiagnosticGroup diagnosticGroup = diagnosticGroups.forName(warningLevel.getKey()); if (diagnosticGroup == null) { throw new MojoFailureException("Failed to process closureWarningLevels: " + warningLevel.getKey() + " is an invalid DiagnosticGroup"); } try { CheckLevel checkLevel = CheckLevel.valueOf(warningLevel.getValue()); warningLevels.put(diagnosticGroup, checkLevel); } catch (IllegalArgumentException e) { throw new MojoFailureException("Failed to process closureWarningLevels: " + warningLevel.getKey() + " is an invalid CheckLevel"); } } return new ClosureConfig(closureLanguageIn, closureLanguageOut, closureEnvironment, closureCompilationLevel, dependencyOptions, externs, closureCreateSourceMap, warningLevels, closureAngularPass, closureExtraAnnotations, closureDefine); }
private ClosureConfig fillClosureConfig() throws MojoFailureException { DependencyOptions dependencyOptions = new DependencyOptions(); dependencyOptions.setDependencySorting(closureSortDependencies); List<SourceFile> externs = new ArrayList<>(); for (String extern : closureExterns) { externs.add(SourceFile.fromFile(webappSourceDir + File.separator + extern, Charset.forName(charset))); } Map<DiagnosticGroup, CheckLevel> warningLevels = new HashMap<>(); DiagnosticGroups diagnosticGroups = new DiagnosticGroups(); for (Map.Entry<String, String> warningLevel : closureWarningLevels.entrySet()) { DiagnosticGroup diagnosticGroup = diagnosticGroups.forName(warningLevel.getKey()); if (diagnosticGroup == null) { throw new MojoFailureException("Failed to process closureWarningLevels: " + warningLevel.getKey() + " is an invalid DiagnosticGroup"); } try { CheckLevel checkLevel = CheckLevel.valueOf(warningLevel.getValue()); warningLevels.put(diagnosticGroup, checkLevel); } catch (IllegalArgumentException e) { throw new MojoFailureException("Failed to process closureWarningLevels: " + warningLevel.getKey() + " is an invalid CheckLevel"); } } return new ClosureConfig(closureLanguageIn, closureLanguageOut, closureEnvironment, closureCompilationLevel, dependencyOptions, externs, closureCreateSourceMap, warningLevels, closureAngularPass, closureExtraAnnotations, closureDefine); }