core_deps.mk 37 KB

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