core_deps.mk 44 KB

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