core_deps.mk 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091
  1. # Core: Packages and dependencies.
  2. CORE_DEPS_TARGETS = $(call list_targets,core-deps)
  3. .PHONY: core-deps $(CORE_DEPS_TARGETS)
  4. core-deps: $(CORE_DEPS_TARGETS)
  5. ifneq ($(PLATFORM),msys2)
  6. core-deps-build-c-8cc: build clean
  7. $i "Bootstrap a new OTP library named $(APP)"
  8. $t mkdir $(APP)/
  9. $t cp ../erlang.mk $(APP)/
  10. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  11. $i "Add 8cc to the list of build dependencies"
  12. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = 8cc\ndep_8cc = git https://github.com/rui314/8cc master\n"}' $(APP)/Makefile
  13. $i "Build the application"
  14. $t $(MAKE) -C $(APP) $v
  15. $i "Check that all dependencies were fetched"
  16. $t test -d $(APP)/deps/8cc
  17. $i "Check that 8cc can be started"
  18. $t $(APP)/deps/8cc/8cc -h $v
  19. $i "Check that the application was compiled correctly"
  20. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  21. [ok = application:load(App) || App <- [$(APP)]], \
  22. {ok, Deps} = application:get_key($(APP), applications), \
  23. false = lists:member('8cc', Deps), \
  24. halt()"
  25. endif
  26. core-deps-build-c-lz4: build clean
  27. $i "Bootstrap a new OTP library named $(APP)"
  28. $t mkdir $(APP)/
  29. $t cp ../erlang.mk $(APP)/
  30. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  31. $i "Add lz4 to the list of build dependencies"
  32. $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
  33. $i "Build the application"
  34. $t $(MAKE) -C $(APP) $v
  35. $i "Check that all dependencies were fetched"
  36. $t test -d $(APP)/deps/lz4_src
  37. $i "Check that lz4 was compiled"
  38. $t test -f $(APP)/deps/lz4_src/lib/liblz4.a
  39. $i "Check that the application was compiled correctly"
  40. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  41. [ok = application:load(App) || App <- [$(APP)]], \
  42. {ok, Deps} = application:get_key($(APP), applications), \
  43. false = lists:member(lz4, Deps), \
  44. halt()"
  45. core-deps-build-erl: build clean
  46. $i "Bootstrap a new OTP library named $(APP)"
  47. $t mkdir $(APP)/
  48. $t cp ../erlang.mk $(APP)/
  49. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  50. $i "Add cowlib to the list of build dependencies"
  51. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = cowlib\n"}' $(APP)/Makefile
  52. $i "Build the application"
  53. $t $(MAKE) -C $(APP) $v
  54. $i "Check that all dependencies were fetched"
  55. $t test -d $(APP)/deps/cowlib
  56. $i "Check that the application was compiled correctly"
  57. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  58. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  59. {ok, Deps} = application:get_key($(APP), applications), \
  60. false = lists:member(cowlib, Deps), \
  61. halt()"
  62. core-deps-build-js: build clean
  63. $i "Bootstrap a new OTP library named $(APP)"
  64. $t mkdir $(APP)/
  65. $t cp ../erlang.mk $(APP)/
  66. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  67. $i "Add jquery to the list of build dependencies"
  68. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = jquery\ndep_jquery = git https://github.com/jquery/jquery master\n"}' $(APP)/Makefile
  69. $i "Build the application"
  70. $t $(MAKE) -C $(APP) $v
  71. $i "Check that all dependencies were fetched"
  72. $t test -d $(APP)/deps/jquery
  73. $i "Check that the application was compiled correctly"
  74. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  75. [ok = application:load(App) || App <- [$(APP)]], \
  76. {ok, Deps} = application:get_key($(APP), applications), \
  77. false = lists:member(jquery, Deps), \
  78. halt()"
  79. core-deps-dep-commit: build clean
  80. $i "Bootstrap a new OTP library named $(APP)"
  81. $t mkdir $(APP)/
  82. $t cp ../erlang.mk $(APP)/
  83. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  84. $i "Add Cowboy 1.0.0 to the list of dependencies"
  85. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 1.0.0\n"}' $(APP)/Makefile
  86. ifdef LEGACY
  87. $i "Add Cowboy to the applications key in the .app.src file"
  88. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  89. endif
  90. $i "Build the application"
  91. $t $(MAKE) -C $(APP) $v
  92. $i "Check that all dependencies were fetched"
  93. $t test -d $(APP)/deps/cowboy
  94. $t test -d $(APP)/deps/cowlib
  95. $t test -d $(APP)/deps/ranch
  96. $i "Check that the application was compiled correctly"
  97. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  98. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  99. {ok, Deps} = application:get_key($(APP), applications), \
  100. true = lists:member(cowboy, Deps), \
  101. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  102. halt()"
  103. core-deps-dir: build clean
  104. $i "Bootstrap a new OTP library named $(APP)"
  105. $t mkdir $(APP)/
  106. $t cp ../erlang.mk $(APP)/
  107. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  108. $i "Add Cowboy to the list of dependencies with a custom DEPS_DIR"
  109. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nDEPS_DIR ?= \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
  110. ifdef LEGACY
  111. $i "Add Cowboy to the applications key in the .app.src file"
  112. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  113. endif
  114. $i "Build the application"
  115. $t $(MAKE) -C $(APP) $v
  116. $i "Check that all dependencies were fetched in the custom DEPS_DIR"
  117. $t test -d $(APP)/deep/libs/cowboy
  118. $t test -d $(APP)/deep/libs/cowlib
  119. $t test -d $(APP)/deep/libs/ranch
  120. $i "Check that the application was compiled correctly"
  121. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deep/libs/*/ebin/ -eval " \
  122. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  123. {ok, Deps} = application:get_key($(APP), applications), \
  124. true = lists:member(cowboy, Deps), \
  125. halt()"
  126. core-deps-doc: build clean
  127. $i "Bootstrap a new OTP library named $(APP)"
  128. $t mkdir $(APP)/
  129. $t cp ../erlang.mk $(APP)/
  130. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  131. $i "Generate .erl files"
  132. $t echo "-module(boy)." > $(APP)/src/boy.erl
  133. $t echo "-module(girl)." > $(APP)/src/girl.erl
  134. $i "Add Edown as a documentation building dependency"
  135. $t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = edown\nEDOC_OPTS = {doclet, edown_doclet}\n"}' $(APP)/Makefile
  136. $i "Build the application"
  137. $t $(MAKE) -C $(APP) $v
  138. $i "Check that no dependencies were fetched"
  139. $t test ! -e $(APP)/deps
  140. $i "Check that the application was compiled correctly"
  141. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  142. [ok = application:load(App) || App <- [$(APP)]], \
  143. {ok, Deps} = application:get_key($(APP), applications), \
  144. false = lists:member(edown, Deps), \
  145. halt()"
  146. $i "Build the application documentation"
  147. $t $(MAKE) -C $(APP) edoc $v
  148. $i "Check that documentation dependencies were fetched"
  149. $t test -d $(APP)/deps/edown
  150. $i "Check the Edown generated Markdown documentation"
  151. $t test -f $(APP)/doc/boy.md
  152. $t test -f $(APP)/doc/girl.md
  153. core-deps-fetch-cp: build clean
  154. $i "Bootstrap a new OTP library named $(APP)"
  155. $t mkdir $(APP)/
  156. $t cp ../erlang.mk $(APP)/
  157. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  158. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  159. $t mkdir $(APP)/my_dep
  160. $t cp ../erlang.mk $(APP)/my_dep/
  161. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  162. $i "Add my_dep to the list of dependencies"
  163. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  164. ifdef LEGACY
  165. $i "Add my_dep to the applications key in the .app.src file"
  166. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  167. endif
  168. $i "Build the application"
  169. $t $(MAKE) -C $(APP) $v
  170. $i "Check that all dependencies were fetched"
  171. $t test -d $(APP)/deps/my_dep
  172. $i "Check that the application was compiled correctly"
  173. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  174. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  175. {ok, Deps} = application:get_key($(APP), applications), \
  176. true = lists:member(my_dep, Deps), \
  177. halt()"
  178. core-deps-fetch-custom: build clean
  179. $i "Bootstrap a new OTP library named $(APP)"
  180. $t mkdir $(APP)/
  181. $t cp ../erlang.mk $(APP)/
  182. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  183. $i "Add dependency boop using custom fetch method beep to the list of dependencies"
  184. $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
  185. ifdef LEGACY
  186. $i "Add boop to the applications key in the .app.src file"
  187. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tboop,\n"}' $(APP)/src/$(APP).app.src
  188. endif
  189. $i "Build the application"
  190. $t $(MAKE) -C $(APP) $v
  191. $i "Check that all dependencies were fetched"
  192. $t test -d $(APP)/deps/boop
  193. $i "Check that the application was compiled correctly"
  194. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  195. ok = application:load($(APP)), \
  196. {ok, Deps} = application:get_key($(APP), applications), \
  197. true = lists:member(boop, Deps), \
  198. halt()"
  199. core-deps-fetch-fail-bad: build clean
  200. $i "Bootstrap a new OTP library named $(APP)"
  201. $t mkdir $(APP)/
  202. $t cp ../erlang.mk $(APP)/
  203. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  204. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  205. $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
  206. $i "Check that building the application fails"
  207. $t ! $(MAKE) -C $(APP) $v
  208. core-deps-fetch-fail-unknown: build clean
  209. $i "Bootstrap a new OTP library named $(APP)"
  210. $t mkdir $(APP)/
  211. $t cp ../erlang.mk $(APP)/
  212. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  213. $i "Add an unknown application as a dependency"
  214. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = unknown\n"}' $(APP)/Makefile
  215. $i "Check that building the application fails"
  216. $t ! $(MAKE) -C $(APP) $v
  217. core-deps-fetch-git: build clean
  218. $i "Bootstrap a new OTP library named $(APP)"
  219. $t mkdir $(APP)/
  220. $t cp ../erlang.mk $(APP)/
  221. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  222. $i "Add Cowboy 1.0.0 to the list of dependencies"
  223. $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
  224. ifdef LEGACY
  225. $i "Add Cowboy to the applications key in the .app.src file"
  226. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  227. endif
  228. $i "Build the application"
  229. $t $(MAKE) -C $(APP) $v
  230. $i "Check that all dependencies were fetched"
  231. $t test -d $(APP)/deps/cowboy
  232. $t test -d $(APP)/deps/cowlib
  233. $t test -d $(APP)/deps/ranch
  234. $i "Check that the application was compiled correctly"
  235. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  236. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  237. {ok, Deps} = application:get_key($(APP), applications), \
  238. true = lists:member(cowboy, Deps), \
  239. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  240. halt()"
  241. core-deps-fetch-git-subfolder: build clean
  242. $i "Bootstrap a new OTP library named $(APP)"
  243. $t mkdir $(APP)/
  244. $t cp ../erlang.mk $(APP)/
  245. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  246. $i "Bootstrap a new OTP library named my_dep as a subfolder inside $(APP)"
  247. $t mkdir -p $(APP)/git_repo/my_dep
  248. $t cp ../erlang.mk $(APP)/git_repo/my_dep/
  249. $t $(MAKE) -C $(APP)/git_repo/my_dep/ -f erlang.mk bootstrap-lib $v
  250. # Create an empty file so src/ gets committed.
  251. $t touch $(APP)/git_repo/my_dep/src/README
  252. $t cd $(APP)/git_repo && \
  253. git init -q && \
  254. git config user.email "testsuite@erlang.mk" && \
  255. git config user.name "test suite" && \
  256. git add . && \
  257. git commit -q --no-gpg-sign -m "Tests"
  258. $i "Add my_dep to the list of dependencies"
  259. $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
  260. ifdef LEGACY
  261. $i "Add my_dep to the applications key in the .app.src file"
  262. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  263. endif
  264. $i "Build the application"
  265. $t $(MAKE) -C $(APP) $v
  266. $i "Check that the dependency was fetched"
  267. $t test -d $(APP)/deps/my_dep
  268. $i "Check that the application was compiled correctly"
  269. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  270. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  271. {ok, Deps} = application:get_key($(APP), applications), \
  272. true = lists:member(my_dep, Deps), \
  273. halt()"
  274. core-deps-fetch-git-submodule: build clean
  275. $i "Bootstrap a new OTP library named $(APP)"
  276. $t mkdir $(APP)/
  277. $t cp ../erlang.mk $(APP)/
  278. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  279. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  280. $t mkdir $(APP)/my_dep
  281. $t cp ../erlang.mk $(APP)/my_dep/
  282. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  283. # Create an empty file so src/ gets committed.
  284. $t touch $(APP)/my_dep/src/README
  285. $t cd $(APP)/my_dep && \
  286. git init -q && \
  287. git config user.email "testsuite@erlang.mk" && \
  288. git config user.name "test suite" && \
  289. git add . && \
  290. git commit -q --no-gpg-sign -m "Tests"
  291. $i "Add the submodule to my_dep"
  292. $t mkdir $(APP)/deps
  293. $t cd $(APP) && \
  294. git init -q && \
  295. git submodule -q add file://$(abspath $(APP)/my_dep) deps/my_dep && \
  296. git config user.email "testsuite@erlang.mk" && \
  297. git config user.name "test suite" && \
  298. git add . && \
  299. git commit -q --no-gpg-sign -m "Tests"
  300. $i "Distclean the application"
  301. $t $(MAKE) -C $(APP) distclean $v
  302. $i "Add my_dep to the list of dependencies"
  303. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = git-submodule\n"}' $(APP)/Makefile
  304. ifdef LEGACY
  305. $i "Add my_dep to the applications key in the .app.src file"
  306. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  307. endif
  308. $i "Build the application"
  309. $t $(MAKE) -C $(APP) $v
  310. $i "Check that all dependencies were fetched"
  311. $t test -d $(APP)/deps/my_dep
  312. $i "Check that the application was compiled correctly"
  313. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  314. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  315. {ok, Deps} = application:get_key($(APP), applications), \
  316. true = lists:member(my_dep, Deps), \
  317. halt()"
  318. core-deps-fetch-hex: build clean
  319. $i "Bootstrap a new OTP library named $(APP)"
  320. $t mkdir $(APP)/
  321. $t cp ../erlang.mk $(APP)/
  322. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  323. $i "Add Cowboy 1.0.0 to the list of dependencies"
  324. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 1.0.0\n"}' $(APP)/Makefile
  325. ifdef LEGACY
  326. $i "Add Cowboy to the applications key in the .app.src file"
  327. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  328. endif
  329. $i "Build the application"
  330. $t $(MAKE) -C $(APP) $v
  331. $i "Check that all dependencies were fetched"
  332. $t test -d $(APP)/deps/cowboy
  333. $t test -d $(APP)/deps/cowlib
  334. $t test -d $(APP)/deps/ranch
  335. $i "Check that the application was compiled correctly"
  336. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  337. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  338. {ok, Deps} = application:get_key($(APP), applications), \
  339. true = lists:member(cowboy, Deps), \
  340. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  341. halt()"
  342. core-deps-fetch-hg: build clean
  343. $i "Bootstrap a new OTP library named $(APP)"
  344. $t mkdir $(APP)/
  345. $t cp ../erlang.mk $(APP)/
  346. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  347. $i "Add Ehsa 4.0.3 to the list of dependencies"
  348. $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
  349. ifdef LEGACY
  350. $i "Add ehsa to the applications key in the .app.src file"
  351. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tehsa,\n"}' $(APP)/src/$(APP).app.src
  352. endif
  353. $i "Build the application"
  354. $t $(MAKE) -C $(APP) $v
  355. $i "Check that all dependencies were fetched"
  356. $t test -d $(APP)/deps/ehsa
  357. $i "Check that the application was compiled correctly"
  358. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  359. [ok = application:load(App) || App <- [$(APP), ehsa]], \
  360. {ok, Deps} = application:get_key($(APP), applications), \
  361. true = lists:member(ehsa, Deps), \
  362. {ok, \"4.0.3\"} = application:get_key(ehsa, vsn), \
  363. halt()"
  364. # Legacy must fail for the top-level application, but work for dependencies.
  365. core-deps-fetch-legacy: build clean
  366. $i "Bootstrap a new OTP library named $(APP)"
  367. $t mkdir $(APP)/
  368. $t cp ../erlang.mk $(APP)/
  369. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  370. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  371. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
  372. $i "Check that building the application fails"
  373. $t ! $(MAKE) -C $(APP) $v
  374. $i "Check that building the application works with IS_DEP=1"
  375. $t $(MAKE) -C $(APP) IS_DEP=1 $v
  376. core-deps-fetch-ln: build clean
  377. $i "Bootstrap a new OTP library named $(APP)"
  378. $t mkdir $(APP)/
  379. $t cp ../erlang.mk $(APP)/
  380. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  381. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  382. $t mkdir $(APP)/my_dep
  383. $t cp ../erlang.mk $(APP)/my_dep/
  384. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  385. $i "Add my_dep to the list of dependencies"
  386. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = ln $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  387. ifdef LEGACY
  388. $i "Add my_dep to the applications key in the .app.src file"
  389. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  390. endif
  391. $i "Build the application"
  392. $t $(MAKE) -C $(APP) $v
  393. $i "Check that all dependencies were fetched"
  394. $t test -d $(APP)/deps/my_dep
  395. $i "Check that the application was compiled correctly"
  396. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  397. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  398. {ok, Deps} = application:get_key($(APP), applications), \
  399. true = lists:member(my_dep, Deps), \
  400. halt()"
  401. core-deps-fetch-svn: build clean
  402. $i "Bootstrap a new OTP library named $(APP)"
  403. $t mkdir $(APP)/
  404. $t cp ../erlang.mk $(APP)/
  405. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  406. $i "Add Cowlib 1.0.0 to the list of dependencies"
  407. $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
  408. ifdef LEGACY
  409. $i "Add Cowlib to the applications key in the .app.src file"
  410. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  411. endif
  412. $i "Build the application"
  413. $t $(MAKE) -C $(APP) $v
  414. $i "Check that all dependencies were fetched"
  415. $t test -d $(APP)/deps/cowlib
  416. $i "Check that the application was compiled correctly"
  417. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  418. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  419. {ok, Deps} = application:get_key($(APP), applications), \
  420. true = lists:member(cowlib, Deps), \
  421. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  422. halt()"
  423. core-deps-ignore: build clean
  424. $i "Bootstrap a new OTP library named $(APP)"
  425. $t mkdir $(APP)/
  426. $t cp ../erlang.mk $(APP)/
  427. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  428. $i "Add Cowboy to dependencies, Ranch to the ignore list and to test dependencies"
  429. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nIGNORE_DEPS = ranch\nTEST_DEPS = ranch\n"}' $(APP)/Makefile
  430. ifdef LEGACY
  431. $i "Add Cowboy to the applications key in the .app.src file"
  432. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  433. endif
  434. $i "Build the application"
  435. $t $(MAKE) -C $(APP) $v
  436. $i "Check that the correct dependencies were fetched"
  437. $t test -d $(APP)/deps/cowboy
  438. $t test -d $(APP)/deps/cowlib
  439. $t test ! -e $(APP)/deps/ranch
  440. $i "Build the test dependencies"
  441. $t $(MAKE) -C $(APP) test-deps $v
  442. $i "Check that the correct dependencies were fetched"
  443. $t test -d $(APP)/deps/ranch
  444. define add_dep_and_subdep
  445. $i "Bootstrap a new OTP library named $(APP)_$(1)subdep"
  446. $t mkdir $(APP)_$(1)subdep/
  447. $t cp ../erlang.mk $(APP)_$(1)subdep/
  448. $t $2 -C $(APP)_$(1)subdep --no-print-directory -f erlang.mk bootstrap-lib $$v
  449. $i "Create a Git repository for $(APP)_$(1)subdep"
  450. $t (cd $(APP)_$(1)subdep && \
  451. git init -q && \
  452. git config user.name "Testsuite" && \
  453. git config user.email "testsuite@erlang.mk" && \
  454. git add . && \
  455. git commit -q --no-gpg-sign -m "Initial commit")
  456. $i "Bootstrap a new OTP library named $(APP)_$(1)dep"
  457. $t mkdir $(APP)_$(1)dep/
  458. $t cp ../erlang.mk $(APP)_$(1)dep/
  459. $t $2 -C $(APP)_$(1)dep --no-print-directory -f erlang.mk bootstrap-lib $$v
  460. $i "Add $(APP)_$(1)subdep as a dependency"
  461. $t perl -ni.bak -e \
  462. 'print;if ($$.==1) {print "DEPS = $(1)subdep\ndep_$(1)subdep = git file://$(abspath $(APP)_$(1)subdep) master\n"}' \
  463. $(APP)_$(1)dep/Makefile
  464. $t rm $(APP)_$(1)dep/Makefile.bak
  465. $i "Create a Git repository for $(APP)_$(1)dep"
  466. $t (cd $(APP)_$(1)dep && \
  467. git init -q && \
  468. git config user.name "Testsuite" && \
  469. git config user.email "testsuite@erlang.mk" && \
  470. git add . && \
  471. git commit -q --no-gpg-sign -m "Initial commit")
  472. endef
  473. core-deps-list-deps: build clean
  474. # We pass $(MAKE) directly so that GNU Make can pass its context forward.
  475. # If we didn't then $(MAKE) would be expanded in the call without context.
  476. $(call add_dep_and_subdep,,$(MAKE))
  477. $(call add_dep_and_subdep,doc,$(MAKE))
  478. $(call add_dep_and_subdep,rel,$(MAKE))
  479. $(call add_dep_and_subdep,test,$(MAKE))
  480. $(call add_dep_and_subdep,shell,$(MAKE))
  481. $i "Bootstrap a new OTP library named $(APP)"
  482. $t mkdir $(APP)/
  483. $t cp ../erlang.mk $(APP)/
  484. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  485. $i "Add $(APP)-dep and $(APP)-testdep as a dependency"
  486. $t sed -i.bak '2i\
  487. DEPS = dep\
  488. DOC_DEPS = docdep\
  489. REL_DEPS = reldep\
  490. TEST_DEPS = testdep\
  491. SHELL_DEPS = shelldep\
  492. dep_dep = git file://$(abspath $(APP)_dep) master\
  493. dep_docdep = git file://$(abspath $(APP)_docdep) master\
  494. dep_reldep = git file://$(abspath $(APP)_reldep) master\
  495. dep_testdep = git file://$(abspath $(APP)_testdep) master\
  496. dep_shelldep = git file://$(abspath $(APP)_shelldep) master\
  497. ' $(APP)/Makefile
  498. $t rm $(APP)/Makefile.bak
  499. $i "Create a Git repository for $(APP)"
  500. $t (cd $(APP) && \
  501. git init -q && \
  502. git config user.name "Testsuite" && \
  503. git config user.email "testsuite@erlang.mk" && \
  504. git add . && \
  505. git commit -q --no-gpg-sign -m "Initial commit")
  506. $i "List application dependencies"
  507. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  508. $t test -d $(APP)/deps/subdep
  509. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  510. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  511. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  512. $i "List application doc dependencies"
  513. $t $(MAKE) -C $(APP) --no-print-directory list-doc-deps $v
  514. $t test -d $(APP)/deps/subdep
  515. $t test -d $(APP)/deps/docsubdep
  516. $t printf "%s\n%s\n%s\n%s\n" \
  517. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/docdep $(APP)/deps/docsubdep) \
  518. | sort > $(APP)/expected-doc-deps.txt
  519. $t cmp $(APP)/expected-doc-deps.txt $(APP)/.erlang.mk/recursive-doc-deps-list.log
  520. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  521. $i "List application rel dependencies"
  522. $t $(MAKE) -C $(APP) --no-print-directory list-rel-deps $v
  523. $t test -d $(APP)/deps/subdep
  524. $t test -d $(APP)/deps/relsubdep
  525. $t printf "%s\n%s\n%s\n%s\n" \
  526. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/reldep $(APP)/deps/relsubdep) \
  527. | sort > $(APP)/expected-rel-deps.txt
  528. $t cmp $(APP)/expected-rel-deps.txt $(APP)/.erlang.mk/recursive-rel-deps-list.log
  529. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  530. $i "List application test dependencies"
  531. $t $(MAKE) -C $(APP) --no-print-directory list-test-deps $v
  532. $t test -d $(APP)/deps/subdep
  533. $t test -d $(APP)/deps/testsubdep
  534. $t printf "%s\n%s\n%s\n%s\n" \
  535. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/testdep $(APP)/deps/testsubdep) \
  536. | sort > $(APP)/expected-test-deps.txt
  537. $t cmp $(APP)/expected-test-deps.txt $(APP)/.erlang.mk/recursive-test-deps-list.log
  538. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  539. $i "List application shell dependencies"
  540. $t $(MAKE) -C $(APP) --no-print-directory list-shell-deps $v
  541. $t test -d $(APP)/deps/subdep
  542. $t test -d $(APP)/deps/shellsubdep
  543. $t printf "%s\n%s\n%s\n%s\n" \
  544. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
  545. | sort > $(APP)/expected-shell-deps.txt
  546. $t cmp $(APP)/expected-shell-deps.txt $(APP)/.erlang.mk/recursive-shell-deps-list.log
  547. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  548. $i "List application all dependencies (all kinds)"
  549. $t $(MAKE) -C $(APP) --no-print-directory list-deps DEP_TYPES='doc rel test shell' $v
  550. $t test -d $(APP)/deps/subdep
  551. $t test -d $(APP)/deps/docsubdep
  552. $t test -d $(APP)/deps/relsubdep
  553. $t test -d $(APP)/deps/testsubdep
  554. $t test -d $(APP)/deps/shellsubdep
  555. $t printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
  556. $(abspath \
  557. $(APP)/deps/dep $(APP)/deps/subdep \
  558. $(APP)/deps/docdep $(APP)/deps/docsubdep \
  559. $(APP)/deps/reldep $(APP)/deps/relsubdep \
  560. $(APP)/deps/testdep $(APP)/deps/testsubdep \
  561. $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
  562. | sort > $(APP)/expected-all-deps.txt
  563. $t cmp $(APP)/expected-all-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  564. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  565. core-deps-mv: build clean
  566. $i "Bootstrap a new OTP library named $(APP)"
  567. $t mkdir $(APP)/
  568. $t cp ../erlang.mk $(APP)/
  569. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  570. $i "Add Cowlib to the list of dependencies"
  571. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  572. $i "Build the application"
  573. $t $(MAKE) -C $(APP) $v
  574. $i "Check that all dependencies were fetched"
  575. $t test -d $(APP)/deps/cowlib
  576. $i "Move the application elsewhere"
  577. $t mv $(APP) $(APP)-moved
  578. $i "Build the application"
  579. $t $(MAKE) -C $(APP)-moved $v
  580. core-deps-mv-rebar: build clean
  581. $i "Bootstrap a new OTP library named $(APP)"
  582. $t mkdir $(APP)/
  583. $t cp ../erlang.mk $(APP)/
  584. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  585. $i "Add Lager to the list of dependencies"
  586. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile
  587. $i "Build the application"
  588. $t $(MAKE) -C $(APP) $v
  589. $i "Check that all dependencies were fetched"
  590. $t test -d $(APP)/deps/goldrush
  591. $t test -d $(APP)/deps/lager
  592. $i "Move the application elsewhere"
  593. $t mv $(APP) $(APP)-moved
  594. $i "Build the application"
  595. $t $(MAKE) -C $(APP)-moved $v
  596. # A lower-level dependency of the first dependency always
  597. # wins over a lower-level dependency of the second dependency.
  598. core-deps-order-first: build clean
  599. $i "Bootstrap a new OTP library named $(APP)"
  600. $t mkdir $(APP)/
  601. $t cp ../erlang.mk $(APP)/
  602. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  603. $i "Add Cowboy package and my_dep to the list of dependencies"
  604. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep cowboy\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  605. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  606. $t mkdir $(APP)/my_dep
  607. $t cp ../erlang.mk $(APP)/my_dep/
  608. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  609. $i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
  610. $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
  611. ifdef LEGACY
  612. $i "Add Cowboy and my_dep to the applications key in the .app.src file"
  613. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  614. endif
  615. $i "Build the application"
  616. $t $(MAKE) -C $(APP) $v
  617. $i "Check that all dependencies were fetched"
  618. $t test -d $(APP)/deps/cowboy
  619. $t test -d $(APP)/deps/cowlib
  620. $t test -d $(APP)/deps/my_dep
  621. $t test -d $(APP)/deps/ranch
  622. $i "Check that the application was compiled correctly"
  623. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  624. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, my_dep, ranch]], \
  625. {ok, Deps} = application:get_key($(APP), applications), \
  626. true = lists:member(cowboy, Deps), \
  627. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  628. halt()"
  629. # A higher-level dependency always wins.
  630. core-deps-order-top: build clean
  631. $i "Bootstrap a new OTP library named $(APP)"
  632. $t mkdir $(APP)/
  633. $t cp ../erlang.mk $(APP)/
  634. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  635. $i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
  636. $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
  637. ifdef LEGACY
  638. $i "Add Cowboy to the applications key in the .app.src file"
  639. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  640. endif
  641. $i "Build the application"
  642. $t $(MAKE) -C $(APP) $v
  643. $i "Check that all dependencies were fetched"
  644. $t test -d $(APP)/deps/cowboy
  645. $t test -d $(APP)/deps/cowlib
  646. $t test -d $(APP)/deps/ranch
  647. $i "Check that the application was compiled correctly"
  648. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  649. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  650. {ok, Deps} = application:get_key($(APP), applications), \
  651. true = lists:member(cowboy, Deps), \
  652. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  653. halt()"
  654. ifndef LEGACY
  655. core-deps-otp: build clean
  656. $i "Bootstrap a new OTP library named $(APP)"
  657. $t mkdir $(APP)/
  658. $t cp ../erlang.mk $(APP)/
  659. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  660. $i "Add Crypto to the list of OTP dependencies"
  661. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = crypto\n"}' $(APP)/Makefile
  662. $i "Build the application"
  663. $t $(MAKE) -C $(APP) $v
  664. $i "Check that no dependencies were fetched"
  665. $t test ! -e $(APP)/deps
  666. $i "Check that the application was compiled correctly"
  667. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  668. [ok = application:load(App) || App <- [$(APP), crypto]], \
  669. {ok, Deps} = application:get_key($(APP), applications), \
  670. true = lists:member(crypto, Deps), \
  671. halt()"
  672. endif
  673. core-deps-pkg: build clean
  674. $i "Bootstrap a new OTP library named $(APP)"
  675. $t mkdir $(APP)/
  676. $t cp ../erlang.mk $(APP)/
  677. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  678. $i "Add Cowboy to the list of dependencies"
  679. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  680. ifdef LEGACY
  681. $i "Add Cowboy to the applications key in the .app.src file"
  682. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  683. endif
  684. $i "Build the application"
  685. $t $(MAKE) -C $(APP) $v
  686. $i "Check that all dependencies were fetched"
  687. $t test -d $(APP)/deps/cowboy
  688. $t test -d $(APP)/deps/cowlib
  689. $t test -d $(APP)/deps/ranch
  690. $i "Check that the application was compiled correctly"
  691. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  692. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  693. {ok, Deps} = application:get_key($(APP), applications), \
  694. true = lists:member(cowboy, Deps), \
  695. halt()"
  696. core-deps-rel: build clean
  697. $i "Bootstrap a new release-enabled OTP library named $(APP)"
  698. $t mkdir $(APP)/
  699. $t cp ../erlang.mk $(APP)/
  700. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
  701. $i "Add Recon to the list of release dependencies"
  702. $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
  703. $i "Add Recon to the relx.config file"
  704. $t $(ERL) -eval " \
  705. {ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
  706. Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
  707. ok = file:write_file(\"$(APP)/relx.config\", \
  708. lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
  709. halt()"
  710. $i "Build the application and its dependencies"
  711. $t $(MAKE) -C $(APP) deps app $v
  712. $i "Check that no dependencies were fetched"
  713. $t test ! -e $(APP)/deps
  714. $i "Check that the application was compiled correctly"
  715. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  716. [ok = application:load(App) || App <- [$(APP)]], \
  717. {ok, Deps} = application:get_key($(APP), applications), \
  718. false = lists:member(recon, Deps), \
  719. halt()"
  720. $i "Build the release"
  721. $t $(MAKE) -C $(APP) $v
  722. $i "Check that all dependencies were fetched"
  723. $t test -d $(APP)/deps/recon
  724. $i "Check that the application was compiled correctly"
  725. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  726. [ok = application:load(App) || App <- [$(APP), recon]], \
  727. {ok, Deps} = application:get_key($(APP), applications), \
  728. false = lists:member(recon, Deps), \
  729. halt()"
  730. # @todo Add check for MSYS2 when releases under Windows become usable.
  731. # $i "Start the release and check that Recon is loaded"
  732. ifeq ($(PLATFORM),msys2)
  733. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
  734. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
  735. # $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
  736. # application loaded_applications | grep recon`"
  737. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
  738. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
  739. else
  740. $i "Start the release and check that Recon is loaded"
  741. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
  742. $t apps="Node is not running!"; \
  743. while test "$$apps" = "Node is not running!"; do \
  744. apps=$$($(APP)/_rel/$(APP)_release/bin/$(APP)_release \
  745. rpcterms \ application loaded_applications); \
  746. done; \
  747. echo "$$apps" | grep -q recon
  748. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
  749. endif
  750. core-deps-search: build clean
  751. $i "Bootstrap a new OTP library named $(APP)"
  752. $t mkdir $(APP)/
  753. $t cp ../erlang.mk $(APP)/
  754. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  755. $i "Run 'make search' and check that it prints packages"
  756. $t test -n "`$(MAKE) -C $(APP) search`"
  757. $i "Run 'make search q=cowboy' and check that it prints packages"
  758. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
  759. core-deps-shell: build clean
  760. $i "Bootstrap a new OTP library named $(APP)"
  761. $t mkdir $(APP)/
  762. $t cp ../erlang.mk $(APP)/
  763. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  764. $i "Add TDDReloader to the list of shell dependencies"
  765. $t perl -ni.bak -e 'print;if ($$.==1) {print "SHELL_DEPS = tddreloader\n"}' $(APP)/Makefile
  766. $i "Build the application and its dependencies"
  767. $t $(MAKE) -C $(APP) deps app $v
  768. $i "Check that no dependencies were fetched"
  769. $t test ! -e $(APP)/deps
  770. $i "Check that the application was compiled correctly"
  771. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  772. [ok = application:load(App) || App <- [$(APP)]], \
  773. {ok, Deps} = application:get_key($(APP), applications), \
  774. false = lists:member(tddreloader, Deps), \
  775. halt()"
  776. $i "Run the shell"
  777. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
  778. ok = application:load($(APP)), \
  779. ok = application:load(tddreloader), \
  780. halt()\"" $v
  781. $i "Check that all dependencies were fetched"
  782. $t test -d $(APP)/deps/tddreloader
  783. $i "Check that the application was compiled correctly"
  784. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  785. [ok = application:load(App) || App <- [$(APP), tddreloader]], \
  786. {ok, Deps} = application:get_key($(APP), applications), \
  787. false = lists:member(tddreloader, Deps), \
  788. halt()"
  789. core-deps-skip: build clean
  790. $i "Bootstrap a new OTP library named $(APP)"
  791. $t mkdir $(APP)/
  792. $t cp ../erlang.mk $(APP)/
  793. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  794. $i "Add Cowboy to the list of dependencies"
  795. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  796. ifdef LEGACY
  797. $i "Add Cowboy to the applications key in the .app.src file"
  798. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  799. endif
  800. $i "Build the application with SKIP_DEPS=1"
  801. $t $(MAKE) -C $(APP) SKIP_DEPS=1 $v
  802. $i "Check that no dependencies were fetched"
  803. $t test ! -e $(APP)/deps
  804. $i "Build the application"
  805. $t $(MAKE) -C $(APP) $v
  806. $i "Check that all dependencies were fetched"
  807. $t test -d $(APP)/deps/cowlib
  808. $t test -d $(APP)/deps/cowboy
  809. $t test -d $(APP)/deps/ranch
  810. $i "Distclean with SKIP_DEPS=1"
  811. $t $(MAKE) -C $(APP) distclean SKIP_DEPS=1 $v
  812. $i "Check that no dependencies were removed"
  813. $t test -d $(APP)/deps/cowlib
  814. $t test -d $(APP)/deps/cowboy
  815. $t test -d $(APP)/deps/ranch
  816. core-deps-test: build clean
  817. $i "Bootstrap a new OTP library named $(APP)"
  818. $t mkdir $(APP)/
  819. $t cp ../erlang.mk $(APP)/
  820. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  821. $i "Generate .erl files"
  822. $t echo "-module(boy)." > $(APP)/src/boy.erl
  823. $t echo "-module(girl)." > $(APP)/src/girl.erl
  824. $i "Add triq to the list of test dependencies"
  825. $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = triq\n"}' $(APP)/Makefile
  826. $i "Build the application and its dependencies"
  827. $t $(MAKE) -C $(APP) deps app $v
  828. $i "Check that no dependencies were fetched"
  829. $t test ! -e $(APP)/deps
  830. $i "Check that the application was compiled correctly"
  831. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  832. [ok = application:load(App) || App <- [$(APP)]], \
  833. {ok, Deps} = application:get_key($(APP), applications), \
  834. false = lists:member(triq, Deps), \
  835. halt()"
  836. $i "Run tests"
  837. $t $(MAKE) -C $(APP) tests $v
  838. $i "Check that all dependencies were fetched"
  839. $t test -d $(APP)/deps/triq
  840. $i "Check that the application was compiled correctly"
  841. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  842. [ok = application:load(App) || App <- [$(APP), triq]], \
  843. {ok, Deps} = application:get_key($(APP), applications), \
  844. false = lists:member(triq, Deps), \
  845. halt()"