July 07, 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.
July 07, 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