on iko/ghcjs-patch-master help sign in
add more cross and docrosscheck logic
commit6cf6e943c013b2003ee5fdb3191ac2e5bfb2e079 authorMoritz Angermann <moritz.angermann@gmail.com> dateMon 10 Dec 2018, 15:47 (8 years ago) parent360fee0
3 files changed+29−10
builder/comp-builder.nix+3−2 builder/default.nix+2−1 modules/package.nix+24−7
builder/comp-builder.nix+3−2
@@ -16,7 +16,8 @@
1616, preCheck ? null, postCheck ? null
1717, preInstall ? null, postInstall ? null
1818
19−, doCheck ? componentId.ctype == "test"
19+, doCheck ? component.doCheck || componentId.ctype == "test"
20+, doCrossCheck ? component.doCrossCheck || false
2021}:
2122
2223let
@@ -129,7 +130,7 @@ let
129130in stdenv.mkDerivation ({
130131 name = fullName;
131132
132− inherit src doCheck;
133+ inherit src doCheck doCrossCheck;
133134
134135 passthru = {
135136 inherit (package) identifier;
builder/default.nix+2−1
@@ -70,7 +70,8 @@ let
7070
7171 buildComp = componentId: component: comp-builder {
7272 inherit componentId component package name src flags setup cabalFile patches
73− preUnpack postUnpack preConfigure postConfigure preBuild postBuild preCheck postCheck preInstall postInstall;
73+ preUnpack postUnpack preConfigure postConfigure preBuild postBuild preCheck postCheck preInstall postInstall
74+ ;
7475 };
7576
7677in {
modules/package.nix+24−7
@@ -97,7 +97,7 @@ in {
9797 };
9898
9999 components = let
100− componentType = submodule {
100+ componentType = check: submodule {
101101 options = {
102102 depends = mkOption {
103103 type = listOfFilteringNulls unspecified;
@@ -139,30 +139,38 @@ in {
139139 type = bool;
140140 default = false;
141141 };
142+ doCheck = mkOption {
143+ type = bool;
144+ default = check;
145+ };
146+ doCrossCheck = mkOption {
147+ type = bool;
148+ default = config.doCrossCheck;
149+ };
142150 };
143151 };
144152 in {
145153 library = mkOption {
146− type = componentType;
154+ type = componentType false;
147155 };
148156 sublibs = mkOption {
149− type = attrsOf componentType;
157+ type = attrsOf (componentType false);
150158 default = {};
151159 };
152160 foreignlibs = mkOption {
153− type = attrsOf componentType;
161+ type = attrsOf (componentType false);
154162 default = {};
155163 };
156164 exes = mkOption {
157− type = attrsOf componentType;
165+ type = attrsOf (componentType false);
158166 default = {};
159167 };
160168 tests = mkOption {
161− type = attrsOf componentType;
169+ type = attrsOf (componentType config.doCheck);
162170 default = {};
163171 };
164172 benchmarks = mkOption {
165− type = attrsOf componentType;
173+ type = attrsOf (componentType false);
166174 default = {};
167175 };
168176 };
@@ -245,5 +253,14 @@ in {
245253 type = nullOr string;
246254 default = null;
247255 };
256+ doCheck = mkOption {
257+ type = bool;
258+ default = false;
259+ };
260+ doCrossCheck = mkOption {
261+ description = "Run doCheck also in cross compilation settings. This can be tricky as the test logic must know how to run the tests on the target.";
262+ type = bool;
263+ default = false;
264+ };
248265 };
249266}