Package com.google.javascript.jscomp

Examples of com.google.javascript.jscomp.CompilerOptions$AliasTransformation


    return root.getLastChild().getFirstChild();
  }

  private Compiler getCompiler(String jsInput) {
    Compiler compiler = new Compiler();
    CompilerOptions options = RefactoringDriver.getCompilerOptions();
    compiler.init(
        ImmutableList.<SourceFile>of(), // Externs
        ImmutableList.of(SourceFile.fromCode("test", jsInput)),
        options);
    compiler.parse();
View Full Code Here


    scanner.initialize(compiler);
    return scanner;
  }

  private void compileTestCode(Compiler compiler, String testCode, String externs) {
    CompilerOptions options = RefactoringDriver.getCompilerOptions();
    compiler.compile(
        ImmutableList.of(SourceFile.fromCode("externs", externs)),
        ImmutableList.of(SourceFile.fromCode("test", testCode)),
        options);
  }
View Full Code Here

      throw new BuildException("outputFile attribute must be set");
    }

    Compiler.setLoggingLevel(Level.OFF);

    CompilerOptions options = createCompilerOptions();
    Compiler compiler = createCompiler(options);

    List<SourceFile> externs = findExternFiles();
    List<SourceFile> sources = findSourceFiles();
View Full Code Here

      throw new BuildException("Cannot write sourcemap to file.", e);
    }
  }

  private CompilerOptions createCompilerOptions() {
    CompilerOptions options = new CompilerOptions();

    this.compilationLevel.setOptionsForCompilationLevel(options);
    if (this.debugOptions) {
      this.compilationLevel.setDebugOptionsForCompilationLevel(options);
    }

    options.prettyPrint = this.prettyPrint;
    options.printInputDelimiter = this.printInputDelimiter;
    options.generateExports = this.generateExports;

    options.setLanguageIn(this.languageIn);
    options.setOutputCharset(this.outputEncoding);

    this.warningLevel.setOptionsForWarningLevel(options);
    options.setManageClosureDependencies(manageDependencies);
    convertEntryPointParameters(options);
    options.setTrustedStrings(true);

    if (replaceProperties) {
      convertPropertiesMap(options);
    }

    convertDefineParameters(options);

    for (Warning warning : warnings) {
      CheckLevel level = warning.getLevel();
      String groupName = warning.getGroup();
      DiagnosticGroup group = new DiagnosticGroups().forName(groupName);
      if (group == null) {
        throw new BuildException(
            "Unrecognized 'warning' option value (" + groupName + ")");
      }
      options.setWarningLevel(group, level);
    }

    if (!Strings.isNullOrEmpty(sourceMapFormat)) {
      options.sourceMapFormat = Format.valueOf(sourceMapFormat);
    }
View Full Code Here

    public static String compile(List<FragmentDescriptor> scripts, IRequestProxy request,
                                 CompressorSettings settings) throws JSCompileException {
        Compiler compiler = new Compiler();

        CompilerOptions options = new CompilerOptions();
        options.markAsCompiled = true;
        if (settings.getLocale() != null)
            options.locale = settings.getLocale();
        options.prettyPrint = settings.isFormatPrettyPrint();
        options.printInputDelimiter = settings.isFormatPrintInputDelimiter();
View Full Code Here

                                .getCompilationLevel());
            } catch (IllegalArgumentException e) {
                throw new MojoFailureException("Compilation level invalid", e);
            }

            CompilerOptions compilerOptions =
                    compilation.getCompilerOptionsMojo().getCompilerOptions();
            if (null == compilerOptions) {
                log.info("With no compiler options");
                compilerOptions = new CompilerOptions();
            }
            log.info("Compiler Options:" + compilerOptions);

            compilationLevel.setOptionsForCompilationLevel(compilerOptions);
View Full Code Here

  public Compiler getCompiler() {
    return compiler;
  }

  private Compiler createCompiler(List<SourceFile> inputs, List<SourceFile> externs) {
    CompilerOptions options = getCompilerOptions();
    Compiler compiler = new Compiler();
    compiler.disableThreads();
    compiler.compile(externs, inputs, options);
    return compiler;
  }
View Full Code Here

    return compiler;
  }

  @VisibleForTesting
  static CompilerOptions getCompilerOptions() {
    CompilerOptions options = new CompilerOptions();

    DependencyOptions deps = new DependencyOptions();
    deps.setDependencySorting(true);
    options.setDependencyOptions(deps);

    options.ideMode = true;
    options.checkSuspiciousCode = true;
    options.checkSymbols = true;
    options.checkTypes = true;
    options.closurePass = true;
    options.preserveGoogRequires = true;

    options.setAcceptConstKeyword(true);

    return options;
  }
View Full Code Here

    return root.getLastChild().getFirstChild();
  }

  private Compiler getCompiler(String jsInput) {
    Compiler compiler = new Compiler();
    CompilerOptions options = RefactoringDriver.getCompilerOptions();
    compiler.init(
        ImmutableList.<SourceFile>of(), // Externs
        ImmutableList.of(SourceFile.fromCode("test", jsInput)),
        options);
    compiler.parse();
View Full Code Here

  }

  private Compiler getCompiler(String externs, String jsInput) {
    Compiler compiler = new Compiler();
    compiler.disableThreads();
    CompilerOptions options = RefactoringDriver.getCompilerOptions();
    compiler.compile(
        ImmutableList.of(SourceFile.fromCode("externs", externs)),
        ImmutableList.of(SourceFile.fromCode("test", jsInput)),
        options);
    return compiler;
View Full Code Here

TOP

Related Classes of com.google.javascript.jscomp.CompilerOptions$AliasTransformation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.