core_deps.mk 39 KB

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