A tool that tries to build every Dub package against a wide range of DMD versions.

commandline.d 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. module backporter.commandline;
  2. import backporter.builder;
  3. import backporter.dmd;
  4. import backporter.git;
  5. import backporter.packagefinder;
  6. import backporter.core;
  7. import std.range;
  8. import std.experimental.logger;
  9. int runCommandLine(string[] args)
  10. {
  11. import std.stdio : File;
  12. auto config = new Config;
  13. string blacklistPath;
  14. bool verbose;
  15. import std.getopt;
  16. auto opties = getopt(
  17. args,
  18. "o|output", "the output file to write to", &config.outpath,
  19. "r|release", "the compiler release to use", &config.compilerRelease,
  20. "w|workdir", "the directory to work in", &config.dataDir,
  21. "b|blacklist", "file containing project blacklists", &blacklistPath,
  22. "v|verbose", "enable verbose logging", &verbose,
  23. "c|version-count", "how many revisions per package to compile",
  24. &config.revisionCount
  25. );
  26. if (opties.helpWanted)
  27. {
  28. defaultGetoptPrinter("backporter: misnamed tester for all dub packages",
  29. opties.options);
  30. return 1;
  31. }
  32. if (verbose)
  33. {
  34. globalLogLevel = LogLevel.trace;
  35. }
  36. else
  37. {
  38. globalLogLevel = LogLevel.info;
  39. }
  40. config.init;
  41. if (blacklistPath)
  42. {
  43. import std.array : array;
  44. config.blacklistedProjects = File(blacklistPath, "r").byLineCopy.array;
  45. }
  46. auto pkgs = grabAll(config);
  47. config.importPackages(pkgs);
  48. auto compilerReleases = [
  49. "2.082.0",
  50. "2.081.2",
  51. "2.081.1",
  52. "2.081.0",
  53. "2.080.1",
  54. "2.080.0",
  55. "2.079.1",
  56. "2.079.0",
  57. "2.078.3",
  58. "2.078.2",
  59. "2.078.1",
  60. "2.078.0",
  61. "2.077.1",
  62. "2.077.0",
  63. "2.076.1",
  64. "2.076.0",
  65. "2.075.1",
  66. "2.075.0",
  67. "2.074.1",
  68. "2.074.0",
  69. "2.073.2",
  70. "2.073.1",
  71. "2.073.0",
  72. "2.072.2",
  73. "2.072.1",
  74. "2.072.0",
  75. "2.071.2",
  76. "2.071.1",
  77. "2.071.0",
  78. "2.070.2",
  79. "2.070.1",
  80. "2.070.0",
  81. "2.069.2",
  82. "2.069.1",
  83. "2.069.0",
  84. "2.068.2",
  85. "2.068.1",
  86. "2.068.0",
  87. "2.067.1",
  88. "2.067.0",
  89. "2.066.1",
  90. "2.066.0",
  91. "2.065.0",
  92. ];
  93. // What order should we test things in?
  94. // We eventually want to test everything. But we want each prefix to be as
  95. // useful as possible. So we do every tenth release (about every 9 months)
  96. // until we get to the end, at which point we back up and try the next
  97. // offset for the stride.
  98. // If you interrupt in the middle, we've got a decent range of releases,
  99. // hopefully, and the more recent ones are more thoroughly covered.
  100. //
  101. // Ideally, we'd divide-and-conquer: the most recent, then the last, then
  102. // the midpoints, and repeat the midpoints until finished.
  103. auto strideLength = 10;
  104. infof("have %s compiler releases and %s package revisions to test",
  105. compilerReleases.length, pkgs.length);
  106. foreach (i; 0..strideLength)
  107. {
  108. foreach (release; compilerReleases[i .. $].stride(strideLength))
  109. {
  110. exerciseRelease(config, release);
  111. }
  112. }
  113. return 0;
  114. }