-
Notifications
You must be signed in to change notification settings - Fork 31
/
reggaefile.d
112 lines (88 loc) · 2.83 KB
/
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import reggae;
import std.array: join;
import std.typecons: Yes, No;
enum debugFlags = ["-w", "-g", "-debug"];
enum releaseFlags = ["-O", "-inline", "-release"];
alias exe = dubDefaultTarget!(CompilerFlags(releaseFlags));
alias lib = dubConfigurationTarget!(
Configuration("library"),
CompilerFlags(debugFlags),
LinkerFlags(),
CompilationMode.package_,
);
enum mainObj = objectFile(
SourceFile("source/main.d"),
Flags(debugFlags),
ImportPaths("source")
);
alias utOld = dubTestTarget!(
CompilerFlags(debugFlags),
LinkerFlags(),
);
// alias ut = dubLink!(
// TargetName("ut"),
// Configuration("unittest"),
// targetConcat!(lib, testObjs, dubDependencies!(Configuration("unittest"))),
// );
alias all_tests = dubTestTarget!(
CompilerFlags(debugFlags),
);
alias dpp2 = dubTarget!(
TargetName("dpp2"),
Configuration("dpp2"),
CompilerFlags(debugFlags ~ "-unittest"),
LinkerFlags(),
CompilationMode.all,
);
// unitThreadedLight, compiles the whole project per D package
alias utlPerPackage = dubTarget!(TargetName("utl_per_package"),
Configuration("unittest"),
CompilerFlags(debugFlags ~ "-version=unitThreadedLight"),
);
// The rest of this file is just to set up a custom unit test build
// that compiles the production code per package and the test code
// per module.
// The test code object files
// We build the default configuration to avoid depencencies
// or -unittest.
alias testObjsLight = dlangObjectsPerModule!(
Sources!"tests",
CompilerFlags(debugFlags ~ ["-unittest", "-version=unitThreadedLight"]),
dubImportPaths!(Configuration("unittest"))
);
alias testObjs = dlangObjectsPerModule!(
Sources!"tests",
CompilerFlags(debugFlags ~ ["-unittest"]),
dubImportPaths!(Configuration("unittest"))
);
// The object file(s) for unit-threaded.
// `dubDependencies` could give us this, but it'd include libclang and any other
// dependencies compiled with `-unittest`, which we'd rather avoid.
alias unitThreadedLight = dubPackageObjects!(
DubPackageName("unit-threaded"),
Configuration("unittest"), // or else the dependency doesn't even exist
CompilerFlags(["-unittest", "-version=unitThreadedLight"]),
);
alias utl = dubLink!(
TargetName("utl"),
Configuration("unittest"),
targetConcat!(lib, testObjsLight, unitThreadedLight),
LinkerFlags("-main"),
);
alias it = dubConfigurationTarget!(
Configuration("integration"),
CompilerFlags(debugFlags ~ "-unittest"),
);
alias ct = dubConfigurationTarget!(
Configuration("contract"),
CompilerFlags(debugFlags ~ "-unittest"),
);
mixin build!(
exe,
optional!all_tests,
optional!it,
optional!ct,
optional!utl, // fast development
optional!utlPerPackage, // for benchmarking
optional!dpp2,
);