core_deps.mk 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373
  1. # Core: Packages and dependencies.
  2. CORE_DEPS_CASES = apps apps-conflict apps-deep-conflict apps-dir apps-dir-include-lib apps-new-app apps-new-lib apps-new-tpl apps-only autopatch-rebar build-c-8cc build-c-imagejs build-erl build-js dep-commit dir doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-git-submodule fetch-hex fetch-hg fetch-legacy fetch-svn ignore mv mv-rebar no-autopatch no-autopatch-erlang-mk no-autopatch-rebar order-first order-top otp pkg rel search shell skip test
  3. CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES))
  4. .PHONY: core-deps $(CORE_DEPS_TARGETS)
  5. core-deps: $(CORE_DEPS_TARGETS)
  6. core-deps-apps: build clean
  7. $i "Bootstrap a new OTP library named $(APP)"
  8. $t mkdir $(APP)/
  9. $t cp ../erlang.mk $(APP)/
  10. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  11. # Bootstrap the application manually to make sure it works as intended.
  12. $i "Bootstrap a repository-local application my_app"
  13. $t mkdir -p $(APP)/apps/my_app/src/
  14. $t touch $(APP)/apps/file.erl
  15. $t echo "DEPS = cowlib" > $(APP)/apps/my_app/Makefile
  16. $t echo "include ../../erlang.mk" >> $(APP)/apps/my_app/Makefile
  17. $t echo "-module(boy)." > $(APP)/apps/my_app/src/boy.erl
  18. $t echo "-module(girl)." > $(APP)/apps/my_app/src/girl.erl
  19. $i "Build the application"
  20. $t $(MAKE) -C $(APP) $v
  21. $i "Check that all compiled files exist"
  22. $t test -f $(APP)/$(APP).d
  23. $t test -f $(APP)/ebin/$(APP).app
  24. $t test -f $(APP)/apps/my_app/my_app.d
  25. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  26. $t test -f $(APP)/apps/my_app/ebin/boy.beam
  27. $t test -f $(APP)/apps/my_app/ebin/girl.beam
  28. $t test -d $(APP)/deps/cowlib
  29. # Applications in apps are compiled automatically but not added
  30. # to the application resource file unless they are listed in LOCAL_DEPS.
  31. $i "Check that the application was compiled correctly"
  32. $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
  33. [ok = application:load(App) || App <- [$(APP), my_app]], \
  34. {ok, Deps} = application:get_key($(APP), applications), \
  35. false = lists:member(my_app, Deps), \
  36. {ok, MyAppDeps} = application:get_key(my_app, applications), \
  37. true = lists:member(cowlib, MyAppDeps), \
  38. {ok, []} = application:get_key($(APP), modules), \
  39. {ok, Mods = [boy, girl]} = application:get_key(my_app, modules), \
  40. [{module, M} = code:load_file(M) || M <- Mods], \
  41. halt()"
  42. $i "Clean the application"
  43. $t $(MAKE) -C $(APP) clean $v
  44. $i "Check that Cowlib is still here"
  45. $t test -d $(APP)/deps/cowlib
  46. $i "Check that all relevant files were removed"
  47. $t test ! -e $(APP)/$(APP).d
  48. $t test ! -e $(APP)/ebin/$(APP).app
  49. $t test ! -e $(APP)/apps/my_app/my_app.d
  50. $t test ! -e $(APP)/apps/my_app/ebin/my_app.app
  51. $t test ! -e $(APP)/apps/my_app/ebin/boy.beam
  52. $t test ! -e $(APP)/apps/my_app/ebin/girl.beam
  53. $i "Distclean the application"
  54. $t $(MAKE) -C $(APP) distclean $v
  55. $i "Check that all relevant files were removed"
  56. $t test ! -e $(APP)/deps
  57. $i "Add my_app to the local dependencies"
  58. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = my_app\n"}' $(APP)/Makefile
  59. ifdef LEGACY
  60. $i "Add my_app to the applications key in the .app.src file"
  61. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_app,\n"}' $(APP)/src/$(APP).app.src
  62. endif
  63. $i "Build the application"
  64. $t $(MAKE) -C $(APP) $v
  65. $i "Check that all compiled files exist"
  66. $t test -f $(APP)/$(APP).d
  67. $t test -f $(APP)/ebin/$(APP).app
  68. $t test -f $(APP)/apps/my_app/my_app.d
  69. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  70. $t test -f $(APP)/apps/my_app/ebin/boy.beam
  71. $t test -f $(APP)/apps/my_app/ebin/girl.beam
  72. $t test -d $(APP)/deps/cowlib
  73. $i "Check that the application was compiled correctly"
  74. $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
  75. [ok = application:load(App) || App <- [$(APP), my_app]], \
  76. {ok, Deps} = application:get_key($(APP), applications), \
  77. true = lists:member(my_app, Deps), \
  78. {ok, MyAppDeps} = application:get_key(my_app, applications), \
  79. true = lists:member(cowlib, MyAppDeps), \
  80. {ok, []} = application:get_key($(APP), modules), \
  81. {ok, Mods = [boy, girl]} = application:get_key(my_app, modules), \
  82. [{module, M} = code:load_file(M) || M <- Mods], \
  83. halt()"
  84. core-deps-apps-conflict: build clean
  85. $i "Bootstrap a new OTP library named $(APP)"
  86. $t mkdir $(APP)/
  87. $t cp ../erlang.mk $(APP)/
  88. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  89. $i "Add Cowlib to the list of dependencies"
  90. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  91. $i "Create a new library Cowlib"
  92. $t $(MAKE) -C $(APP) new-lib in=cowlib $v
  93. $i "Check that building the application fails because of a conflict"
  94. $t ! $(MAKE) -C $(APP) $v
  95. $i "Check that Cowlib wasn't fetched"
  96. $t test ! -e $(APP)/deps/cowlib
  97. core-deps-apps-deep-conflict: build clean
  98. $i "Bootstrap a new OTP library named $(APP)"
  99. $t mkdir $(APP)/
  100. $t cp ../erlang.mk $(APP)/
  101. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  102. $i "Add Cowboy to the list of dependencies"
  103. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  104. $i "Create a new library Cowlib"
  105. $t $(MAKE) -C $(APP) new-lib in=cowlib $v
  106. $i "Check that building the application fails because of a conflict"
  107. $t ! $(MAKE) -C $(APP) $v
  108. $i "Check that Cowlib wasn't fetched"
  109. $t test ! -e $(APP)/deps/cowlib
  110. core-deps-apps-dir: build clean
  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 "Set a custom APPS_DIR"
  116. $t perl -ni.bak -e 'print;if ($$.==1) {print "APPS_DIR ?= \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
  117. $i "Create a new library my_app"
  118. $t $(MAKE) -C $(APP) new-lib in=my_app $v
  119. $i "Add Cowlib as a dependency to my_app"
  120. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/deep/libs/my_app/Makefile
  121. ifdef LEGACY
  122. $i "Add Cowlib to the applications key in the .app.src file"
  123. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/deep/libs/my_app/src/my_app.app.src
  124. endif
  125. $i "Generate .erl files in my_app"
  126. $t echo "-module(boy)." > $(APP)/deep/libs/my_app/src/boy.erl
  127. $t echo "-module(girl)." > $(APP)/deep/libs/my_app/src/girl.erl
  128. $i "Build the application"
  129. $t $(MAKE) -C $(APP) $v
  130. $i "Check that all compiled files exist"
  131. $t test -f $(APP)/$(APP).d
  132. $t test -f $(APP)/ebin/$(APP).app
  133. $t test -f $(APP)/deep/libs/my_app/my_app.d
  134. $t test -f $(APP)/deep/libs/my_app/ebin/my_app.app
  135. $t test -f $(APP)/deep/libs/my_app/ebin/boy.beam
  136. $t test -f $(APP)/deep/libs/my_app/ebin/girl.beam
  137. $t test -d $(APP)/deps/cowlib
  138. # Applications in apps are compiled automatically but not added
  139. # to the application resource file unless they are listed in LOCAL_DEPS.
  140. $i "Check that the application was compiled correctly"
  141. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deep/libs/*/ebin/ -eval " \
  142. [ok = application:load(App) || App <- [$(APP), my_app]], \
  143. {ok, Deps} = application:get_key($(APP), applications), \
  144. false = lists:member(my_app, Deps), \
  145. {ok, MyAppDeps} = application:get_key(my_app, applications), \
  146. true = lists:member(cowlib, MyAppDeps), \
  147. {ok, []} = application:get_key($(APP), modules), \
  148. {ok, Mods = [boy, girl]} = application:get_key(my_app, modules), \
  149. [{module, M} = code:load_file(M) || M <- Mods], \
  150. halt()"
  151. $i "Clean the application"
  152. $t $(MAKE) -C $(APP) clean $v
  153. $i "Check that Cowlib is still here"
  154. $t test -d $(APP)/deps/cowlib
  155. $i "Check that all relevant files were removed"
  156. $t test ! -e $(APP)/$(APP).d
  157. $t test ! -e $(APP)/ebin/$(APP).app
  158. $t test ! -e $(APP)/libs/my_app/my_app.d
  159. $t test ! -e $(APP)/libs/my_app/ebin/my_app.app
  160. $t test ! -e $(APP)/libs/my_app/ebin/boy.beam
  161. $t test ! -e $(APP)/libs/my_app/ebin/girl.beam
  162. $i "Distclean the application"
  163. $t $(MAKE) -C $(APP) distclean $v
  164. $i "Check that all relevant files were removed"
  165. $t test ! -e $(APP)/deps
  166. core-deps-apps-dir-include-lib: build clean
  167. $i "Bootstrap a new OTP library named $(APP)"
  168. $t mkdir $(APP)/
  169. $t cp ../erlang.mk $(APP)/
  170. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  171. $i "Set a custom APPS_DIR"
  172. $t perl -ni.bak -e 'print;if ($$.==1) {print "APPS_DIR ?= \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
  173. $i "Create new libraries boy_app and girl_app"
  174. $t $(MAKE) -C $(APP) new-lib in=boy_app $v
  175. $t $(MAKE) -C $(APP) new-lib in=girl_app $v
  176. $i "Generate .erl and .hrl files in apps with mutual include_lib()"
  177. $t echo '-module(boy). -include_lib("girl_app/include/girl.hrl").' > $(APP)/deep/libs/boy_app/src/boy.erl
  178. $t echo '-module(girl). -include_lib("boy_app/include/boy.hrl").' > $(APP)/deep/libs/girl_app/src/girl.erl
  179. $t mkdir -p $(APP)/deep/libs/boy_app/include
  180. $t echo '%% boy' > $(APP)/deep/libs/boy_app/include/boy.hrl
  181. $t mkdir -p $(APP)/deep/libs/girl_app/include
  182. $t echo '%% girl' > $(APP)/deep/libs/girl_app/include/girl.hrl
  183. $i "Build the application"
  184. $t $(MAKE) -C $(APP) $v
  185. $i "Check that all compiled files exist"
  186. $t test -f $(APP)/$(APP).d
  187. $t test -f $(APP)/ebin/$(APP).app
  188. $t test -f $(APP)/deep/libs/boy_app/boy_app.d
  189. $t test -f $(APP)/deep/libs/boy_app/ebin/boy_app.app
  190. $t test -f $(APP)/deep/libs/boy_app/ebin/boy.beam
  191. $t test -f $(APP)/deep/libs/girl_app/girl_app.d
  192. $t test -f $(APP)/deep/libs/girl_app/ebin/girl_app.app
  193. $t test -f $(APP)/deep/libs/girl_app/ebin/girl.beam
  194. $i "Distclean the application"
  195. $t $(MAKE) -C $(APP) distclean $v
  196. core-deps-apps-new-app: build clean
  197. $i "Bootstrap a new OTP library named $(APP)"
  198. $t mkdir $(APP)/
  199. $t cp ../erlang.mk $(APP)/
  200. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  201. $i "Create a new application my_app"
  202. $t $(MAKE) -C $(APP) new-app in=my_app $v
  203. $i "Check that all bootstrapped files exist"
  204. $t test -f $(APP)/apps/my_app/Makefile
  205. ifdef LEGACY
  206. $t test -f $(APP)/apps/my_app/src/my_app.app.src
  207. endif
  208. $t test -f $(APP)/apps/my_app/src/my_app_app.erl
  209. $t test -f $(APP)/apps/my_app/src/my_app_sup.erl
  210. $i "Create a new module my_server in my_app"
  211. $t $(MAKE) -C $(APP) new t=gen_server n=my_server in=my_app $v
  212. $i "Check that the file exists"
  213. $t test -f $(APP)/apps/my_app/src/my_server.erl
  214. $i "Build the application"
  215. $t $(MAKE) -C $(APP) $v
  216. $i "Check that all compiled files exist"
  217. $t test -f $(APP)/$(APP).d
  218. $t test -f $(APP)/ebin/$(APP).app
  219. $t test -f $(APP)/apps/my_app/my_app.d
  220. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  221. $t test -f $(APP)/apps/my_app/ebin/my_app_app.beam
  222. $t test -f $(APP)/apps/my_app/ebin/my_app_sup.beam
  223. $t test -f $(APP)/apps/my_app/ebin/my_server.beam
  224. $i "Check that the application was compiled correctly"
  225. $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
  226. ok = application:start(my_app), \
  227. {ok, [my_app_app, my_app_sup, my_server]} = application:get_key(my_app, modules), \
  228. {module, my_app_app} = code:load_file(my_app_app), \
  229. {module, my_app_sup} = code:load_file(my_app_sup), \
  230. {module, my_server} = code:load_file(my_server), \
  231. halt()"
  232. core-deps-apps-new-lib: build clean
  233. $i "Bootstrap a new OTP library named $(APP)"
  234. $t mkdir $(APP)/
  235. $t cp ../erlang.mk $(APP)/
  236. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  237. $i "Create a new application my_app"
  238. $t $(MAKE) -C $(APP) new-lib in=my_app $v
  239. $i "Check that all bootstrapped files exist"
  240. $t test -f $(APP)/apps/my_app/Makefile
  241. ifdef LEGACY
  242. $t test -f $(APP)/apps/my_app/src/my_app.app.src
  243. endif
  244. $i "Create a new module my_server in my_app"
  245. $t $(MAKE) -C $(APP) new t=gen_server n=my_server in=my_app $v
  246. $i "Check that the file exists"
  247. $t test -f $(APP)/apps/my_app/src/my_server.erl
  248. $i "Build the application"
  249. $t $(MAKE) -C $(APP) $v
  250. $i "Check that all compiled files exist"
  251. $t test -f $(APP)/$(APP).d
  252. $t test -f $(APP)/ebin/$(APP).app
  253. $t test -f $(APP)/apps/my_app/my_app.d
  254. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  255. $t test -f $(APP)/apps/my_app/ebin/my_server.beam
  256. $i "Check that the application was compiled correctly"
  257. $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
  258. ok = application:start(my_app), \
  259. {ok, [my_server]} = application:get_key(my_app, modules), \
  260. {module, my_server} = code:load_file(my_server), \
  261. halt()"
  262. core-deps-apps-new-tpl: build clean
  263. $i "Bootstrap a new OTP library named $(APP)"
  264. $t mkdir $(APP)/
  265. $t cp ../erlang.mk $(APP)/
  266. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  267. $i "Create a new library my_app"
  268. $t $(MAKE) -C $(APP) new-lib in=my_app $v
  269. $i "Generate one of each template"
  270. $t $(MAKE) -C $(APP) --no-print-directory new in=my_app t=gen_fsm n=my_fsm
  271. $t $(MAKE) -C $(APP) --no-print-directory new in=my_app t=gen_server n=my_server
  272. $t $(MAKE) -C $(APP) --no-print-directory new in=my_app t=supervisor n=my_sup
  273. # Here we disable warnings because templates contain missing behaviors.
  274. $i "Build the application"
  275. $t $(MAKE) -C $(APP)/apps/my_app ERLC_OPTS=+debug_info $v
  276. $i "Check that all compiled files exist"
  277. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  278. $t test -f $(APP)/apps/my_app/ebin/my_fsm.beam
  279. $t test -f $(APP)/apps/my_app/ebin/my_server.beam
  280. $t test -f $(APP)/apps/my_app/ebin/my_sup.beam
  281. $i "Check that all the modules can be loaded"
  282. $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
  283. ok = application:start(my_app), \
  284. {ok, Mods = [my_fsm, my_server, my_sup]} = application:get_key(my_app, modules), \
  285. [{module, M} = code:load_file(M) || M <- Mods], \
  286. halt()"
  287. core-deps-apps-only: build clean
  288. $i "Create a multi application repository with no root application"
  289. $t mkdir $(APP)/
  290. $t cp ../erlang.mk $(APP)/
  291. $t echo "include erlang.mk" > $(APP)/Makefile
  292. $i "Create a new application my_app"
  293. $t $(MAKE) -C $(APP) new-app in=my_app $v
  294. $i "Create a module my_server from gen_server template in my_app"
  295. $t $(MAKE) -C $(APP) new t=gen_server n=my_server in=my_app $v
  296. $i "Add Cowlib to the list of dependencies"
  297. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/apps/my_app/Makefile
  298. $i "Build the application"
  299. $t $(MAKE) -C $(APP) $v
  300. $i "Check that all compiled files exist"
  301. $t test -f $(APP)/apps/my_app/my_app.d
  302. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  303. $t test -f $(APP)/apps/my_app/ebin/my_app_app.beam
  304. $t test -f $(APP)/apps/my_app/ebin/my_app_sup.beam
  305. $t test -f $(APP)/apps/my_app/ebin/my_server.beam
  306. $t test -d $(APP)/deps/cowlib/
  307. $i "Check that the application was compiled correctly"
  308. $t $(ERL) -pa $(APP)/apps/*/ebin/ -eval " \
  309. ok = application:load(my_app), \
  310. {ok, Mods = [my_app_app, my_app_sup, my_server]} = application:get_key(my_app, modules), \
  311. [{module, M} = code:load_file(M) || M <- Mods], \
  312. halt()"
  313. $i "Clean the application"
  314. $t $(MAKE) -C $(APP) clean $v
  315. $i "Check that Cowlib is still here"
  316. $t test -d $(APP)/deps/cowlib
  317. $i "Check that all relevant files were removed"
  318. $t test ! -e $(APP)/apps/my_app/my_app.d
  319. $t test ! -e $(APP)/apps/my_app/ebin/my_app.app
  320. $t test ! -e $(APP)/apps/my_app/ebin/my_app_app.beam
  321. $t test ! -e $(APP)/apps/my_app/ebin/my_app_sup.beam
  322. $t test ! -e $(APP)/apps/my_app/ebin/my_server.beam
  323. $i "Distclean the application"
  324. $t $(MAKE) -C $(APP) distclean $v
  325. $i "Check that all relevant files were removed"
  326. $t test ! -e $(APP)/deps
  327. core-deps-autopatch-rebar: build clean
  328. $i "Bootstrap a new OTP library named $(APP)"
  329. $t mkdir $(APP)/
  330. $t cp ../erlang.mk $(APP)/
  331. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  332. $i "Add erlsha2 to the list of dependencies"
  333. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = erlsha2\n"}' $(APP)/Makefile
  334. $i "Build the application"
  335. $t $(MAKE) -C $(APP) $v
  336. $i "Check that erlsha2 was fetched and built"
  337. $t test -d $(APP)/deps/erlsha2
  338. $t test -f $(APP)/deps/erlsha2/ebin/erlsha2.beam
  339. ifneq ($(PLATFORM),msys2)
  340. $t test -f $(APP)/deps/erlsha2/priv/erlsha2_nif.so
  341. endif
  342. ifneq ($(PLATFORM),msys2)
  343. core-deps-build-c-8cc: 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 8cc to the list of build dependencies"
  349. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = 8cc\ndep_8cc = git https://github.com/rui314/8cc master\n"}' $(APP)/Makefile
  350. $i "Build the application"
  351. $t $(MAKE) -C $(APP) $v
  352. $i "Check that all dependencies were fetched"
  353. $t test -d $(APP)/deps/8cc
  354. $i "Check that 8cc can be started"
  355. $t $(APP)/deps/8cc/8cc -h $v
  356. $i "Check that the application was compiled correctly"
  357. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  358. [ok = application:load(App) || App <- [$(APP)]], \
  359. {ok, Deps} = application:get_key($(APP), applications), \
  360. false = lists:member('8cc', Deps), \
  361. halt()"
  362. endif
  363. ifneq ($(PLATFORM),freebsd)
  364. core-deps-build-c-imagejs: build clean
  365. $i "Bootstrap a new OTP library named $(APP)"
  366. $t mkdir $(APP)/
  367. $t cp ../erlang.mk $(APP)/
  368. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  369. $i "Add imagejs to the list of build dependencies"
  370. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = imagejs\ndep_imagejs = git https://github.com/jklmnn/imagejs master\n"}' $(APP)/Makefile
  371. $i "Build the application"
  372. $t $(MAKE) -C $(APP) $v
  373. $i "Check that all dependencies were fetched"
  374. $t test -d $(APP)/deps/imagejs
  375. $i "Check that imagejs works"
  376. $t $(APP)/deps/imagejs/imagejs bmp $(APP)/deps/imagejs/Makefile
  377. $t test -f $(APP)/deps/imagejs/Makefile.bmp
  378. $i "Check that the application was compiled correctly"
  379. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  380. [ok = application:load(App) || App <- [$(APP)]], \
  381. {ok, Deps} = application:get_key($(APP), applications), \
  382. false = lists:member(imagejs, Deps), \
  383. halt()"
  384. endif
  385. core-deps-build-erl: build clean
  386. $i "Bootstrap a new OTP library named $(APP)"
  387. $t mkdir $(APP)/
  388. $t cp ../erlang.mk $(APP)/
  389. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  390. $i "Add cowlib to the list of build dependencies"
  391. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = cowlib\n"}' $(APP)/Makefile
  392. $i "Build the application"
  393. $t $(MAKE) -C $(APP) $v
  394. $i "Check that all dependencies were fetched"
  395. $t test -d $(APP)/deps/cowlib
  396. $i "Check that the application was compiled correctly"
  397. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  398. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  399. {ok, Deps} = application:get_key($(APP), applications), \
  400. false = lists:member(cowlib, Deps), \
  401. halt()"
  402. core-deps-build-js: build clean
  403. $i "Bootstrap a new OTP library named $(APP)"
  404. $t mkdir $(APP)/
  405. $t cp ../erlang.mk $(APP)/
  406. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  407. $i "Add jquery to the list of build dependencies"
  408. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = jquery\ndep_jquery = git https://github.com/jquery/jquery master\n"}' $(APP)/Makefile
  409. $i "Build the application"
  410. $t $(MAKE) -C $(APP) $v
  411. $i "Check that all dependencies were fetched"
  412. $t test -d $(APP)/deps/jquery
  413. $i "Check that the application was compiled correctly"
  414. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  415. [ok = application:load(App) || App <- [$(APP)]], \
  416. {ok, Deps} = application:get_key($(APP), applications), \
  417. false = lists:member(jquery, Deps), \
  418. halt()"
  419. core-deps-dep-commit: build clean
  420. $i "Bootstrap a new OTP library named $(APP)"
  421. $t mkdir $(APP)/
  422. $t cp ../erlang.mk $(APP)/
  423. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  424. $i "Add Cowboy 1.0.0 to the list of dependencies"
  425. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 1.0.0\n"}' $(APP)/Makefile
  426. ifdef LEGACY
  427. $i "Add Cowboy to the applications key in the .app.src file"
  428. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  429. endif
  430. $i "Build the application"
  431. $t $(MAKE) -C $(APP) $v
  432. $i "Check that all dependencies were fetched"
  433. $t test -d $(APP)/deps/cowboy
  434. $t test -d $(APP)/deps/cowlib
  435. $t test -d $(APP)/deps/ranch
  436. $i "Check that the application was compiled correctly"
  437. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  438. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  439. {ok, Deps} = application:get_key($(APP), applications), \
  440. true = lists:member(cowboy, Deps), \
  441. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  442. halt()"
  443. core-deps-dir: build clean
  444. $i "Bootstrap a new OTP library named $(APP)"
  445. $t mkdir $(APP)/
  446. $t cp ../erlang.mk $(APP)/
  447. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  448. $i "Add Cowboy to the list of dependencies with a custom DEPS_DIR"
  449. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nDEPS_DIR ?= \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
  450. ifdef LEGACY
  451. $i "Add Cowboy to the applications key in the .app.src file"
  452. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  453. endif
  454. $i "Build the application"
  455. $t $(MAKE) -C $(APP) $v
  456. $i "Check that all dependencies were fetched in the custom DEPS_DIR"
  457. $t test -d $(APP)/deep/libs/cowboy
  458. $t test -d $(APP)/deep/libs/cowlib
  459. $t test -d $(APP)/deep/libs/ranch
  460. $i "Check that the application was compiled correctly"
  461. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deep/libs/*/ebin/ -eval " \
  462. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  463. {ok, Deps} = application:get_key($(APP), applications), \
  464. true = lists:member(cowboy, Deps), \
  465. halt()"
  466. core-deps-doc: build clean
  467. $i "Bootstrap a new OTP library named $(APP)"
  468. $t mkdir $(APP)/
  469. $t cp ../erlang.mk $(APP)/
  470. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  471. $i "Generate .erl files"
  472. $t echo "-module(boy)." > $(APP)/src/boy.erl
  473. $t echo "-module(girl)." > $(APP)/src/girl.erl
  474. $i "Add Edown as a documentation building dependency"
  475. $t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = edown\nEDOC_OPTS = {doclet, edown_doclet}\n"}' $(APP)/Makefile
  476. $i "Build the application"
  477. $t $(MAKE) -C $(APP) $v
  478. $i "Check that no dependencies were fetched"
  479. $t test ! -e $(APP)/deps
  480. $i "Check that the application was compiled correctly"
  481. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  482. [ok = application:load(App) || App <- [$(APP)]], \
  483. {ok, Deps} = application:get_key($(APP), applications), \
  484. false = lists:member(edown, Deps), \
  485. halt()"
  486. $i "Build the application documentation"
  487. $t $(MAKE) -C $(APP) edoc $v
  488. $i "Check that documentation dependencies were fetched"
  489. $t test -d $(APP)/deps/edown
  490. $i "Check the Edown generated Markdown documentation"
  491. $t test -f $(APP)/doc/boy.md
  492. $t test -f $(APP)/doc/girl.md
  493. core-deps-fetch-cp: build clean
  494. $i "Bootstrap a new OTP library named $(APP)"
  495. $t mkdir $(APP)/
  496. $t cp ../erlang.mk $(APP)/
  497. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  498. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  499. $t mkdir $(APP)/my_dep
  500. $t cp ../erlang.mk $(APP)/my_dep/
  501. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  502. $i "Add my_dep to the list of dependencies"
  503. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  504. ifdef LEGACY
  505. $i "Add my_dep to the applications key in the .app.src file"
  506. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  507. endif
  508. $i "Build the application"
  509. $t $(MAKE) -C $(APP) $v
  510. $i "Check that all dependencies were fetched"
  511. $t test -d $(APP)/deps/my_dep
  512. $i "Check that the application was compiled correctly"
  513. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  514. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  515. {ok, Deps} = application:get_key($(APP), applications), \
  516. true = lists:member(my_dep, Deps), \
  517. halt()"
  518. core-deps-fetch-custom: build clean
  519. $i "Bootstrap a new OTP library named $(APP)"
  520. $t mkdir $(APP)/
  521. $t cp ../erlang.mk $(APP)/
  522. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  523. $i "Add dependency boop using custom fetch method beep to the list of dependencies"
  524. $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
  525. ifdef LEGACY
  526. $i "Add boop to the applications key in the .app.src file"
  527. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tboop,\n"}' $(APP)/src/$(APP).app.src
  528. endif
  529. $i "Build the application"
  530. $t $(MAKE) -C $(APP) $v
  531. $i "Check that all dependencies were fetched"
  532. $t test -d $(APP)/deps/boop
  533. $i "Check that the application was compiled correctly"
  534. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  535. ok = application:load($(APP)), \
  536. {ok, Deps} = application:get_key($(APP), applications), \
  537. true = lists:member(boop, Deps), \
  538. halt()"
  539. core-deps-fetch-fail-bad: build clean
  540. $i "Bootstrap a new OTP library named $(APP)"
  541. $t mkdir $(APP)/
  542. $t cp ../erlang.mk $(APP)/
  543. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  544. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  545. $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
  546. $i "Check that building the application fails"
  547. $t ! $(MAKE) -C $(APP) $v
  548. core-deps-fetch-fail-unknown: build clean
  549. $i "Bootstrap a new OTP library named $(APP)"
  550. $t mkdir $(APP)/
  551. $t cp ../erlang.mk $(APP)/
  552. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  553. $i "Add an unknown application as a dependency"
  554. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = unknown\n"}' $(APP)/Makefile
  555. $i "Check that building the application fails"
  556. $t ! $(MAKE) -C $(APP) $v
  557. core-deps-fetch-git: build clean
  558. $i "Bootstrap a new OTP library named $(APP)"
  559. $t mkdir $(APP)/
  560. $t cp ../erlang.mk $(APP)/
  561. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  562. $i "Add Cowboy 1.0.0 to the list of dependencies"
  563. $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
  564. ifdef LEGACY
  565. $i "Add Cowboy to the applications key in the .app.src file"
  566. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  567. endif
  568. $i "Build the application"
  569. $t $(MAKE) -C $(APP) $v
  570. $i "Check that all dependencies were fetched"
  571. $t test -d $(APP)/deps/cowboy
  572. $t test -d $(APP)/deps/cowlib
  573. $t test -d $(APP)/deps/ranch
  574. $i "Check that the application was compiled correctly"
  575. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  576. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  577. {ok, Deps} = application:get_key($(APP), applications), \
  578. true = lists:member(cowboy, Deps), \
  579. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  580. halt()"
  581. core-deps-fetch-git-submodule: build clean
  582. $i "Bootstrap a new OTP library named $(APP)"
  583. $t mkdir $(APP)/
  584. $t cp ../erlang.mk $(APP)/
  585. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  586. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  587. $t mkdir $(APP)/my_dep
  588. $t cp ../erlang.mk $(APP)/my_dep/
  589. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  590. # Create an empty file so src/ gets committed.
  591. $t touch $(APP)/my_dep/src/README
  592. $t cd $(APP)/my_dep && \
  593. git init -q && \
  594. git config user.email "testsuite@erlang.mk" && \
  595. git config user.name "test suite" && \
  596. git add . && \
  597. git commit -q -m "Tests"
  598. $i "Add the submodule to my_dep"
  599. $t mkdir $(APP)/deps
  600. $t cd $(APP) && \
  601. git init -q && \
  602. git submodule -q add file://$(abspath $(APP)/my_dep) deps/my_dep && \
  603. git config user.email "testsuite@erlang.mk" && \
  604. git config user.name "test suite" && \
  605. git add . && \
  606. git commit -q -m "Tests"
  607. $i "Distclean the application"
  608. $t $(MAKE) -C $(APP) distclean $v
  609. $i "Add my_dep to the list of dependencies"
  610. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = git-submodule\n"}' $(APP)/Makefile
  611. ifdef LEGACY
  612. $i "Add my_dep to the applications key in the .app.src file"
  613. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  614. endif
  615. $i "Build the application"
  616. $t $(MAKE) -C $(APP) $v
  617. $i "Check that all dependencies were fetched"
  618. $t test -d $(APP)/deps/my_dep
  619. $i "Check that the application was compiled correctly"
  620. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  621. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  622. {ok, Deps} = application:get_key($(APP), applications), \
  623. true = lists:member(my_dep, Deps), \
  624. halt()"
  625. core-deps-fetch-hex: build clean
  626. $i "Bootstrap a new OTP library named $(APP)"
  627. $t mkdir $(APP)/
  628. $t cp ../erlang.mk $(APP)/
  629. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  630. $i "Add Cowboy 1.0.0 to the list of dependencies"
  631. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 1.0.0\n"}' $(APP)/Makefile
  632. ifdef LEGACY
  633. $i "Add Cowboy to the applications key in the .app.src file"
  634. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  635. endif
  636. $i "Build the application"
  637. $t $(MAKE) -C $(APP) $v
  638. $i "Check that all dependencies were fetched"
  639. $t test -d $(APP)/deps/cowboy
  640. $t test -d $(APP)/deps/cowlib
  641. $t test -d $(APP)/deps/ranch
  642. $i "Check that the application was compiled correctly"
  643. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  644. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  645. {ok, Deps} = application:get_key($(APP), applications), \
  646. true = lists:member(cowboy, Deps), \
  647. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  648. halt()"
  649. core-deps-fetch-hg: build clean
  650. $i "Bootstrap a new OTP library named $(APP)"
  651. $t mkdir $(APP)/
  652. $t cp ../erlang.mk $(APP)/
  653. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  654. $i "Add Ehsa 4.0.3 to the list of dependencies"
  655. $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
  656. ifdef LEGACY
  657. $i "Add ehsa to the applications key in the .app.src file"
  658. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tehsa,\n"}' $(APP)/src/$(APP).app.src
  659. endif
  660. $i "Build the application"
  661. $t $(MAKE) -C $(APP) $v
  662. $i "Check that all dependencies were fetched"
  663. $t test -d $(APP)/deps/ehsa
  664. $i "Check that the application was compiled correctly"
  665. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  666. [ok = application:load(App) || App <- [$(APP), ehsa]], \
  667. {ok, Deps} = application:get_key($(APP), applications), \
  668. true = lists:member(ehsa, Deps), \
  669. {ok, \"4.0.3\"} = application:get_key(ehsa, vsn), \
  670. halt()"
  671. # Legacy must fail for the top-level application, but work for dependencies.
  672. core-deps-fetch-legacy: build clean
  673. $i "Bootstrap a new OTP library named $(APP)"
  674. $t mkdir $(APP)/
  675. $t cp ../erlang.mk $(APP)/
  676. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  677. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  678. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
  679. $i "Check that building the application fails"
  680. $t ! $(MAKE) -C $(APP) $v
  681. $i "Check that building the application works with IS_DEP=1"
  682. $t $(MAKE) -C $(APP) IS_DEP=1 $v
  683. core-deps-fetch-svn: build clean
  684. $i "Bootstrap a new OTP library named $(APP)"
  685. $t mkdir $(APP)/
  686. $t cp ../erlang.mk $(APP)/
  687. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  688. $i "Add Cowlib 1.0.0 to the list of dependencies"
  689. $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
  690. ifdef LEGACY
  691. $i "Add Cowlib to the applications key in the .app.src file"
  692. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  693. endif
  694. $i "Build the application"
  695. $t $(MAKE) -C $(APP) $v
  696. $i "Check that all dependencies were fetched"
  697. $t test -d $(APP)/deps/cowlib
  698. $i "Check that the application was compiled correctly"
  699. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  700. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  701. {ok, Deps} = application:get_key($(APP), applications), \
  702. true = lists:member(cowlib, Deps), \
  703. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  704. halt()"
  705. core-deps-ignore: 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 Cowboy to dependencies, Ranch to the ignore list and to test dependencies"
  711. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nIGNORE_DEPS = ranch\nTEST_DEPS = ranch\n"}' $(APP)/Makefile
  712. ifdef LEGACY
  713. $i "Add Cowboy to the applications key in the .app.src file"
  714. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  715. endif
  716. $i "Build the application"
  717. $t $(MAKE) -C $(APP) $v
  718. $i "Check that the correct dependencies were fetched"
  719. $t test -d $(APP)/deps/cowboy
  720. $t test -d $(APP)/deps/cowlib
  721. $t test ! -e $(APP)/deps/ranch
  722. $i "Build the test dependencies"
  723. $t $(MAKE) -C $(APP) test-deps $v
  724. $i "Check that the correct dependencies were fetched"
  725. $t test -d $(APP)/deps/ranch
  726. core-deps-mv: build clean
  727. $i "Bootstrap a new OTP library named $(APP)"
  728. $t mkdir $(APP)/
  729. $t cp ../erlang.mk $(APP)/
  730. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  731. $i "Add Cowlib to the list of dependencies"
  732. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  733. $i "Build the application"
  734. $t $(MAKE) -C $(APP) $v
  735. $i "Check that all dependencies were fetched"
  736. $t test -d $(APP)/deps/cowlib
  737. $i "Move the application elsewhere"
  738. $t mv $(APP) $(APP)-moved
  739. $i "Build the application"
  740. $t $(MAKE) -C $(APP)-moved $v
  741. core-deps-mv-rebar: build clean
  742. $i "Bootstrap a new OTP library named $(APP)"
  743. $t mkdir $(APP)/
  744. $t cp ../erlang.mk $(APP)/
  745. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  746. $i "Add Lager to the list of dependencies"
  747. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile
  748. $i "Build the application"
  749. $t $(MAKE) -C $(APP) $v
  750. $i "Check that all dependencies were fetched"
  751. $t test -d $(APP)/deps/goldrush
  752. $t test -d $(APP)/deps/lager
  753. $i "Move the application elsewhere"
  754. $t mv $(APP) $(APP)-moved
  755. $i "Build the application"
  756. $t $(MAKE) -C $(APP)-moved $v
  757. # A lower-level dependency of the first dependency always
  758. # wins over a lower-level dependency of the second dependency.
  759. core-deps-order-first: build clean
  760. $i "Bootstrap a new OTP library named $(APP)"
  761. $t mkdir $(APP)/
  762. $t cp ../erlang.mk $(APP)/
  763. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  764. $i "Add Cowboy package and my_dep to the list of dependencies"
  765. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep cowboy\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  766. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  767. $t mkdir $(APP)/my_dep
  768. $t cp ../erlang.mk $(APP)/my_dep/
  769. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  770. $i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
  771. $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
  772. ifdef LEGACY
  773. $i "Add Cowboy and my_dep to the applications key in the .app.src file"
  774. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  775. endif
  776. $i "Build the application"
  777. $t $(MAKE) -C $(APP) $v
  778. $i "Check that all dependencies were fetched"
  779. $t test -d $(APP)/deps/cowboy
  780. $t test -d $(APP)/deps/cowlib
  781. $t test -d $(APP)/deps/my_dep
  782. $t test -d $(APP)/deps/ranch
  783. $i "Check that the application was compiled correctly"
  784. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  785. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, my_dep, ranch]], \
  786. {ok, Deps} = application:get_key($(APP), applications), \
  787. true = lists:member(cowboy, Deps), \
  788. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  789. halt()"
  790. # A higher-level dependency always wins.
  791. core-deps-order-top: build clean
  792. $i "Bootstrap a new OTP library named $(APP)"
  793. $t mkdir $(APP)/
  794. $t cp ../erlang.mk $(APP)/
  795. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  796. $i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
  797. $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
  798. ifdef LEGACY
  799. $i "Add Cowboy to the applications key in the .app.src file"
  800. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  801. endif
  802. $i "Build the application"
  803. $t $(MAKE) -C $(APP) $v
  804. $i "Check that all dependencies were fetched"
  805. $t test -d $(APP)/deps/cowboy
  806. $t test -d $(APP)/deps/cowlib
  807. $t test -d $(APP)/deps/ranch
  808. $i "Check that the application was compiled correctly"
  809. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  810. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  811. {ok, Deps} = application:get_key($(APP), applications), \
  812. true = lists:member(cowboy, Deps), \
  813. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  814. halt()"
  815. core-deps-no-autopatch: build clean
  816. $i "Bootstrap a new OTP library named $(APP)"
  817. $t mkdir $(APP)/
  818. $t cp ../erlang.mk $(APP)/
  819. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  820. $i "Add Cowboy to the list of dependencies and Cowlib to the NO_AUTOPATCH list"
  821. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nNO_AUTOPATCH = cowlib\n"}' $(APP)/Makefile
  822. $i "Build the application"
  823. $t $(MAKE) -C $(APP) $v
  824. $i "Check that all dependencies were fetched"
  825. $t test -d $(APP)/deps/cowboy
  826. $t test -d $(APP)/deps/cowlib
  827. $t test -d $(APP)/deps/ranch
  828. $i "Check that Cowlib was not autopatched"
  829. $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
  830. core-deps-no-autopatch-erlang-mk: build clean
  831. $i "Bootstrap a new OTP library named $(APP)"
  832. $t mkdir $(APP)/
  833. $t cp ../erlang.mk $(APP)/
  834. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  835. $i "Add Cowlib to the list of dependencies and set NO_AUTOPATCH_ERLANG_MK=1"
  836. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\nNO_AUTOPATCH_ERLANG_MK = 1\n"}' $(APP)/Makefile
  837. $i "Build the application"
  838. $t $(MAKE) -C $(APP) $v
  839. $i "Check that all dependencies were fetched"
  840. $t test -d $(APP)/deps/cowlib
  841. $i "Check that Erlang.mk was not autopatched"
  842. $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
  843. core-deps-no-autopatch-rebar: build clean
  844. $i "Bootstrap a new OTP library named $(APP)"
  845. $t mkdir $(APP)/
  846. $t cp ../erlang.mk $(APP)/
  847. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  848. $i "Add Lager to the list of dependencies and to the NO_AUTOPATCH list"
  849. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\nNO_AUTOPATCH = lager\n"}' $(APP)/Makefile
  850. $i "Build the application"
  851. $t $(MAKE) -C $(APP) $v
  852. $i "Check that all dependencies were fetched"
  853. $t test -d $(APP)/deps/goldrush
  854. $t test -d $(APP)/deps/lager
  855. $i "Check that Lager was not autopatched"
  856. $t if grep -q erlang\.mk $(APP)/deps/goldrush/Makefile; then false; fi
  857. $t if grep -q erlang\.mk $(APP)/deps/lager/Makefile; then false; fi
  858. ifndef LEGACY
  859. core-deps-otp: build clean
  860. $i "Bootstrap a new OTP library named $(APP)"
  861. $t mkdir $(APP)/
  862. $t cp ../erlang.mk $(APP)/
  863. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  864. $i "Add Crypto to the list of OTP dependencies"
  865. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = crypto\n"}' $(APP)/Makefile
  866. $i "Build the application"
  867. $t $(MAKE) -C $(APP) $v
  868. $i "Check that no dependencies were fetched"
  869. $t test ! -e $(APP)/deps
  870. $i "Check that the application was compiled correctly"
  871. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  872. [ok = application:load(App) || App <- [$(APP), crypto]], \
  873. {ok, Deps} = application:get_key($(APP), applications), \
  874. true = lists:member(crypto, Deps), \
  875. halt()"
  876. endif
  877. core-deps-pkg: build clean
  878. $i "Bootstrap a new OTP library named $(APP)"
  879. $t mkdir $(APP)/
  880. $t cp ../erlang.mk $(APP)/
  881. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  882. $i "Add Cowboy to the list of dependencies"
  883. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  884. ifdef LEGACY
  885. $i "Add Cowboy to the applications key in the .app.src file"
  886. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  887. endif
  888. $i "Build the application"
  889. $t $(MAKE) -C $(APP) $v
  890. $i "Check that all dependencies were fetched"
  891. $t test -d $(APP)/deps/cowboy
  892. $t test -d $(APP)/deps/cowlib
  893. $t test -d $(APP)/deps/ranch
  894. $i "Check that the application was compiled correctly"
  895. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  896. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  897. {ok, Deps} = application:get_key($(APP), applications), \
  898. true = lists:member(cowboy, Deps), \
  899. halt()"
  900. core-deps-rel: build clean
  901. $i "Bootstrap a new release-enabled OTP library named $(APP)"
  902. $t mkdir $(APP)/
  903. $t cp ../erlang.mk $(APP)/
  904. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
  905. $i "Add Recon to the list of release dependencies"
  906. $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
  907. $i "Add Recon to the relx.config file"
  908. $t $(ERL) -eval " \
  909. {ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
  910. Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
  911. ok = file:write_file(\"$(APP)/relx.config\", \
  912. lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
  913. halt()"
  914. $i "Build the application and its dependencies"
  915. $t $(MAKE) -C $(APP) deps app $v
  916. $i "Check that no dependencies were fetched"
  917. $t test ! -e $(APP)/deps
  918. $i "Check that the application was compiled correctly"
  919. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  920. [ok = application:load(App) || App <- [$(APP)]], \
  921. {ok, Deps} = application:get_key($(APP), applications), \
  922. false = lists:member(recon, Deps), \
  923. halt()"
  924. $i "Build the release"
  925. $t $(MAKE) -C $(APP) $v
  926. $i "Check that all dependencies were fetched"
  927. $t test -d $(APP)/deps/recon
  928. $i "Check that the application was compiled correctly"
  929. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  930. [ok = application:load(App) || App <- [$(APP), recon]], \
  931. {ok, Deps} = application:get_key($(APP), applications), \
  932. false = lists:member(recon, Deps), \
  933. halt()"
  934. # @todo Add check for MSYS2 when releases under Windows become usable.
  935. # $i "Start the release and check that Recon is loaded"
  936. ifeq ($(PLATFORM),msys2)
  937. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
  938. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
  939. # $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
  940. # application loaded_applications | grep recon`"
  941. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
  942. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
  943. else
  944. $i "Start the release and check that Recon is loaded"
  945. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
  946. $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release rpcterms \
  947. application loaded_applications | grep recon`"
  948. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
  949. endif
  950. core-deps-search: build clean
  951. $i "Bootstrap a new OTP library named $(APP)"
  952. $t mkdir $(APP)/
  953. $t cp ../erlang.mk $(APP)/
  954. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  955. $i "Run 'make search' and check that it prints packages"
  956. $t test -n "`$(MAKE) -C $(APP) search`"
  957. $i "Run 'make search q=cowboy' and check that it prints packages"
  958. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
  959. core-deps-shell: build clean
  960. $i "Bootstrap a new OTP library named $(APP)"
  961. $t mkdir $(APP)/
  962. $t cp ../erlang.mk $(APP)/
  963. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  964. $i "Add TDDReloader to the list of shell dependencies"
  965. $t perl -ni.bak -e 'print;if ($$.==1) {print "SHELL_DEPS = tddreloader\n"}' $(APP)/Makefile
  966. $i "Build the application and its dependencies"
  967. $t $(MAKE) -C $(APP) deps app $v
  968. $i "Check that no dependencies were fetched"
  969. $t test ! -e $(APP)/deps
  970. $i "Check that the application was compiled correctly"
  971. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  972. [ok = application:load(App) || App <- [$(APP)]], \
  973. {ok, Deps} = application:get_key($(APP), applications), \
  974. false = lists:member(tddreloader, Deps), \
  975. halt()"
  976. $i "Run the shell"
  977. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
  978. ok = application:load($(APP)), \
  979. ok = application:load(tddreloader), \
  980. halt()\"" $v
  981. $i "Check that all dependencies were fetched"
  982. $t test -d $(APP)/deps/tddreloader
  983. $i "Check that the application was compiled correctly"
  984. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  985. [ok = application:load(App) || App <- [$(APP), tddreloader]], \
  986. {ok, Deps} = application:get_key($(APP), applications), \
  987. false = lists:member(tddreloader, Deps), \
  988. halt()"
  989. core-deps-skip: build clean
  990. $i "Bootstrap a new OTP library named $(APP)"
  991. $t mkdir $(APP)/
  992. $t cp ../erlang.mk $(APP)/
  993. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  994. $i "Add Cowboy to the list of dependencies"
  995. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  996. ifdef LEGACY
  997. $i "Add Cowboy to the applications key in the .app.src file"
  998. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  999. endif
  1000. $i "Build the application with SKIP_DEPS=1"
  1001. $t $(MAKE) -C $(APP) SKIP_DEPS=1 $v
  1002. $i "Check that no dependencies were fetched"
  1003. $t test ! -e $(APP)/deps
  1004. $i "Build the application"
  1005. $t $(MAKE) -C $(APP) $v
  1006. $i "Check that all dependencies were fetched"
  1007. $t test -d $(APP)/deps/cowlib
  1008. $t test -d $(APP)/deps/cowboy
  1009. $t test -d $(APP)/deps/ranch
  1010. $i "Distclean with SKIP_DEPS=1"
  1011. $t $(MAKE) -C $(APP) distclean SKIP_DEPS=1 $v
  1012. $i "Check that no dependencies were removed"
  1013. $t test -d $(APP)/deps/cowlib
  1014. $t test -d $(APP)/deps/cowboy
  1015. $t test -d $(APP)/deps/ranch
  1016. core-deps-test: build clean
  1017. $i "Bootstrap a new OTP library named $(APP)"
  1018. $t mkdir $(APP)/
  1019. $t cp ../erlang.mk $(APP)/
  1020. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1021. $i "Generate .erl files"
  1022. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1023. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1024. $i "Add triq to the list of test dependencies"
  1025. $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = triq\n"}' $(APP)/Makefile
  1026. $i "Build the application and its dependencies"
  1027. $t $(MAKE) -C $(APP) deps app $v
  1028. $i "Check that no dependencies were fetched"
  1029. $t test ! -e $(APP)/deps
  1030. $i "Check that the application was compiled correctly"
  1031. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1032. [ok = application:load(App) || App <- [$(APP)]], \
  1033. {ok, Deps} = application:get_key($(APP), applications), \
  1034. false = lists:member(triq, Deps), \
  1035. halt()"
  1036. $i "Run tests"
  1037. $t $(MAKE) -C $(APP) tests $v
  1038. $i "Check that all dependencies were fetched"
  1039. $t test -d $(APP)/deps/triq
  1040. $i "Check that the application was compiled correctly"
  1041. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1042. [ok = application:load(App) || App <- [$(APP), triq]], \
  1043. {ok, Deps} = application:get_key($(APP), applications), \
  1044. false = lists:member(triq, Deps), \
  1045. halt()"