Package com.google.gwt.core.ext

Examples of com.google.gwt.core.ext.TreeLogger


   * @throws UnableToCompleteException
   */
  private void relink(TreeLogger logger, StandardLinkerContext linkerContext,
      ModuleDef module, ArtifactSet newlyGeneratedArtifacts)
      throws UnableToCompleteException {
    TreeLogger linkLogger = logger.branch(TreeLogger.DEBUG,
        "Relinking module '" + module.getName() + "'");

    ArtifactSet artifacts = linkerContext.invokeRelink(linkLogger,
        newlyGeneratedArtifacts);
    produceOutput(linkLogger, linkerContext, artifacts, module, true);
View Full Code Here


    }

    public ModuleSpaceHost createModuleSpaceHost(ModuleHandle module,
        String moduleName) throws UnableToCompleteException {
      // TODO(jat): add support for closing an active module
      TreeLogger logger = module.getLogger();
      try {
        // Try to find an existing loaded version of the module def.
        ModuleDef moduleDef = loadModule(logger, moduleName, true);
        assert (moduleDef != null);

        ShellModuleSpaceHost host = doCreateShellModuleSpaceHost(logger,
            moduleDef.getCompilationState(logger), moduleDef);
        return host;
      } catch (RuntimeException e) {
        logger.log(TreeLogger.ERROR, "Exception initializing module", e);
        module.unload();
        throw e;
      }
    }
View Full Code Here

          options.getLogLevel(), null);

      // Eager AWT initialization for OS X to ensure safe coexistence with SWT.
      BootStrapPlatform.initGui();

      final TreeLogger logger = loggerWindow.getLogger();
      final boolean[] success = new boolean[1];

      // Compiler will be spawned onto a second thread, UI thread for tree
      // logger will remain on the main.
      Thread compilerThread = new Thread(new Runnable() {
        public void run() {
          success[0] = doRun(logger, task);
        }
      });

      compilerThread.setName("GWTCompiler Thread");
      compilerThread.start();
      // TODO(jat): create an app frame for loggerWindow
     
      // Even if the tree logger window is closed, we wait for the compiler
      // to finish.
      waitForThreadToTerminate(compilerThread);

      return success[0];
    } else {
      // Compile tasks without -treeLogger should run headless.
      if (System.getProperty("java.awt.headless") == null) {
        System.setProperty("java.awt.headless", "true");
      }
      PrintWriterTreeLogger logger = new PrintWriterTreeLogger();
      logger.setMaxDetail(options.getLogLevel());
      return doRun(logger, task);
    }
  }
View Full Code Here

        compilationFailed = true;
        // Early out if we don't need to itemize.
        if (!itemizeErrors) {
          break;
        }
        TreeLogger branch = logger.branch(TreeLogger.ERROR, "Errors in "
            + String.valueOf(result.getFileName()), null);
        IProblem[] errors = result.getErrors();
        for (IProblem problem : errors) {
          if (problemSet.contains(problem)) {
            continue;
          }

          problemSet.add(problem);

          // Strip the initial code from each error.
          //
          String msg = problem.toString();
          msg = msg.substring(msg.indexOf(' '));

          // Append 'file (line): msg' to the error message.
          //
          int line = problem.getSourceLineNumber();
          StringBuffer msgBuf = new StringBuffer();
          msgBuf.append("Line ");
          msgBuf.append(line);
          msgBuf.append(": ");
          msgBuf.append(msg);
          branch.log(TreeLogger.ERROR, msgBuf.toString(), null);
        }
      }
    }
    if (compilationFailed) {
      logger.log(TreeLogger.ERROR, "Cannot proceed due to previous errors",
View Full Code Here

      TreeLogger logger, Throwable e) {
    if (e instanceof UnableToCompleteException) {
      // just rethrow
      return (UnableToCompleteException) e;
    } else if (e instanceof InternalCompilerException) {
      TreeLogger topBranch = logger.branch(TreeLogger.ERROR,
          "An internal compiler exception occurred", e);
      List<NodeInfo> nodeTrace = ((InternalCompilerException) e).getNodeTrace();
      for (NodeInfo nodeInfo : nodeTrace) {
        SourceInfo info = nodeInfo.getSourceInfo();
        String msg;
        if (info != null) {
          String fileName = info.getFileName();
          fileName = fileName.substring(fileName.lastIndexOf('/') + 1);
          fileName = fileName.substring(fileName.lastIndexOf('\\') + 1);
          msg = "at " + fileName + "(" + info.getStartLine() + "): ";
        } else {
          msg = "<no source info>: ";
        }

        String description = nodeInfo.getDescription();
        if (description != null) {
          msg += description;
        } else {
          msg += "<no description available>";
        }
        TreeLogger nodeBranch = topBranch.branch(TreeLogger.ERROR, msg, null);
        String className = nodeInfo.getClassName();
        if (className != null) {
          nodeBranch.log(TreeLogger.INFO, className, null);
        }
      }
      return new UnableToCompleteException();
    } else if (e instanceof OutOfMemoryError) {
      // Rethrow the original exception so the caller can deal with it.
View Full Code Here

  }

  @Override
  public TreeLogger branch(Type type, String msg, Throwable caught,
      HelpInfo helpInfo) {
    TreeLogger children[] = new TreeLogger[loggers.length];
    for (int i = 0; i < loggers.length; i++) {
      children[i] = loggers[i].branch(type, msg, caught, helpInfo);
    }
    return new CompositeTreeLogger(children);
  }
View Full Code Here

          }
        }
      }

      if (logger.isLoggable(Type.SPAM)) {
        TreeLogger dumpLogger = logger.branch(Type.SPAM,
            "SingleJsoImpl method mappings");
        for (Map.Entry<String, List<com.google.gwt.dev.asm.commons.Method>> entry : mangledNamesToImplementations.entrySet()) {
          dumpLogger.log(Type.SPAM, entry.getKey() + " -> " + entry.getValue());
        }
      }
    }
