RejectedSoftware Forums

Sign up

Indicating compiler priority order

It's easy to specify a compiler to use when building with dub (dub build --compiler=...) but is it possible for the creator of a dub package to specify a preferred priority order of available compilers? So, for example, if I specify a priority list of,

1. gdc >= 4.8
2. ldc >= 0.12.0
3. dmd >= 2.063

Then dub will first look to see if an appropriate GDC version is installed (and compile with it if it is); then LDC; and finally DMD if nothing else presents. This could be a way in which package creators can help to ensure builds of their software are adequate in terms of performance and available features. (I'm not sure if checking for compiler version is reliably possible but thought I'd throw it out there as a suggestion in case it is.)

Re: Indicating compiler priority order

Am 24.10.2013 07:22, schrieb Joseph Rushton Wakeling:

It's easy to specify a compiler to use when building with dub (dub build --compiler=...) but is it possible for the creator of a dub package to specify a preferred priority order of available compilers? So, for example, if I specify a priority list of,

 1. gdc >= 4.8
 2. ldc >= 0.12.0
 3. dmd >= 2.063

Then dub will first look to see if an appropriate GDC version is installed (and compile with it if it is); then LDC; and finally DMD if nothing else presents. This could be a way in which package creators can help to ensure builds of their software are adequate in terms of performance and available features. (I'm not sure if checking for compiler version is reliably possible but thought I'd throw it out there as a suggestion in case it is.)

I think for now this is a bit too much to be really useful:

  • Many users will only have one compiler installed
  • How to decide which compiler to use when the root package differs
    from their dependencies (the order of compilers in particular)
  • The burden to keep the versions manually up to date for multiple
    compilers

What is planned, though, is to have CI based automatic testing of all
registered with a couple of compilers/versions. That would provide the
basic information for each package of which compiler/version is
supported. Starting from there, it would probably be safe to let DUB
itself always choose the priority GDC->LDC->DMD or LDC->GDC->DMD and for
special requirements it could simply be documented to prefer a certain
compiler (maybe a conditional info/warning/error field inside of
package.json could be useful here).

What do you think?