core_deps.mk 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325
  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-git-submodule fetch-hex fetch-hg fetch-legacy fetch-svn ignore mv mv-rebar no-autopatch no-autopatch-erlang-mk no-autopatch-rebar order-first order-top otp pkg rel search shell skip test
  3. CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES))
  4. 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-git-submodule: build clean-core-deps-fetch-git-submodule
  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 "Bootstrap a new OTP library named my_dep inside $(APP)"
  550. $t mkdir $(APP)/my_dep
  551. $t cp ../erlang.mk $(APP)/my_dep/
  552. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  553. # Create an empty file so src/ gets committed.
  554. $t touch $(APP)/my_dep/src/README
  555. $t cd $(APP)/my_dep && \
  556. git init -q && \
  557. git config user.email "testsuite@erlang.mk" && \
  558. git config user.name "test suite" && \
  559. git add . && \
  560. git commit -q -m "Tests"
  561. $i "Add the submodule to my_dep"
  562. $t mkdir $(APP)/deps
  563. $t cd $(APP) && \
  564. git init -q && \
  565. git submodule -q add file://$(abspath $(APP)/my_dep) deps/my_dep && \
  566. git config user.email "testsuite@erlang.mk" && \
  567. git config user.name "test suite" && \
  568. git add . && \
  569. git commit -q -m "Tests"
  570. $i "Distclean the application"
  571. $t $(MAKE) -C $(APP) distclean $v
  572. $i "Add my_dep to the list of dependencies"
  573. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = git-submodule\n"}' $(APP)/Makefile
  574. ifdef LEGACY
  575. $i "Add my_dep to the applications key in the .app.src file"
  576. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  577. endif
  578. $i "Build the application"
  579. $t $(MAKE) -C $(APP) $v
  580. $i "Check that all dependencies were fetched"
  581. $t test -d $(APP)/deps/my_dep
  582. $i "Check that the application was compiled correctly"
  583. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  584. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  585. {ok, Deps} = application:get_key($(APP), applications), \
  586. true = lists:member(my_dep, Deps), \
  587. halt()"
  588. core-deps-fetch-hex: build clean-core-deps-fetch-hex
  589. $i "Bootstrap a new OTP library named $(APP)"
  590. $t mkdir $(APP)/
  591. $t cp ../erlang.mk $(APP)/
  592. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  593. $i "Add Cowboy 1.0.0 to the list of dependencies"
  594. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 1.0.0\n"}' $(APP)/Makefile
  595. ifdef LEGACY
  596. $i "Add Cowboy to the applications key in the .app.src file"
  597. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  598. endif
  599. $i "Build the application"
  600. $t $(MAKE) -C $(APP) $v
  601. $i "Check that all dependencies were fetched"
  602. $t test -d $(APP)/deps/cowboy
  603. $t test -d $(APP)/deps/cowlib
  604. $t test -d $(APP)/deps/ranch
  605. $i "Check that the application was compiled correctly"
  606. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  607. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  608. {ok, Deps} = application:get_key($(APP), applications), \
  609. true = lists:member(cowboy, Deps), \
  610. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  611. halt()"
  612. core-deps-fetch-hg: build clean-core-deps-fetch-hg
  613. $i "Bootstrap a new OTP library named $(APP)"
  614. $t mkdir $(APP)/
  615. $t cp ../erlang.mk $(APP)/
  616. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  617. $i "Add Ehsa 4.0.3 to the list of dependencies"
  618. $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
  619. ifdef LEGACY
  620. $i "Add ehsa to the applications key in the .app.src file"
  621. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tehsa,\n"}' $(APP)/src/$(APP).app.src
  622. endif
  623. $i "Build the application"
  624. $t $(MAKE) -C $(APP) $v
  625. $i "Check that all dependencies were fetched"
  626. $t test -d $(APP)/deps/ehsa
  627. $i "Check that the application was compiled correctly"
  628. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  629. [ok = application:load(App) || App <- [$(APP), ehsa]], \
  630. {ok, Deps} = application:get_key($(APP), applications), \
  631. true = lists:member(ehsa, Deps), \
  632. {ok, \"4.0.3\"} = application:get_key(ehsa, vsn), \
  633. halt()"
  634. # Legacy must fail for the top-level application, but work for dependencies.
  635. core-deps-fetch-legacy: build clean-core-deps-fetch-legacy
  636. $i "Bootstrap a new OTP library named $(APP)"
  637. $t mkdir $(APP)/
  638. $t cp ../erlang.mk $(APP)/
  639. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  640. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  641. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
  642. $i "Check that building the application fails"
  643. $t ! $(MAKE) -C $(APP) $v
  644. $i "Check that building the application works with IS_DEP=1"
  645. $t $(MAKE) -C $(APP) IS_DEP=1 $v
  646. core-deps-fetch-svn: build clean-core-deps-fetch-svn
  647. $i "Bootstrap a new OTP library named $(APP)"
  648. $t mkdir $(APP)/
  649. $t cp ../erlang.mk $(APP)/
  650. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  651. $i "Add Cowlib 1.0.0 to the list of dependencies"
  652. $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
  653. ifdef LEGACY
  654. $i "Add Cowlib to the applications key in the .app.src file"
  655. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  656. endif
  657. $i "Build the application"
  658. $t $(MAKE) -C $(APP) $v
  659. $i "Check that all dependencies were fetched"
  660. $t test -d $(APP)/deps/cowlib
  661. $i "Check that the application was compiled correctly"
  662. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  663. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  664. {ok, Deps} = application:get_key($(APP), applications), \
  665. true = lists:member(cowlib, Deps), \
  666. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  667. halt()"
  668. core-deps-ignore: build clean-core-deps-ignore
  669. $i "Bootstrap a new OTP library named $(APP)"
  670. $t mkdir $(APP)/
  671. $t cp ../erlang.mk $(APP)/
  672. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  673. $i "Add Cowboy to dependencies, Ranch to the ignore list and to test dependencies"
  674. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nIGNORE_DEPS = ranch\nTEST_DEPS = ranch\n"}' $(APP)/Makefile
  675. ifdef LEGACY
  676. $i "Add Cowboy to the applications key in the .app.src file"
  677. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  678. endif
  679. $i "Build the application"
  680. $t $(MAKE) -C $(APP) $v
  681. $i "Check that the correct dependencies were fetched"
  682. $t test -d $(APP)/deps/cowboy
  683. $t test -d $(APP)/deps/cowlib
  684. $t test ! -e $(APP)/deps/ranch
  685. $i "Build the test dependencies"
  686. $t $(MAKE) -C $(APP) test-deps $v
  687. $i "Check that the correct dependencies were fetched"
  688. $t test -d $(APP)/deps/ranch
  689. core-deps-mv: build clean-core-deps-mv clean-core-deps-mv-moved
  690. $i "Bootstrap a new OTP library named $(APP)"
  691. $t mkdir $(APP)/
  692. $t cp ../erlang.mk $(APP)/
  693. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  694. $i "Add Cowlib to the list of dependencies"
  695. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  696. $i "Build the application"
  697. $t $(MAKE) -C $(APP) $v
  698. $i "Check that all dependencies were fetched"
  699. $t test -d $(APP)/deps/cowlib
  700. $i "Move the application elsewhere"
  701. $t mv $(APP) $(APP)-moved
  702. $i "Build the application"
  703. $t $(MAKE) -C $(APP)-moved $v
  704. core-deps-mv-rebar: build clean-core-deps-mv-rebar clean-core-deps-mv-rebar-moved
  705. $i "Bootstrap a new OTP library named $(APP)"
  706. $t mkdir $(APP)/
  707. $t cp ../erlang.mk $(APP)/
  708. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  709. $i "Add Lager to the list of dependencies"
  710. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile
  711. $i "Build the application"
  712. $t $(MAKE) -C $(APP) $v
  713. $i "Check that all dependencies were fetched"
  714. $t test -d $(APP)/deps/goldrush
  715. $t test -d $(APP)/deps/lager
  716. $i "Move the application elsewhere"
  717. $t mv $(APP) $(APP)-moved
  718. $i "Build the application"
  719. $t $(MAKE) -C $(APP)-moved $v
  720. # A lower-level dependency of the first dependency always
  721. # wins over a lower-level dependency of the second dependency.
  722. core-deps-order-first: build clean-core-deps-order-first
  723. $i "Bootstrap a new OTP library named $(APP)"
  724. $t mkdir $(APP)/
  725. $t cp ../erlang.mk $(APP)/
  726. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  727. $i "Add Cowboy package and my_dep to the list of dependencies"
  728. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep cowboy\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  729. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  730. $t mkdir $(APP)/my_dep
  731. $t cp ../erlang.mk $(APP)/my_dep/
  732. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  733. $i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
  734. $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
  735. ifdef LEGACY
  736. $i "Add Cowboy and my_dep to the applications key in the .app.src file"
  737. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  738. endif
  739. $i "Build the application"
  740. $t $(MAKE) -C $(APP) $v
  741. $i "Check that all dependencies were fetched"
  742. $t test -d $(APP)/deps/cowboy
  743. $t test -d $(APP)/deps/cowlib
  744. $t test -d $(APP)/deps/my_dep
  745. $t test -d $(APP)/deps/ranch
  746. $i "Check that the application was compiled correctly"
  747. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  748. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, my_dep, ranch]], \
  749. {ok, Deps} = application:get_key($(APP), applications), \
  750. true = lists:member(cowboy, Deps), \
  751. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  752. halt()"
  753. # A higher-level dependency always wins.
  754. core-deps-order-top: build clean-core-deps-order-top
  755. $i "Bootstrap a new OTP library named $(APP)"
  756. $t mkdir $(APP)/
  757. $t cp ../erlang.mk $(APP)/
  758. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  759. $i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
  760. $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
  761. ifdef LEGACY
  762. $i "Add Cowboy to the applications key in the .app.src file"
  763. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  764. endif
  765. $i "Build the application"
  766. $t $(MAKE) -C $(APP) $v
  767. $i "Check that all dependencies were fetched"
  768. $t test -d $(APP)/deps/cowboy
  769. $t test -d $(APP)/deps/cowlib
  770. $t test -d $(APP)/deps/ranch
  771. $i "Check that the application was compiled correctly"
  772. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  773. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  774. {ok, Deps} = application:get_key($(APP), applications), \
  775. true = lists:member(cowboy, Deps), \
  776. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  777. halt()"
  778. core-deps-no-autopatch: build clean-core-deps-no-autopatch
  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 Cowboy to the list of dependencies and Cowlib to the NO_AUTOPATCH list"
  784. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nNO_AUTOPATCH = cowlib\n"}' $(APP)/Makefile
  785. $i "Build the application"
  786. $t $(MAKE) -C $(APP) $v
  787. $i "Check that all dependencies were fetched"
  788. $t test -d $(APP)/deps/cowboy
  789. $t test -d $(APP)/deps/cowlib
  790. $t test -d $(APP)/deps/ranch
  791. $i "Check that Cowlib was not autopatched"
  792. $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
  793. core-deps-no-autopatch-erlang-mk: build clean-core-deps-no-autopatch-erlang-mk
  794. $i "Bootstrap a new OTP library named $(APP)"
  795. $t mkdir $(APP)/
  796. $t cp ../erlang.mk $(APP)/
  797. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  798. $i "Add Cowlib to the list of dependencies and set NO_AUTOPATCH_ERLANG_MK=1"
  799. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\nNO_AUTOPATCH_ERLANG_MK = 1\n"}' $(APP)/Makefile
  800. $i "Build the application"
  801. $t $(MAKE) -C $(APP) $v
  802. $i "Check that all dependencies were fetched"
  803. $t test -d $(APP)/deps/cowlib
  804. $i "Check that Erlang.mk was not autopatched"
  805. $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
  806. core-deps-no-autopatch-rebar: build clean-core-deps-no-autopatch-rebar
  807. $i "Bootstrap a new OTP library named $(APP)"
  808. $t mkdir $(APP)/
  809. $t cp ../erlang.mk $(APP)/
  810. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  811. $i "Add Lager to the list of dependencies and to the NO_AUTOPATCH list"
  812. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\nNO_AUTOPATCH = lager\n"}' $(APP)/Makefile
  813. $i "Build the application"
  814. $t $(MAKE) -C $(APP) $v
  815. $i "Check that all dependencies were fetched"
  816. $t test -d $(APP)/deps/goldrush
  817. $t test -d $(APP)/deps/lager
  818. $i "Check that Lager was not autopatched"
  819. $t if grep -q erlang\.mk $(APP)/deps/goldrush/Makefile; then false; fi
  820. $t if grep -q erlang\.mk $(APP)/deps/lager/Makefile; then false; fi
  821. ifndef LEGACY
  822. core-deps-otp: build clean-core-deps-otp
  823. $i "Bootstrap a new OTP library named $(APP)"
  824. $t mkdir $(APP)/
  825. $t cp ../erlang.mk $(APP)/
  826. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  827. $i "Add Crypto to the list of OTP dependencies"
  828. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = crypto\n"}' $(APP)/Makefile
  829. $i "Build the application"
  830. $t $(MAKE) -C $(APP) $v
  831. $i "Check that no dependencies were fetched"
  832. $t test ! -e $(APP)/deps
  833. $i "Check that the application was compiled correctly"
  834. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  835. [ok = application:load(App) || App <- [$(APP), crypto]], \
  836. {ok, Deps} = application:get_key($(APP), applications), \
  837. true = lists:member(crypto, Deps), \
  838. halt()"
  839. endif
  840. core-deps-pkg: build clean-core-deps-pkg
  841. $i "Bootstrap a new OTP library named $(APP)"
  842. $t mkdir $(APP)/
  843. $t cp ../erlang.mk $(APP)/
  844. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  845. $i "Add Cowboy to the list of dependencies"
  846. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  847. ifdef LEGACY
  848. $i "Add Cowboy to the applications key in the .app.src file"
  849. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  850. endif
  851. $i "Build the application"
  852. $t $(MAKE) -C $(APP) $v
  853. $i "Check that all dependencies were fetched"
  854. $t test -d $(APP)/deps/cowboy
  855. $t test -d $(APP)/deps/cowlib
  856. $t test -d $(APP)/deps/ranch
  857. $i "Check that the application was compiled correctly"
  858. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  859. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  860. {ok, Deps} = application:get_key($(APP), applications), \
  861. true = lists:member(cowboy, Deps), \
  862. halt()"
  863. core-deps-rel: build clean-core-deps-rel
  864. $i "Bootstrap a new release-enabled OTP library named $(APP)"
  865. $t mkdir $(APP)/
  866. $t cp ../erlang.mk $(APP)/
  867. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
  868. $i "Add Recon to the list of release dependencies"
  869. $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
  870. $i "Add Recon to the relx.config file"
  871. $t $(ERL) -eval " \
  872. {ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
  873. Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
  874. ok = file:write_file(\"$(APP)/relx.config\", \
  875. lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
  876. halt()"
  877. $i "Build the application and its dependencies"
  878. $t $(MAKE) -C $(APP) deps app $v
  879. $i "Check that no dependencies were fetched"
  880. $t test ! -e $(APP)/deps
  881. $i "Check that the application was compiled correctly"
  882. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  883. [ok = application:load(App) || App <- [$(APP)]], \
  884. {ok, Deps} = application:get_key($(APP), applications), \
  885. false = lists:member(recon, Deps), \
  886. halt()"
  887. $i "Build the release"
  888. $t $(MAKE) -C $(APP) $v
  889. $i "Check that all dependencies were fetched"
  890. $t test -d $(APP)/deps/recon
  891. $i "Check that the application was compiled correctly"
  892. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  893. [ok = application:load(App) || App <- [$(APP), recon]], \
  894. {ok, Deps} = application:get_key($(APP), applications), \
  895. false = lists:member(recon, Deps), \
  896. halt()"
  897. # @todo Add check for MSYS2 when releases under Windows become usable.
  898. # $i "Start the release and check that Recon is loaded"
  899. ifeq ($(PLATFORM),msys2)
  900. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
  901. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
  902. # $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
  903. # application loaded_applications | grep recon`"
  904. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
  905. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
  906. else
  907. $i "Start the release and check that Recon is loaded"
  908. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
  909. $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release rpcterms \
  910. application loaded_applications | grep recon`"
  911. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
  912. endif
  913. core-deps-search: build clean-core-deps-search
  914. $i "Bootstrap a new OTP library named $(APP)"
  915. $t mkdir $(APP)/
  916. $t cp ../erlang.mk $(APP)/
  917. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  918. $i "Run 'make search' and check that it prints packages"
  919. $t test -n "`$(MAKE) -C $(APP) search`"
  920. $i "Run 'make search q=cowboy' and check that it prints packages"
  921. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
  922. core-deps-shell: build clean-core-deps-shell
  923. $i "Bootstrap a new OTP library named $(APP)"
  924. $t mkdir $(APP)/
  925. $t cp ../erlang.mk $(APP)/
  926. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  927. $i "Add TDDReloader to the list of shell dependencies"
  928. $t perl -ni.bak -e 'print;if ($$.==1) {print "SHELL_DEPS = tddreloader\n"}' $(APP)/Makefile
  929. $i "Build the application and its dependencies"
  930. $t $(MAKE) -C $(APP) deps app $v
  931. $i "Check that no dependencies were fetched"
  932. $t test ! -e $(APP)/deps
  933. $i "Check that the application was compiled correctly"
  934. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  935. [ok = application:load(App) || App <- [$(APP)]], \
  936. {ok, Deps} = application:get_key($(APP), applications), \
  937. false = lists:member(tddreloader, Deps), \
  938. halt()"
  939. $i "Run the shell"
  940. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
  941. ok = application:load($(APP)), \
  942. ok = application:load(tddreloader), \
  943. halt()\"" $v
  944. $i "Check that all dependencies were fetched"
  945. $t test -d $(APP)/deps/tddreloader
  946. $i "Check that the application was compiled correctly"
  947. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  948. [ok = application:load(App) || App <- [$(APP), tddreloader]], \
  949. {ok, Deps} = application:get_key($(APP), applications), \
  950. false = lists:member(tddreloader, Deps), \
  951. halt()"
  952. core-deps-skip: build clean-core-deps-skip
  953. $i "Bootstrap a new OTP library named $(APP)"
  954. $t mkdir $(APP)/
  955. $t cp ../erlang.mk $(APP)/
  956. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  957. $i "Add Cowboy to the list of dependencies"
  958. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  959. ifdef LEGACY
  960. $i "Add Cowboy to the applications key in the .app.src file"
  961. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  962. endif
  963. $i "Build the application with SKIP_DEPS=1"
  964. $t $(MAKE) -C $(APP) SKIP_DEPS=1 $v
  965. $i "Check that no dependencies were fetched"
  966. $t test ! -e $(APP)/deps
  967. $i "Build the application"
  968. $t $(MAKE) -C $(APP) $v
  969. $i "Check that all dependencies were fetched"
  970. $t test -d $(APP)/deps/cowlib
  971. $t test -d $(APP)/deps/cowboy
  972. $t test -d $(APP)/deps/ranch
  973. $i "Distclean with SKIP_DEPS=1"
  974. $t $(MAKE) -C $(APP) distclean SKIP_DEPS=1 $v
  975. $i "Check that no dependencies were removed"
  976. $t test -d $(APP)/deps/cowlib
  977. $t test -d $(APP)/deps/cowboy
  978. $t test -d $(APP)/deps/ranch
  979. core-deps-test: build clean-core-deps-test
  980. $i "Bootstrap a new OTP library named $(APP)"
  981. $t mkdir $(APP)/
  982. $t cp ../erlang.mk $(APP)/
  983. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  984. $i "Generate .erl files"
  985. $t echo "-module(boy)." > $(APP)/src/boy.erl
  986. $t echo "-module(girl)." > $(APP)/src/girl.erl
  987. $i "Add triq to the list of test dependencies"
  988. $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = triq\n"}' $(APP)/Makefile
  989. $i "Build the application and its dependencies"
  990. $t $(MAKE) -C $(APP) deps app $v
  991. $i "Check that no dependencies were fetched"
  992. $t test ! -e $(APP)/deps
  993. $i "Check that the application was compiled correctly"
  994. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  995. [ok = application:load(App) || App <- [$(APP)]], \
  996. {ok, Deps} = application:get_key($(APP), applications), \
  997. false = lists:member(triq, Deps), \
  998. halt()"
  999. $i "Run tests"
  1000. $t $(MAKE) -C $(APP) tests $v
  1001. $i "Check that all dependencies were fetched"
  1002. $t test -d $(APP)/deps/triq
  1003. $i "Check that the application was compiled correctly"
  1004. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1005. [ok = application:load(App) || App <- [$(APP), triq]], \
  1006. {ok, Deps} = application:get_key($(APP), applications), \
  1007. false = lists:member(triq, Deps), \
  1008. halt()"