core_deps.mk 26 KB

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