Esempio n. 1
0
    static int Main(string[] args)
    {
      var options = new Options();
      options.Parse(args);

      if (options.HelpRequested)
      {
        options.PrintOptions("", Console.Out);
        return 0;
      }
      if (options.HasErrors)
      {
        options.PrintErrorsAndExit(Console.Out);
      }

      if (options.repoDir.EndsWith("*"))
      {
        return RunMany(options);
      }
      else
      {
        return RunOne(options);
      }
    }
Esempio n. 2
0
    static int RunMany(Options options)
    {
      var root = options.repoDir.Substring(0, options.repoDir.Length-1);
      var projects = options.projects;
      var minversion = options.version;
      var dirs = Directory.EnumerateDirectories(root).OrderBy(s => s).ToArray();
      Contract.Assume(Contract.ForAll(dirs, d => d != null));
      for (int i = 0; i < dirs.Length; i++)
      {
        var dir = dirs[i];
        var match = Regex.Match(dir, @"[\\/](\d+)$");
        if (match.Success) {
          // a version number
          var version = match.Groups[1].Value;
          if (string.Compare(version, minversion) < 0) continue;

          Console.WriteLine("CCBaseline: Computing baseline of {0}", dir);
          if (RunOne(dir, projects, options.GeneralArguments, version, save:true) != 0) {
            Console.WriteLine("Computing baseline of {0} failed", dir);
            continue;
          }

          Console.WriteLine("CCHistory: Applying baseline of {0}", dir);
          if (RunOne(dir, projects, options.GeneralArguments, version, save:false) != 0)
          {
            Console.WriteLine("Using the baseline of {0} failed", dir);
            continue;
          }
          // run against prior baseline
          for (int j = 1; j < 3; j++)
          { // run for past 2 versions
            if (i - j < 0) break;
            var pastdir = dirs[i - j];
            var pastmatch = Regex.Match(pastdir, @"[\\/](\d+)$");
            if (pastmatch.Success)
            {
              // a version number
              var priorVersion = pastmatch.Groups[1].Value;
              if (string.Compare(priorVersion, minversion) < 0) break;
              Console.WriteLine("CCBaseline: Using prior baseline {0} for {1}", priorVersion, dir);
              if (RunOne(dir, projects, options.GeneralArguments, priorVersion, save:false) != 0)
              {
                Console.WriteLine("Using the prior baseline {0} for {1} failed", priorVersion, dir);
              }
            }
          }
        }
      }
      return 0;
    }
Esempio n. 3
0
 static int RunOne(Options options)
 {
   return RunOne(options.repoDir, options.projects, options.GeneralArguments, options.version, options.save);
 }