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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
|
# file : tests/new.testscript
# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
.include common.testscript
posix = ($cxx.target.class != 'windows')
# Our C tests use fmemopen() which is not always available.
#
c_tests = ($c.target.class != 'windows' && $c.target.class != 'macos')
# Disable nesting checks in the created projects.
#
test.arguments += --no-checks
c = config.c="'$recall($c.path)'"
cxx = config.cxx="'$recall($cxx.path)'"
status += -d prj
: no-cfg
:
{
# Disable amalgamation support in the created projects.
#
test.arguments += --no-amalgamation
: exe
:
{
$* -t exe -l c++ prj-foo 2>>/"EOE" &prj-foo/***;
created new executable project prj-foo in $~/prj-foo/
EOE
$build prj-foo/ $cxx 2>>~%EOE%
%(c\+\+|ld) .+%{2}
EOE
}
: lib
:
{
$* -t lib -l c++ libprj-foo 2>>/"EOE" &libprj-foo/***;
created new library project libprj-foo in $~/libprj-foo/
EOE
$build libprj-foo/ $cxx 2>>~%EOE%
%(version\.in|c\+\+|ar|ld) .+%{7}
EOE
}
: exe-unit-tests
:
{
$* -t exe,unit-tests -l c++ foo 2>>/"EOE" &foo/***;
created new executable project foo in $~/foo/
EOE
$build foo/ $cxx 2>>~%EOE%
%(c\+\+|ld|ar) .+%{5}
EOE
}
: lib-unit-tests
:
{
$* -t lib,unit-tests -l c++ libfoo 2>>/"EOE" &libfoo/***;
created new library project libfoo in $~/libfoo/
EOE
$build libfoo/ $cxx 2>>~%EOE%
%(version\.in|c\+\+|ar|ld) .+%{11}
EOE
}
: exe-alt-naming
:
{
$* -t exe,alt-naming,unit-tests -l c++ foo 2>>/"EOE" &foo/***;
created new executable project foo in $~/foo/
EOE
$build foo/ $cxx 2>>~%EOE%
%(c\+\+|ld|ar) .+%{5}
EOE
}
: lib-alt-naming
:
{
$* -t lib,alt-naming,unit-tests -l c++ libfoo 2>>/"EOE" &libfoo/***;
created new library project libfoo in $~/libfoo/
EOE
$build libfoo/ $cxx 2>>~%EOE%
%(version\.in|c\+\+|ar|ld) .+%{11}
EOE
}
: exe-readme
:
{
: add
:
{
$* foo 2>>/"EOE" &foo/***;
created new executable project foo in $~/foo/
EOE
test -f foo/README.md;
cat foo/manifest >>~%EOE%;
%.+
description-file: README.md
%.+
EOE
cat foo/buildfile >>~%EOE%;
%.*
%.+ doc\{README.md\}.*%
%.*
EOE
$build foo/ $cxx 2>>~%EOE%
%(c\+\+|ld) .+%{2}
EOE
}
: omit
:
{
$* -t exe,no-readme foo 2>>/"EOE" &foo/***;
created new executable project foo in $~/foo/
EOE
test -f foo/README.md == 1;
$build foo/ $cxx 2>>~%EOE%
%(c\+\+|ld) .+%{2}
EOE
}
}
: lib-no-version
:
{
$* -t lib,unit-tests,no-version -l c++ libfoo 2>>/"EOE" &libfoo/***;
created new library project libfoo in $~/libfoo/
EOE
$build libfoo/ $cxx 2>>~%EOE%
%(c\+\+|ar|ld) .+%{10}
EOE
}
: lib-binless
:
{
$* -t lib -l c++,binless libfoo 2>>/"EOE" &libfoo/***;
created new library project libfoo in $~/libfoo/
EOE
$build libfoo/ $cxx 2>>~%EOE%
%(version\.in|c\+\+|ld) .+%{3}
EOE
}
: lib-binless-unit-tests
:
{
$* -t lib,unit-tests -l c++,binless libfoo 2>>/"EOE" &libfoo/***;
created new library project libfoo in $~/libfoo/
EOE
$build libfoo/ $cxx 2>>~%EOE%
%(version\.in|c\+\+|ld) .+%{5}
EOE
}
# C versions of the above.
#
: exe-c
:
{
$* -t exe -l c prj-foo 2>>/"EOE" &prj-foo/***;
created new executable project prj-foo in $~/prj-foo/
EOE
$build prj-foo/ $c 2>>~%EOE%
%(c|ld) .+%{2}
EOE
}
: exe-c-unit-tests
:
{
$* -t exe,unit-tests -l c foo 2>>/"EOE" &foo/***;
created new executable project foo in $~/foo/
EOE
$build foo/ $c 2>>~%EOE%
%(c|ld|ar) .+%{5}
EOE
}
: lib-c
:
if $c_tests
{
$* -t lib -l c libprj-foo 2>>/"EOE" &libprj-foo/***;
created new library project libprj-foo in $~/libprj-foo/
EOE
$build libprj-foo/ $c 2>>~%EOE%
%(version\.in|c|ar|ld) .+%{7}
EOE
}
: lib-c-unit-tests
:
if $c_tests
{
$* -t lib,unit-tests -l c libfoo 2>>/"EOE" &libfoo/***;
created new library project libfoo in $~/libfoo/
EOE
$build libfoo/ $c 2>>~%EOE%
%(version\.in|c|ar|ld) .+%{11}
EOE
}
# Test create-from-existin functionality.
#
: exist
:
{
: basics
:
mkdir libfoo &!libfoo/;
git -C libfoo init -q;
cat <<EOI >=libfoo/README.md &!libfoo/README.md;
# libfoo
cool foo
Some more stuff.
EOI
cat <<EOI >=libfoo/LICENSE &!libfoo/LICENSE;
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
...
EOI
$* -t lib --output-dir libfoo 2>>/"EOE" &libfoo/***;
created new library project libfoo in $~/libfoo/
EOE
test -f libfoo/.gitignore;
sed -n -e 's/^summary: (.+)$/\1/p' libfoo/manifest >'cool foo';
sed -n -e 's/^license: ([^ ]+).*$/\1/p' libfoo/manifest >'ASLv2'
}
: pkg
:
{
: add
:
: Test creating a library as a separate package in the project.
:
{
$* -t empty prj 2>>/"EOE" &prj/***;
created new empty project prj in $~/prj/
EOE
# While at it, test that README.md is created.
#
test -f prj/README.md;
$* --package -t lib libprj -d prj 2>>/"EOE";
created new library package libprj in $~/prj/libprj/
EOE
$build prj/libprj/ $cxx 2>>~%EOE%
%(version\.in|c\+\+|ar|ld) .+%{7}
EOE
}
: name
:
: Test that the package/project name is validated.
:
{
: package
:
$* x 2>'error: invalid package name: length is less than two characters' != 0
: project
:
: Here we also test that the project name is also validated as a package.
:
$* -t empty x 2>'error: invalid project name: length is less than two characters' != 0
: project-derived
:
$* -t empty xx &xx/*** 2>>/"EOE";
created new empty project xx in $~/xx/
EOE
mv xx x;
$* --package pkg -d x 2>>/"EOE"
warning: project name 'x' is invalid: length is less than two characters
info: leaving the 'project' manifest value empty
created new executable package pkg in $~/x/pkg/
EOE
}
}
: sub
:
{
: exe
:
: Test adding a library source subdirectory to an executable project.
:
{
$* -t exe prj 2>>/"EOE" &prj/***;
created new executable project prj in $~/prj/
EOE
$* --subdirectory -t lib libprj -d prj 2>>/"EOE";
created new library source subdirectory libprj in $~/prj/libprj/
EOE
# While at it, test that README.md is not created.
#
test -f prj/libprj/README.md == 1;
$build prj/ $cxx 2>>~%EOE%
%(c\+\+|ar|ld) .+%{6}
EOE
}
: bare
:
: Test filling a bare project with source subdirectories.
:
{
$* -t bare prj 2>>/"EOE" &prj/***;
created new bare project prj in $~/prj/
EOE
$* --subdirectory -t lib libprj -d prj 2>>/"EOE";
created new library source subdirectory libprj in $~/prj/libprj/
EOE
$* --subdirectory -t exe prj -d prj 2>>/"EOE";
created new executable source subdirectory prj in $~/prj/prj/
EOE
$build prj/ $cxx 2>>~%EOE%
%(c\+\+|ar|ld) .+%{6}
EOE
}
: nested
:
: Test adding a source subdirectories to a subdirectory.
:
{
$* -t bare prj 2>>/"EOE" &prj/***;
created new bare project prj in $~/prj/
EOE
$* --subdirectory -t lib,unit-tests prj -d prj -o prj/core/prj 2>>/"EOE";
created new library source subdirectory prj in $~/prj/core/prj/
EOE
$build prj/ $cxx 2>>~%EOE%
%(c\+\+|ar|ld) .+%{8}
EOE
}
}
: extensions
:
{
: default
:
{
$* -t lib -l c++ libprj 2>>/"EOE" &libprj/***;
created new library project libprj in $~/libprj/
EOE
test -f libprj/libprj/prj.cxx;
test -f libprj/libprj/prj.hxx;
$build libprj/ $cxx 2>>~%EOE%
%(version\.in|c\+\+|ar|ld) .+%{7}
EOE
}
: cpp
:
{
$* -t lib -l c++,cpp libprj 2>>/"EOE" &libprj/***;
created new library project libprj in $~/libprj/
EOE
test -f libprj/libprj/prj.cpp;
test -f libprj/libprj/prj.hpp;
$build libprj/ $cxx 2>>~%EOE%
%(version\.in|c\+\+|ar|ld) .+%{7}
EOE
}
: extension-c++
:
{
$* -t lib -l c++,extension=?++ libprj 2>>/"EOE" &libprj/***;
created new library project libprj in $~/libprj/
EOE
test -f libprj/libprj/prj.c++;
test -f libprj/libprj/prj.h++;
$build libprj/ $cxx 2>>~%EOE%
%(version\.in|c\+\+|ar|ld) .+%{7}
EOE
}
: extension-cc
:
{
$* -t lib -l c++,extension=?? libprj 2>>/"EOE" &libprj/***;
created new library project libprj in $~/libprj/
EOE
test -f libprj/libprj/prj.cc;
test -f libprj/libprj/prj.hh;
$build libprj/ $cxx 2>>~%EOE%
%(version\.in|c\+\+|ar|ld) .+%{7}
EOE
}
: cxx-hxx
:
{
$* -t lib -l c++,cxx=c,hxx=h libprj 2>>/"EOE" &libprj/***;
created new library project libprj in $~/libprj/
EOE
test -f libprj/libprj/prj.c;
test -f libprj/libprj/prj.h;
$build libprj/ $cxx 2>>~%EOE%
%(version\.in|c\+\+|ar|ld) .+%{7}
EOE
}
: empty-hxx
:
{
$* -t lib -l c++,hxx= libprj 2>>/"EOE" &libprj/***;
created new library project libprj in $~/libprj/
EOE
test -f libprj/libprj/prj.cxx;
test -f libprj/libprj/prj;
$build libprj/ $cxx 2>>~%EOE%
%(version\.in|c\+\+|ar|ld) .+%{7}
EOE
}
: ixx
:
{
$* -t lib -l c++,ixx=ixx libprj 2>>/"EOE" &libprj/***;
created new library project libprj in $~/libprj/
EOE
cat libprj/build/root.build >>~%EOO%;
%.+
ixx{*}: extension = ixx
%.+
EOO
cat libprj/libprj/buildfile >>~%EOO%;
%.+
%.*\{hxx ixx cxx\}.*%
%.+
{hxx ixx}{*}:
%.+
EOO
$build libprj/ $cxx 2>>~%EOE%
%(version\.in|c\+\+|ar|ld) .+%{7}
EOE
}
: leading-dot
:
{
$* -t lib -l c++,cxx=.cpp libprj 2>>/"EOE" &libprj/***;
created new library project libprj in $~/libprj/
EOE
test -f libprj/libprj/prj.cpp;
test -f libprj/libprj/prj.hxx;
$build libprj/ $cxx 2>>~%EOE%
%(version\.in|c\+\+|ar|ld) .+%{7}
EOE
}
: merge
{
$* -t lib -l c++,cxx=cpp -l c -l c++,hxx=hpp libprj 2>>/"EOE" &libprj/***;
created new library project libprj in $~/libprj/
EOE
test -f libprj/libprj/prj.cpp;
test -f libprj/libprj/prj.hpp;
$build libprj/ $cxx 2>>~%EOE%
%(version\.in|c\+\+|ar|ld) .+%{7}
EOE
}
: errors
:
{
: missing-value
:
$* -t lib -l c++,cxx libprj 2>>EOE != 0
error: invalid value 'cxx' for option '-l': missing value for 'cxx'
EOE
: unexpected-value
:
$* -t lib -l c++,cpp=cxx libprj 2>>EOE != 0
error: invalid value 'cpp' for option '-l': unexpected value for 'cpp'
EOE
: empty-value
:
$* -t lib -l c++,extension= libprj 2>>EOE != 0
error: empty extension specified with 'extension' c++ option
EOE
: dot-only
:
$* -t lib -l c++,extension=. libprj 2>>EOE != 0
error: empty extension specified with 'extension' c++ option
EOE
: unknown-value
:
$* -t lib -l c++,zxx= libprj 2>>EOE != 0
error: invalid value 'zxx' for option '-l'
EOE
: mutually-exclusive
:
$* -t lib -l c++,cpp,extension=?pp libprj 2>>EOE != 0
error: 'extension' and 'cpp' are mutually exclusive c++ options
EOE
}
}
: options-file
:
{
+cat <<EOI >=options
--type exe,no-tests,unit-tests
--type lib,no-version
--type bare,alt-naming
--lang c++,cpp
--lang c
--vcs none
EOI
test.arguments += --options-file $~/options
: type
:
if $c_tests
{
: exe
:
{
$* -t exe prj 2>>/"EOE" &prj/***;
created new executable project prj in $~/prj/
EOE
test -f prj/buildfile;
test -f prj/prj/testscript == 1;
cat prj/prj/buildfile >>~%EOO%;
%.+
%for t: c\{\*\*.test...\}%d
%.+
EOO
$build prj/ $cxx 2>>~%EOE%
%(c|ar|ld) .+%{5}
EOE
}
: lib
:
{
$* -t lib libprj 2>>/"EOE" &libprj/***;
created new library project libprj in $~/libprj/
EOE
test -f libprj/buildfile;
test -f libprj/libprj/version.h.in == 1;
$build libprj/ $cxx 2>>~%EOE%
%(c|ar|ld) .+%{6}
EOE
}
: bare
:
{
$* -t bare libprj 2>>/"EOE" &libprj/***;
created new bare project libprj in $~/libprj/
EOE
test -f libprj/build2file;
test -d libprj/libprj == 1;
$build libprj/ $cxx 2>>~%EOE%
%info: .+ is up to date%
EOE
}
: empty
:
{
$* -t empty libprj 2>>/"EOE" &libprj/***
created new empty project libprj in $~/libprj/
EOE
}
}
: lang
:
{
test.arguments += -t lib
: c++
:
{
$* -l c++,hxx= libprj 2>>/"EOE" &libprj/***;
created new library project libprj in $~/libprj/
EOE
test -f libprj/libprj/prj;
test -f libprj/libprj/prj.cpp;
$build libprj/ $cxx 2>>~%EOE%
%(c\+\+|ar|ld) .+%{6}
EOE
}
: c
:
if $c_tests
{
$* -l c libprj 2>>/"EOE" &libprj/***;
created new library project libprj in $~/libprj/
EOE
test -f libprj/libprj/prj.h;
test -f libprj/libprj/prj.c;
$build libprj/ $cxx 2>>~%EOE%
%(c|ar|ld) .+%{6}
EOE
}
}
: vcs
:
{
: git
:
{
$* -s git prj 2>>/"EOE" &prj/***;
created new bare project prj in $~/prj/
EOE
test -d prj/.git
}
}
}
: default-options-files
:
{
: remote-hooks
:
{
$* -t empty prj 2>! &prj/***;
mkdir prj/.build2;
cat <<EOI >=prj/.build2/bdep-new-package.options;
--pre-hook "mv .gitignore .gitignore.bak"
--post-hook "cat .gitignore.bak >>.gitignore"
--post-hook "rm .gitignore.bak"
EOI
mkdir --no-cleanup prj/libprj;
cat <<EOI >=prj/libprj/.gitignore;
CMakeCache.txt
EOI
$* --package -t lib -d prj libprj <'y' 2>>/~%EOE%;
%remote hook commands in .+/.build2/bdep-new-package.options:%
pre: mv .gitignore .gitignore.bak
post: cat .gitignore.bak >>.gitignore
post: rm .gitignore.bak
%execute\? \[y.n\] created new library package libprj in .+/prj/libprj/%
EOE
cat prj/libprj/.gitignore >>~%EOO%;
# Compiler/linker output.
#
%.+
CMakeCache.txt
EOO
$build prj/libprj/ $cxx 2>>~%EOE%
%(version\.in|c\+\+|ar|ld) .+%{7}
EOE
}
: disallow-options
:
{
mkdir .build2;
cat <<EOI >=.build2/bdep-new.options;
--package
EOI
$* prj 2>>/~%EOE%d != 0;
%\.+/.build2/bdep-new.options: error: --package in default options file%
EOE
# Disable default options files loading.
#
$* --no-default-options prj 2>>/"EOE" &prj/***
created new executable project prj in $~/prj/
EOE
}
}
: post-hook
:
{
: success
:
{
$* -t empty prj \
--post-hook "echo .idea/ >>.gitignore" \
--post-hook "echo @mode@ @name@ @base@ @stem@" \
--post-hook "echo @type@ @lang@ @vcs@ @root@" \
>>/"EOO" 2>>/"EOE" &prj/***;
project prj prj prj
empty c++ git $~/prj
EOO
created new empty project prj in $~/prj/
EOE
cat prj/.gitignore >>~%EOO%;
%.+
.idea/
EOO
$* --package prj -d prj \
--post-hook "echo @@@@TODO >>NEWS" \
--post-hook "echo @mode@ @name@ @base@ @stem@ @root@" \
>>/"EOO" 2>>/"EOE" &prj/prj/***;
package prj prj prj $~/prj
EOO
created new executable package prj in $~/prj/prj/
EOE
cat prj/prj/NEWS >'@@TODO';
$* --package -t lib libprj.bash -d prj \
--post-hook "echo @@@@TODO >>NEWS" \
--post-hook "echo @mode@ @name@ @base@ @stem@ @root@" \
>>/"EOO" 2>>/"EOE" &prj/prj/***;
package libprj.bash libprj prj $~/prj
EOO
created new library package libprj.bash in $~/prj/libprj.bash/
EOE
cat prj/libprj.bash/NEWS >'@@TODO';
if $posix
cat <<EOI >=hook
#!/bin/sh
echo "$(pwd)"
echo "$BDEP_NEW_MODE $BDEP_NEW_ROOT"
EOI
chmod u+x hook
$* -t lib --subdirectory libprj -d prj/prj --post-hook "'$~/hook'" \
>>"EOO" 2>>/"EOE" &prj/prj/libprj/***
$~/prj/prj/libprj
subdirectory $~/prj/prj
EOO
created new library source subdirectory libprj in $~/prj/prj/libprj/
EOE
end
}
: failure
:
{
: substitution
:
$* prj --post-hook 'echo foo >>@bar@' 2>>EOE &prj/*** != 0
error: invalid post hook 'echo foo >>@bar@': unknown variable 'bar'
EOE
: open-redirect
:
$* prj --post-hook 'echo foo >>bar/baz' 2>>~%EOE% &prj/*** != 0
%error: unable to execute post hook 'echo foo >>bar/baz': unable to open stdout redirect file '.+baz'.*%
EOE
: process
:
$* prj --post-hook '""' 2>>~%EOE% &prj/*** != 0
%error: unable to execute post hook '""': .+%
EOE
}
}
: pre-hook
:
{
: success
:
{
mkdir --no-cleanup prj &prj/***;
cat <<EOI >=prj/.gitignore;
CMakeCache.txt
EOI
$* prj --pre-hook "mv .gitignore .gitignore.bak" \
--post-hook "cat .gitignore.bak >>.gitignore" \
--post-hook "rm .gitignore.bak" 2>>/"EOE";
created new executable project prj in $~/prj/
EOE
cat prj/.gitignore >>~%EOO%
.bdep/
%.+
CMakeCache.txt
EOO
}
: failure
:
{
: substitution
:
$* prj --pre-hook 'echo foo >>@bar@' 2>>EOE &prj/*** != 0
error: invalid pre hook 'echo foo >>@bar@': unknown variable 'bar'
EOE
}
}
}
: cfg
{
: dir-and-name
:
{
$* -C prj-config @cfg prj cc $cxx 2>>/~"%EOE%" &prj/*** &prj-config/***;
created new executable project prj in $~/prj/
created configuration @cfg $~/prj-config/ 1 default,forwarded,auto-synchronized
synchronizing:
% new prj.+19700101000000%
EOE
$status >'prj configured 0.1.0-a.0.19700101000000';
$build prj/ 2>>~%EOE%
%(mkdir|c\+\+|ld|ln) .+%{4}
EOE
}
: name
:
: Test deducing the configuration directory path from the project source
: directory path and the configuration name. Here we also use the
: dash-prefixed name (as in Windows PowerShell where the leading '@'
: character is special).
:
{
$* -C -@cfg prj cc $cxx 2>>/~"%EOE%" &prj/*** &prj-cfg/***;
created new executable project prj in $~/prj/
created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized
synchronizing:
% new prj.+19700101000000%
EOE
$status >'prj configured 0.1.0-a.0.19700101000000';
$build prj/ 2>>~%EOE%
%(mkdir|c\+\+|ld|ln) .+%{4}
EOE
}
}
|