core_deps.mk 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345
  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 autopatch-rebar build-c-8cc build-c-imagejs build-erl build-js dep-commit dir doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-git-submodule fetch-hex fetch-hg fetch-legacy fetch-svn ignore mv mv-rebar no-autopatch no-autopatch-erlang-mk no-autopatch-rebar order-first order-top otp pkg rel search shell skip test
  3. CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES))
  4. 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. core-deps-autopatch-rebar: build clean-core-deps-autopatch-rebar
  306. $i "Bootstrap a new OTP library named $(APP)"
  307. $t mkdir $(APP)/
  308. $t cp ../erlang.mk $(APP)/
  309. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  310. $i "Add erlsha2 to the list of dependencies"
  311. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = erlsha2\n"}' $(APP)/Makefile
  312. $i "Build the application"
  313. $t $(MAKE) -C $(APP) $v
  314. $i "Check that erlsha2 was fetched and built"
  315. $t test -d $(APP)/deps/erlsha2
  316. $t test -f $(APP)/deps/erlsha2/ebin/erlsha2.beam
  317. ifneq ($(PLATFORM),msys2)
  318. $t test -f $(APP)/deps/erlsha2/priv/erlsha2_nif.so
  319. endif
  320. ifneq ($(PLATFORM),msys2)
  321. core-deps-build-c-8cc: build clean-core-deps-build-c-8cc
  322. $i "Bootstrap a new OTP library named $(APP)"
  323. $t mkdir $(APP)/
  324. $t cp ../erlang.mk $(APP)/
  325. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  326. $i "Add 8cc to the list of build dependencies"
  327. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = 8cc\ndep_8cc = git https://github.com/rui314/8cc master\n"}' $(APP)/Makefile
  328. $i "Build the application"
  329. $t $(MAKE) -C $(APP) $v
  330. $i "Check that all dependencies were fetched"
  331. $t test -d $(APP)/deps/8cc
  332. $i "Check that 8cc can be started"
  333. $t $(APP)/deps/8cc/8cc -h $v
  334. $i "Check that the application was compiled correctly"
  335. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  336. [ok = application:load(App) || App <- [$(APP)]], \
  337. {ok, Deps} = application:get_key($(APP), applications), \
  338. false = lists:member('8cc', Deps), \
  339. halt()"
  340. endif
  341. ifneq ($(PLATFORM),freebsd)
  342. core-deps-build-c-imagejs: build clean-core-deps-build-c-imagejs
  343. $i "Bootstrap a new OTP library named $(APP)"
  344. $t mkdir $(APP)/
  345. $t cp ../erlang.mk $(APP)/
  346. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  347. $i "Add imagejs to the list of build dependencies"
  348. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = imagejs\ndep_imagejs = git https://github.com/jklmnn/imagejs master\n"}' $(APP)/Makefile
  349. $i "Build the application"
  350. $t $(MAKE) -C $(APP) $v
  351. $i "Check that all dependencies were fetched"
  352. $t test -d $(APP)/deps/imagejs
  353. $i "Check that imagejs works"
  354. $t $(APP)/deps/imagejs/imagejs bmp $(APP)/deps/imagejs/Makefile
  355. $t test -f $(APP)/deps/imagejs/Makefile.bmp
  356. $i "Check that the application was compiled correctly"
  357. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  358. [ok = application:load(App) || App <- [$(APP)]], \
  359. {ok, Deps} = application:get_key($(APP), applications), \
  360. false = lists:member(imagejs, Deps), \
  361. halt()"
  362. endif
  363. core-deps-build-erl: build clean-core-deps-build-erl
  364. $i "Bootstrap a new OTP library named $(APP)"
  365. $t mkdir $(APP)/
  366. $t cp ../erlang.mk $(APP)/
  367. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  368. $i "Add cowlib to the list of build dependencies"
  369. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = cowlib\n"}' $(APP)/Makefile
  370. $i "Build the application"
  371. $t $(MAKE) -C $(APP) $v
  372. $i "Check that all dependencies were fetched"
  373. $t test -d $(APP)/deps/cowlib
  374. $i "Check that the application was compiled correctly"
  375. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  376. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  377. {ok, Deps} = application:get_key($(APP), applications), \
  378. false = lists:member(cowlib, Deps), \
  379. halt()"
  380. core-deps-build-js: build clean-core-deps-build-js
  381. $i "Bootstrap a new OTP library named $(APP)"
  382. $t mkdir $(APP)/
  383. $t cp ../erlang.mk $(APP)/
  384. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  385. $i "Add jquery to the list of build dependencies"
  386. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = jquery\ndep_jquery = git https://github.com/jquery/jquery master\n"}' $(APP)/Makefile
  387. $i "Build the application"
  388. $t $(MAKE) -C $(APP) $v
  389. $i "Check that all dependencies were fetched"
  390. $t test -d $(APP)/deps/jquery
  391. $i "Check that the application was compiled correctly"
  392. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  393. [ok = application:load(App) || App <- [$(APP)]], \
  394. {ok, Deps} = application:get_key($(APP), applications), \
  395. false = lists:member(jquery, Deps), \
  396. halt()"
  397. core-deps-dep-commit: build clean-core-deps-dep-commit
  398. $i "Bootstrap a new OTP library named $(APP)"
  399. $t mkdir $(APP)/
  400. $t cp ../erlang.mk $(APP)/
  401. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  402. $i "Add Cowboy 1.0.0 to the list of dependencies"
  403. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 1.0.0\n"}' $(APP)/Makefile
  404. ifdef LEGACY
  405. $i "Add Cowboy to the applications key in the .app.src file"
  406. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  407. endif
  408. $i "Build the application"
  409. $t $(MAKE) -C $(APP) $v
  410. $i "Check that all dependencies were fetched"
  411. $t test -d $(APP)/deps/cowboy
  412. $t test -d $(APP)/deps/cowlib
  413. $t test -d $(APP)/deps/ranch
  414. $i "Check that the application was compiled correctly"
  415. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  416. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  417. {ok, Deps} = application:get_key($(APP), applications), \
  418. true = lists:member(cowboy, Deps), \
  419. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  420. halt()"
  421. core-deps-dir: build clean-core-deps-dir
  422. $i "Bootstrap a new OTP library named $(APP)"
  423. $t mkdir $(APP)/
  424. $t cp ../erlang.mk $(APP)/
  425. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  426. $i "Add Cowboy to the list of dependencies with a custom DEPS_DIR"
  427. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nDEPS_DIR ?= \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
  428. ifdef LEGACY
  429. $i "Add Cowboy to the applications key in the .app.src file"
  430. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  431. endif
  432. $i "Build the application"
  433. $t $(MAKE) -C $(APP) $v
  434. $i "Check that all dependencies were fetched in the custom DEPS_DIR"
  435. $t test -d $(APP)/deep/libs/cowboy
  436. $t test -d $(APP)/deep/libs/cowlib
  437. $t test -d $(APP)/deep/libs/ranch
  438. $i "Check that the application was compiled correctly"
  439. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deep/libs/*/ebin/ -eval " \
  440. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  441. {ok, Deps} = application:get_key($(APP), applications), \
  442. true = lists:member(cowboy, Deps), \
  443. halt()"
  444. core-deps-doc: build clean-core-deps-doc
  445. $i "Bootstrap a new OTP library named $(APP)"
  446. $t mkdir $(APP)/
  447. $t cp ../erlang.mk $(APP)/
  448. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  449. $i "Generate .erl files"
  450. $t echo "-module(boy)." > $(APP)/src/boy.erl
  451. $t echo "-module(girl)." > $(APP)/src/girl.erl
  452. $i "Add Edown as a documentation building dependency"
  453. $t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = edown\nEDOC_OPTS = {doclet, edown_doclet}\n"}' $(APP)/Makefile
  454. $i "Build the application"
  455. $t $(MAKE) -C $(APP) $v
  456. $i "Check that no dependencies were fetched"
  457. $t test ! -e $(APP)/deps
  458. $i "Check that the application was compiled correctly"
  459. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  460. [ok = application:load(App) || App <- [$(APP)]], \
  461. {ok, Deps} = application:get_key($(APP), applications), \
  462. false = lists:member(edown, Deps), \
  463. halt()"
  464. $i "Build the application documentation"
  465. $t $(MAKE) -C $(APP) docs $v
  466. $i "Check that documentation dependencies were fetched"
  467. $t test -d $(APP)/deps/edown
  468. $i "Check the Edown generated Markdown documentation"
  469. $t test -f $(APP)/doc/boy.md
  470. $t test -f $(APP)/doc/girl.md
  471. core-deps-fetch-cp: build clean-core-deps-fetch-cp
  472. $i "Bootstrap a new OTP library named $(APP)"
  473. $t mkdir $(APP)/
  474. $t cp ../erlang.mk $(APP)/
  475. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  476. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  477. $t mkdir $(APP)/my_dep
  478. $t cp ../erlang.mk $(APP)/my_dep/
  479. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  480. $i "Add my_dep to the list of dependencies"
  481. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  482. ifdef LEGACY
  483. $i "Add my_dep to the applications key in the .app.src file"
  484. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  485. endif
  486. $i "Build the application"
  487. $t $(MAKE) -C $(APP) $v
  488. $i "Check that all dependencies were fetched"
  489. $t test -d $(APP)/deps/my_dep
  490. $i "Check that the application was compiled correctly"
  491. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  492. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  493. {ok, Deps} = application:get_key($(APP), applications), \
  494. true = lists:member(my_dep, Deps), \
  495. halt()"
  496. core-deps-fetch-custom: build clean-core-deps-fetch-custom
  497. $i "Bootstrap a new OTP library named $(APP)"
  498. $t mkdir $(APP)/
  499. $t cp ../erlang.mk $(APP)/
  500. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  501. $i "Add dependency boop using custom fetch method beep to the list of dependencies"
  502. $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
  503. ifdef LEGACY
  504. $i "Add boop to the applications key in the .app.src file"
  505. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tboop,\n"}' $(APP)/src/$(APP).app.src
  506. endif
  507. $i "Build the application"
  508. $t $(MAKE) -C $(APP) $v
  509. $i "Check that all dependencies were fetched"
  510. $t test -d $(APP)/deps/boop
  511. $i "Check that the application was compiled correctly"
  512. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  513. ok = application:load($(APP)), \
  514. {ok, Deps} = application:get_key($(APP), applications), \
  515. true = lists:member(boop, Deps), \
  516. halt()"
  517. core-deps-fetch-fail-bad: build clean-core-deps-fetch-fail-bad
  518. $i "Bootstrap a new OTP library named $(APP)"
  519. $t mkdir $(APP)/
  520. $t cp ../erlang.mk $(APP)/
  521. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  522. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  523. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = oops https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
  524. $i "Check that building the application fails"
  525. $t ! $(MAKE) -C $(APP) $v
  526. core-deps-fetch-fail-unknown: build clean-core-deps-fetch-fail-unknown
  527. $i "Bootstrap a new OTP library named $(APP)"
  528. $t mkdir $(APP)/
  529. $t cp ../erlang.mk $(APP)/
  530. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  531. $i "Add an unknown application as a dependency"
  532. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = unknown\n"}' $(APP)/Makefile
  533. $i "Check that building the application fails"
  534. $t ! $(MAKE) -C $(APP) $v
  535. core-deps-fetch-git: build clean-core-deps-fetch-git
  536. $i "Bootstrap a new OTP library named $(APP)"
  537. $t mkdir $(APP)/
  538. $t cp ../erlang.mk $(APP)/
  539. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  540. $i "Add Cowboy 1.0.0 to the list of dependencies"
  541. $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
  542. ifdef LEGACY
  543. $i "Add Cowboy to the applications key in the .app.src file"
  544. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  545. endif
  546. $i "Build the application"
  547. $t $(MAKE) -C $(APP) $v
  548. $i "Check that all dependencies were fetched"
  549. $t test -d $(APP)/deps/cowboy
  550. $t test -d $(APP)/deps/cowlib
  551. $t test -d $(APP)/deps/ranch
  552. $i "Check that the application was compiled correctly"
  553. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  554. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  555. {ok, Deps} = application:get_key($(APP), applications), \
  556. true = lists:member(cowboy, Deps), \
  557. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  558. halt()"
  559. core-deps-fetch-git-submodule: build clean-core-deps-fetch-git-submodule
  560. $i "Bootstrap a new OTP library named $(APP)"
  561. $t mkdir $(APP)/
  562. $t cp ../erlang.mk $(APP)/
  563. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  564. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  565. $t mkdir $(APP)/my_dep
  566. $t cp ../erlang.mk $(APP)/my_dep/
  567. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  568. # Create an empty file so src/ gets committed.
  569. $t touch $(APP)/my_dep/src/README
  570. $t cd $(APP)/my_dep && \
  571. git init -q && \
  572. git config user.email "testsuite@erlang.mk" && \
  573. git config user.name "test suite" && \
  574. git add . && \
  575. git commit -q -m "Tests"
  576. $i "Add the submodule to my_dep"
  577. $t mkdir $(APP)/deps
  578. $t cd $(APP) && \
  579. git init -q && \
  580. git submodule -q add file://$(abspath $(APP)/my_dep) deps/my_dep && \
  581. git config user.email "testsuite@erlang.mk" && \
  582. git config user.name "test suite" && \
  583. git add . && \
  584. git commit -q -m "Tests"
  585. $i "Distclean the application"
  586. $t $(MAKE) -C $(APP) distclean $v
  587. $i "Add my_dep to the list of dependencies"
  588. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = git-submodule\n"}' $(APP)/Makefile
  589. ifdef LEGACY
  590. $i "Add my_dep to the applications key in the .app.src file"
  591. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  592. endif
  593. $i "Build the application"
  594. $t $(MAKE) -C $(APP) $v
  595. $i "Check that all dependencies were fetched"
  596. $t test -d $(APP)/deps/my_dep
  597. $i "Check that the application was compiled correctly"
  598. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  599. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  600. {ok, Deps} = application:get_key($(APP), applications), \
  601. true = lists:member(my_dep, Deps), \
  602. halt()"
  603. core-deps-fetch-hex: build clean-core-deps-fetch-hex
  604. $i "Bootstrap a new OTP library named $(APP)"
  605. $t mkdir $(APP)/
  606. $t cp ../erlang.mk $(APP)/
  607. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  608. $i "Add Cowboy 1.0.0 to the list of dependencies"
  609. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 1.0.0\n"}' $(APP)/Makefile
  610. ifdef LEGACY
  611. $i "Add Cowboy to the applications key in the .app.src file"
  612. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  613. endif
  614. $i "Build the application"
  615. $t $(MAKE) -C $(APP) $v
  616. $i "Check that all dependencies were fetched"
  617. $t test -d $(APP)/deps/cowboy
  618. $t test -d $(APP)/deps/cowlib
  619. $t test -d $(APP)/deps/ranch
  620. $i "Check that the application was compiled correctly"
  621. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  622. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  623. {ok, Deps} = application:get_key($(APP), applications), \
  624. true = lists:member(cowboy, Deps), \
  625. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  626. halt()"
  627. core-deps-fetch-hg: build clean-core-deps-fetch-hg
  628. $i "Bootstrap a new OTP library named $(APP)"
  629. $t mkdir $(APP)/
  630. $t cp ../erlang.mk $(APP)/
  631. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  632. $i "Add Ehsa 4.0.3 to the list of dependencies"
  633. $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
  634. ifdef LEGACY
  635. $i "Add ehsa to the applications key in the .app.src file"
  636. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tehsa,\n"}' $(APP)/src/$(APP).app.src
  637. endif
  638. $i "Build the application"
  639. $t $(MAKE) -C $(APP) $v
  640. $i "Check that all dependencies were fetched"
  641. $t test -d $(APP)/deps/ehsa
  642. $i "Check that the application was compiled correctly"
  643. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  644. [ok = application:load(App) || App <- [$(APP), ehsa]], \
  645. {ok, Deps} = application:get_key($(APP), applications), \
  646. true = lists:member(ehsa, Deps), \
  647. {ok, \"4.0.3\"} = application:get_key(ehsa, vsn), \
  648. halt()"
  649. # Legacy must fail for the top-level application, but work for dependencies.
  650. core-deps-fetch-legacy: build clean-core-deps-fetch-legacy
  651. $i "Bootstrap a new OTP library named $(APP)"
  652. $t mkdir $(APP)/
  653. $t cp ../erlang.mk $(APP)/
  654. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  655. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  656. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
  657. $i "Check that building the application fails"
  658. $t ! $(MAKE) -C $(APP) $v
  659. $i "Check that building the application works with IS_DEP=1"
  660. $t $(MAKE) -C $(APP) IS_DEP=1 $v
  661. core-deps-fetch-svn: build clean-core-deps-fetch-svn
  662. $i "Bootstrap a new OTP library named $(APP)"
  663. $t mkdir $(APP)/
  664. $t cp ../erlang.mk $(APP)/
  665. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  666. $i "Add Cowlib 1.0.0 to the list of dependencies"
  667. $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
  668. ifdef LEGACY
  669. $i "Add Cowlib to the applications key in the .app.src file"
  670. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  671. endif
  672. $i "Build the application"
  673. $t $(MAKE) -C $(APP) $v
  674. $i "Check that all dependencies were fetched"
  675. $t test -d $(APP)/deps/cowlib
  676. $i "Check that the application was compiled correctly"
  677. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  678. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  679. {ok, Deps} = application:get_key($(APP), applications), \
  680. true = lists:member(cowlib, Deps), \
  681. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  682. halt()"
  683. core-deps-ignore: build clean-core-deps-ignore
  684. $i "Bootstrap a new OTP library named $(APP)"
  685. $t mkdir $(APP)/
  686. $t cp ../erlang.mk $(APP)/
  687. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  688. $i "Add Cowboy to dependencies, Ranch to the ignore list and to test dependencies"
  689. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nIGNORE_DEPS = ranch\nTEST_DEPS = ranch\n"}' $(APP)/Makefile
  690. ifdef LEGACY
  691. $i "Add Cowboy to the applications key in the .app.src file"
  692. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  693. endif
  694. $i "Build the application"
  695. $t $(MAKE) -C $(APP) $v
  696. $i "Check that the correct dependencies were fetched"
  697. $t test -d $(APP)/deps/cowboy
  698. $t test -d $(APP)/deps/cowlib
  699. $t test ! -e $(APP)/deps/ranch
  700. $i "Build the test dependencies"
  701. $t $(MAKE) -C $(APP) test-deps $v
  702. $i "Check that the correct dependencies were fetched"
  703. $t test -d $(APP)/deps/ranch
  704. core-deps-mv: build clean-core-deps-mv clean-core-deps-mv-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 Cowlib to the list of dependencies"
  710. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\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/cowlib
  715. $i "Move the application elsewhere"
  716. $t mv $(APP) $(APP)-moved
  717. $i "Build the application"
  718. $t $(MAKE) -C $(APP)-moved $v
  719. core-deps-mv-rebar: build clean-core-deps-mv-rebar clean-core-deps-mv-rebar-moved
  720. $i "Bootstrap a new OTP library named $(APP)"
  721. $t mkdir $(APP)/
  722. $t cp ../erlang.mk $(APP)/
  723. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  724. $i "Add Lager to the list of dependencies"
  725. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile
  726. $i "Build the application"
  727. $t $(MAKE) -C $(APP) $v
  728. $i "Check that all dependencies were fetched"
  729. $t test -d $(APP)/deps/goldrush
  730. $t test -d $(APP)/deps/lager
  731. $i "Move the application elsewhere"
  732. $t mv $(APP) $(APP)-moved
  733. $i "Build the application"
  734. $t $(MAKE) -C $(APP)-moved $v
  735. # A lower-level dependency of the first dependency always
  736. # wins over a lower-level dependency of the second dependency.
  737. core-deps-order-first: build clean-core-deps-order-first
  738. $i "Bootstrap a new OTP library named $(APP)"
  739. $t mkdir $(APP)/
  740. $t cp ../erlang.mk $(APP)/
  741. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  742. $i "Add Cowboy package and my_dep to the list of dependencies"
  743. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep cowboy\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  744. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  745. $t mkdir $(APP)/my_dep
  746. $t cp ../erlang.mk $(APP)/my_dep/
  747. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  748. $i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
  749. $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
  750. ifdef LEGACY
  751. $i "Add Cowboy and my_dep to the applications key in the .app.src file"
  752. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  753. endif
  754. $i "Build the application"
  755. $t $(MAKE) -C $(APP) $v
  756. $i "Check that all dependencies were fetched"
  757. $t test -d $(APP)/deps/cowboy
  758. $t test -d $(APP)/deps/cowlib
  759. $t test -d $(APP)/deps/my_dep
  760. $t test -d $(APP)/deps/ranch
  761. $i "Check that the application was compiled correctly"
  762. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  763. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, my_dep, ranch]], \
  764. {ok, Deps} = application:get_key($(APP), applications), \
  765. true = lists:member(cowboy, Deps), \
  766. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  767. halt()"
  768. # A higher-level dependency always wins.
  769. core-deps-order-top: build clean-core-deps-order-top
  770. $i "Bootstrap a new OTP library named $(APP)"
  771. $t mkdir $(APP)/
  772. $t cp ../erlang.mk $(APP)/
  773. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  774. $i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
  775. $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
  776. ifdef LEGACY
  777. $i "Add Cowboy to the applications key in the .app.src file"
  778. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  779. endif
  780. $i "Build the application"
  781. $t $(MAKE) -C $(APP) $v
  782. $i "Check that all dependencies were fetched"
  783. $t test -d $(APP)/deps/cowboy
  784. $t test -d $(APP)/deps/cowlib
  785. $t test -d $(APP)/deps/ranch
  786. $i "Check that the application was compiled correctly"
  787. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  788. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  789. {ok, Deps} = application:get_key($(APP), applications), \
  790. true = lists:member(cowboy, Deps), \
  791. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  792. halt()"
  793. core-deps-no-autopatch: build clean-core-deps-no-autopatch
  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 Cowboy to the list of dependencies and Cowlib to the NO_AUTOPATCH list"
  799. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nNO_AUTOPATCH = cowlib\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/cowboy
  804. $t test -d $(APP)/deps/cowlib
  805. $t test -d $(APP)/deps/ranch
  806. $i "Check that Cowlib was not autopatched"
  807. $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
  808. core-deps-no-autopatch-erlang-mk: build clean-core-deps-no-autopatch-erlang-mk
  809. $i "Bootstrap a new OTP library named $(APP)"
  810. $t mkdir $(APP)/
  811. $t cp ../erlang.mk $(APP)/
  812. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  813. $i "Add Cowlib to the list of dependencies and set NO_AUTOPATCH_ERLANG_MK=1"
  814. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\nNO_AUTOPATCH_ERLANG_MK = 1\n"}' $(APP)/Makefile
  815. $i "Build the application"
  816. $t $(MAKE) -C $(APP) $v
  817. $i "Check that all dependencies were fetched"
  818. $t test -d $(APP)/deps/cowlib
  819. $i "Check that Erlang.mk was not autopatched"
  820. $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
  821. core-deps-no-autopatch-rebar: build clean-core-deps-no-autopatch-rebar
  822. $i "Bootstrap a new OTP library named $(APP)"
  823. $t mkdir $(APP)/
  824. $t cp ../erlang.mk $(APP)/
  825. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  826. $i "Add Lager to the list of dependencies and to the NO_AUTOPATCH list"
  827. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\nNO_AUTOPATCH = lager\n"}' $(APP)/Makefile
  828. $i "Build the application"
  829. $t $(MAKE) -C $(APP) $v
  830. $i "Check that all dependencies were fetched"
  831. $t test -d $(APP)/deps/goldrush
  832. $t test -d $(APP)/deps/lager
  833. $i "Check that Lager was not autopatched"
  834. $t if grep -q erlang\.mk $(APP)/deps/goldrush/Makefile; then false; fi
  835. $t if grep -q erlang\.mk $(APP)/deps/lager/Makefile; then false; fi
  836. ifndef LEGACY
  837. core-deps-otp: build clean-core-deps-otp
  838. $i "Bootstrap a new OTP library named $(APP)"
  839. $t mkdir $(APP)/
  840. $t cp ../erlang.mk $(APP)/
  841. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  842. $i "Add Crypto to the list of OTP dependencies"
  843. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = crypto\n"}' $(APP)/Makefile
  844. $i "Build the application"
  845. $t $(MAKE) -C $(APP) $v
  846. $i "Check that no dependencies were fetched"
  847. $t test ! -e $(APP)/deps
  848. $i "Check that the application was compiled correctly"
  849. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  850. [ok = application:load(App) || App <- [$(APP), crypto]], \
  851. {ok, Deps} = application:get_key($(APP), applications), \
  852. true = lists:member(crypto, Deps), \
  853. halt()"
  854. endif
  855. core-deps-pkg: build clean-core-deps-pkg
  856. $i "Bootstrap a new OTP library named $(APP)"
  857. $t mkdir $(APP)/
  858. $t cp ../erlang.mk $(APP)/
  859. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  860. $i "Add Cowboy to the list of dependencies"
  861. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  862. ifdef LEGACY
  863. $i "Add Cowboy to the applications key in the .app.src file"
  864. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  865. endif
  866. $i "Build the application"
  867. $t $(MAKE) -C $(APP) $v
  868. $i "Check that all dependencies were fetched"
  869. $t test -d $(APP)/deps/cowboy
  870. $t test -d $(APP)/deps/cowlib
  871. $t test -d $(APP)/deps/ranch
  872. $i "Check that the application was compiled correctly"
  873. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  874. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  875. {ok, Deps} = application:get_key($(APP), applications), \
  876. true = lists:member(cowboy, Deps), \
  877. halt()"
  878. core-deps-rel: build clean-core-deps-rel
  879. $i "Bootstrap a new release-enabled OTP library named $(APP)"
  880. $t mkdir $(APP)/
  881. $t cp ../erlang.mk $(APP)/
  882. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
  883. $i "Add Recon to the list of release dependencies"
  884. $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
  885. $i "Add Recon to the relx.config file"
  886. $t $(ERL) -eval " \
  887. {ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
  888. Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
  889. ok = file:write_file(\"$(APP)/relx.config\", \
  890. lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
  891. halt()"
  892. $i "Build the application and its dependencies"
  893. $t $(MAKE) -C $(APP) deps app $v
  894. $i "Check that no dependencies were fetched"
  895. $t test ! -e $(APP)/deps
  896. $i "Check that the application was compiled correctly"
  897. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  898. [ok = application:load(App) || App <- [$(APP)]], \
  899. {ok, Deps} = application:get_key($(APP), applications), \
  900. false = lists:member(recon, Deps), \
  901. halt()"
  902. $i "Build the release"
  903. $t $(MAKE) -C $(APP) $v
  904. $i "Check that all dependencies were fetched"
  905. $t test -d $(APP)/deps/recon
  906. $i "Check that the application was compiled correctly"
  907. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  908. [ok = application:load(App) || App <- [$(APP), recon]], \
  909. {ok, Deps} = application:get_key($(APP), applications), \
  910. false = lists:member(recon, Deps), \
  911. halt()"
  912. # @todo Add check for MSYS2 when releases under Windows become usable.
  913. # $i "Start the release and check that Recon is loaded"
  914. ifeq ($(PLATFORM),msys2)
  915. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
  916. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
  917. # $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
  918. # application loaded_applications | grep recon`"
  919. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
  920. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
  921. else
  922. $i "Start the release and check that Recon is loaded"
  923. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
  924. $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release rpcterms \
  925. application loaded_applications | grep recon`"
  926. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
  927. endif
  928. core-deps-search: build clean-core-deps-search
  929. $i "Bootstrap a new OTP library named $(APP)"
  930. $t mkdir $(APP)/
  931. $t cp ../erlang.mk $(APP)/
  932. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  933. $i "Run 'make search' and check that it prints packages"
  934. $t test -n "`$(MAKE) -C $(APP) search`"
  935. $i "Run 'make search q=cowboy' and check that it prints packages"
  936. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
  937. core-deps-shell: build clean-core-deps-shell
  938. $i "Bootstrap a new OTP library named $(APP)"
  939. $t mkdir $(APP)/
  940. $t cp ../erlang.mk $(APP)/
  941. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  942. $i "Add TDDReloader to the list of shell dependencies"
  943. $t perl -ni.bak -e 'print;if ($$.==1) {print "SHELL_DEPS = tddreloader\n"}' $(APP)/Makefile
  944. $i "Build the application and its dependencies"
  945. $t $(MAKE) -C $(APP) deps app $v
  946. $i "Check that no dependencies were fetched"
  947. $t test ! -e $(APP)/deps
  948. $i "Check that the application was compiled correctly"
  949. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  950. [ok = application:load(App) || App <- [$(APP)]], \
  951. {ok, Deps} = application:get_key($(APP), applications), \
  952. false = lists:member(tddreloader, Deps), \
  953. halt()"
  954. $i "Run the shell"
  955. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
  956. ok = application:load($(APP)), \
  957. ok = application:load(tddreloader), \
  958. halt()\"" $v
  959. $i "Check that all dependencies were fetched"
  960. $t test -d $(APP)/deps/tddreloader
  961. $i "Check that the application was compiled correctly"
  962. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  963. [ok = application:load(App) || App <- [$(APP), tddreloader]], \
  964. {ok, Deps} = application:get_key($(APP), applications), \
  965. false = lists:member(tddreloader, Deps), \
  966. halt()"
  967. core-deps-skip: build clean-core-deps-skip
  968. $i "Bootstrap a new OTP library named $(APP)"
  969. $t mkdir $(APP)/
  970. $t cp ../erlang.mk $(APP)/
  971. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  972. $i "Add Cowboy to the list of dependencies"
  973. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  974. ifdef LEGACY
  975. $i "Add Cowboy to the applications key in the .app.src file"
  976. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  977. endif
  978. $i "Build the application with SKIP_DEPS=1"
  979. $t $(MAKE) -C $(APP) SKIP_DEPS=1 $v
  980. $i "Check that no dependencies were fetched"
  981. $t test ! -e $(APP)/deps
  982. $i "Build the application"
  983. $t $(MAKE) -C $(APP) $v
  984. $i "Check that all dependencies were fetched"
  985. $t test -d $(APP)/deps/cowlib
  986. $t test -d $(APP)/deps/cowboy
  987. $t test -d $(APP)/deps/ranch
  988. $i "Distclean with SKIP_DEPS=1"
  989. $t $(MAKE) -C $(APP) distclean SKIP_DEPS=1 $v
  990. $i "Check that no dependencies were removed"
  991. $t test -d $(APP)/deps/cowlib
  992. $t test -d $(APP)/deps/cowboy
  993. $t test -d $(APP)/deps/ranch
  994. core-deps-test: build clean-core-deps-test
  995. $i "Bootstrap a new OTP library named $(APP)"
  996. $t mkdir $(APP)/
  997. $t cp ../erlang.mk $(APP)/
  998. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  999. $i "Generate .erl files"
  1000. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1001. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1002. $i "Add triq to the list of test dependencies"
  1003. $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = triq\n"}' $(APP)/Makefile
  1004. $i "Build the application and its dependencies"
  1005. $t $(MAKE) -C $(APP) deps app $v
  1006. $i "Check that no dependencies were fetched"
  1007. $t test ! -e $(APP)/deps
  1008. $i "Check that the application was compiled correctly"
  1009. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1010. [ok = application:load(App) || App <- [$(APP)]], \
  1011. {ok, Deps} = application:get_key($(APP), applications), \
  1012. false = lists:member(triq, Deps), \
  1013. halt()"
  1014. $i "Run tests"
  1015. $t $(MAKE) -C $(APP) tests $v
  1016. $i "Check that all dependencies were fetched"
  1017. $t test -d $(APP)/deps/triq
  1018. $i "Check that the application was compiled correctly"
  1019. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1020. [ok = application:load(App) || App <- [$(APP), triq]], \
  1021. {ok, Deps} = application:get_key($(APP), applications), \
  1022. false = lists:member(triq, Deps), \
  1023. halt()"