On Tuesday, 8 March 2022 at 22:28:27 UTC, bauss wrote:
On Tuesday, 8 March 2022 at 20:12:40 UTC, BoQsc wrote:
I think D Language needs and lacks conditional compilation
condition and attribute of "exclude". The exclude keyword or
code block in the exclude, would be made sure to not be
imported by any means. Now it seems all to be only workarounds.
What D just needs is a way to specify the entry point, in which
it just defaults to the first main function found, but could be
any function given.
I just place `main` in a separate skeletal `entrypoint.d` file
that contains only it (and an import to the "main"
`main.d`/`app.d`/whatever), so dub can safely exclude it in
unittest builds without skipping any other tests I might have in
the main file.
```
mainSourceFile "source/myproject/entrypoint.d"
```
```d
module myproject.entrypoint;
int main(string[] args)
{
import myproject.main : run;
return run(args);
}
```