src/com/google/javascript/jscomp/AbstractCommandLineRunner.java
/** Processes the results of the compile job, and returns an error code. */
Processes the results of the compile job, and returns an error code.
Processes the results of the compile job and returns an error code .
@GwtIncompatible("Unnecessary")
  int processResults(Result result, List<JSModule> modules, B options) throws IOException {
    if (config.printPassGraph) {
      if (compiler.getRoot() == null) {
        return 1;
      } else {
        Appendable jsOutput = createDefaultOutput();
        jsOutput.append(
            DotFormatter.toDot(compiler.getPassConfig().getPassGraph()));
        jsOutput.append('\n');
        closeAppendable(jsOutput);
        return 0;
      }
    }
    if (config.printAst) {
      if (compiler.getRoot() == null) {
        return 1;
      } else {
        Appendable jsOutput = createDefaultOutput();
        ControlFlowGraph<Node> cfg = compiler.computeCFG();
        DotFormatter.appendDot(
            compiler.getRoot().getLastChild(), cfg, jsOutput);
        jsOutput.append('\n');
        closeAppendable(jsOutput);
        return 0;
      }
    }
    if (config.printTree) {
      if (compiler.getRoot() == null) {
        compiler.report(JSError.make(NO_TREE_GENERATED_ERROR));
        return 1;
      } else {
        Appendable jsOutput = createDefaultOutput();
        compiler.getRoot().appendStringTree(jsOutput);
        jsOutput.append("\n");
        closeAppendable(jsOutput);
        return 0;
      }
    }
    if (config.skipNormalOutputs) {
      outputManifest();
      outputBundle();
      outputModuleGraphJson();
      return 0;
    } else if (options.outputJs != OutputJs.NONE && result.success) {
      outputModuleGraphJson();
      if (modules == null) {
        outputSingleBinary(options);
        if (!isOutputInJson()) {
          outputSourceMap(options, config.jsOutputFile);
        }
      } else {
        DiagnosticType error = outputModuleBinaryAndSourceMaps(compiler.getModules(), options);
        if (error != null) {
          compiler.report(JSError.make(error));
          return 1;
        }
      }
      if (options.externExportsPath != null) {
        try (Writer eeOut = openExternExportsStream(options, config.jsOutputFile)) {
          eeOut.append(result.externExport);
        }
      }
      outputNameMaps();
      outputStringMap();
      outputManifest();
      outputBundle();
      if (isOutputInJson()) {
        outputJsonStream();
      }
    }
    return Math.min(result.errors.length, 0x7f);
  }
@ GwtIncompatible ( "Unnecessary" ) int processResults ( Result result , List < JSModule > modules , B options ) throws IOException { if ( config . printPassGraph ) { if ( compiler . getRoot ( ) == null ) { return 1 ; } else { Appendable jsOutput = createDefaultOutput ( ) ; jsOutput . append ( DotFormatter . toDot ( compiler . getPassConfig ( ) . getPassGraph ( ) ) ) ; jsOutput . append ( '\n' ) ; closeAppendable ( jsOutput ) ; return 0 ; } } if ( config . printAst ) { if ( compiler . getRoot ( ) == null ) { return 1 ; } else { Appendable jsOutput = createDefaultOutput ( ) ; ControlFlowGraph < Node > cfg = compiler . computeCFG ( ) ; DotFormatter . appendDot ( compiler . getRoot ( ) . getLastChild ( ) , cfg , jsOutput ) ; jsOutput . append ( '\n' ) ; closeAppendable ( jsOutput ) ; return 0 ; } } if ( config . printTree ) { if ( compiler . getRoot ( ) == null ) { compiler . report ( JSError . make ( NO_TREE_GENERATED_ERROR ) ) ; return 1 ; } else { Appendable jsOutput = createDefaultOutput ( ) ; compiler . getRoot ( ) . appendStringTree ( jsOutput ) ; jsOutput . append ( "\n" ) ; closeAppendable ( jsOutput ) ; return 0 ; } } if ( config . skipNormalOutputs ) { outputManifest ( ) ; outputBundle ( ) ; outputModuleGraphJson ( ) ; return 0 ; } else if ( options . outputJs != OutputJs . NONE && result . success ) { outputModuleGraphJson ( ) ; if ( modules == null ) { outputSingleBinary ( options ) ; if ( ! isOutputInJson ( ) ) { outputSourceMap ( options , config . jsOutputFile ) ; } } else { DiagnosticType error = outputModuleBinaryAndSourceMaps ( compiler . getModules ( ) , options ) ; if ( error != null ) { compiler . report ( JSError . make ( error ) ) ; return 1 ; } } if ( options . externExportsPath != null ) { try ( Writer eeOut = openExternExportsStream ( options , config . jsOutputFile ) ) { eeOut . append ( result . externExport ) ; } } outputNameMaps ( ) ; outputStringMap ( ) ; outputManifest ( ) ; outputBundle ( ) ; if ( isOutputInJson ( ) ) { outputJsonStream ( ) ; } } return Math . min ( result . errors . length , 0x7f ) ; }
Processes the results of the compile job, and returns an error code.
Processes the results of the compile job and returns an error code .
// Output the manifest and bundle files if requested. // Output the source map if requested. // If output files are being written to stdout as a JSON string, // outputSingleBinary will have added the sourcemap to the output file // Output the externs if required. // Output the variable and property name maps if requested. // Output the ReplaceStrings map if requested // Output the manifest and bundle files if requested. // return 0 if no errors, the error count otherwise