core_deps.mk 39 KB

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