DUB: Is it possible to set release as a default build for a dub package?

BoQsc vaidas.boqsc at gmail.com
Fri Nov 3 19:21:42 UTC 2023


While using `dub`, you might notice that after running `dub` or 
`dub run` command you will end up with notice:

```
Starting Performing "debug" build using 
C:\D\dmd2\windows\bin64\dmd.exe for x86_64.
```

Example output:

```
C:\Users\Windows10\Documents\Dlang winsock\datatypes>dub
      Pre-gen Running commands for datatypes
              Public Domain. No rights reserved.
     Starting Performing "debug" build using 
C:\D\dmd2\windows\bin64\dmd.exe for x86_64.
     Building datatypes 0.0.0: building configuration [application]
      Linking datatypes
      Running builds/datatypes.exe
```

**Question:** is it possible to set it to release build in a 
`dub.json` or `dub.sdl` file?

Yes, it is possible using command line `dub --build=release`

```
C:\Users\Windows10\Documents\Dlang winsock\datatypes>dub 
--build=release
      Pre-gen Running commands for datatypes
              Public Domain. No rights reserved.
     Starting Performing "release" build using 
C:\D\dmd2\windows\bin64\dmd.exe for x86_64.
     Building datatypes 0.0.0: building configuration [application]
      Linking datatypes
      Running builds/datatypes.exe
```

However I would want to try to enforce this behaviour from the 
`dub.json` or `dub.sdl` file.


More information about the Digitalmars-d-learn mailing list