Package com.google.gwt.dev.javac

Examples of com.google.gwt.dev.javac.CompilationState


        }
      } finally {
        loadAllArchives.end();
      }

      CompilationState compilationState;
      try {
        compilationState = module.getCompilationState(logger, compilerContext);
      } catch (Throwable e) {
        CompilationProblemReporter.logAndTranslateException(logger, e);
        return false;
      }

      if (options.isStrict() && compilationState.hasErrors()) {
        logger.log(TreeLogger.ERROR, "Failed to compile " + moduleToCompile);
        return false;
      }

      Set<String> compiledUnits = Sets.newHashSet();
      CompilationUnitArchive outputArchive = new CompilationUnitArchive(moduleToCompile);
      for (CompilationUnit unit : compilationState.getCompilationUnits()) {
        if (!currentModuleArchivedUnits.contains(unit.getResourcePath())) {
          outputArchive.addUnit(unit);
          compiledUnits.add(unit.getResourcePath());
        }
      }
View Full Code Here


        ModuleDef moduleDef = loadModule(logger, moduleName, true);
        assert (moduleDef != null);

        ArchivePreloader.preloadArchives(logger, compilerContext);

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

  }

  public CompilationState getCompilationState(TreeLogger logger, CompilerContext compilerContext)
      throws UnableToCompleteException {
    ensureResourcesScanned();
    CompilationState compilationState = CompilationStateBuilder.buildFrom(
        logger, compilerContext, compilerContext.getSourceResourceOracle().getResources());
    checkForSeedTypes(logger, compilationState);
    return compilationState;
  }
View Full Code Here

  public static boolean validate(TreeLogger logger, CompilerContext compilerContext) {
    Event validateEvent = SpeedTracerLogger.start(CompilerEventType.VALIDATE);
    try {
      ModuleDef module = compilerContext.getModule();
      PrecompileTaskOptions jjsOptions = compilerContext.getOptions();
      CompilationState compilationState = module.getCompilationState(logger, compilerContext);
      if (jjsOptions.isStrict() && compilationState.hasErrors()) {
        abortDueToStrictMode(logger);
      }
      String[] declEntryPts = module.getEntryPointTypeNames();
      String[] additionalRootTypes = null;
      if (declEntryPts.length == 0) {
        // No declared entry points, just validate all visible classes.
        Collection<CompilationUnit> compilationUnits = compilationState.getCompilationUnits();
        additionalRootTypes = new String[compilationUnits.size()];
        int i = 0;
        for (CompilationUnit unit : compilationUnits) {
          additionalRootTypes[i++] = unit.getTypeName();
        }
View Full Code Here

    ArchivePreloader.preloadArchives(logger, compilerContext);

    try {
      ModuleDef module = compilerContext.getModule();
      PrecompileTaskOptions jjsOptions = compilerContext.getOptions();
      CompilationState compilationState = module.getCompilationState(logger, compilerContext);
      if (jjsOptions.isStrict() && compilationState.hasErrors()) {
        abortDueToStrictMode(logger);
      }

      List<String> initialTypeOracleTypes = new ArrayList<String>();
      if (jjsOptions.isCompilerMetricsEnabled()) {
        for (JClassType type : compilationState.getTypeOracle().getTypes()) {
          initialTypeOracleTypes.add(type.getPackage().getName() + "." + type.getName());
        }
      }

      // Track information about the module load including initial type
View Full Code Here

        // (2) Assert preconditions
        checkEntryPoints(additionalRootTypes);

        // (3) Construct and unify the unresolved Java AST
        CompilationState compilationState = constructJavaAst(additionalRootTypes);

        // TODO(stalcup): hide metrics gathering in a callback or subclass
        TypeRefDepsChecker.exec(logger, jprogram, module, options.warnMissingDeps(),
            options.getMissingDepsFile());
        logTypeOracleMetrics(precompilationMetrics, compilationState);
View Full Code Here

    }

    private CompilationState constructJavaAst(String[] additionalRootTypes)
        throws UnableToCompleteException {
      Set<String> allRootTypes = new TreeSet<String>();
      CompilationState compilationState = rpo.getCompilationState();
      Memory.maybeDumpMemory("CompStateBuilt");
      populateRootTypes(allRootTypes, additionalRootTypes, compilationState.getTypeOracle());
      String entryMethodHolderTypeName =
          buildEntryMethodHolder(rpo.getGeneratorContext(), allRootTypes);
      beforeUnifyAst(allRootTypes);
      unifyJavaAst(allRootTypes, entryMethodHolderTypeName);
      if (options.isSoycEnabled() || options.isJsonSoycEnabled()) {
        SourceInfoCorrelator.exec(jprogram);
      }

      // Gathers simple metrics that can highlight overly-large modules in an incremental compile.
      TinyCompileSummary tinyCompileSummary = compilerContext.getTinyCompileSummary();
      tinyCompileSummary.setTypesForGeneratorsCount(
          rpo.getGeneratorContext().getTypeOracle().getTypes().length);
      tinyCompileSummary.setTypesForAstCount(jprogram.getDeclaredTypes().size());
      tinyCompileSummary.setStaticSourceFilesCount(compilationState.getStaticSourceCount());
      tinyCompileSummary.setGeneratedSourceFilesCount(compilationState.getGeneratedSourceCount());
      tinyCompileSummary.setCachedStaticSourceFilesCount(
          compilationState.getCachedStaticSourceCount());
      tinyCompileSummary.setCachedGeneratedSourceFilesCount(
          compilationState.getCachedGeneratedSourceCount());

      // Free up memory.
      rpo.clear();
      jprogram.typeOracle.computeBeforeAST();
      return compilationState;
View Full Code Here

   */
  public static boolean validate(TreeLogger logger, JJSOptions jjsOptions,
      ModuleDef module, File genDir, File generatorResourcesDir,
      File dumpSignatureFile) {
    try {
      CompilationState compilationState = module.getCompilationState(logger);
      if (dumpSignatureFile != null) {
        // Dump early to avoid generated types.
        SignatureDumper.dumpSignatures(logger, module.getTypeOracle(logger),
            dumpSignatureFile);
      }

      String[] declEntryPts = module.getEntryPointTypeNames();
      String[] additionalRootTypes = null;
      if (declEntryPts.length == 0) {
        // No declared entry points, just validate all visible classes.
        Collection<CompilationUnit> compilationUnits = compilationState.getCompilationUnits();
        additionalRootTypes = new String[compilationUnits.size()];
        int i = 0;
        for (CompilationUnit unit : compilationUnits) {
          additionalRootTypes[i++] = unit.getTypeName();
        }
View Full Code Here

      JJSOptions jjsOptions, ModuleDef module, int permutationBase,
      PropertyPermutations allPermutations, File genDir,
      File generatorResourcesDir, File dumpSignatureFile) {

    try {
      CompilationState compilationState = module.getCompilationState(logger);
      if (dumpSignatureFile != null) {
        // Dump early to avoid generated types.
        SignatureDumper.dumpSignatures(logger, module.getTypeOracle(logger),
            dumpSignatureFile);
      }
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.javac.CompilationState

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.