-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
reggaefile.d
24 lines (19 loc) · 1007 Bytes
/
reggaefile.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import reggae;
alias buildTarget = dubDefaultTarget!(); // dub build
alias testTarget = dubTestTarget!(); // dub test (=> ut[.exe])
Target aliasTarget(string aliasName, alias target)() {
import std.algorithm: map;
// Using a leaf target with `$builddir/<raw output>` outputs as dependency
// yields the expected relative target names for Ninja/make.
return Target.phony(aliasName, "", Target(target.rawOutputs.map!(o => "$builddir/" ~ o), ""));
}
// Add a `default` convenience alias for the `dub build` target.
// Especially useful for Ninja (`ninja default ut` to build default & test targets in parallel).
alias defaultTarget = aliasTarget!("default", buildTarget);
version (Windows) {
// Windows: extra `ut` convenience alias for `ut.exe`
alias utTarget = aliasTarget!("ut", testTarget);
mixin build!(buildTarget, optional!testTarget, optional!defaultTarget, optional!utTarget);
} else {
mixin build!(buildTarget, optional!testTarget, optional!defaultTarget);
}