core_deps.mk 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  1. # Core: Packages and dependencies.
  2. CORE_DEPS_CASES = build-c-8cc build-c-imagejs build-erl build-js dep-commit dir doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-hex fetch-hg fetch-legacy fetch-svn ignore order-first order-top otp pkg rel search shell test
  3. CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES))
  4. CORE_DEPS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_DEPS_TARGETS))
  5. .PHONY: core-deps $(CORE_DEPS_TARGETS) clean-core-deps $(CORE_DEPS_CLEAN_TARGETS)
  6. clean-core-deps: $(CORE_DEPS_CLEAN_TARGETS)
  7. $(CORE_DEPS_CLEAN_TARGETS):
  8. $t rm -rf $(APP_TO_CLEAN)/
  9. core-deps: $(CORE_DEPS_TARGETS)
  10. ifneq ($(PLATFORM),msys2)
  11. core-deps-build-c-8cc: build clean-core-deps-build-c-8cc
  12. $i "Bootstrap a new OTP library named $(APP)"
  13. $t mkdir $(APP)/
  14. $t cp ../erlang.mk $(APP)/
  15. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  16. $i "Add 8cc to the list of build dependencies"
  17. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = 8cc\ndep_8cc = git https://github.com/rui314/8cc master\n"}' $(APP)/Makefile
  18. $i "Build the application"
  19. $t $(MAKE) -C $(APP) $v
  20. $i "Check that all dependencies were fetched"
  21. $t test -d $(APP)/deps/8cc
  22. $i "Check that 8cc can be started"
  23. $t $(APP)/deps/8cc/8cc -h $v
  24. $i "Check that the application was compiled correctly"
  25. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  26. [ok = application:load(App) || App <- [$(APP)]], \
  27. {ok, Deps} = application:get_key($(APP), applications), \
  28. false = lists:member('8cc', Deps), \
  29. halt()"
  30. endif
  31. core-deps-build-c-imagejs: build clean-core-deps-build-c-imagejs
  32. $i "Bootstrap a new OTP library named $(APP)"
  33. $t mkdir $(APP)/
  34. $t cp ../erlang.mk $(APP)/
  35. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  36. $i "Add imagejs to the list of build dependencies"
  37. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = imagejs\ndep_imagejs = git https://github.com/jklmnn/imagejs master\n"}' $(APP)/Makefile
  38. $i "Build the application"
  39. $t $(MAKE) -C $(APP) $v
  40. $i "Check that all dependencies were fetched"
  41. $t test -d $(APP)/deps/imagejs
  42. $i "Check that imagejs works"
  43. $t $(APP)/deps/imagejs/imagejs bmp $(APP)/deps/imagejs/Makefile
  44. $t test -f $(APP)/deps/imagejs/Makefile.bmp
  45. $i "Check that the application was compiled correctly"
  46. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  47. [ok = application:load(App) || App <- [$(APP)]], \
  48. {ok, Deps} = application:get_key($(APP), applications), \
  49. false = lists:member(imagejs, Deps), \
  50. halt()"
  51. core-deps-build-erl: build clean-core-deps-build-erl
  52. $i "Bootstrap a new OTP library named $(APP)"
  53. $t mkdir $(APP)/
  54. $t cp ../erlang.mk $(APP)/
  55. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  56. $i "Add cowlib to the list of build dependencies"
  57. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = cowlib\n"}' $(APP)/Makefile
  58. $i "Build the application"
  59. $t $(MAKE) -C $(APP) $v
  60. $i "Check that all dependencies were fetched"
  61. $t test -d $(APP)/deps/cowlib
  62. $i "Check that the application was compiled correctly"
  63. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  64. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  65. {ok, Deps} = application:get_key($(APP), applications), \
  66. false = lists:member(cowlib, Deps), \
  67. halt()"
  68. core-deps-build-js: build clean-core-deps-build-js
  69. $i "Bootstrap a new OTP library named $(APP)"
  70. $t mkdir $(APP)/
  71. $t cp ../erlang.mk $(APP)/
  72. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  73. $i "Add jquery to the list of build dependencies"
  74. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = jquery\ndep_jquery = git https://github.com/jquery/jquery master\n"}' $(APP)/Makefile
  75. $i "Build the application"
  76. $t $(MAKE) -C $(APP) $v
  77. $i "Check that all dependencies were fetched"
  78. $t test -d $(APP)/deps/jquery
  79. $i "Check that the application was compiled correctly"
  80. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  81. [ok = application:load(App) || App <- [$(APP)]], \
  82. {ok, Deps} = application:get_key($(APP), applications), \
  83. false = lists:member(jquery, Deps), \
  84. halt()"
  85. core-deps-dep-commit: build clean-core-deps-dep-commit
  86. $i "Bootstrap a new OTP library named $(APP)"
  87. $t mkdir $(APP)/
  88. $t cp ../erlang.mk $(APP)/
  89. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  90. $i "Add Cowboy 1.0.0 to the list of dependencies"
  91. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 1.0.0\n"}' $(APP)/Makefile
  92. ifdef LEGACY
  93. $i "Add Cowboy to the applications key in the .app.src file"
  94. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  95. endif
  96. $i "Build the application"
  97. $t $(MAKE) -C $(APP) $v
  98. $i "Check that all dependencies were fetched"
  99. $t test -d $(APP)/deps/cowboy
  100. $t test -d $(APP)/deps/cowlib
  101. $t test -d $(APP)/deps/ranch
  102. $i "Check that the application was compiled correctly"
  103. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  104. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  105. {ok, Deps} = application:get_key($(APP), applications), \
  106. true = lists:member(cowboy, Deps), \
  107. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  108. halt()"
  109. core-deps-dir: build clean-core-deps-dir
  110. $i "Bootstrap a new OTP library named $(APP)"
  111. $t mkdir $(APP)/
  112. $t cp ../erlang.mk $(APP)/
  113. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  114. $i "Add Cowboy to the list of dependencies with a custom DEPS_DIR"
  115. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nDEPS_DIR ?= \$$(CURDIR)/libs\n"}' $(APP)/Makefile
  116. ifdef LEGACY
  117. $i "Add Cowboy to the applications key in the .app.src file"
  118. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  119. endif
  120. $i "Build the application"
  121. $t $(MAKE) -C $(APP) $v
  122. $i "Check that all dependencies were fetched in the custom DEPS_DIR"
  123. $t test -d $(APP)/libs/cowboy
  124. $t test -d $(APP)/libs/cowlib
  125. $t test -d $(APP)/libs/ranch
  126. $i "Check that the application was compiled correctly"
  127. $t $(ERL) -pa $(APP)/ebin/ $(APP)/libs/*/ebin/ -eval " \
  128. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  129. {ok, Deps} = application:get_key($(APP), applications), \
  130. true = lists:member(cowboy, Deps), \
  131. halt()"
  132. core-deps-doc: build clean-core-deps-doc
  133. $i "Bootstrap a new OTP library named $(APP)"
  134. $t mkdir $(APP)/
  135. $t cp ../erlang.mk $(APP)/
  136. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  137. $i "Generate .erl files"
  138. $t echo "-module(boy)." > $(APP)/src/boy.erl
  139. $t echo "-module(girl)." > $(APP)/src/girl.erl
  140. $i "Add Edown as a documentation building dependency"
  141. $t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = edown\nEDOC_OPTS = {doclet, edown_doclet}\n"}' $(APP)/Makefile
  142. $i "Build the application"
  143. $t $(MAKE) -C $(APP) $v
  144. $i "Check that no dependencies were fetched"
  145. $t test ! -e $(APP)/deps
  146. $i "Check that the application was compiled correctly"
  147. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  148. [ok = application:load(App) || App <- [$(APP)]], \
  149. {ok, Deps} = application:get_key($(APP), applications), \
  150. false = lists:member(edown, Deps), \
  151. halt()"
  152. $i "Build the application documentation"
  153. $t $(MAKE) -C $(APP) docs $v
  154. $i "Check that documentation dependencies were fetched"
  155. $t test -d $(APP)/deps/edown
  156. $i "Check the Edown generated Markdown documentation"
  157. $t test -f $(APP)/doc/boy.md
  158. $t test -f $(APP)/doc/girl.md
  159. core-deps-fetch-cp: build clean-core-deps-fetch-cp
  160. $i "Bootstrap a new OTP library named $(APP)"
  161. $t mkdir $(APP)/
  162. $t cp ../erlang.mk $(APP)/
  163. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  164. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  165. $t mkdir $(APP)/my_dep
  166. $t cp ../erlang.mk $(APP)/my_dep/
  167. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  168. $i "Add my_dep to the list of dependencies"
  169. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  170. ifdef LEGACY
  171. $i "Add my_dep to the applications key in the .app.src file"
  172. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  173. endif
  174. $i "Build the application"
  175. $t $(MAKE) -C $(APP) $v
  176. $i "Check that all dependencies were fetched"
  177. $t test -d $(APP)/deps/my_dep
  178. $i "Check that the application was compiled correctly"
  179. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  180. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  181. {ok, Deps} = application:get_key($(APP), applications), \
  182. true = lists:member(my_dep, Deps), \
  183. halt()"
  184. core-deps-fetch-custom: build clean-core-deps-fetch-custom
  185. $i "Bootstrap a new OTP library named $(APP)"
  186. $t mkdir $(APP)/
  187. $t cp ../erlang.mk $(APP)/
  188. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  189. $i "Add dependency boop using custom fetch method beep to the list of dependencies"
  190. $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
  191. ifdef LEGACY
  192. $i "Add boop to the applications key in the .app.src file"
  193. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tboop,\n"}' $(APP)/src/$(APP).app.src
  194. endif
  195. $i "Build the application"
  196. $t $(MAKE) -C $(APP) $v
  197. $i "Check that all dependencies were fetched"
  198. $t test -d $(APP)/deps/boop
  199. $i "Check that the application was compiled correctly"
  200. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  201. ok = application:load($(APP)), \
  202. {ok, Deps} = application:get_key($(APP), applications), \
  203. true = lists:member(boop, Deps), \
  204. halt()"
  205. core-deps-fetch-fail-bad: build clean-core-deps-fetch-fail-bad
  206. $i "Bootstrap a new OTP library named $(APP)"
  207. $t mkdir $(APP)/
  208. $t cp ../erlang.mk $(APP)/
  209. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  210. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  211. $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
  212. $i "Check that building the application fails"
  213. $t if $(MAKE) -C $(APP) $v; then false; fi
  214. core-deps-fetch-fail-unknown: build clean-core-deps-fetch-fail-unknown
  215. $i "Bootstrap a new OTP library named $(APP)"
  216. $t mkdir $(APP)/
  217. $t cp ../erlang.mk $(APP)/
  218. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  219. $i "Add an unknown application as a dependency"
  220. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = unknown\n"}' $(APP)/Makefile
  221. $i "Check that building the application fails"
  222. $t if $(MAKE) -C $(APP) $v; then false; fi
  223. core-deps-fetch-git: build clean-core-deps-fetch-git
  224. $i "Bootstrap a new OTP library named $(APP)"
  225. $t mkdir $(APP)/
  226. $t cp ../erlang.mk $(APP)/
  227. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  228. $i "Add Cowboy 1.0.0 to the list of dependencies"
  229. $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
  230. ifdef LEGACY
  231. $i "Add Cowboy to the applications key in the .app.src file"
  232. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  233. endif
  234. $i "Build the application"
  235. $t $(MAKE) -C $(APP) $v
  236. $i "Check that all dependencies were fetched"
  237. $t test -d $(APP)/deps/cowboy
  238. $t test -d $(APP)/deps/cowlib
  239. $t test -d $(APP)/deps/ranch
  240. $i "Check that the application was compiled correctly"
  241. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  242. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  243. {ok, Deps} = application:get_key($(APP), applications), \
  244. true = lists:member(cowboy, Deps), \
  245. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  246. halt()"
  247. core-deps-fetch-hex: build clean-core-deps-fetch-hex
  248. $i "Bootstrap a new OTP library named $(APP)"
  249. $t mkdir $(APP)/
  250. $t cp ../erlang.mk $(APP)/
  251. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  252. $i "Add Cowboy 1.0.0 to the list of dependencies"
  253. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 1.0.0\n"}' $(APP)/Makefile
  254. ifdef LEGACY
  255. $i "Add Cowboy to the applications key in the .app.src file"
  256. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  257. endif
  258. $i "Build the application"
  259. $t $(MAKE) -C $(APP) $v
  260. $i "Check that all dependencies were fetched"
  261. $t test -d $(APP)/deps/cowboy
  262. $t test -d $(APP)/deps/cowlib
  263. $t test -d $(APP)/deps/ranch
  264. $i "Check that the application was compiled correctly"
  265. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  266. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  267. {ok, Deps} = application:get_key($(APP), applications), \
  268. true = lists:member(cowboy, Deps), \
  269. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  270. halt()"
  271. core-deps-fetch-hg: build clean-core-deps-fetch-hg
  272. $i "Bootstrap a new OTP library named $(APP)"
  273. $t mkdir $(APP)/
  274. $t cp ../erlang.mk $(APP)/
  275. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  276. $i "Add Ehsa 4.0.3 to the list of dependencies"
  277. $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
  278. ifdef LEGACY
  279. $i "Add ehsa to the applications key in the .app.src file"
  280. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tehsa,\n"}' $(APP)/src/$(APP).app.src
  281. endif
  282. $i "Build the application"
  283. $t $(MAKE) -C $(APP) $v
  284. $i "Check that all dependencies were fetched"
  285. $t test -d $(APP)/deps/ehsa
  286. $i "Check that the application was compiled correctly"
  287. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  288. [ok = application:load(App) || App <- [$(APP), ehsa]], \
  289. {ok, Deps} = application:get_key($(APP), applications), \
  290. true = lists:member(ehsa, Deps), \
  291. {ok, \"4.0.3\"} = application:get_key(ehsa, vsn), \
  292. halt()"
  293. # Legacy must fail for the top-level application, but work for dependencies.
  294. core-deps-fetch-legacy: build clean-core-deps-fetch-legacy
  295. $i "Bootstrap a new OTP library named $(APP)"
  296. $t mkdir $(APP)/
  297. $t cp ../erlang.mk $(APP)/
  298. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  299. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  300. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
  301. $i "Check that building the application fails"
  302. $t if $(MAKE) -C $(APP) $v; then false; fi
  303. $i "Check that building the application works with IS_DEP=1"
  304. $t $(MAKE) -C $(APP) IS_DEP=1 $v
  305. core-deps-fetch-svn: build clean-core-deps-fetch-svn
  306. $i "Bootstrap a new OTP library named $(APP)"
  307. $t mkdir $(APP)/
  308. $t cp ../erlang.mk $(APP)/
  309. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  310. $i "Add Cowlib 1.0.0 to the list of dependencies"
  311. $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
  312. ifdef LEGACY
  313. $i "Add Cowlib to the applications key in the .app.src file"
  314. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  315. endif
  316. $i "Build the application"
  317. $t $(MAKE) -C $(APP) $v
  318. $i "Check that all dependencies were fetched"
  319. $t test -d $(APP)/deps/cowlib
  320. $i "Check that the application was compiled correctly"
  321. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  322. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  323. {ok, Deps} = application:get_key($(APP), applications), \
  324. true = lists:member(cowlib, Deps), \
  325. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  326. halt()"
  327. core-deps-ignore: build clean-core-deps-ignore
  328. $i "Bootstrap a new OTP library named $(APP)"
  329. $t mkdir $(APP)/
  330. $t cp ../erlang.mk $(APP)/
  331. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  332. $i "Add Cowboy to dependencies, Ranch to the ignore list and to test dependencies"
  333. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nIGNORE_DEPS = ranch\nTEST_DEPS = ranch\n"}' $(APP)/Makefile
  334. ifdef LEGACY
  335. $i "Add Cowboy to the applications key in the .app.src file"
  336. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  337. endif
  338. $i "Build the application"
  339. $t $(MAKE) -C $(APP) $v
  340. $i "Check that the correct dependencies were fetched"
  341. $t test -d $(APP)/deps/cowboy
  342. $t test -d $(APP)/deps/cowlib
  343. $t test ! -e $(APP)/deps/ranch
  344. $i "Build the test dependencies"
  345. $t $(MAKE) -C $(APP) test-deps $v
  346. $i "Check that the correct dependencies were fetched"
  347. $t test -d $(APP)/deps/ranch
  348. # A lower-level dependency of the first dependency always
  349. # wins over a lower-level dependency of the second dependency.
  350. core-deps-order-first: build clean-core-deps-order-first
  351. $i "Bootstrap a new OTP library named $(APP)"
  352. $t mkdir $(APP)/
  353. $t cp ../erlang.mk $(APP)/
  354. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  355. $i "Add Cowboy package and my_dep to the list of dependencies"
  356. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep cowboy\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  357. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  358. $t mkdir $(APP)/my_dep
  359. $t cp ../erlang.mk $(APP)/my_dep/
  360. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  361. $i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
  362. $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
  363. ifdef LEGACY
  364. $i "Add Cowboy and my_dep to the applications key in the .app.src file"
  365. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  366. endif
  367. $i "Build the application"
  368. $t $(MAKE) -C $(APP) $v
  369. $i "Check that all dependencies were fetched"
  370. $t test -d $(APP)/deps/cowboy
  371. $t test -d $(APP)/deps/cowlib
  372. $t test -d $(APP)/deps/my_dep
  373. $t test -d $(APP)/deps/ranch
  374. $i "Check that the application was compiled correctly"
  375. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  376. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, my_dep, ranch]], \
  377. {ok, Deps} = application:get_key($(APP), applications), \
  378. true = lists:member(cowboy, Deps), \
  379. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  380. halt()"
  381. # A higher-level dependency always wins.
  382. core-deps-order-top: build clean-core-deps-order-top
  383. $i "Bootstrap a new OTP library named $(APP)"
  384. $t mkdir $(APP)/
  385. $t cp ../erlang.mk $(APP)/
  386. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  387. $i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
  388. $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
  389. ifdef LEGACY
  390. $i "Add Cowboy to the applications key in the .app.src file"
  391. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  392. endif
  393. $i "Build the application"
  394. $t $(MAKE) -C $(APP) $v
  395. $i "Check that all dependencies were fetched"
  396. $t test -d $(APP)/deps/cowboy
  397. $t test -d $(APP)/deps/cowlib
  398. $t test -d $(APP)/deps/ranch
  399. $i "Check that the application was compiled correctly"
  400. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  401. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  402. {ok, Deps} = application:get_key($(APP), applications), \
  403. true = lists:member(cowboy, Deps), \
  404. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  405. halt()"
  406. ifndef LEGACY
  407. core-deps-otp: build clean-core-deps-otp
  408. $i "Bootstrap a new OTP library named $(APP)"
  409. $t mkdir $(APP)/
  410. $t cp ../erlang.mk $(APP)/
  411. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  412. $i "Add Crypto to the list of OTP dependencies"
  413. $t perl -ni.bak -e 'print;if ($$.==1) {print "OTP_DEPS = crypto\n"}' $(APP)/Makefile
  414. $i "Build the application"
  415. $t $(MAKE) -C $(APP) $v
  416. $i "Check that no dependencies were fetched"
  417. $t test ! -e $(APP)/deps
  418. $i "Check that the application was compiled correctly"
  419. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  420. [ok = application:load(App) || App <- [$(APP), crypto]], \
  421. {ok, Deps} = application:get_key($(APP), applications), \
  422. true = lists:member(crypto, Deps), \
  423. halt()"
  424. endif
  425. core-deps-pkg: build clean-core-deps-pkg
  426. $i "Bootstrap a new OTP library named $(APP)"
  427. $t mkdir $(APP)/
  428. $t cp ../erlang.mk $(APP)/
  429. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  430. $i "Add Cowboy to the list of dependencies"
  431. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  432. ifdef LEGACY
  433. $i "Add Cowboy to the applications key in the .app.src file"
  434. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  435. endif
  436. $i "Build the application"
  437. $t $(MAKE) -C $(APP) $v
  438. $i "Check that all dependencies were fetched"
  439. $t test -d $(APP)/deps/cowboy
  440. $t test -d $(APP)/deps/cowlib
  441. $t test -d $(APP)/deps/ranch
  442. $i "Check that the application was compiled correctly"
  443. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  444. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  445. {ok, Deps} = application:get_key($(APP), applications), \
  446. true = lists:member(cowboy, Deps), \
  447. halt()"
  448. core-deps-rel: build clean-core-deps-rel
  449. $i "Bootstrap a new release-enabled OTP library named $(APP)"
  450. $t mkdir $(APP)/
  451. $t cp ../erlang.mk $(APP)/
  452. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
  453. $i "Add Recon to the list of release dependencies"
  454. $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
  455. $i "Add Recon to the relx.config file"
  456. $t $(ERL) -eval " \
  457. {ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
  458. Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
  459. ok = file:write_file(\"$(APP)/relx.config\", \
  460. lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
  461. halt()"
  462. $i "Build the application and its dependencies"
  463. $t $(MAKE) -C $(APP) deps app $v
  464. $i "Check that no dependencies were fetched"
  465. $t test ! -e $(APP)/deps
  466. $i "Check that the application was compiled correctly"
  467. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  468. [ok = application:load(App) || App <- [$(APP)]], \
  469. {ok, Deps} = application:get_key($(APP), applications), \
  470. false = lists:member(recon, Deps), \
  471. halt()"
  472. $i "Build the release"
  473. $t $(MAKE) -C $(APP) $v
  474. $i "Check that all dependencies were fetched"
  475. $t test -d $(APP)/deps/recon
  476. $i "Check that the application was compiled correctly"
  477. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  478. [ok = application:load(App) || App <- [$(APP), recon]], \
  479. {ok, Deps} = application:get_key($(APP), applications), \
  480. false = lists:member(recon, Deps), \
  481. halt()"
  482. # @todo Add check for MSYS2 when releases under Windows become usable.
  483. # $i "Start the release and check that Recon is loaded"
  484. ifeq ($(PLATFORM),msys2)
  485. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
  486. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
  487. # $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
  488. # application loaded_applications | grep recon`"
  489. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
  490. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
  491. else
  492. $i "Start the release and check that Recon is loaded"
  493. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
  494. $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release rpcterms \
  495. application loaded_applications | grep recon`"
  496. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
  497. endif
  498. core-deps-search: build clean-core-deps-search
  499. $i "Bootstrap a new OTP library named $(APP)"
  500. $t mkdir $(APP)/
  501. $t cp ../erlang.mk $(APP)/
  502. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  503. $i "Run 'make search' and check that it prints packages"
  504. $t test -n "`$(MAKE) -C $(APP) search`"
  505. $i "Run 'make search q=cowboy' and check that it prints packages"
  506. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
  507. core-deps-shell: build clean-core-deps-shell
  508. $i "Bootstrap a new OTP library named $(APP)"
  509. $t mkdir $(APP)/
  510. $t cp ../erlang.mk $(APP)/
  511. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  512. $i "Add TDDReloader to the list of shell dependencies"
  513. $t perl -ni.bak -e 'print;if ($$.==1) {print "SHELL_DEPS = tddreloader\n"}' $(APP)/Makefile
  514. $i "Build the application and its dependencies"
  515. $t $(MAKE) -C $(APP) deps app $v
  516. $i "Check that no dependencies were fetched"
  517. $t test ! -e $(APP)/deps
  518. $i "Check that the application was compiled correctly"
  519. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  520. [ok = application:load(App) || App <- [$(APP)]], \
  521. {ok, Deps} = application:get_key($(APP), applications), \
  522. false = lists:member(tddreloader, Deps), \
  523. halt()"
  524. $i "Run the shell"
  525. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
  526. ok = application:load($(APP)), \
  527. ok = application:load(tddreloader), \
  528. halt()\"" $v
  529. $i "Check that all dependencies were fetched"
  530. $t test -d $(APP)/deps/tddreloader
  531. $i "Check that the application was compiled correctly"
  532. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  533. [ok = application:load(App) || App <- [$(APP), tddreloader]], \
  534. {ok, Deps} = application:get_key($(APP), applications), \
  535. false = lists:member(tddreloader, Deps), \
  536. halt()"
  537. core-deps-test: build clean-core-deps-test
  538. $i "Bootstrap a new OTP library named $(APP)"
  539. $t mkdir $(APP)/
  540. $t cp ../erlang.mk $(APP)/
  541. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  542. $i "Generate .erl files"
  543. $t echo "-module(boy)." > $(APP)/src/boy.erl
  544. $t echo "-module(girl)." > $(APP)/src/girl.erl
  545. $i "Add triq to the list of test dependencies"
  546. $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = triq\n"}' $(APP)/Makefile
  547. $i "Build the application and its dependencies"
  548. $t $(MAKE) -C $(APP) deps app $v
  549. $i "Check that no dependencies were fetched"
  550. $t test ! -e $(APP)/deps
  551. $i "Check that the application was compiled correctly"
  552. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  553. [ok = application:load(App) || App <- [$(APP)]], \
  554. {ok, Deps} = application:get_key($(APP), applications), \
  555. false = lists:member(triq, Deps), \
  556. halt()"
  557. $i "Run tests"
  558. $t $(MAKE) -C $(APP) tests $v
  559. $i "Check that all dependencies were fetched"
  560. $t test -d $(APP)/deps/triq
  561. $i "Check that the application was compiled correctly"
  562. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  563. [ok = application:load(App) || App <- [$(APP), triq]], \
  564. {ok, Deps} = application:get_key($(APP), applications), \
  565. false = lists:member(triq, Deps), \
  566. halt()"