Package com.google.javascript.jscomp

Examples of com.google.javascript.jscomp.CompilationLevel


            log.info("Compiling to: " + compilation.getOutputFile());
            log.info("Compiling with level: "
                    + compilation.getCompilationLevel());

            CompilationLevel compilationLevel = null;
            try {
                compilationLevel =
                        CompilationLevel.valueOf(compilation
                                .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);

            Compiler compiler = new Compiler();
            Result result = compiler.compile(externs, source, compilerOptions);

            // TODO: should log results to a file if desired.
View Full Code Here


        if (files.size() == 0) {
            getLog().debug("No source files detected, skipping");
            return;
        }
       
        CompilationLevel compLevel = null;
        try {
            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

        String sourceName = key.id.getScope() + "/" + key.id.getName() + ".js";

        //
        if (script != null) {
            if (key.minified) {
                CompilationLevel level = CompilationLevel.SIMPLE_OPTIMIZATIONS;
                CompilerOptions options = new CompilerOptions();
                level.setOptionsForCompilationLevel(options);
                com.google.javascript.jscomp.Compiler compiler = new Compiler();
                compiler.setErrorManager(new LoggerErrorManager(java.util.logging.Logger.getLogger(ResourceRequestHandler.class
                        .getName())));
                StringWriter code = new StringWriter();
                IOTools.copy(script, code);
View Full Code Here

    public ClosureCompressorPlugin(InitParams params) {
        super(params);

        //
        ValueParam vp = params.getValueParam("level");
        CompilationLevel level = null;
        if (vp != null) {
            String value = vp.getValue().trim().toLowerCase();
            log.debug("found compressor level configuration " + value);
            setLevel(value);
        }
View Full Code Here

    public ResourceType getResourceType() {
        return ResourceType.JAVASCRIPT;
    }

    public void compress(Reader input, Writer output) throws ResourceCompressorException {
        CompilationLevel level = compilationLevel;
        if (level == null) {
            level = CompilationLevel.SIMPLE_OPTIMIZATIONS;
        }

        //
        Compiler compiler = new Compiler();
        CompilerOptions options = new CompilerOptions();
        level.setOptionsForCompilationLevel(options);
        WarningLevel.QUIET.setOptionsForWarningLevel(options);
        JSSourceFile extern = JSSourceFile.fromCode("extern", "");

        //
        JSSourceFile jsInput;
View Full Code Here

       
        JSlim.getLogger().log(Level.INFO, "Compiling with character set " + m_charset);
        slim.setCharset(m_charset);
        slim.setPrintTree(m_printTree);
       
        CompilationLevel level = getCompilationLevel();
       
        /*
         First we add the externs
         */
        readExterns(slim);
View Full Code Here

   {
      super(params);

      //
      ValueParam vp = params.getValueParam("level");
      CompilationLevel level = null;
      if (vp != null)
      {
         String value = vp.getValue().trim().toLowerCase();
         log.debug("found compressor level configuration " + value);
         setLevel(value);
View Full Code Here

      return ResourceType.JAVASCRIPT;
   }

   public void compress(Reader input, Writer output) throws ResourceCompressorException
   {
      CompilationLevel level = compilationLevel;
      if (level == null)
      {
         level = CompilationLevel.SIMPLE_OPTIMIZATIONS;
      }

      //
      Compiler compiler = new Compiler();
      CompilerOptions options = new CompilerOptions();
      level.setOptionsForCompilationLevel(options);
      WarningLevel.QUIET.setOptionsForWarningLevel(options);
      JSSourceFile extern = JSSourceFile.fromCode("extern", "");

      //
      JSSourceFile jsInput;
View Full Code Here

TOP

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

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.