How to specify a version from dub build command

mw mingwu at gmail.com
Tue Jul 7 18:21:51 UTC 2020


On Tuesday, 7 July 2020 at 06:34:15 UTC, adnan338 wrote:
> I have a separate version for flatpak builds in my app. Let's 
> say I have a large project that builds with dub that goes like 
> this:
>
> import std.stdio;
>
> void main()
> {
> 	version (flatpak) {
> 		writeln(`Flatpak build`);
> 	} else {
> 		writeln("Edit source/app.d to start your project.");
> 	}
> }
>
> Now if I try `dub build --version=flatpak` it's not recognized 
> by the compiler. How can I set the version __from command 
> line__ before building my project? I cannot depend on dflags 
> inside dub.json because dub.json has no idea whether if it's 
> being parsed in a flatpak version build or a regular build.

try dub Configurations?

https://dub.pm/package-format-json.html#configurations




More information about the Digitalmars-d-learn mailing list