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
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
|
# Core: Packages and dependencies.
CORE_DEPS_TARGETS = $(call list_targets,core-deps)
.PHONY: core-deps $(CORE_DEPS_TARGETS)
core-deps: $(CORE_DEPS_TARGETS)
ifneq ($(PLATFORM),msys2)
core-deps-build-c-8cc: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add 8cc to the list of build dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = 8cc\ndep_8cc = git https://github.com/rui314/8cc master\n"}' $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/8cc
$i "Check that 8cc can be started"
$t $(APP)/deps/8cc/8cc -h $v
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP)]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member('8cc', Deps), \
halt()"
endif
core-deps-build-c-lz4: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add lz4 to the list of build dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = lz4_src\ndep_lz4_src = git https://github.com/lz4/lz4 v1.8.2\n"}' $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/lz4_src
$i "Check that lz4 was compiled"
$t test -f $(APP)/deps/lz4_src/lib/liblz4.a
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP)]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(lz4, Deps), \
halt()"
core-deps-build-erl: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add cowlib to the list of build dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = cowlib\n"}' $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/cowlib
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), cowlib]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(cowlib, Deps), \
halt()"
core-deps-build-js: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add jquery to the list of build dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = jquery\ndep_jquery = git https://github.com/jquery/jquery master\n"}' $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/jquery
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP)]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(jquery, Deps), \
halt()"
core-deps-dep-built: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add cowlib to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Touch one cowlib file to mark it for recompilation"
$t $(SLEEP)
$t touch $(APP)/deps/cowlib/src/cow_http.erl
$i "Check that cowlib is not rebuilt"
$t touch $(APP)/EXPECT
$t $(SLEEP)
$t $(MAKE) -C $(APP) $v
$t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
$i "Delete the dep_built file"
$t rm $(APP)/deps/cowlib/ebin/dep_built
$i "Check that cowlib was rebuilt"
$t printf "%s\n" \
$(APP)/deps/cowlib/cowlib.d \
$(APP)/deps/cowlib/ebin/cowlib.app \
$(APP)/deps/cowlib/ebin/cow_http.beam \
$(APP)/deps/cowlib/ebin/dep_built | sort > $(APP)/EXPECT
$t $(SLEEP)
$t $(MAKE) -C $(APP) $v
# Files in .git might end up modified due to the id generation in the .app file.
$t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
core-deps-dep-built-full: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add cowlib to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Touch one cowlib file to mark it for recompilation"
$t $(SLEEP)
$t touch $(APP)/deps/cowlib/src/cow_http.erl
$i "Check that cowlib is rebuilt with FULL=1"
$t printf "%s\n" \
$(APP)/deps/cowlib/cowlib.d \
$(APP)/deps/cowlib/ebin/cowlib.app \
$(APP)/deps/cowlib/ebin/cow_http.beam \
$(APP)/deps/cowlib/ebin/dep_built | sort > $(APP)/EXPECT
$t $(SLEEP)
$t $(MAKE) -C $(APP) FULL=1 $v
# Files in .git might end up modified due to the id generation in the .app file.
$t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
core-deps-dep-built-ln: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add cowlib to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
$i "Clone cowlib manually inside $(APP)"
$t git clone -q https://github.com/ninenines/cowlib $(APP)/cowlib
$i "Link to cowlib instead of fetching the dependency"
$t mkdir -p $(APP)/deps
$t ln -s ../cowlib $(APP)/deps/cowlib
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Touch one cowlib file to mark it for recompilation"
$t $(SLEEP)
$t touch $(APP)/deps/cowlib/src/cow_http.erl
$i "Check that cowlib is rebuilt; symlinked deps don't create dep_built"
$t printf "%s\n" \
$(APP)/cowlib/cowlib.d \
$(APP)/cowlib/ebin/cowlib.app \
$(APP)/cowlib/ebin/cow_http.beam | sort > $(APP)/EXPECT
$t $(SLEEP)
$t $(MAKE) -C $(APP) $v
# Files in .git might end up modified due to the id generation in the .app file.
$t find $(APP)/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
core-deps-dep-commit: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy 1.0.0 to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 1.0.0\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/cowboy
$t test -d $(APP)/deps/cowlib
$t test -d $(APP)/deps/ranch
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(cowboy, Deps), \
{ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
halt()"
core-deps-dir: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy to the list of dependencies with a custom DEPS_DIR"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nDEPS_DIR ?= \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched in the custom DEPS_DIR"
$t test -d $(APP)/deep/libs/cowboy
$t test -d $(APP)/deep/libs/cowlib
$t test -d $(APP)/deep/libs/ranch
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deep/libs/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(cowboy, Deps), \
halt()"
core-deps-doc: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Generate .erl files"
$t echo "-module(boy)." > $(APP)/src/boy.erl
$t echo "-module(girl)." > $(APP)/src/girl.erl
$i "Add Edown as a documentation building dependency"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = edown\nEDOC_OPTS = {doclet, edown_doclet}\n"}' $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that no dependencies were fetched"
$t test ! -e $(APP)/deps
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP)]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(edown, Deps), \
halt()"
$i "Build the application documentation"
$t $(MAKE) -C $(APP) edoc $v
$i "Check that documentation dependencies were fetched"
$t test -d $(APP)/deps/edown
$i "Check the Edown generated Markdown documentation"
$t test -f $(APP)/doc/boy.md
$t test -f $(APP)/doc/girl.md
core-deps-fetch-cp: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Bootstrap a new OTP library named my_dep inside $(APP)"
$t mkdir $(APP)/my_dep
$t cp ../erlang.mk $(APP)/my_dep/
$t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
$i "Add my_dep to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add my_dep to the applications key in the .app.src file"
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/my_dep
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), my_dep]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(my_dep, Deps), \
halt()"
core-deps-fetch-custom: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add dependency boop using custom fetch method beep to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = boop\ndep_boop = beep boop\ndep_fetch_beep = mkdir -p \$$(DEPS_DIR)/\$$1/ebin/\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add boop to the applications key in the .app.src file"
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tboop,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/boop
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
ok = application:load($(APP)), \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(boop, Deps), \
halt()"
core-deps-fetch-fail-bad: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowlib as a dependency using a non-existing fetch method named oops"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = oops https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
$i "Check that building the application fails"
$t ! $(MAKE) -C $(APP) $v
core-deps-fetch-fail-unknown: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add an unknown application as a dependency"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = unknown\n"}' $(APP)/Makefile
$i "Check that building the application fails"
$t ! $(MAKE) -C $(APP) $v
core-deps-fetch-git: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy 1.0.0 to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = git https://github.com/ninenines/cowboy 1.0.0\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/cowboy
$t test -d $(APP)/deps/cowlib
$t test -d $(APP)/deps/ranch
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(cowboy, Deps), \
{ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
halt()"
core-deps-fetch-git-subfolder: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Bootstrap a new OTP library named my_dep as a subfolder inside $(APP)"
$t mkdir -p $(APP)/git_repo/my_dep
$t cp ../erlang.mk $(APP)/git_repo/my_dep/
$t $(MAKE) -C $(APP)/git_repo/my_dep/ -f erlang.mk bootstrap-lib $v
# Create an empty file so src/ gets committed.
$t touch $(APP)/git_repo/my_dep/src/README
$t cd $(APP)/git_repo && \
git init -q && \
git config user.email "[email protected]" && \
git config user.name "test suite" && \
git add . && \
git commit -q --no-gpg-sign -m "Tests"
$i "Add my_dep to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = git-subfolder file://$(abspath $(APP)/git_repo) master my_dep\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add my_dep to the applications key in the .app.src file"
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that the dependency was fetched"
$t test -d $(APP)/deps/my_dep
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), my_dep]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(my_dep, Deps), \
halt()"
core-deps-fetch-git-submodule: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Bootstrap a new OTP library named my_dep inside $(APP)"
$t mkdir $(APP)/my_dep
$t cp ../erlang.mk $(APP)/my_dep/
$t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
# Create an empty file so src/ gets committed.
$t touch $(APP)/my_dep/src/README
$t cd $(APP)/my_dep && \
git init -q && \
git config user.email "[email protected]" && \
git config user.name "test suite" && \
git add . && \
git commit -q --no-gpg-sign -m "Tests"
$i "Add the submodule to my_dep"
$t mkdir $(APP)/deps
$t cd $(APP) && \
git init -q && \
git submodule -q add file://$(abspath $(APP)/my_dep) deps/my_dep && \
git config user.email "[email protected]" && \
git config user.name "test suite" && \
git add . && \
git commit -q --no-gpg-sign -m "Tests"
$i "Distclean the application"
$t $(MAKE) -C $(APP) distclean $v
$i "Add my_dep to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = git-submodule\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add my_dep to the applications key in the .app.src file"
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/my_dep
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), my_dep]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(my_dep, Deps), \
halt()"
core-deps-fetch-hex: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy 1.0.0 to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 1.0.0\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/cowboy
$t test -d $(APP)/deps/cowlib
$t test -d $(APP)/deps/ranch
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(cowboy, Deps), \
{ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
halt()"
core-deps-fetch-hg: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Ehsa 4.0.3 to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = ehsa\ndep_ehsa = hg https://bitbucket.org/a12n/ehsa 4.0.3\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add ehsa to the applications key in the .app.src file"
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tehsa,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/ehsa
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), ehsa]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(ehsa, Deps), \
{ok, \"4.0.3\"} = application:get_key(ehsa, vsn), \
halt()"
# Legacy must fail for the top-level application, but work for dependencies.
core-deps-fetch-legacy: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowlib as a dependency using a non-existing fetch method named oops"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
$i "Check that building the application fails"
$t ! $(MAKE) -C $(APP) $v
$i "Check that building the application works with IS_DEP=1"
$t $(MAKE) -C $(APP) IS_DEP=1 $v
core-deps-fetch-ln: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Bootstrap a new OTP library named my_dep inside $(APP)"
$t mkdir $(APP)/my_dep
$t cp ../erlang.mk $(APP)/my_dep/
$t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
$i "Add my_dep to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = ln $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add my_dep to the applications key in the .app.src file"
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/my_dep
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), my_dep]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(my_dep, Deps), \
halt()"
core-deps-fetch-svn: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowlib 1.0.0 to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = svn https://github.com/ninenines/cowlib/tags/1.0.0\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowlib to the applications key in the .app.src file"
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/cowlib
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), cowlib]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(cowlib, Deps), \
{ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
halt()"
core-deps-ignore: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy to dependencies, Ranch to the ignore list and to test dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nIGNORE_DEPS = ranch\nTEST_DEPS = ranch\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that the correct dependencies were fetched"
$t test -d $(APP)/deps/cowboy
$t test -d $(APP)/deps/cowlib
$t test ! -e $(APP)/deps/ranch
$i "Build the test dependencies"
$t $(MAKE) -C $(APP) test-deps $v
$i "Check that the correct dependencies were fetched"
$t test -d $(APP)/deps/ranch
define add_dep_and_subdep
$i "Bootstrap a new OTP library named $(APP)_$(1)subdep"
$t mkdir $(APP)_$(1)subdep/
$t cp ../erlang.mk $(APP)_$(1)subdep/
$t $2 -C $(APP)_$(1)subdep --no-print-directory -f erlang.mk bootstrap-lib $$v
$i "Create a Git repository for $(APP)_$(1)subdep"
$t (cd $(APP)_$(1)subdep && \
git init -q && \
git config user.name "Testsuite" && \
git config user.email "[email protected]" && \
git add . && \
git commit -q --no-gpg-sign -m "Initial commit")
$i "Bootstrap a new OTP library named $(APP)_$(1)dep"
$t mkdir $(APP)_$(1)dep/
$t cp ../erlang.mk $(APP)_$(1)dep/
$t $2 -C $(APP)_$(1)dep --no-print-directory -f erlang.mk bootstrap-lib $$v
$i "Add $(APP)_$(1)subdep as a dependency"
$t perl -ni.bak -e \
'print;if ($$.==1) {print "DEPS = $(1)subdep\ndep_$(1)subdep = git file://$(abspath $(APP)_$(1)subdep) master\n"}' \
$(APP)_$(1)dep/Makefile
$t rm $(APP)_$(1)dep/Makefile.bak
$i "Create a Git repository for $(APP)_$(1)dep"
$t (cd $(APP)_$(1)dep && \
git init -q && \
git config user.name "Testsuite" && \
git config user.email "[email protected]" && \
git add . && \
git commit -q --no-gpg-sign -m "Initial commit")
endef
core-deps-list-deps: build clean
# We pass $(MAKE) directly so that GNU Make can pass its context forward.
# If we didn't then $(MAKE) would be expanded in the call without context.
$(call add_dep_and_subdep,,$(MAKE))
$(call add_dep_and_subdep,doc,$(MAKE))
$(call add_dep_and_subdep,rel,$(MAKE))
$(call add_dep_and_subdep,test,$(MAKE))
$(call add_dep_and_subdep,shell,$(MAKE))
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add $(APP)-dep and $(APP)-testdep as a dependency"
$t sed -i.bak '2i\
DEPS = dep\
DOC_DEPS = docdep\
REL_DEPS = reldep\
TEST_DEPS = testdep\
SHELL_DEPS = shelldep\
dep_dep = git file://$(abspath $(APP)_dep) master\
dep_docdep = git file://$(abspath $(APP)_docdep) master\
dep_reldep = git file://$(abspath $(APP)_reldep) master\
dep_testdep = git file://$(abspath $(APP)_testdep) master\
dep_shelldep = git file://$(abspath $(APP)_shelldep) master\
' $(APP)/Makefile
$t rm $(APP)/Makefile.bak
$i "Create a Git repository for $(APP)"
$t (cd $(APP) && \
git init -q && \
git config user.name "Testsuite" && \
git config user.email "[email protected]" && \
git add . && \
git commit -q --no-gpg-sign -m "Initial commit")
$i "List application dependencies"
$t $(MAKE) -C $(APP) --no-print-directory list-deps $v
$t test -d $(APP)/deps/subdep
$t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
$t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
$t $(MAKE) -C $(APP) --no-print-directory distclean $v
$i "List application doc dependencies"
$t $(MAKE) -C $(APP) --no-print-directory list-doc-deps $v
$t test -d $(APP)/deps/subdep
$t test -d $(APP)/deps/docsubdep
$t printf "%s\n%s\n%s\n%s\n" \
$(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/docdep $(APP)/deps/docsubdep) \
| sort > $(APP)/expected-doc-deps.txt
$t cmp $(APP)/expected-doc-deps.txt $(APP)/.erlang.mk/recursive-doc-deps-list.log
$t $(MAKE) -C $(APP) --no-print-directory distclean $v
$i "List application rel dependencies"
$t $(MAKE) -C $(APP) --no-print-directory list-rel-deps $v
$t test -d $(APP)/deps/subdep
$t test -d $(APP)/deps/relsubdep
$t printf "%s\n%s\n%s\n%s\n" \
$(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/reldep $(APP)/deps/relsubdep) \
| sort > $(APP)/expected-rel-deps.txt
$t cmp $(APP)/expected-rel-deps.txt $(APP)/.erlang.mk/recursive-rel-deps-list.log
$t $(MAKE) -C $(APP) --no-print-directory distclean $v
$i "List application test dependencies"
$t $(MAKE) -C $(APP) --no-print-directory list-test-deps $v
$t test -d $(APP)/deps/subdep
$t test -d $(APP)/deps/testsubdep
$t printf "%s\n%s\n%s\n%s\n" \
$(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/testdep $(APP)/deps/testsubdep) \
| sort > $(APP)/expected-test-deps.txt
$t cmp $(APP)/expected-test-deps.txt $(APP)/.erlang.mk/recursive-test-deps-list.log
$t $(MAKE) -C $(APP) --no-print-directory distclean $v
$i "List application shell dependencies"
$t $(MAKE) -C $(APP) --no-print-directory list-shell-deps $v
$t test -d $(APP)/deps/subdep
$t test -d $(APP)/deps/shellsubdep
$t printf "%s\n%s\n%s\n%s\n" \
$(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
| sort > $(APP)/expected-shell-deps.txt
$t cmp $(APP)/expected-shell-deps.txt $(APP)/.erlang.mk/recursive-shell-deps-list.log
$t $(MAKE) -C $(APP) --no-print-directory distclean $v
$i "List application all dependencies (all kinds)"
$t $(MAKE) -C $(APP) --no-print-directory list-deps DEP_TYPES='doc rel test shell' $v
$t test -d $(APP)/deps/subdep
$t test -d $(APP)/deps/docsubdep
$t test -d $(APP)/deps/relsubdep
$t test -d $(APP)/deps/testsubdep
$t test -d $(APP)/deps/shellsubdep
$t printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
$(abspath \
$(APP)/deps/dep $(APP)/deps/subdep \
$(APP)/deps/docdep $(APP)/deps/docsubdep \
$(APP)/deps/reldep $(APP)/deps/relsubdep \
$(APP)/deps/testdep $(APP)/deps/testsubdep \
$(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
| sort > $(APP)/expected-all-deps.txt
$t cmp $(APP)/expected-all-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
$t $(MAKE) -C $(APP) --no-print-directory distclean $v
core-deps-mv: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowlib to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/cowlib
$i "Move the application elsewhere"
$t mv $(APP) $(APP)-moved
$i "Build the application"
$t $(MAKE) -C $(APP)-moved $v
core-deps-mv-rebar: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Lager to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/goldrush
$t test -d $(APP)/deps/lager
$i "Move the application elsewhere"
$t mv $(APP) $(APP)-moved
$i "Build the application"
$t $(MAKE) -C $(APP)-moved $v
# A lower-level dependency of the first dependency always
# wins over a lower-level dependency of the second dependency.
core-deps-order-first: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy package and my_dep to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep cowboy\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
$i "Bootstrap a new OTP library named my_dep inside $(APP)"
$t mkdir $(APP)/my_dep
$t cp ../erlang.mk $(APP)/my_dep/
$t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
$i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = git https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/my_dep/Makefile
ifdef LEGACY
$i "Add Cowboy and my_dep to the applications key in the .app.src file"
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/cowboy
$t test -d $(APP)/deps/cowlib
$t test -d $(APP)/deps/my_dep
$t test -d $(APP)/deps/ranch
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), cowboy, cowlib, my_dep, ranch]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(cowboy, Deps), \
{ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
halt()"
# A higher-level dependency always wins.
core-deps-order-top: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy cowlib\ndep_cowlib = git https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/cowboy
$t test -d $(APP)/deps/cowlib
$t test -d $(APP)/deps/ranch
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(cowboy, Deps), \
{ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
halt()"
ifndef LEGACY
core-deps-otp: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Crypto to the list of OTP dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = crypto\n"}' $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that no dependencies were fetched"
$t test ! -e $(APP)/deps
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), crypto]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(crypto, Deps), \
halt()"
endif
core-deps-pkg: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/cowboy
$t test -d $(APP)/deps/cowlib
$t test -d $(APP)/deps/ranch
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(cowboy, Deps), \
halt()"
core-deps-rel: build clean
$i "Bootstrap a new release-enabled OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
$i "Add Recon to the list of release dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
$i "Add Recon to the relx.config file"
$t $(ERL) -eval " \
{ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
ok = file:write_file(\"$(APP)/relx.config\", \
lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
halt()"
$i "Build the application and its dependencies"
$t $(MAKE) -C $(APP) deps app $v
$i "Check that no dependencies were fetched"
$t test ! -e $(APP)/deps
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP)]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(recon, Deps), \
halt()"
$i "Build the release"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/recon
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), recon]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(recon, Deps), \
halt()"
# @todo Add check for MSYS2 when releases under Windows become usable.
# $i "Start the release and check that Recon is loaded"
ifeq ($(PLATFORM),msys2)
# $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
# $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
# $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
# application loaded_applications | grep recon`"
# $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
# $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
else
$i "Start the release and check that Recon is loaded"
$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
$t apps="Node is not running!"; \
while test "$$apps" = "Node is not running!"; do \
apps=$$($(APP)/_rel/$(APP)_release/bin/$(APP)_release \
rpcterms \ application loaded_applications); \
done; \
echo "$$apps" | grep -q recon
$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
endif
core-deps-search: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Run 'make search' and check that it prints packages"
$t test -n "`$(MAKE) -C $(APP) search`"
$i "Run 'make search q=cowboy' and check that it prints packages"
$t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
core-deps-shell: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add TDDReloader to the list of shell dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "SHELL_DEPS = tddreloader\n"}' $(APP)/Makefile
$i "Build the application and its dependencies"
$t $(MAKE) -C $(APP) deps app $v
$i "Check that no dependencies were fetched"
$t test ! -e $(APP)/deps
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP)]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(tddreloader, Deps), \
halt()"
$i "Run the shell"
$t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
ok = application:load($(APP)), \
ok = application:load(tddreloader), \
halt()\"" $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/tddreloader
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), tddreloader]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(tddreloader, Deps), \
halt()"
core-deps-skip: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Add Cowboy to the list of dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
endif
$i "Build the application with SKIP_DEPS=1"
$t $(MAKE) -C $(APP) SKIP_DEPS=1 $v
$i "Check that no dependencies were fetched"
$t test ! -e $(APP)/deps
$i "Build the application"
$t $(MAKE) -C $(APP) $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/cowlib
$t test -d $(APP)/deps/cowboy
$t test -d $(APP)/deps/ranch
$i "Distclean with SKIP_DEPS=1"
$t $(MAKE) -C $(APP) distclean SKIP_DEPS=1 $v
$i "Check that no dependencies were removed"
$t test -d $(APP)/deps/cowlib
$t test -d $(APP)/deps/cowboy
$t test -d $(APP)/deps/ranch
core-deps-test: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Generate .erl files"
$t echo "-module(boy)." > $(APP)/src/boy.erl
$t echo "-module(girl)." > $(APP)/src/girl.erl
$i "Add triq to the list of test dependencies"
$t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = triq\n"}' $(APP)/Makefile
$i "Build the application and its dependencies"
$t $(MAKE) -C $(APP) deps app $v
$i "Check that no dependencies were fetched"
$t test ! -e $(APP)/deps
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP)]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(triq, Deps), \
halt()"
$i "Run tests"
$t $(MAKE) -C $(APP) tests $v
$i "Check that all dependencies were fetched"
$t test -d $(APP)/deps/triq
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
[ok = application:load(App) || App <- [$(APP), triq]], \
{ok, Deps} = application:get_key($(APP), applications), \
false = lists:member(triq, Deps), \
halt()"
|