core_deps.mk 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454
  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: init
  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: init
  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: init
  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: init
  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 main\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-built: init
  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 cowlib to the list of dependencies"
  85. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  86. $i "Build the application"
  87. $t $(MAKE) -C $(APP) $v
  88. $i "Touch one cowlib file to mark it for recompilation"
  89. $t $(SLEEP)
  90. $t touch $(APP)/deps/cowlib/src/cow_http.erl
  91. $i "Check that cowlib is not rebuilt"
  92. $t touch $(APP)/EXPECT
  93. $t $(SLEEP)
  94. $t $(MAKE) -C $(APP) $v
  95. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | sort | diff $(APP)/EXPECT -
  96. $t rm $(APP)/EXPECT
  97. $i "Delete the dep_built file"
  98. $t rm $(APP)/deps/cowlib/ebin/dep_built
  99. $i "Check that cowlib was rebuilt"
  100. $t printf "%s\n" \
  101. $(APP)/deps/cowlib/cowlib.d \
  102. $(APP)/deps/cowlib/ebin/cowlib.app \
  103. $(APP)/deps/cowlib/ebin/cow_http.beam \
  104. $(APP)/deps/cowlib/ebin/dep_built | sort > $(APP)/EXPECT
  105. $t $(SLEEP)
  106. $t $(MAKE) -C $(APP) $v
  107. # Files in .git might end up modified due to the id generation in the .app file.
  108. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT -
  109. $t rm $(APP)/EXPECT
  110. core-deps-dep-built-full: init
  111. $i "Bootstrap a new OTP library named $(APP)"
  112. $t mkdir $(APP)/
  113. $t cp ../erlang.mk $(APP)/
  114. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  115. $i "Add cowlib to the list of dependencies"
  116. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  117. $i "Build the application"
  118. $t $(MAKE) -C $(APP) $v
  119. $i "Touch one cowlib file to mark it for recompilation"
  120. $t $(SLEEP)
  121. $t touch $(APP)/deps/cowlib/src/cow_http.erl
  122. $i "Check that cowlib is rebuilt with FULL=1"
  123. $t printf "%s\n" \
  124. $(APP)/deps/cowlib/cowlib.d \
  125. $(APP)/deps/cowlib/ebin/cowlib.app \
  126. $(APP)/deps/cowlib/ebin/cow_http.beam \
  127. $(APP)/deps/cowlib/ebin/dep_built | sort > $(APP)/EXPECT
  128. $t $(SLEEP)
  129. $t $(MAKE) -C $(APP) FULL=1 $v
  130. # Files in .git might end up modified due to the id generation in the .app file.
  131. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT -
  132. $t rm $(APP)/EXPECT
  133. core-deps-dep-built-force-full: init
  134. $i "Bootstrap a new OTP library named $(APP)"
  135. $t mkdir $(APP)/
  136. $t cp ../erlang.mk $(APP)/
  137. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  138. $i "Add cowlib to the list of dependencies"
  139. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  140. $i "Build the application"
  141. $t $(MAKE) -C $(APP) $v
  142. $i "Touch one cowlib file to mark it for recompilation"
  143. $t $(SLEEP)
  144. $t touch $(APP)/deps/cowlib/src/cow_http.erl
  145. $i "Check that cowlib is not rebuilt if \`force_rebuild_dep\` returns false"
  146. $t touch $(APP)/EXPECT
  147. $t $(SLEEP)
  148. $t $(MAKE) -C $(APP) force_rebuild_dep='test $$(1) != $(CURDIR)/$(APP)/deps/cowlib' $v
  149. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | sort | diff $(APP)/EXPECT -
  150. $t rm $(APP)/EXPECT
  151. $i "Check that cowlib is rebuilt if \`force_rebuild_dep\` returns true"
  152. $t printf "%s\n" \
  153. $(APP)/deps/cowlib/cowlib.d \
  154. $(APP)/deps/cowlib/ebin/cowlib.app \
  155. $(APP)/deps/cowlib/ebin/cow_http.beam \
  156. $(APP)/deps/cowlib/ebin/dep_built | sort > $(APP)/EXPECT
  157. $t $(SLEEP)
  158. $t $(MAKE) -C $(APP) force_rebuild_dep='test $$(1) = $(CURDIR)/$(APP)/deps/cowlib' $v
  159. # Files in .git might end up modified due to the id generation in the .app file.
  160. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT -
  161. $t rm $(APP)/EXPECT
  162. $i "Touch one cowlib file to mark it for recompilation"
  163. $t $(SLEEP)
  164. $t touch $(APP)/deps/cowlib/src/cow_http.erl
  165. $i "Check that cowlib is not rebuilt if \`FORCE_REBUILD\` is empty"
  166. $t touch $(APP)/EXPECT
  167. $t $(SLEEP)
  168. $t $(MAKE) -C $(APP) FORCE_REBUILD= $v
  169. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | sort | diff $(APP)/EXPECT -
  170. $t rm $(APP)/EXPECT
  171. $i "Check that cowlib is not rebuilt if \`FORCE_REBUILD\` does not mention cowlib"
  172. $t touch $(APP)/EXPECT
  173. $t $(SLEEP)
  174. $t $(MAKE) -C $(APP) FORCE_REBUILD='other_dep' $v
  175. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | sort | diff $(APP)/EXPECT -
  176. $t rm $(APP)/EXPECT
  177. $i "Check that cowlib is rebuilt if \`FORCE_REBUILD\` contains cowlib"
  178. $t printf "%s\n" \
  179. $(APP)/deps/cowlib/cowlib.d \
  180. $(APP)/deps/cowlib/ebin/cowlib.app \
  181. $(APP)/deps/cowlib/ebin/cow_http.beam \
  182. $(APP)/deps/cowlib/ebin/dep_built | sort > $(APP)/EXPECT
  183. $t $(SLEEP)
  184. $t $(MAKE) -C $(APP) FORCE_REBUILD='other_dep cowlib' $v
  185. # Files in .git might end up modified due to the id generation in the .app file.
  186. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT -
  187. $t rm $(APP)/EXPECT
  188. core-deps-dep-built-ln: init
  189. $i "Bootstrap a new OTP library named $(APP)"
  190. $t mkdir $(APP)/
  191. $t cp ../erlang.mk $(APP)/
  192. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  193. $i "Add cowlib to the list of dependencies"
  194. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  195. $i "Clone cowlib manually inside $(APP)"
  196. $t git clone -q https://github.com/ninenines/cowlib $(APP)/cowlib
  197. $i "Link to cowlib instead of fetching the dependency"
  198. $t mkdir -p $(APP)/deps
  199. $t ln -s ../cowlib $(APP)/deps/cowlib
  200. $i "Build the application"
  201. $t $(MAKE) -C $(APP) $v
  202. # On MSYS2 "ln" will by default not create symbolic links because
  203. # it requires an option to be enabled and administrative privileges.
  204. # The "rebuild" part of the test is therefore skipped on Windows.
  205. ifneq ($(PLATFORM),msys2)
  206. $i "Touch one cowlib file to mark it for recompilation"
  207. $t $(SLEEP)
  208. $t touch $(APP)/deps/cowlib/src/cow_http.erl
  209. $i "Check that cowlib is rebuilt; symlinked deps don't create dep_built"
  210. $t printf "%s\n" \
  211. $(APP)/cowlib/cowlib.d \
  212. $(APP)/cowlib/ebin/cowlib.app \
  213. $(APP)/cowlib/ebin/cow_http.beam | sort > $(APP)/EXPECT
  214. $t $(SLEEP)
  215. $t $(MAKE) -C $(APP) $v
  216. # Files in .git might end up modified due to the id generation in the .app file.
  217. $t find $(APP)/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT -
  218. $t rm $(APP)/EXPECT
  219. endif
  220. core-deps-dep-commit: init
  221. $i "Bootstrap a new OTP library named $(APP)"
  222. $t mkdir $(APP)/
  223. $t cp ../erlang.mk $(APP)/
  224. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  225. $i "Add Cowboy 1.0.0 to the list of dependencies"
  226. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 1.0.0\n"}' $(APP)/Makefile
  227. ifdef LEGACY
  228. $i "Add Cowboy to the applications key in the .app.src file"
  229. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  230. endif
  231. $i "Build the application"
  232. $t $(MAKE) -C $(APP) $v
  233. $i "Check that all dependencies were fetched"
  234. $t test -d $(APP)/deps/cowboy
  235. $t test -d $(APP)/deps/cowlib
  236. $t test -d $(APP)/deps/ranch
  237. $i "Check that the application was compiled correctly"
  238. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  239. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  240. {ok, Deps} = application:get_key($(APP), applications), \
  241. true = lists:member(cowboy, Deps), \
  242. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  243. halt()"
  244. core-deps-dir: init
  245. $i "Bootstrap a new OTP library named $(APP)"
  246. $t mkdir $(APP)/
  247. $t cp ../erlang.mk $(APP)/
  248. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  249. $i "Add Cowboy to the list of dependencies with a custom DEPS_DIR"
  250. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nDEPS_DIR ?= \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
  251. ifdef LEGACY
  252. $i "Add Cowboy to the applications key in the .app.src file"
  253. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  254. endif
  255. $i "Build the application"
  256. $t $(MAKE) -C $(APP) $v
  257. $i "Check that all dependencies were fetched in the custom DEPS_DIR"
  258. $t test -d $(APP)/deep/libs/cowboy
  259. $t test -d $(APP)/deep/libs/cowlib
  260. $t test -d $(APP)/deep/libs/ranch
  261. $i "Check that the application was compiled correctly"
  262. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deep/libs/*/ebin/ -eval " \
  263. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  264. {ok, Deps} = application:get_key($(APP), applications), \
  265. true = lists:member(cowboy, Deps), \
  266. halt()"
  267. core-deps-doc: init
  268. $i "Bootstrap a new OTP library named $(APP)"
  269. $t mkdir $(APP)/
  270. $t cp ../erlang.mk $(APP)/
  271. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  272. $i "Generate .erl files"
  273. $t echo "-module(boy)." > $(APP)/src/boy.erl
  274. $t echo "-module(girl)." > $(APP)/src/girl.erl
  275. $i "Add Edown as a documentation building dependency"
  276. $t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = edown\nEDOC_OPTS = {doclet, edown_doclet}\n"}' $(APP)/Makefile
  277. $i "Build the application"
  278. $t $(MAKE) -C $(APP) $v
  279. $i "Check that no dependencies were fetched"
  280. $t test ! -e $(APP)/deps
  281. $i "Check that the application was compiled correctly"
  282. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  283. [ok = application:load(App) || App <- [$(APP)]], \
  284. {ok, Deps} = application:get_key($(APP), applications), \
  285. false = lists:member(edown, Deps), \
  286. halt()"
  287. $i "Build the application documentation"
  288. $t $(MAKE) -C $(APP) edoc $v
  289. $i "Check that documentation dependencies were fetched"
  290. $t test -d $(APP)/deps/edown
  291. $i "Check the Edown generated Markdown documentation"
  292. $t test -f $(APP)/doc/boy.md
  293. $t test -f $(APP)/doc/girl.md
  294. core-deps-fetch-cp: init
  295. $i "Bootstrap a new OTP library named $(APP)"
  296. $t mkdir $(APP)/
  297. $t cp ../erlang.mk $(APP)/
  298. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  299. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  300. $t mkdir $(APP)/my_dep
  301. $t cp ../erlang.mk $(APP)/my_dep/
  302. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  303. $i "Add my_dep to the list of dependencies"
  304. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  305. ifdef LEGACY
  306. $i "Add my_dep to the applications key in the .app.src file"
  307. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  308. endif
  309. $i "Build the application"
  310. $t $(MAKE) -C $(APP) $v
  311. $i "Check that all dependencies were fetched"
  312. $t test -d $(APP)/deps/my_dep
  313. $i "Check that the application was compiled correctly"
  314. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  315. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  316. {ok, Deps} = application:get_key($(APP), applications), \
  317. true = lists:member(my_dep, Deps), \
  318. halt()"
  319. core-deps-fetch-custom: init
  320. $i "Bootstrap a new OTP library named $(APP)"
  321. $t mkdir $(APP)/
  322. $t cp ../erlang.mk $(APP)/
  323. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  324. $i "Add dependency boop using custom fetch method beep to the list of dependencies"
  325. $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
  326. ifdef LEGACY
  327. $i "Add boop to the applications key in the .app.src file"
  328. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tboop,\n"}' $(APP)/src/$(APP).app.src
  329. endif
  330. $i "Build the application"
  331. $t $(MAKE) -C $(APP) $v
  332. $i "Check that all dependencies were fetched"
  333. $t test -d $(APP)/deps/boop
  334. $i "Check that the application was compiled correctly"
  335. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  336. ok = application:load($(APP)), \
  337. {ok, Deps} = application:get_key($(APP), applications), \
  338. true = lists:member(boop, Deps), \
  339. halt()"
  340. core-deps-fetch-fail-bad: init
  341. $i "Bootstrap a new OTP library named $(APP)"
  342. $t mkdir $(APP)/
  343. $t cp ../erlang.mk $(APP)/
  344. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  345. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  346. $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
  347. $i "Check that building the application fails"
  348. $t ! $(MAKE) -C $(APP) $v
  349. core-deps-fetch-fail-unknown: init
  350. $i "Bootstrap a new OTP library named $(APP)"
  351. $t mkdir $(APP)/
  352. $t cp ../erlang.mk $(APP)/
  353. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  354. $i "Add an unknown application as a dependency"
  355. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = unknown\n"}' $(APP)/Makefile
  356. $i "Check that building the application fails"
  357. $t ! $(MAKE) -C $(APP) $v
  358. core-deps-fetch-git: init
  359. $i "Bootstrap a new OTP library named $(APP)"
  360. $t mkdir $(APP)/
  361. $t cp ../erlang.mk $(APP)/
  362. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  363. $i "Add Cowboy 1.0.0 to the list of dependencies"
  364. $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
  365. ifdef LEGACY
  366. $i "Add Cowboy to the applications key in the .app.src file"
  367. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  368. endif
  369. $i "Build the application"
  370. $t $(MAKE) -C $(APP) $v
  371. $i "Check that all dependencies were fetched"
  372. $t test -d $(APP)/deps/cowboy
  373. $t test -d $(APP)/deps/cowlib
  374. $t test -d $(APP)/deps/ranch
  375. $i "Check that the application was compiled correctly"
  376. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  377. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  378. {ok, Deps} = application:get_key($(APP), applications), \
  379. true = lists:member(cowboy, Deps), \
  380. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  381. halt()"
  382. core-deps-fetch-git-subfolder: init
  383. $i "Bootstrap a new OTP library named $(APP)"
  384. $t mkdir $(APP)/
  385. $t cp ../erlang.mk $(APP)/
  386. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  387. $i "Bootstrap a new OTP library named my_dep as a subfolder inside $(APP)"
  388. $t mkdir -p $(APP)/git_repo/my_dep
  389. $t cp ../erlang.mk $(APP)/git_repo/my_dep/
  390. $t $(MAKE) -C $(APP)/git_repo/my_dep/ -f erlang.mk bootstrap-lib $v
  391. # Create an empty file so src/ gets committed.
  392. $t touch $(APP)/git_repo/my_dep/src/README
  393. $t cd $(APP)/git_repo && \
  394. git init -q && \
  395. git config user.email "testsuite@erlang.mk" && \
  396. git config user.name "test suite" && \
  397. git add . && \
  398. git commit -q --no-gpg-sign -m "Tests"
  399. $i "Add my_dep to the list of dependencies"
  400. $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
  401. ifdef LEGACY
  402. $i "Add my_dep to the applications key in the .app.src file"
  403. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  404. endif
  405. $i "Build the application"
  406. $t $(MAKE) -C $(APP) $v
  407. $i "Check that the dependency was fetched"
  408. $t test -d $(APP)/deps/my_dep
  409. $i "Check that the application was compiled correctly"
  410. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  411. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  412. {ok, Deps} = application:get_key($(APP), applications), \
  413. true = lists:member(my_dep, Deps), \
  414. halt()"
  415. core-deps-fetch-git-submodule: init
  416. $i "Bootstrap a new OTP library named $(APP)"
  417. $t mkdir $(APP)/
  418. $t cp ../erlang.mk $(APP)/
  419. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  420. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  421. $t mkdir $(APP)/my_dep
  422. $t cp ../erlang.mk $(APP)/my_dep/
  423. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  424. # Create an empty file so src/ gets committed.
  425. $t touch $(APP)/my_dep/src/README
  426. $t cd $(APP)/my_dep && \
  427. git init -q && \
  428. git config user.email "testsuite@erlang.mk" && \
  429. git config user.name "test suite" && \
  430. git add . && \
  431. git commit -q --no-gpg-sign -m "Tests"
  432. $i "Add the submodule to my_dep"
  433. $t mkdir $(APP)/deps
  434. $t cd $(APP) && \
  435. git init -q && \
  436. git submodule -q add file://$(abspath $(APP)/my_dep) deps/my_dep && \
  437. git config user.email "testsuite@erlang.mk" && \
  438. git config user.name "test suite" && \
  439. git add . && \
  440. git commit -q --no-gpg-sign -m "Tests"
  441. $i "Distclean the application"
  442. $t $(MAKE) -C $(APP) distclean $v
  443. $i "Add my_dep to the list of dependencies"
  444. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = git-submodule\n"}' $(APP)/Makefile
  445. ifdef LEGACY
  446. $i "Add my_dep to the applications key in the .app.src file"
  447. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  448. endif
  449. $i "Build the application"
  450. $t $(MAKE) -C $(APP) $v
  451. $i "Check that all dependencies were fetched"
  452. $t test -d $(APP)/deps/my_dep
  453. $i "Check that the application was compiled correctly"
  454. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  455. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  456. {ok, Deps} = application:get_key($(APP), applications), \
  457. true = lists:member(my_dep, Deps), \
  458. halt()"
  459. core-deps-fetch-hex: init
  460. $i "Bootstrap a new OTP library named $(APP)"
  461. $t mkdir $(APP)/
  462. $t cp ../erlang.mk $(APP)/
  463. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  464. $i "Add Cowboy 1.0.0 to the list of dependencies"
  465. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy systemd\ndep_cowboy = hex 1.0.0\ndep_systemd = hex 0.6.0\n"}' $(APP)/Makefile
  466. ifdef LEGACY
  467. $i "Add Cowboy to the applications key in the .app.src file"
  468. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  469. endif
  470. $i "Build the application"
  471. $t $(MAKE) -C $(APP) $v
  472. $i "Check that all dependencies were fetched"
  473. $t test -d $(APP)/deps/cowboy
  474. $t test -d $(APP)/deps/cowlib
  475. $t test -d $(APP)/deps/ranch
  476. $t test -d $(APP)/deps/systemd
  477. $t test -d $(APP)/deps/enough
  478. $i "Check that the application was compiled correctly"
  479. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  480. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch, systemd, enough]], \
  481. {ok, Deps} = application:get_key($(APP), applications), \
  482. true = lists:member(cowboy, Deps), \
  483. true = lists:member(systemd, Deps), \
  484. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  485. {ok, \"0.6.0\"} = application:get_key(systemd, vsn), \
  486. halt()"
  487. # @todo Enable this test again when a host provides Mercurial again.
  488. #core-deps-fetch-hg: init
  489. #
  490. # $i "Bootstrap a new OTP library named $(APP)"
  491. # $t mkdir $(APP)/
  492. # $t cp ../erlang.mk $(APP)/
  493. # $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  494. #
  495. # $i "Add Ehsa 4.0.3 to the list of dependencies"
  496. # $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
  497. #
  498. #ifdef LEGACY
  499. # $i "Add ehsa to the applications key in the .app.src file"
  500. # $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tehsa,\n"}' $(APP)/src/$(APP).app.src
  501. #endif
  502. #
  503. # $i "Build the application"
  504. # $t $(MAKE) -C $(APP) $v
  505. #
  506. # $i "Check that all dependencies were fetched"
  507. # $t test -d $(APP)/deps/ehsa
  508. #
  509. # $i "Check that the application was compiled correctly"
  510. # $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  511. # [ok = application:load(App) || App <- [$(APP), ehsa]], \
  512. # {ok, Deps} = application:get_key($(APP), applications), \
  513. # true = lists:member(ehsa, Deps), \
  514. # {ok, \"4.0.3\"} = application:get_key(ehsa, vsn), \
  515. # halt()"
  516. # Legacy must fail for the top-level application, but work for dependencies.
  517. core-deps-fetch-legacy: init
  518. $i "Bootstrap a new OTP library named $(APP)"
  519. $t mkdir $(APP)/
  520. $t cp ../erlang.mk $(APP)/
  521. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  522. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  523. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
  524. $i "Check that building the application fails"
  525. $t ! $(MAKE) -C $(APP) $v
  526. $i "Check that building the application works with IS_DEP=1"
  527. $t $(MAKE) -C $(APP) IS_DEP=1 $v
  528. core-deps-fetch-ln: init
  529. $i "Bootstrap a new OTP library named $(APP)"
  530. $t mkdir $(APP)/
  531. $t cp ../erlang.mk $(APP)/
  532. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  533. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  534. $t mkdir $(APP)/my_dep
  535. $t cp ../erlang.mk $(APP)/my_dep/
  536. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  537. $i "Add my_dep to the list of dependencies"
  538. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = ln $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  539. ifdef LEGACY
  540. $i "Add my_dep to the applications key in the .app.src file"
  541. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  542. endif
  543. $i "Build the application"
  544. $t $(MAKE) -C $(APP) $v
  545. $i "Check that all dependencies were fetched"
  546. $t test -d $(APP)/deps/my_dep
  547. $i "Check that the application was compiled correctly"
  548. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  549. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  550. {ok, Deps} = application:get_key($(APP), applications), \
  551. true = lists:member(my_dep, Deps), \
  552. halt()"
  553. core-deps-fetch-svn: init
  554. $i "Bootstrap a new OTP library named $(APP)"
  555. $t mkdir $(APP)/
  556. $t cp ../erlang.mk $(APP)/
  557. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  558. $i "Add Cowlib 1.0.0 to the list of dependencies"
  559. $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
  560. ifdef LEGACY
  561. $i "Add Cowlib to the applications key in the .app.src file"
  562. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  563. endif
  564. $i "Build the application"
  565. $t $(MAKE) -C $(APP) $v
  566. $i "Check that all dependencies were fetched"
  567. $t test -d $(APP)/deps/cowlib
  568. $i "Check that the application was compiled correctly"
  569. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  570. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  571. {ok, Deps} = application:get_key($(APP), applications), \
  572. true = lists:member(cowlib, Deps), \
  573. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  574. halt()"
  575. core-deps-ignore: init
  576. $i "Bootstrap a new OTP library named $(APP)"
  577. $t mkdir $(APP)/
  578. $t cp ../erlang.mk $(APP)/
  579. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  580. $i "Add Cowboy to dependencies, Ranch to the ignore list and to test dependencies"
  581. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nIGNORE_DEPS = ranch\nTEST_DEPS = ranch\n"}' $(APP)/Makefile
  582. ifdef LEGACY
  583. $i "Add Cowboy to the applications key in the .app.src file"
  584. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  585. endif
  586. $i "Build the application"
  587. $t $(MAKE) -C $(APP) $v
  588. $i "Check that the correct dependencies were fetched"
  589. $t test -d $(APP)/deps/cowboy
  590. $t test -d $(APP)/deps/cowlib
  591. $t test ! -e $(APP)/deps/ranch
  592. $i "Build the test dependencies"
  593. $t $(MAKE) -C $(APP) test-deps $v
  594. $i "Check that the correct dependencies were fetched"
  595. $t test -d $(APP)/deps/ranch
  596. define add_dep_and_subdep
  597. $i "Bootstrap a new OTP library named $(APP)_$(1)subdep"
  598. $t mkdir $(APP)_$(1)subdep/
  599. $t cp ../erlang.mk $(APP)_$(1)subdep/
  600. $t $2 -C $(APP)_$(1)subdep --no-print-directory -f erlang.mk bootstrap-lib $$v
  601. $i "Create a Git repository for $(APP)_$(1)subdep"
  602. $t (cd $(APP)_$(1)subdep && \
  603. git init -q && \
  604. git config user.name "Testsuite" && \
  605. git config user.email "testsuite@erlang.mk" && \
  606. git add . && \
  607. git commit -q --no-gpg-sign -m "Initial commit")
  608. $i "Bootstrap a new OTP library named $(APP)_$(1)dep"
  609. $t mkdir $(APP)_$(1)dep/
  610. $t cp ../erlang.mk $(APP)_$(1)dep/
  611. $t $2 -C $(APP)_$(1)dep --no-print-directory -f erlang.mk bootstrap-lib $$v
  612. $i "Add $(APP)_$(1)subdep as a dependency"
  613. $t perl -ni.bak -e \
  614. 'print;if ($$.==1) {print "DEPS = $(1)subdep\ndep_$(1)subdep = git file://$(abspath $(APP)_$(1)subdep) master\n"}' \
  615. $(APP)_$(1)dep/Makefile
  616. $t rm $(APP)_$(1)dep/Makefile.bak
  617. $i "Create a Git repository for $(APP)_$(1)dep"
  618. $t (cd $(APP)_$(1)dep && \
  619. git init -q && \
  620. git config user.name "Testsuite" && \
  621. git config user.email "testsuite@erlang.mk" && \
  622. git add . && \
  623. git commit -q --no-gpg-sign -m "Initial commit")
  624. endef
  625. core-deps-list-deps: init
  626. # We pass $(MAKE) directly so that GNU Make can pass its context forward.
  627. # If we didn't then $(MAKE) would be expanded in the call without context.
  628. $(call add_dep_and_subdep,,$(MAKE))
  629. $(call add_dep_and_subdep,doc,$(MAKE))
  630. $(call add_dep_and_subdep,rel,$(MAKE))
  631. $(call add_dep_and_subdep,test,$(MAKE))
  632. $(call add_dep_and_subdep,shell,$(MAKE))
  633. $i "Bootstrap a new OTP library named $(APP)"
  634. $t mkdir $(APP)/
  635. $t cp ../erlang.mk $(APP)/
  636. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  637. $i "Add $(APP)-dep and $(APP)-testdep as a dependency"
  638. $t sed -i.bak '2i\
  639. DEPS = dep\
  640. DOC_DEPS = docdep\
  641. REL_DEPS = reldep\
  642. TEST_DEPS = testdep\
  643. SHELL_DEPS = shelldep\
  644. dep_dep = git file://$(abspath $(APP)_dep) master\
  645. dep_docdep = git file://$(abspath $(APP)_docdep) master\
  646. dep_reldep = git file://$(abspath $(APP)_reldep) master\
  647. dep_testdep = git file://$(abspath $(APP)_testdep) master\
  648. dep_shelldep = git file://$(abspath $(APP)_shelldep) master\
  649. ' $(APP)/Makefile
  650. $t rm $(APP)/Makefile.bak
  651. $i "Create a Git repository for $(APP)"
  652. $t (cd $(APP) && \
  653. git init -q && \
  654. git config user.name "Testsuite" && \
  655. git config user.email "testsuite@erlang.mk" && \
  656. git add . && \
  657. git commit -q --no-gpg-sign -m "Initial commit")
  658. $i "List application dependencies"
  659. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  660. $t test -d $(APP)/deps/subdep
  661. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  662. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  663. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  664. $i "List application doc dependencies"
  665. $t $(MAKE) -C $(APP) --no-print-directory list-doc-deps $v
  666. $t test -d $(APP)/deps/subdep
  667. $t test -d $(APP)/deps/docsubdep
  668. $t printf "%s\n%s\n%s\n%s\n" \
  669. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/docdep $(APP)/deps/docsubdep) \
  670. | sort > $(APP)/expected-doc-deps.txt
  671. $t cmp $(APP)/expected-doc-deps.txt $(APP)/.erlang.mk/recursive-doc-deps-list.log
  672. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  673. $i "List application rel dependencies"
  674. $t $(MAKE) -C $(APP) --no-print-directory list-rel-deps $v
  675. $t test -d $(APP)/deps/subdep
  676. $t test -d $(APP)/deps/relsubdep
  677. $t printf "%s\n%s\n%s\n%s\n" \
  678. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/reldep $(APP)/deps/relsubdep) \
  679. | sort > $(APP)/expected-rel-deps.txt
  680. $t cmp $(APP)/expected-rel-deps.txt $(APP)/.erlang.mk/recursive-rel-deps-list.log
  681. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  682. $i "List application test dependencies"
  683. $t $(MAKE) -C $(APP) --no-print-directory list-test-deps $v
  684. $t test -d $(APP)/deps/subdep
  685. $t test -d $(APP)/deps/testsubdep
  686. $t printf "%s\n%s\n%s\n%s\n" \
  687. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/testdep $(APP)/deps/testsubdep) \
  688. | sort > $(APP)/expected-test-deps.txt
  689. $t cmp $(APP)/expected-test-deps.txt $(APP)/.erlang.mk/recursive-test-deps-list.log
  690. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  691. $i "List application shell dependencies"
  692. $t $(MAKE) -C $(APP) --no-print-directory list-shell-deps $v
  693. $t test -d $(APP)/deps/subdep
  694. $t test -d $(APP)/deps/shellsubdep
  695. $t printf "%s\n%s\n%s\n%s\n" \
  696. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
  697. | sort > $(APP)/expected-shell-deps.txt
  698. $t cmp $(APP)/expected-shell-deps.txt $(APP)/.erlang.mk/recursive-shell-deps-list.log
  699. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  700. $i "List application all dependencies (all kinds)"
  701. $t $(MAKE) -C $(APP) --no-print-directory list-deps DEP_TYPES='doc rel test shell' $v
  702. $t test -d $(APP)/deps/subdep
  703. $t test -d $(APP)/deps/docsubdep
  704. $t test -d $(APP)/deps/relsubdep
  705. $t test -d $(APP)/deps/testsubdep
  706. $t test -d $(APP)/deps/shellsubdep
  707. $t printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
  708. $(abspath \
  709. $(APP)/deps/dep $(APP)/deps/subdep \
  710. $(APP)/deps/docdep $(APP)/deps/docsubdep \
  711. $(APP)/deps/reldep $(APP)/deps/relsubdep \
  712. $(APP)/deps/testdep $(APP)/deps/testsubdep \
  713. $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
  714. | sort > $(APP)/expected-all-deps.txt
  715. $t cmp $(APP)/expected-all-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  716. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  717. core-deps-list-deps-with-apps: init
  718. # We pass $(MAKE) directly so that GNU Make can pass its context forward.
  719. # If we didn't then $(MAKE) would be expanded in the call without context.
  720. $(call add_dep_and_subdep,,$(MAKE))
  721. $i "Bootstrap a new OTP library named $(APP)"
  722. $t mkdir $(APP)/
  723. $t cp ../erlang.mk $(APP)/
  724. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  725. $i "Bootstrap another APP named $(APP)_app in $(APP) repository"
  726. $t $(MAKE) -C $(APP) --no-print-directory new-lib in=my_app $v
  727. $i "Bootstrap another APP named $(APP)_dep_app in $(APP)_dep repository"
  728. $t $(MAKE) -C $(APP)_dep --no-print-directory new-lib in=my_dep_app $v
  729. $t sed -i.bak '2i\
  730. APPS_DIR := $$(CURDIR)/apps\
  731. LOCAL_DEPS = my_dep_app ssl\
  732. ' $(APP)_dep/Makefile
  733. $t echo 'unexport APPS_DIR' >> $(APP)_dep/Makefile
  734. $t rm $(APP)_dep/Makefile.bak
  735. $t cd $(APP)_dep && git add .
  736. $t cd $(APP)_dep && git commit -q --no-gpg-sign -m "Add application"
  737. $i "Add $(APP)-dep as a dependency"
  738. $t sed -i.bak '2i\
  739. DEPS = dep\
  740. dep_dep = git file://$(abspath $(APP)_dep) master\
  741. ' $(APP)/Makefile
  742. $t rm $(APP)/Makefile.bak
  743. $i "Create a Git repository for $(APP)"
  744. $t (cd $(APP) && \
  745. git init -q && \
  746. git config user.name "Testsuite" && \
  747. git config user.email "testsuite@erlang.mk" && \
  748. git add . && \
  749. git commit -q --no-gpg-sign -m "Initial commit")
  750. $i "List application dependencies ($(APP)_app is missing)"
  751. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  752. $t test -d $(APP)/deps/subdep
  753. $t printf "%s\n%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/dep/apps/my_dep_app $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  754. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  755. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  756. $i "Add $(APP)_app as a dependency"
  757. $t sed -i.bak '3i\
  758. LOCAL_DEPS = my_app\
  759. ' $(APP)/Makefile
  760. $t rm $(APP)/Makefile.bak
  761. $i "List application dependencies ($(APP)_app is listed)"
  762. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  763. $t test -d $(APP)/deps/subdep
  764. $t printf "%s\n%s\n%s\n%s\n" $(abspath $(APP)/apps/my_app $(APP)/deps/dep $(APP)/deps/dep/apps/my_dep_app $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  765. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  766. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  767. core-deps-list-deps-with-specified-full-var: init
  768. # We pass $(MAKE) directly so that GNU Make can pass its context forward.
  769. # If we didn't then $(MAKE) would be expanded in the call without context.
  770. $(call add_dep_and_subdep,,$(MAKE))
  771. $i "Bootstrap a new OTP library named $(APP)"
  772. $t mkdir $(APP)/
  773. $t cp ../erlang.mk $(APP)/
  774. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  775. $i "Add $(APP)-dep as a dependency"
  776. $t sed -i.bak '2i\
  777. DEPS = dep\
  778. dep_dep = git file://$(abspath $(APP)_dep) master\
  779. ' $(APP)/Makefile
  780. $t rm $(APP)/Makefile.bak
  781. $i "Create a Git repository for $(APP)"
  782. $t (cd $(APP) && \
  783. git init -q && \
  784. git config user.name "Testsuite" && \
  785. git config user.email "testsuite@erlang.mk" && \
  786. git add . && \
  787. git commit -q --no-gpg-sign -m "Initial commit")
  788. $i "Build application"
  789. $t $(MAKE) -C $(APP) --no-print-directory $v
  790. $t test -d $(APP)/deps/subdep
  791. $i "List application dependencies without FULL"
  792. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  793. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  794. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  795. $i "List application dependencies with empty FULL"
  796. $t $(MAKE) -C $(APP) --no-print-directory list-deps FULL= $v
  797. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  798. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  799. $i "List application dependencies with FULL=1"
  800. $t $(MAKE) -C $(APP) --no-print-directory list-deps FULL=1 $v
  801. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  802. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  803. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  804. core-deps-makefile-change: init
  805. $i "Bootstrap a new OTP application named $(APP)"
  806. $t mkdir $(APP)/
  807. $t cp ../erlang.mk $(APP)/
  808. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  809. $i "Build the application"
  810. $t $(MAKE) -C $(APP) $v
  811. $i "Add Cowlib to the list of dependencies"
  812. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  813. ifdef LEGACY
  814. $i "Add Cowlib to the applications key in the .app.src file"
  815. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  816. endif
  817. $i "Build the application again"
  818. $t $(MAKE) -C $(APP) $v
  819. $i "Check that Cowlib was included in the .app file"
  820. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  821. ok = application:load($(APP)), \
  822. {ok, Apps} = application:get_key($(APP), applications), \
  823. true = lists:member(cowlib, Apps), \
  824. halt()."
  825. core-deps-dep-makefile-change: init
  826. $i "Bootstrap a new OTP application named $(APP)"
  827. $t mkdir $(APP)/
  828. $t cp ../erlang.mk $(APP)/
  829. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  830. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  831. $t mkdir $(APP)/my_dep
  832. $t cp ../erlang.mk $(APP)/my_dep/
  833. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  834. $i "Add my_dep to the list of dependencies"
  835. # We use FORCE_REBUILD to ensure it gets rebuilt even on Windows.
  836. $t perl -ni.bak -e "print;if ($$.==1) {print \"DEPS = my_dep\ndep_my_dep = ln $(CURDIR)/$(APP)/my_dep/\nFORCE_REBUILD = my_dep\n\"}" $(APP)/Makefile
  837. ifdef LEGACY
  838. $i "Add my_dep to the applications key in the .app.src file"
  839. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  840. endif
  841. $i "Build the application"
  842. $t $(MAKE) -C $(APP) NO_AUTOPATCH=my_dep $v
  843. $i "Add Cowlib to the list of dependencies in my_dep"
  844. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib_commit = master\n"}' $(APP)/deps/my_dep/Makefile
  845. ifdef LEGACY
  846. $i "Add Cowlib to the applications key in my_dep's .app.src file"
  847. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/deps/my_dep/src/my_dep.app.src
  848. endif
  849. $i "Build the application again"
  850. $t $(MAKE) -C $(APP) $v
  851. $i "Check that Cowlib was included in my_dep's .app file"
  852. $t $(ERL) -pa $(APP)/deps/my_dep/ebin/ -eval " \
  853. ok = application:load(my_dep), \
  854. {ok, Apps} = application:get_key(my_dep, applications), \
  855. true = lists:member(cowlib, Apps), \
  856. halt()."
  857. core-deps-mv: init
  858. $i "Bootstrap a new OTP library named $(APP)"
  859. $t mkdir $(APP)/
  860. $t cp ../erlang.mk $(APP)/
  861. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  862. $i "Add Cowlib to the list of dependencies"
  863. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  864. $i "Build the application"
  865. $t $(MAKE) -C $(APP) $v
  866. $i "Check that all dependencies were fetched"
  867. $t test -d $(APP)/deps/cowlib
  868. $i "Move the application elsewhere"
  869. $t mv $(APP) $(APP)-moved
  870. $i "Build the application"
  871. $t $(MAKE) -C $(APP)-moved $v
  872. core-deps-mv-rebar: init
  873. $i "Bootstrap a new OTP library named $(APP)"
  874. $t mkdir $(APP)/
  875. $t cp ../erlang.mk $(APP)/
  876. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  877. $i "Add Lager to the list of dependencies"
  878. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile
  879. $i "Build the application"
  880. $t $(MAKE) -C $(APP) $v
  881. $i "Check that all dependencies were fetched"
  882. $t test -d $(APP)/deps/goldrush
  883. $t test -d $(APP)/deps/lager
  884. $i "Move the application elsewhere"
  885. $t mv $(APP) $(APP)-moved
  886. $i "Build the application"
  887. $t $(MAKE) -C $(APP)-moved $v
  888. # A lower-level dependency of the first dependency always
  889. # wins over a lower-level dependency of the second dependency.
  890. core-deps-order-first: init
  891. $i "Bootstrap a new OTP library named $(APP)"
  892. $t mkdir $(APP)/
  893. $t cp ../erlang.mk $(APP)/
  894. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  895. $i "Add Cowboy package and my_dep to the list of dependencies"
  896. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep cowboy\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  897. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  898. $t mkdir $(APP)/my_dep
  899. $t cp ../erlang.mk $(APP)/my_dep/
  900. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  901. $i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
  902. $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
  903. ifdef LEGACY
  904. $i "Add Cowboy and my_dep to the applications key in the .app.src file"
  905. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  906. endif
  907. $i "Build the application"
  908. $t $(MAKE) -C $(APP) $v
  909. $i "Check that all dependencies were fetched"
  910. $t test -d $(APP)/deps/cowboy
  911. $t test -d $(APP)/deps/cowlib
  912. $t test -d $(APP)/deps/my_dep
  913. $t test -d $(APP)/deps/ranch
  914. $i "Check that the application was compiled correctly"
  915. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  916. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, my_dep, ranch]], \
  917. {ok, Deps} = application:get_key($(APP), applications), \
  918. true = lists:member(cowboy, Deps), \
  919. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  920. halt()"
  921. # A higher-level dependency always wins.
  922. core-deps-order-top: init
  923. $i "Bootstrap a new OTP library named $(APP)"
  924. $t mkdir $(APP)/
  925. $t cp ../erlang.mk $(APP)/
  926. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  927. $i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
  928. $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
  929. ifdef LEGACY
  930. $i "Add Cowboy to the applications key in the .app.src file"
  931. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  932. endif
  933. $i "Build the application"
  934. $t $(MAKE) -C $(APP) $v
  935. $i "Check that all dependencies were fetched"
  936. $t test -d $(APP)/deps/cowboy
  937. $t test -d $(APP)/deps/cowlib
  938. $t test -d $(APP)/deps/ranch
  939. $i "Check that the application was compiled correctly"
  940. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  941. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  942. {ok, Deps} = application:get_key($(APP), applications), \
  943. true = lists:member(cowboy, Deps), \
  944. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  945. halt()"
  946. ifndef LEGACY
  947. core-deps-otp: init
  948. $i "Bootstrap a new OTP library named $(APP)"
  949. $t mkdir $(APP)/
  950. $t cp ../erlang.mk $(APP)/
  951. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  952. $i "Add Crypto to the list of OTP dependencies"
  953. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = crypto\n"}' $(APP)/Makefile
  954. $i "Build the application"
  955. $t $(MAKE) -C $(APP) $v
  956. $i "Check that no dependencies were fetched"
  957. $t test ! -e $(APP)/deps
  958. $i "Check that the application was compiled correctly"
  959. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  960. [ok = application:load(App) || App <- [$(APP), crypto]], \
  961. {ok, Deps} = application:get_key($(APP), applications), \
  962. true = lists:member(crypto, Deps), \
  963. halt()"
  964. endif
  965. core-deps-pkg: init
  966. $i "Bootstrap a new OTP library named $(APP)"
  967. $t mkdir $(APP)/
  968. $t cp ../erlang.mk $(APP)/
  969. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  970. $i "Add Cowboy to the list of dependencies"
  971. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  972. ifdef LEGACY
  973. $i "Add Cowboy to the applications key in the .app.src file"
  974. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  975. endif
  976. $i "Build the application"
  977. $t $(MAKE) -C $(APP) $v
  978. $i "Check that all dependencies were fetched"
  979. $t test -d $(APP)/deps/cowboy
  980. $t test -d $(APP)/deps/cowlib
  981. $t test -d $(APP)/deps/ranch
  982. $i "Check that the application was compiled correctly"
  983. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  984. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  985. {ok, Deps} = application:get_key($(APP), applications), \
  986. true = lists:member(cowboy, Deps), \
  987. halt()"
  988. core-deps-rel: init
  989. $i "Bootstrap a new release-enabled OTP library named $(APP)"
  990. $t mkdir $(APP)/
  991. $t cp ../erlang.mk $(APP)/
  992. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
  993. $i "Add Recon to the list of release dependencies"
  994. $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
  995. $i "Add Recon to the relx.config file"
  996. $t $(ERL) -eval " \
  997. {ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
  998. Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
  999. ok = file:write_file(\"$(APP)/relx.config\", \
  1000. lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
  1001. halt()"
  1002. $i "Build the application and its dependencies"
  1003. $t $(MAKE) -C $(APP) deps app $v
  1004. $i "Check that no dependencies were fetched"
  1005. $t test ! -e $(APP)/deps
  1006. $i "Check that the application was compiled correctly"
  1007. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1008. [ok = application:load(App) || App <- [$(APP)]], \
  1009. {ok, Deps} = application:get_key($(APP), applications), \
  1010. false = lists:member(recon, Deps), \
  1011. halt()"
  1012. $i "Build the release"
  1013. $t $(MAKE) -C $(APP) $v
  1014. $i "Check that all dependencies were fetched"
  1015. $t test -d $(APP)/deps/recon
  1016. $i "Check that the application was compiled correctly"
  1017. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1018. [ok = application:load(App) || App <- [$(APP), recon]], \
  1019. {ok, Deps} = application:get_key($(APP), applications), \
  1020. false = lists:member(recon, Deps), \
  1021. halt()"
  1022. # @todo Add check for MSYS2 when releases under Windows become usable.
  1023. # $i "Start the release and check that Recon is loaded"
  1024. ifeq ($(PLATFORM),msys2)
  1025. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
  1026. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
  1027. # $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
  1028. # application loaded_applications | grep recon`"
  1029. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
  1030. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
  1031. else
  1032. $i "Start the release and check that Recon is loaded"
  1033. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
  1034. $t apps="Node is not running!"; \
  1035. while test "$$apps" = "Node is not running!"; do \
  1036. apps=$$($(APP)/_rel/$(APP)_release/bin/$(APP)_release \
  1037. rpcterms \ application loaded_applications); \
  1038. done; \
  1039. echo "$$apps" | grep -q recon
  1040. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
  1041. endif
  1042. core-deps-search: init
  1043. $i "Bootstrap a new OTP library named $(APP)"
  1044. $t mkdir $(APP)/
  1045. $t cp ../erlang.mk $(APP)/
  1046. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1047. $i "Run 'make search' and check that it prints packages"
  1048. $t test -n "`$(MAKE) -C $(APP) search`"
  1049. $i "Run 'make search q=cowboy' and check that it prints packages"
  1050. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
  1051. core-deps-shell: init
  1052. $i "Bootstrap a new OTP library named $(APP)"
  1053. $t mkdir $(APP)/
  1054. $t cp ../erlang.mk $(APP)/
  1055. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1056. $i "Bootstrap a new OTP application named my_dep inside $(APP)"
  1057. $t mkdir $(APP)/my_dep
  1058. $t cp ../erlang.mk $(APP)/my_dep/
  1059. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap $v
  1060. $i "Add my_dep to the list of dependencies"
  1061. # We use FORCE_REBUILD to ensure it gets rebuilt even on Windows.
  1062. $t perl -ni.bak -e "print;if ($$.==1) {print \"SHELL_DEPS = my_dep\ndep_my_dep = ln $(CURDIR)/$(APP)/my_dep/\nFORCE_REBUILD = my_dep\n\"}" $(APP)/Makefile
  1063. $i "Build the application and its dependencies"
  1064. $t $(MAKE) -C $(APP) deps app $v
  1065. $i "Check that no dependencies were fetched"
  1066. $t test ! -e $(APP)/deps
  1067. $i "Check that the application was compiled correctly"
  1068. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1069. [ok = application:load(App) || App <- [$(APP)]], \
  1070. {ok, Deps} = application:get_key($(APP), applications), \
  1071. false = lists:member(my_dep, Deps), \
  1072. halt()"
  1073. $i "Run the shell"
  1074. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
  1075. ok = application:load($(APP)), \
  1076. ok = application:load(my_dep), \
  1077. halt()\"" $v
  1078. $i "Check that all dependencies were fetched"
  1079. $t test -d $(APP)/deps/my_dep
  1080. $i "Check that the application was compiled correctly"
  1081. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1082. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  1083. {ok, Deps} = application:get_key($(APP), applications), \
  1084. false = lists:member(my_dep, Deps), \
  1085. halt()"
  1086. core-deps-skip: init
  1087. $i "Bootstrap a new OTP library named $(APP)"
  1088. $t mkdir $(APP)/
  1089. $t cp ../erlang.mk $(APP)/
  1090. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1091. $i "Add Cowboy to the list of dependencies"
  1092. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  1093. ifdef LEGACY
  1094. $i "Add Cowboy to the applications key in the .app.src file"
  1095. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1096. endif
  1097. $i "Build the application with SKIP_DEPS=1"
  1098. $t $(MAKE) -C $(APP) SKIP_DEPS=1 $v
  1099. $i "Check that no dependencies were fetched"
  1100. $t test ! -e $(APP)/deps
  1101. $i "Build the application"
  1102. $t $(MAKE) -C $(APP) $v
  1103. $i "Check that all dependencies were fetched"
  1104. $t test -d $(APP)/deps/cowlib
  1105. $t test -d $(APP)/deps/cowboy
  1106. $t test -d $(APP)/deps/ranch
  1107. $i "Distclean with SKIP_DEPS=1"
  1108. $t $(MAKE) -C $(APP) distclean SKIP_DEPS=1 $v
  1109. $i "Check that no dependencies were removed"
  1110. $t test -d $(APP)/deps/cowlib
  1111. $t test -d $(APP)/deps/cowboy
  1112. $t test -d $(APP)/deps/ranch
  1113. core-deps-test: init
  1114. $i "Bootstrap a new OTP library named $(APP)"
  1115. $t mkdir $(APP)/
  1116. $t cp ../erlang.mk $(APP)/
  1117. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1118. $i "Generate .erl files"
  1119. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1120. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1121. $i "Add triq to the list of test dependencies"
  1122. $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = triq\n"}' $(APP)/Makefile
  1123. $i "Build the application and its dependencies"
  1124. $t $(MAKE) -C $(APP) deps app $v
  1125. $i "Check that no dependencies were fetched"
  1126. $t test ! -e $(APP)/deps
  1127. $i "Check that the application was compiled correctly"
  1128. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1129. [ok = application:load(App) || App <- [$(APP)]], \
  1130. {ok, Deps} = application:get_key($(APP), applications), \
  1131. false = lists:member(triq, Deps), \
  1132. halt()"
  1133. $i "Run tests"
  1134. $t $(MAKE) -C $(APP) tests $v
  1135. $i "Check that all dependencies were fetched"
  1136. $t test -d $(APP)/deps/triq
  1137. $i "Check that the application was compiled correctly"
  1138. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1139. [ok = application:load(App) || App <- [$(APP), triq]], \
  1140. {ok, Deps} = application:get_key($(APP), applications), \
  1141. false = lists:member(triq, Deps), \
  1142. halt()"