How to specify a version from dub build command

adnan338 relay.dev.adnan338 at protonmail.com
Tue Jul 7 06:34:15 UTC 2020


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.


More information about the Digitalmars-d-learn mailing list