Package com.google.javascript.jscomp

Examples of com.google.javascript.jscomp.CompilerOptions


        CommandLineRunner.getDefaultExterns(),
        Arrays.asList(jsModule), getOptions());
  }

  private CompilerOptions getOptions() {
    CompilerOptions options = new CompilerOptions();
    compilationLevel.setOptionsForCompilationLevel(options);
    options.variableRenaming = VariableRenamingPolicy.OFF;
    return options;
  }
View Full Code Here


    }

    public String generateCode(AbstractCompiler compiler, Node node) {
      // TODO(mknichel): Fix all the formatting problems with this code.
      // How does this play with goog.scope?
      CompilerOptions compilerOptions = new CompilerOptions();
      compilerOptions.setPreferSingleQuotes(true);
      compilerOptions.setLineLengthThreshold(80);
      return new CodePrinter.Builder(node)
          .setCompilerOptions(compilerOptions)
          .setTypeRegistry(compiler.getTypeRegistry())
          .setPrettyPrint(true)
          .setLineBreak(true)
View Full Code Here

    return new CheckDebuggerStatement(compiler);
  }

  @Override
  protected CompilerOptions getOptions() {
    CompilerOptions options = super.getOptions();
    if (checkLevel != null) {
      options.setWarningLevel(
          DiagnosticGroups.DEBUGGER_STATEMENT_PRESENT,
          checkLevel);
    }
    return options;
  }
View Full Code Here

  protected RunResult compile(String js, String fileName) {
    return compile(js, fileName, null, null);
  }

  protected CompilerOptions getCompilerOptions() {
    CompilerOptions options = new CompilerOptions();
    options.sourceMapOutputPath = "testcode_source_map.out";
    options.sourceMapFormat = getSourceMapFormat();
    options.sourceMapDetailLevel = detailLevel;
    return options;
  }
View Full Code Here

  }

  protected RunResult compile(
      String js1, String fileName1, String js2, String fileName2) {
    Compiler compiler = new Compiler();
    CompilerOptions options = getCompilerOptions();

    // Turn on IDE mode to get rid of optimizations.
    options.ideMode = true;

    List<SourceFile> inputs =
View Full Code Here

  private void compile(final Reader reader, final Writer writer,
      final Map<String, Object> options) throws IOException {
    Compiler.setLoggingLevel(Level.SEVERE);
    final Compiler compiler = new Compiler(new PrintStream(
        LOGGER_OUTPUT_STREAM, false, "UTF-8"));
    final CompilerOptions compilerOptions = new CompilerOptions();
    CompilationLevel.SIMPLE_OPTIMIZATIONS
        .setOptionsForCompilationLevel(compilerOptions);
    compilerOptions.setCodingConvention(new ClosureCodingConvention());
    if (isSourceMappingEnabled(options)) {
      compilerOptions.setSourceMapFormat(Format.V3);
      compilerOptions.setSourceMapDetailLevel(DetailLevel.ALL);
    }
    setupOptions(compilerOptions, options);
    compiler.initOptions(compilerOptions);

    final Result result = compiler.compile(SourceFile.fromCode("externs", ""),
View Full Code Here

    List<SourceFile> jsInputs = new ArrayList<SourceFile>();
    for (File f : inputs) {
      jsInputs.add(SourceFile.fromFile(f));
    }

    CompilerOptions options = new CompilerOptions();
    CompilationLevel.ADVANCED_OPTIMIZATIONS
        .setOptionsForCompilationLevel(options);
    WarningLevel.VERBOSE.setOptionsForWarningLevel(options);
    for (DiagnosticGroup dg : diagnosticGroups) {
      options.setWarningLevel(dg, CheckLevel.ERROR);
    }

    options.setCodingConvention(new GoogleCodingConvention());

    Compiler compiler = new Compiler();
    MessageFormatter formatter =
        options.errorFormat.toFormatter(compiler, false);
    AntErrorManager errorManager = new AntErrorManager(formatter, task);
View Full Code Here

            compLevel = CompilationLevel.valueOf(compilationLevel);
        } catch (IllegalArgumentException e) {
            throw new MojoFailureException("Compilation level invalid" + e.getMessage());
        }

        CompilerOptions compilerOptions = new CompilerOptions();
        compLevel.setOptionsForCompilationLevel(compilerOptions);

        List<JSSourceFile> sources = new ArrayList<JSSourceFile>();
       
        long lastMod = -1;
View Full Code Here

 
  private void compress() throws UnsupportedEncodingException, IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    InputStream is = new ByteArrayInputStream(content);
    Writer out = new OutputStreamWriter(baos, charset);
    CompilerOptions options = new CompilerOptions();
    CompilationLevel.SIMPLE_OPTIMIZATIONS.setOptionsForCompilationLevel(options);
    Compiler.setLoggingLevel(Level.OFF);
    Compiler compiler = new Compiler();
    compiler.disableThreads();
    Result result = compiler.compile(new JSSourceFile[] {},
View Full Code Here

            switch (engine) {
                case CLOSURE:
                    log.debug("Using Google Closure Compiler engine.");

                    CompilerOptions options = new CompilerOptions();
                    closureConfig.getCompilationLevel().setOptionsForCompilationLevel(options);
                    options.setOutputCharset(charset);
                    options.setLanguageIn(closureConfig.getLanguage());
                    options.setAngularPass(closureConfig.getAngularPass());
                    options.setDependencyOptions(closureConfig.getDependencyOptions());

                    File sourceMapResult = new File(minifiedFile.getPath() + ".map");
                    if (closureConfig.getSourceMapFormat() != null) {
                        options.setSourceMapFormat(closureConfig.getSourceMapFormat());
                        options.setSourceMapOutputPath(sourceMapResult.getPath());
                        // options.setSourceMapLocationMappings(Lists.newArrayList(new
                        // SourceMap.LocationMapping(sourceDir.getPath() + File.separator, "")));
                    }

                    SourceFile input = SourceFile.fromInputStream(mergedFile.getName(), in);
View Full Code Here

TOP

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

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.