public static void main()

in src/main/java/com/uber/scip/aggregator/Aggregator.java [33:80]


  public static void main(String[] args) {
    try {
      CommandLineConfig config = CommandLineConfig.parseArgs(args);

      // Load analyzer from config file
      FileAnalyzer analyzer = fromConfigFile(config.configFile, config.rootDir);
      logger.debug("Loaded configuration from: {}", config.configFile);

      // Apply command line overrides
      if (config.outputPath != null) {
        analyzer.withOutputPath(config.outputPath);
        logger.debug("Overriding output path to: {}", config.outputPath);
      }

      // Process files
      List<File> javaFiles = new ArrayList<>();
      if (config.files != null) {
        analyzer.withFiles(config.files);
        javaFiles = ConfigLoader.findJavaFilesFromPaths(config.files);
        logger.debug("Using files from command line arguments: {}", config.files);
      } else if (!analyzer.getFilePaths().isEmpty()) {
        javaFiles = ConfigLoader.findJavaFilesFromPaths(analyzer.getFilePaths());
        logger.debug("Using files specified in config: {}", analyzer.getFilePaths());
      }

      if (javaFiles.isEmpty()) {
        logger.debug("No Java files found in the specified paths or source roots");
      }

      // Log configuration
      logger.debug("Found {} Java files", javaFiles.size());
      logger.debug("SemanticDB Source Root: {}", analyzer.getSemanticDbManager().getSourceRoot());
      logger.debug("SemanticDB Target Root: {}", analyzer.getSemanticDbManager().getTargetRoot());
      logger.debug("Classpath: {}", analyzer.getCompilerOptions().getClasspath());
      logger.debug("Options: {}", analyzer.getCompilerOptions().getOptions());
      logger.debug("Output: {}", analyzer.getOutputPath());

      // Perform analysis
      analyzer.analyzeFiles(javaFiles);
      logger.debug("Analysis complete");

    } catch (ParseException | IOException e) {
      String message = String.format("Error parsing command line arguments: %s", e.getMessage());
      logger.debug(message);
      CommandLineConfig.printHelp();
      throw new IllegalArgumentException(message);
    }
  }