View Full Code Here

      } catch (IOException e) {
        caught = e;
      } catch (URISyntaxException e) {
        caught = e;
      }
      TreeLogger branch = getLogger().branch(TreeLogger.ERROR,
          "Unable to launch default browser", caught);
      branch.log(TreeLogger.INFO, url.toExternalForm());
    }
View Full Code Here

                        options.getLogDir()))));
            // TODO: Switch to a wait cursor?
            return new SwingModuleHandle(tab);
          }
        });
    TreeLogger logger = handle.getLogger();
    TreeLogger branch = logger.branch(TreeLogger.INFO, "Loading module "
        + moduleName);
    if (url != null) {
      branch.log(TreeLogger.INFO, "Top URL: " + url);
    }
    branch.log(TreeLogger.INFO, "User agent: " + userAgent);
    branch.log(TreeLogger.TRACE, "Remote socket: " + remoteSocket);
    if (tabKey != null) {
      branch.log(TreeLogger.DEBUG, "Tab key: " + tabKey);
    }
    if (sessionKey != null) {
      branch.log(TreeLogger.DEBUG, "Session key: " + sessionKey);
    }
    return handle;
  }
View Full Code Here

      // TODO: All JDT checks now before even building TypeOracle?
      module.getCompilationState(logger);

      if (options.isValidateOnly()) {
        TreeLogger branch = logger.branch(TreeLogger.INFO,
            "Validating compilation " + module.getName());
        if (!validate(branch, options, module, options.getGenDir(),
            compilerWorkDir, options.getDumpSignatureFile())) {
          branch.log(TreeLogger.ERROR, "Validation failed");
          return false;
        }
        branch.log(TreeLogger.INFO, "Validation succeeded");
      } else {
        TreeLogger branch = logger.branch(TreeLogger.INFO,
            "Precompiling module " + module.getName());
        PropertyPermutations allPermutations = new PropertyPermutations(
            module.getProperties());
        int potentialPermutations = allPermutations.size();
        int permutationsPerIteration = options.getMaxPermsPerPrecompile();

        if (permutationsPerIteration <= 0) {
          permutationsPerIteration = potentialPermutations;
        }
        /*
         * The potential number of permutations to precompile >= the actual
         * number of permutations that end up being precompiled, because some of
         * the permutations might collapse due to identical rebind results. So
         * we have to track these two counts and ids separately.
         */
        int actualPermutations = 0;
        for (int potentialFirstPerm = 0; potentialFirstPerm < potentialPermutations; potentialFirstPerm += permutationsPerIteration) {
          int numPermsToPrecompile = Math.min(potentialPermutations
              - potentialFirstPerm, permutationsPerIteration);

          // Select only the range of property permutations that we want
          PropertyPermutations localPermutations = new PropertyPermutations(
              allPermutations, potentialFirstPerm, numPermsToPrecompile);

          Precompilation precompilation = precompile(branch, options, module,
              actualPermutations, localPermutations, options.getGenDir(),
              compilerWorkDir, options.getDumpSignatureFile());
          if (precompilation == null) {
            branch.log(TreeLogger.ERROR, "Precompilation failed");
            return false;
          }
          int actualNumPermsPrecompiled = precompilation.getPermutations().length;
          String precompilationFilename = PrecompilationFile.fileNameForPermutations(
              actualPermutations, actualNumPermsPrecompiled);
          try {
            precompilationJar.putNextEntry(new ZipEntry(precompilationFilename));
            Util.writeObjectToStream(precompilationJar, precompilation);
          } catch (IOException e) {
            branch.log(TreeLogger.ERROR,
                "Failed to write a precompilation result", e);
            return false;
          }

          actualPermutations += actualNumPermsPrecompiled;
          branch.log(TreeLogger.DEBUG, "Compiled " + actualNumPermsPrecompiled
              + " permutations starting from " + potentialFirstPerm);
        }

        try {
          precompilationJar.close();
        } catch (IOException e) {
          branch.log(TreeLogger.ERROR, "Failed to finalize "
              + PRECOMPILE_FILENAME, e);
          return false;
        }

        Util.writeStringAsFile(branch, new File(compilerWorkDir,
            PERM_COUNT_FILENAME), String.valueOf(actualPermutations));
        branch.log(TreeLogger.INFO,
            "Precompilation succeeded, number of permutations: "
                + actualPermutations);
      }
    }
    return true;
View Full Code Here

TOP

Related Classes of com.google.gwt.core.ext.TreeLogger

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.