core_deps.mk 38 KB

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