123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- module backporter.commandline;
-
- import backporter.builder;
- import backporter.dmd;
- import backporter.git;
- import backporter.packagefinder;
- import backporter.core;
- import std.range;
- import std.experimental.logger;
-
- int runCommandLine(string[] args)
- {
- import std.stdio : File;
- auto config = new Config;
- string blacklistPath;
- bool verbose;
-
- import std.getopt;
- auto opties = getopt(
- args,
- "o|output", "the output file to write to", &config.outpath,
- "r|release", "the compiler release to use", &config.compilerRelease,
- "w|workdir", "the directory to work in", &config.dataDir,
- "b|blacklist", "file containing project blacklists", &blacklistPath,
- "v|verbose", "enable verbose logging", &verbose,
- "c|version-count", "how many revisions per package to compile",
- &config.revisionCount
- );
-
- if (opties.helpWanted)
- {
- defaultGetoptPrinter("backporter: misnamed tester for all dub packages",
- opties.options);
- return 1;
- }
- if (verbose)
- {
- globalLogLevel = LogLevel.trace;
- }
- else
- {
- globalLogLevel = LogLevel.info;
- }
-
- config.init;
- if (blacklistPath)
- {
- import std.array : array;
- config.blacklistedProjects = File(blacklistPath, "r").byLineCopy.array;
- }
-
- auto pkgs = grabAll(config);
- config.importPackages(pkgs);
- auto compilerReleases = [
- "2.082.0",
- "2.081.2",
- "2.081.1",
- "2.081.0",
- "2.080.1",
- "2.080.0",
- "2.079.1",
- "2.079.0",
- "2.078.3",
- "2.078.2",
- "2.078.1",
- "2.078.0",
- "2.077.1",
- "2.077.0",
- "2.076.1",
- "2.076.0",
- "2.075.1",
- "2.075.0",
- "2.074.1",
- "2.074.0",
- "2.073.2",
- "2.073.1",
- "2.073.0",
- "2.072.2",
- "2.072.1",
- "2.072.0",
- "2.071.2",
- "2.071.1",
- "2.071.0",
- "2.070.2",
- "2.070.1",
- "2.070.0",
- "2.069.2",
- "2.069.1",
- "2.069.0",
- "2.068.2",
- "2.068.1",
- "2.068.0",
- "2.067.1",
- "2.067.0",
- "2.066.1",
- "2.066.0",
- "2.065.0",
- ];
- // What order should we test things in?
- // We eventually want to test everything. But we want each prefix to be as
- // useful as possible. So we do every tenth release (about every 9 months)
- // until we get to the end, at which point we back up and try the next
- // offset for the stride.
- // If you interrupt in the middle, we've got a decent range of releases,
- // hopefully, and the more recent ones are more thoroughly covered.
- //
- // Ideally, we'd divide-and-conquer: the most recent, then the last, then
- // the midpoints, and repeat the midpoints until finished.
- auto strideLength = 10;
- infof("have %s compiler releases and %s package revisions to test",
- compilerReleases.length, pkgs.length);
- foreach (i; 0..strideLength)
- {
- foreach (release; compilerReleases[i .. $].stride(strideLength))
- {
- exerciseRelease(config, release);
- }
- }
- return 0;
- }
|