core_deps.mk 43 KB

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