core_deps.mk 42 KB

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