core_deps.mk 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450
  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. ifneq ($(PLATFORM),msys2)
  6. core-deps-build-c-8cc: init
  7. $i "Bootstrap a new OTP library named $(APP)"
  8. $t mkdir $(APP)/
  9. $t cp ../erlang.mk $(APP)/
  10. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  11. $i "Add 8cc to the list of build dependencies"
  12. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = 8cc\ndep_8cc = git https://github.com/rui314/8cc master\n"}' $(APP)/Makefile
  13. $i "Build the application"
  14. $t $(MAKE) -C $(APP) $v
  15. $i "Check that all dependencies were fetched"
  16. $t test -d $(APP)/deps/8cc
  17. $i "Check that 8cc can be started"
  18. $t $(APP)/deps/8cc/8cc -h $v
  19. $i "Check that the application was compiled correctly"
  20. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  21. [ok = application:load(App) || App <- [$(APP)]], \
  22. {ok, Deps} = application:get_key($(APP), applications), \
  23. false = lists:member('8cc', Deps), \
  24. halt()"
  25. endif
  26. core-deps-build-c-lz4: init
  27. $i "Bootstrap a new OTP library named $(APP)"
  28. $t mkdir $(APP)/
  29. $t cp ../erlang.mk $(APP)/
  30. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  31. $i "Add lz4 to the list of build dependencies"
  32. $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
  33. $i "Build the application"
  34. $t $(MAKE) -C $(APP) $v
  35. $i "Check that all dependencies were fetched"
  36. $t test -d $(APP)/deps/lz4_src
  37. $i "Check that lz4 was compiled"
  38. $t test -f $(APP)/deps/lz4_src/lib/liblz4.a
  39. $i "Check that the application was compiled correctly"
  40. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  41. [ok = application:load(App) || App <- [$(APP)]], \
  42. {ok, Deps} = application:get_key($(APP), applications), \
  43. false = lists:member(lz4, Deps), \
  44. halt()"
  45. core-deps-build-erl: init
  46. $i "Bootstrap a new OTP library named $(APP)"
  47. $t mkdir $(APP)/
  48. $t cp ../erlang.mk $(APP)/
  49. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  50. $i "Add cowlib to the list of build dependencies"
  51. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = cowlib\n"}' $(APP)/Makefile
  52. $i "Build the application"
  53. $t $(MAKE) -C $(APP) $v
  54. $i "Check that all dependencies were fetched"
  55. $t test -d $(APP)/deps/cowlib
  56. $i "Check that the application was compiled correctly"
  57. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  58. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  59. {ok, Deps} = application:get_key($(APP), applications), \
  60. false = lists:member(cowlib, Deps), \
  61. halt()"
  62. core-deps-build-js: init
  63. $i "Bootstrap a new OTP library named $(APP)"
  64. $t mkdir $(APP)/
  65. $t cp ../erlang.mk $(APP)/
  66. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  67. $i "Add jquery to the list of build dependencies"
  68. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = jquery\ndep_jquery = git https://github.com/jquery/jquery master\n"}' $(APP)/Makefile
  69. $i "Build the application"
  70. $t $(MAKE) -C $(APP) $v
  71. $i "Check that all dependencies were fetched"
  72. $t test -d $(APP)/deps/jquery
  73. $i "Check that the application was compiled correctly"
  74. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  75. [ok = application:load(App) || App <- [$(APP)]], \
  76. {ok, Deps} = application:get_key($(APP), applications), \
  77. false = lists:member(jquery, Deps), \
  78. halt()"
  79. core-deps-dep-built: init
  80. $i "Bootstrap a new OTP library named $(APP)"
  81. $t mkdir $(APP)/
  82. $t cp ../erlang.mk $(APP)/
  83. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  84. $i "Add cowlib to the list of dependencies"
  85. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  86. $i "Build the application"
  87. $t $(MAKE) -C $(APP) $v
  88. $i "Touch one cowlib file to mark it for recompilation"
  89. $t $(SLEEP)
  90. $t touch $(APP)/deps/cowlib/src/cow_http.erl
  91. $i "Check that cowlib is not rebuilt"
  92. $t touch $(APP)/EXPECT
  93. $t $(SLEEP)
  94. $t $(MAKE) -C $(APP) $v
  95. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | sort | diff $(APP)/EXPECT -
  96. $t rm $(APP)/EXPECT
  97. $i "Delete the dep_built file"
  98. $t rm $(APP)/deps/cowlib/ebin/dep_built
  99. $i "Check that cowlib was rebuilt"
  100. $t printf "%s\n" \
  101. $(APP)/deps/cowlib/cowlib.d \
  102. $(APP)/deps/cowlib/ebin/cowlib.app \
  103. $(APP)/deps/cowlib/ebin/cow_http.beam \
  104. $(APP)/deps/cowlib/ebin/dep_built | sort > $(APP)/EXPECT
  105. $t $(SLEEP)
  106. $t $(MAKE) -C $(APP) $v
  107. # Files in .git might end up modified due to the id generation in the .app file.
  108. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT -
  109. $t rm $(APP)/EXPECT
  110. core-deps-dep-built-full: init
  111. $i "Bootstrap a new OTP library named $(APP)"
  112. $t mkdir $(APP)/
  113. $t cp ../erlang.mk $(APP)/
  114. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  115. $i "Add cowlib to the list of dependencies"
  116. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  117. $i "Build the application"
  118. $t $(MAKE) -C $(APP) $v
  119. $i "Touch one cowlib file to mark it for recompilation"
  120. $t $(SLEEP)
  121. $t touch $(APP)/deps/cowlib/src/cow_http.erl
  122. $i "Check that cowlib is rebuilt with FULL=1"
  123. $t printf "%s\n" \
  124. $(APP)/deps/cowlib/cowlib.d \
  125. $(APP)/deps/cowlib/ebin/cowlib.app \
  126. $(APP)/deps/cowlib/ebin/cow_http.beam \
  127. $(APP)/deps/cowlib/ebin/dep_built | sort > $(APP)/EXPECT
  128. $t $(SLEEP)
  129. $t $(MAKE) -C $(APP) FULL=1 $v
  130. # Files in .git might end up modified due to the id generation in the .app file.
  131. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT -
  132. $t rm $(APP)/EXPECT
  133. core-deps-dep-built-force-full: init
  134. $i "Bootstrap a new OTP library named $(APP)"
  135. $t mkdir $(APP)/
  136. $t cp ../erlang.mk $(APP)/
  137. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  138. $i "Add cowlib to the list of dependencies"
  139. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  140. $i "Build the application"
  141. $t $(MAKE) -C $(APP) $v
  142. $i "Touch one cowlib file to mark it for recompilation"
  143. $t $(SLEEP)
  144. $t touch $(APP)/deps/cowlib/src/cow_http.erl
  145. $i "Check that cowlib is not rebuilt if \`force_rebuild_dep\` returns false"
  146. $t touch $(APP)/EXPECT
  147. $t $(SLEEP)
  148. $t $(MAKE) -C $(APP) force_rebuild_dep='test $$(1) != $(CURDIR)/$(APP)/deps/cowlib' $v
  149. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | sort | diff $(APP)/EXPECT -
  150. $t rm $(APP)/EXPECT
  151. $i "Check that cowlib is rebuilt if \`force_rebuild_dep\` returns true"
  152. $t printf "%s\n" \
  153. $(APP)/deps/cowlib/cowlib.d \
  154. $(APP)/deps/cowlib/ebin/cowlib.app \
  155. $(APP)/deps/cowlib/ebin/cow_http.beam \
  156. $(APP)/deps/cowlib/ebin/dep_built | sort > $(APP)/EXPECT
  157. $t $(SLEEP)
  158. $t $(MAKE) -C $(APP) force_rebuild_dep='test $$(1) = $(CURDIR)/$(APP)/deps/cowlib' $v
  159. # Files in .git might end up modified due to the id generation in the .app file.
  160. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT -
  161. $t rm $(APP)/EXPECT
  162. $i "Touch one cowlib file to mark it for recompilation"
  163. $t $(SLEEP)
  164. $t touch $(APP)/deps/cowlib/src/cow_http.erl
  165. $i "Check that cowlib is not rebuilt if \`FORCE_REBUILD\` is empty"
  166. $t touch $(APP)/EXPECT
  167. $t $(SLEEP)
  168. $t $(MAKE) -C $(APP) FORCE_REBUILD= $v
  169. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | sort | diff $(APP)/EXPECT -
  170. $t rm $(APP)/EXPECT
  171. $i "Check that cowlib is not rebuilt if \`FORCE_REBUILD\` does not mention cowlib"
  172. $t touch $(APP)/EXPECT
  173. $t $(SLEEP)
  174. $t $(MAKE) -C $(APP) FORCE_REBUILD='other_dep' $v
  175. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | sort | diff $(APP)/EXPECT -
  176. $t rm $(APP)/EXPECT
  177. $i "Check that cowlib is rebuilt if \`FORCE_REBUILD\` contains cowlib"
  178. $t printf "%s\n" \
  179. $(APP)/deps/cowlib/cowlib.d \
  180. $(APP)/deps/cowlib/ebin/cowlib.app \
  181. $(APP)/deps/cowlib/ebin/cow_http.beam \
  182. $(APP)/deps/cowlib/ebin/dep_built | sort > $(APP)/EXPECT
  183. $t $(SLEEP)
  184. $t $(MAKE) -C $(APP) FORCE_REBUILD='other_dep cowlib' $v
  185. # Files in .git might end up modified due to the id generation in the .app file.
  186. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT -
  187. $t rm $(APP)/EXPECT
  188. core-deps-dep-built-ln: init
  189. $i "Bootstrap a new OTP library named $(APP)"
  190. $t mkdir $(APP)/
  191. $t cp ../erlang.mk $(APP)/
  192. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  193. $i "Add cowlib to the list of dependencies"
  194. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  195. $i "Clone cowlib manually inside $(APP)"
  196. $t git clone -q https://github.com/ninenines/cowlib $(APP)/cowlib
  197. $i "Link to cowlib instead of fetching the dependency"
  198. $t mkdir -p $(APP)/deps
  199. $t ln -s ../cowlib $(APP)/deps/cowlib
  200. $i "Build the application"
  201. $t $(MAKE) -C $(APP) $v
  202. # On MSYS2 "ln" will by default not create symbolic links because
  203. # it requires an option to be enabled and administrative privileges.
  204. # The "rebuild" part of the test is therefore skipped on Windows.
  205. ifneq ($(PLATFORM),msys2)
  206. $i "Touch one cowlib file to mark it for recompilation"
  207. $t $(SLEEP)
  208. $t touch $(APP)/deps/cowlib/src/cow_http.erl
  209. $i "Check that cowlib is rebuilt; symlinked deps don't create dep_built"
  210. $t printf "%s\n" \
  211. $(APP)/cowlib/cowlib.d \
  212. $(APP)/cowlib/ebin/cowlib.app \
  213. $(APP)/cowlib/ebin/cow_http.beam | sort > $(APP)/EXPECT
  214. $t $(SLEEP)
  215. $t $(MAKE) -C $(APP) $v
  216. # Files in .git might end up modified due to the id generation in the .app file.
  217. $t find $(APP)/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT -
  218. $t rm $(APP)/EXPECT
  219. endif
  220. core-deps-dep-commit: init
  221. $i "Bootstrap a new OTP library named $(APP)"
  222. $t mkdir $(APP)/
  223. $t cp ../erlang.mk $(APP)/
  224. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  225. $i "Add Cowboy 1.0.0 to the list of dependencies"
  226. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 1.0.0\n"}' $(APP)/Makefile
  227. ifdef LEGACY
  228. $i "Add Cowboy to the applications key in the .app.src file"
  229. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  230. endif
  231. $i "Build the application"
  232. $t $(MAKE) -C $(APP) $v
  233. $i "Check that all dependencies were fetched"
  234. $t test -d $(APP)/deps/cowboy
  235. $t test -d $(APP)/deps/cowlib
  236. $t test -d $(APP)/deps/ranch
  237. $i "Check that the application was compiled correctly"
  238. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  239. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  240. {ok, Deps} = application:get_key($(APP), applications), \
  241. true = lists:member(cowboy, Deps), \
  242. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  243. halt()"
  244. core-deps-dir: init
  245. $i "Bootstrap a new OTP library named $(APP)"
  246. $t mkdir $(APP)/
  247. $t cp ../erlang.mk $(APP)/
  248. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  249. $i "Add Cowboy to the list of dependencies with a custom DEPS_DIR"
  250. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nDEPS_DIR ?= \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
  251. ifdef LEGACY
  252. $i "Add Cowboy to the applications key in the .app.src file"
  253. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  254. endif
  255. $i "Build the application"
  256. $t $(MAKE) -C $(APP) $v
  257. $i "Check that all dependencies were fetched in the custom DEPS_DIR"
  258. $t test -d $(APP)/deep/libs/cowboy
  259. $t test -d $(APP)/deep/libs/cowlib
  260. $t test -d $(APP)/deep/libs/ranch
  261. $i "Check that the application was compiled correctly"
  262. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deep/libs/*/ebin/ -eval " \
  263. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  264. {ok, Deps} = application:get_key($(APP), applications), \
  265. true = lists:member(cowboy, Deps), \
  266. halt()"
  267. core-deps-doc: init
  268. $i "Bootstrap a new OTP library named $(APP)"
  269. $t mkdir $(APP)/
  270. $t cp ../erlang.mk $(APP)/
  271. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  272. $i "Generate .erl files"
  273. $t echo "-module(boy)." > $(APP)/src/boy.erl
  274. $t echo "-module(girl)." > $(APP)/src/girl.erl
  275. $i "Add Edown as a documentation building dependency"
  276. $t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = edown\nEDOC_OPTS = {doclet, edown_doclet}\n"}' $(APP)/Makefile
  277. $i "Build the application"
  278. $t $(MAKE) -C $(APP) $v
  279. $i "Check that no dependencies were fetched"
  280. $t test ! -e $(APP)/deps
  281. $i "Check that the application was compiled correctly"
  282. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  283. [ok = application:load(App) || App <- [$(APP)]], \
  284. {ok, Deps} = application:get_key($(APP), applications), \
  285. false = lists:member(edown, Deps), \
  286. halt()"
  287. $i "Build the application documentation"
  288. $t $(MAKE) -C $(APP) edoc $v
  289. $i "Check that documentation dependencies were fetched"
  290. $t test -d $(APP)/deps/edown
  291. $i "Check the Edown generated Markdown documentation"
  292. $t test -f $(APP)/doc/boy.md
  293. $t test -f $(APP)/doc/girl.md
  294. core-deps-fetch-cp: init
  295. $i "Bootstrap a new OTP library named $(APP)"
  296. $t mkdir $(APP)/
  297. $t cp ../erlang.mk $(APP)/
  298. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  299. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  300. $t mkdir $(APP)/my_dep
  301. $t cp ../erlang.mk $(APP)/my_dep/
  302. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  303. $i "Add my_dep to the list of dependencies"
  304. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  305. ifdef LEGACY
  306. $i "Add my_dep to the applications key in the .app.src file"
  307. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  308. endif
  309. $i "Build the application"
  310. $t $(MAKE) -C $(APP) $v
  311. $i "Check that all dependencies were fetched"
  312. $t test -d $(APP)/deps/my_dep
  313. $i "Check that the application was compiled correctly"
  314. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  315. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  316. {ok, Deps} = application:get_key($(APP), applications), \
  317. true = lists:member(my_dep, Deps), \
  318. halt()"
  319. core-deps-fetch-custom: init
  320. $i "Bootstrap a new OTP library named $(APP)"
  321. $t mkdir $(APP)/
  322. $t cp ../erlang.mk $(APP)/
  323. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  324. $i "Add dependency boop using custom fetch method beep to the list of dependencies"
  325. $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
  326. ifdef LEGACY
  327. $i "Add boop to the applications key in the .app.src file"
  328. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tboop,\n"}' $(APP)/src/$(APP).app.src
  329. endif
  330. $i "Build the application"
  331. $t $(MAKE) -C $(APP) $v
  332. $i "Check that all dependencies were fetched"
  333. $t test -d $(APP)/deps/boop
  334. $i "Check that the application was compiled correctly"
  335. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  336. ok = application:load($(APP)), \
  337. {ok, Deps} = application:get_key($(APP), applications), \
  338. true = lists:member(boop, Deps), \
  339. halt()"
  340. core-deps-fetch-fail-bad: init
  341. $i "Bootstrap a new OTP library named $(APP)"
  342. $t mkdir $(APP)/
  343. $t cp ../erlang.mk $(APP)/
  344. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  345. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  346. $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
  347. $i "Check that building the application fails"
  348. $t ! $(MAKE) -C $(APP) $v
  349. core-deps-fetch-fail-unknown: init
  350. $i "Bootstrap a new OTP library named $(APP)"
  351. $t mkdir $(APP)/
  352. $t cp ../erlang.mk $(APP)/
  353. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  354. $i "Add an unknown application as a dependency"
  355. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = unknown\n"}' $(APP)/Makefile
  356. $i "Check that building the application fails"
  357. $t ! $(MAKE) -C $(APP) $v
  358. core-deps-fetch-git: init
  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 "Add Cowboy 1.0.0 to the list of dependencies"
  364. $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
  365. ifdef LEGACY
  366. $i "Add Cowboy to the applications key in the .app.src file"
  367. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  368. endif
  369. $i "Build the application"
  370. $t $(MAKE) -C $(APP) $v
  371. $i "Check that all dependencies were fetched"
  372. $t test -d $(APP)/deps/cowboy
  373. $t test -d $(APP)/deps/cowlib
  374. $t test -d $(APP)/deps/ranch
  375. $i "Check that the application was compiled correctly"
  376. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  377. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  378. {ok, Deps} = application:get_key($(APP), applications), \
  379. true = lists:member(cowboy, Deps), \
  380. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  381. halt()"
  382. core-deps-fetch-git-subfolder: init
  383. $i "Bootstrap a new OTP library named $(APP)"
  384. $t mkdir $(APP)/
  385. $t cp ../erlang.mk $(APP)/
  386. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  387. $i "Bootstrap a new OTP library named my_dep as a subfolder inside $(APP)"
  388. $t mkdir -p $(APP)/git_repo/my_dep
  389. $t cp ../erlang.mk $(APP)/git_repo/my_dep/
  390. $t $(MAKE) -C $(APP)/git_repo/my_dep/ -f erlang.mk bootstrap-lib $v
  391. # Create an empty file so src/ gets committed.
  392. $t touch $(APP)/git_repo/my_dep/src/README
  393. $t cd $(APP)/git_repo && \
  394. git init -q && \
  395. git config user.email "testsuite@erlang.mk" && \
  396. git config user.name "test suite" && \
  397. git add . && \
  398. git commit -q --no-gpg-sign -m "Tests"
  399. $i "Add my_dep to the list of dependencies"
  400. $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
  401. ifdef LEGACY
  402. $i "Add my_dep to the applications key in the .app.src file"
  403. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  404. endif
  405. $i "Build the application"
  406. $t $(MAKE) -C $(APP) $v
  407. $i "Check that the dependency was fetched"
  408. $t test -d $(APP)/deps/my_dep
  409. $i "Check that the application was compiled correctly"
  410. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  411. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  412. {ok, Deps} = application:get_key($(APP), applications), \
  413. true = lists:member(my_dep, Deps), \
  414. halt()"
  415. core-deps-fetch-git-submodule: init
  416. $i "Bootstrap a new OTP library named $(APP)"
  417. $t mkdir $(APP)/
  418. $t cp ../erlang.mk $(APP)/
  419. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  420. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  421. $t mkdir $(APP)/my_dep
  422. $t cp ../erlang.mk $(APP)/my_dep/
  423. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  424. # Create an empty file so src/ gets committed.
  425. $t touch $(APP)/my_dep/src/README
  426. $t cd $(APP)/my_dep && \
  427. git init -q && \
  428. git config user.email "testsuite@erlang.mk" && \
  429. git config user.name "test suite" && \
  430. git add . && \
  431. git commit -q --no-gpg-sign -m "Tests"
  432. $i "Add the submodule to my_dep"
  433. $t mkdir $(APP)/deps
  434. $t cd $(APP) && \
  435. git init -q && \
  436. git submodule -q add file://$(abspath $(APP)/my_dep) deps/my_dep && \
  437. git config user.email "testsuite@erlang.mk" && \
  438. git config user.name "test suite" && \
  439. git add . && \
  440. git commit -q --no-gpg-sign -m "Tests"
  441. $i "Distclean the application"
  442. $t $(MAKE) -C $(APP) distclean $v
  443. $i "Add my_dep to the list of dependencies"
  444. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = git-submodule\n"}' $(APP)/Makefile
  445. ifdef LEGACY
  446. $i "Add my_dep to the applications key in the .app.src file"
  447. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  448. endif
  449. $i "Build the application"
  450. $t $(MAKE) -C $(APP) $v
  451. $i "Check that all dependencies were fetched"
  452. $t test -d $(APP)/deps/my_dep
  453. $i "Check that the application was compiled correctly"
  454. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  455. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  456. {ok, Deps} = application:get_key($(APP), applications), \
  457. true = lists:member(my_dep, Deps), \
  458. halt()"
  459. core-deps-fetch-hex: init
  460. $i "Bootstrap a new OTP library named $(APP)"
  461. $t mkdir $(APP)/
  462. $t cp ../erlang.mk $(APP)/
  463. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  464. $i "Add Cowboy 1.0.0 to the list of dependencies"
  465. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 1.0.0\n"}' $(APP)/Makefile
  466. ifdef LEGACY
  467. $i "Add Cowboy to the applications key in the .app.src file"
  468. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  469. endif
  470. $i "Build the application"
  471. $t $(MAKE) -C $(APP) $v
  472. $i "Check that all dependencies were fetched"
  473. $t test -d $(APP)/deps/cowboy
  474. $t test -d $(APP)/deps/cowlib
  475. $t test -d $(APP)/deps/ranch
  476. $i "Check that the application was compiled correctly"
  477. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  478. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  479. {ok, Deps} = application:get_key($(APP), applications), \
  480. true = lists:member(cowboy, Deps), \
  481. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  482. halt()"
  483. # @todo Enable this test again when a host provides Mercurial again.
  484. #core-deps-fetch-hg: init
  485. #
  486. # $i "Bootstrap a new OTP library named $(APP)"
  487. # $t mkdir $(APP)/
  488. # $t cp ../erlang.mk $(APP)/
  489. # $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  490. #
  491. # $i "Add Ehsa 4.0.3 to the list of dependencies"
  492. # $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
  493. #
  494. #ifdef LEGACY
  495. # $i "Add ehsa to the applications key in the .app.src file"
  496. # $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tehsa,\n"}' $(APP)/src/$(APP).app.src
  497. #endif
  498. #
  499. # $i "Build the application"
  500. # $t $(MAKE) -C $(APP) $v
  501. #
  502. # $i "Check that all dependencies were fetched"
  503. # $t test -d $(APP)/deps/ehsa
  504. #
  505. # $i "Check that the application was compiled correctly"
  506. # $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  507. # [ok = application:load(App) || App <- [$(APP), ehsa]], \
  508. # {ok, Deps} = application:get_key($(APP), applications), \
  509. # true = lists:member(ehsa, Deps), \
  510. # {ok, \"4.0.3\"} = application:get_key(ehsa, vsn), \
  511. # halt()"
  512. # Legacy must fail for the top-level application, but work for dependencies.
  513. core-deps-fetch-legacy: init
  514. $i "Bootstrap a new OTP library named $(APP)"
  515. $t mkdir $(APP)/
  516. $t cp ../erlang.mk $(APP)/
  517. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  518. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  519. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
  520. $i "Check that building the application fails"
  521. $t ! $(MAKE) -C $(APP) $v
  522. $i "Check that building the application works with IS_DEP=1"
  523. $t $(MAKE) -C $(APP) IS_DEP=1 $v
  524. core-deps-fetch-ln: init
  525. $i "Bootstrap a new OTP library named $(APP)"
  526. $t mkdir $(APP)/
  527. $t cp ../erlang.mk $(APP)/
  528. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  529. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  530. $t mkdir $(APP)/my_dep
  531. $t cp ../erlang.mk $(APP)/my_dep/
  532. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  533. $i "Add my_dep to the list of dependencies"
  534. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = ln $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  535. ifdef LEGACY
  536. $i "Add my_dep to the applications key in the .app.src file"
  537. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  538. endif
  539. $i "Build the application"
  540. $t $(MAKE) -C $(APP) $v
  541. $i "Check that all dependencies were fetched"
  542. $t test -d $(APP)/deps/my_dep
  543. $i "Check that the application was compiled correctly"
  544. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  545. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  546. {ok, Deps} = application:get_key($(APP), applications), \
  547. true = lists:member(my_dep, Deps), \
  548. halt()"
  549. core-deps-fetch-svn: init
  550. $i "Bootstrap a new OTP library named $(APP)"
  551. $t mkdir $(APP)/
  552. $t cp ../erlang.mk $(APP)/
  553. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  554. $i "Add Cowlib 1.0.0 to the list of dependencies"
  555. $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
  556. ifdef LEGACY
  557. $i "Add Cowlib to the applications key in the .app.src file"
  558. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  559. endif
  560. $i "Build the application"
  561. $t $(MAKE) -C $(APP) $v
  562. $i "Check that all dependencies were fetched"
  563. $t test -d $(APP)/deps/cowlib
  564. $i "Check that the application was compiled correctly"
  565. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  566. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  567. {ok, Deps} = application:get_key($(APP), applications), \
  568. true = lists:member(cowlib, Deps), \
  569. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  570. halt()"
  571. core-deps-ignore: init
  572. $i "Bootstrap a new OTP library named $(APP)"
  573. $t mkdir $(APP)/
  574. $t cp ../erlang.mk $(APP)/
  575. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  576. $i "Add Cowboy to dependencies, Ranch to the ignore list and to test dependencies"
  577. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nIGNORE_DEPS = ranch\nTEST_DEPS = ranch\n"}' $(APP)/Makefile
  578. ifdef LEGACY
  579. $i "Add Cowboy to the applications key in the .app.src file"
  580. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  581. endif
  582. $i "Build the application"
  583. $t $(MAKE) -C $(APP) $v
  584. $i "Check that the correct dependencies were fetched"
  585. $t test -d $(APP)/deps/cowboy
  586. $t test -d $(APP)/deps/cowlib
  587. $t test ! -e $(APP)/deps/ranch
  588. $i "Build the test dependencies"
  589. $t $(MAKE) -C $(APP) test-deps $v
  590. $i "Check that the correct dependencies were fetched"
  591. $t test -d $(APP)/deps/ranch
  592. define add_dep_and_subdep
  593. $i "Bootstrap a new OTP library named $(APP)_$(1)subdep"
  594. $t mkdir $(APP)_$(1)subdep/
  595. $t cp ../erlang.mk $(APP)_$(1)subdep/
  596. $t $2 -C $(APP)_$(1)subdep --no-print-directory -f erlang.mk bootstrap-lib $$v
  597. $i "Create a Git repository for $(APP)_$(1)subdep"
  598. $t (cd $(APP)_$(1)subdep && \
  599. git init -q && \
  600. git config user.name "Testsuite" && \
  601. git config user.email "testsuite@erlang.mk" && \
  602. git add . && \
  603. git commit -q --no-gpg-sign -m "Initial commit")
  604. $i "Bootstrap a new OTP library named $(APP)_$(1)dep"
  605. $t mkdir $(APP)_$(1)dep/
  606. $t cp ../erlang.mk $(APP)_$(1)dep/
  607. $t $2 -C $(APP)_$(1)dep --no-print-directory -f erlang.mk bootstrap-lib $$v
  608. $i "Add $(APP)_$(1)subdep as a dependency"
  609. $t perl -ni.bak -e \
  610. 'print;if ($$.==1) {print "DEPS = $(1)subdep\ndep_$(1)subdep = git file://$(abspath $(APP)_$(1)subdep) master\n"}' \
  611. $(APP)_$(1)dep/Makefile
  612. $t rm $(APP)_$(1)dep/Makefile.bak
  613. $i "Create a Git repository for $(APP)_$(1)dep"
  614. $t (cd $(APP)_$(1)dep && \
  615. git init -q && \
  616. git config user.name "Testsuite" && \
  617. git config user.email "testsuite@erlang.mk" && \
  618. git add . && \
  619. git commit -q --no-gpg-sign -m "Initial commit")
  620. endef
  621. core-deps-list-deps: init
  622. # We pass $(MAKE) directly so that GNU Make can pass its context forward.
  623. # If we didn't then $(MAKE) would be expanded in the call without context.
  624. $(call add_dep_and_subdep,,$(MAKE))
  625. $(call add_dep_and_subdep,doc,$(MAKE))
  626. $(call add_dep_and_subdep,rel,$(MAKE))
  627. $(call add_dep_and_subdep,test,$(MAKE))
  628. $(call add_dep_and_subdep,shell,$(MAKE))
  629. $i "Bootstrap a new OTP library named $(APP)"
  630. $t mkdir $(APP)/
  631. $t cp ../erlang.mk $(APP)/
  632. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  633. $i "Add $(APP)-dep and $(APP)-testdep as a dependency"
  634. $t sed -i.bak '2i\
  635. DEPS = dep\
  636. DOC_DEPS = docdep\
  637. REL_DEPS = reldep\
  638. TEST_DEPS = testdep\
  639. SHELL_DEPS = shelldep\
  640. dep_dep = git file://$(abspath $(APP)_dep) master\
  641. dep_docdep = git file://$(abspath $(APP)_docdep) master\
  642. dep_reldep = git file://$(abspath $(APP)_reldep) master\
  643. dep_testdep = git file://$(abspath $(APP)_testdep) master\
  644. dep_shelldep = git file://$(abspath $(APP)_shelldep) master\
  645. ' $(APP)/Makefile
  646. $t rm $(APP)/Makefile.bak
  647. $i "Create a Git repository for $(APP)"
  648. $t (cd $(APP) && \
  649. git init -q && \
  650. git config user.name "Testsuite" && \
  651. git config user.email "testsuite@erlang.mk" && \
  652. git add . && \
  653. git commit -q --no-gpg-sign -m "Initial commit")
  654. $i "List application dependencies"
  655. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  656. $t test -d $(APP)/deps/subdep
  657. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  658. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  659. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  660. $i "List application doc dependencies"
  661. $t $(MAKE) -C $(APP) --no-print-directory list-doc-deps $v
  662. $t test -d $(APP)/deps/subdep
  663. $t test -d $(APP)/deps/docsubdep
  664. $t printf "%s\n%s\n%s\n%s\n" \
  665. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/docdep $(APP)/deps/docsubdep) \
  666. | sort > $(APP)/expected-doc-deps.txt
  667. $t cmp $(APP)/expected-doc-deps.txt $(APP)/.erlang.mk/recursive-doc-deps-list.log
  668. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  669. $i "List application rel dependencies"
  670. $t $(MAKE) -C $(APP) --no-print-directory list-rel-deps $v
  671. $t test -d $(APP)/deps/subdep
  672. $t test -d $(APP)/deps/relsubdep
  673. $t printf "%s\n%s\n%s\n%s\n" \
  674. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/reldep $(APP)/deps/relsubdep) \
  675. | sort > $(APP)/expected-rel-deps.txt
  676. $t cmp $(APP)/expected-rel-deps.txt $(APP)/.erlang.mk/recursive-rel-deps-list.log
  677. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  678. $i "List application test dependencies"
  679. $t $(MAKE) -C $(APP) --no-print-directory list-test-deps $v
  680. $t test -d $(APP)/deps/subdep
  681. $t test -d $(APP)/deps/testsubdep
  682. $t printf "%s\n%s\n%s\n%s\n" \
  683. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/testdep $(APP)/deps/testsubdep) \
  684. | sort > $(APP)/expected-test-deps.txt
  685. $t cmp $(APP)/expected-test-deps.txt $(APP)/.erlang.mk/recursive-test-deps-list.log
  686. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  687. $i "List application shell dependencies"
  688. $t $(MAKE) -C $(APP) --no-print-directory list-shell-deps $v
  689. $t test -d $(APP)/deps/subdep
  690. $t test -d $(APP)/deps/shellsubdep
  691. $t printf "%s\n%s\n%s\n%s\n" \
  692. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
  693. | sort > $(APP)/expected-shell-deps.txt
  694. $t cmp $(APP)/expected-shell-deps.txt $(APP)/.erlang.mk/recursive-shell-deps-list.log
  695. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  696. $i "List application all dependencies (all kinds)"
  697. $t $(MAKE) -C $(APP) --no-print-directory list-deps DEP_TYPES='doc rel test shell' $v
  698. $t test -d $(APP)/deps/subdep
  699. $t test -d $(APP)/deps/docsubdep
  700. $t test -d $(APP)/deps/relsubdep
  701. $t test -d $(APP)/deps/testsubdep
  702. $t test -d $(APP)/deps/shellsubdep
  703. $t printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
  704. $(abspath \
  705. $(APP)/deps/dep $(APP)/deps/subdep \
  706. $(APP)/deps/docdep $(APP)/deps/docsubdep \
  707. $(APP)/deps/reldep $(APP)/deps/relsubdep \
  708. $(APP)/deps/testdep $(APP)/deps/testsubdep \
  709. $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
  710. | sort > $(APP)/expected-all-deps.txt
  711. $t cmp $(APP)/expected-all-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  712. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  713. core-deps-list-deps-with-apps: init
  714. # We pass $(MAKE) directly so that GNU Make can pass its context forward.
  715. # If we didn't then $(MAKE) would be expanded in the call without context.
  716. $(call add_dep_and_subdep,,$(MAKE))
  717. $i "Bootstrap a new OTP library named $(APP)"
  718. $t mkdir $(APP)/
  719. $t cp ../erlang.mk $(APP)/
  720. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  721. $i "Bootstrap another APP named $(APP)_app in $(APP) repository"
  722. $t $(MAKE) -C $(APP) --no-print-directory new-lib in=my_app $v
  723. $i "Bootstrap another APP named $(APP)_dep_app in $(APP)_dep repository"
  724. $t $(MAKE) -C $(APP)_dep --no-print-directory new-lib in=my_dep_app $v
  725. $t sed -i.bak '2i\
  726. APPS_DIR := $$(CURDIR)/apps\
  727. LOCAL_DEPS = my_dep_app ssl\
  728. ' $(APP)_dep/Makefile
  729. $t echo 'unexport APPS_DIR' >> $(APP)_dep/Makefile
  730. $t rm $(APP)_dep/Makefile.bak
  731. $t cd $(APP)_dep && git add .
  732. $t cd $(APP)_dep && git commit -q --no-gpg-sign -m "Add application"
  733. $i "Add $(APP)-dep as a dependency"
  734. $t sed -i.bak '2i\
  735. DEPS = dep\
  736. dep_dep = git file://$(abspath $(APP)_dep) master\
  737. ' $(APP)/Makefile
  738. $t rm $(APP)/Makefile.bak
  739. $i "Create a Git repository for $(APP)"
  740. $t (cd $(APP) && \
  741. git init -q && \
  742. git config user.name "Testsuite" && \
  743. git config user.email "testsuite@erlang.mk" && \
  744. git add . && \
  745. git commit -q --no-gpg-sign -m "Initial commit")
  746. $i "List application dependencies ($(APP)_app is missing)"
  747. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  748. $t test -d $(APP)/deps/subdep
  749. $t printf "%s\n%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/dep/apps/my_dep_app $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  750. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  751. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  752. $i "Add $(APP)_app as a dependency"
  753. $t sed -i.bak '3i\
  754. LOCAL_DEPS = my_app\
  755. ' $(APP)/Makefile
  756. $t rm $(APP)/Makefile.bak
  757. $i "List application dependencies ($(APP)_app is listed)"
  758. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  759. $t test -d $(APP)/deps/subdep
  760. $t printf "%s\n%s\n%s\n%s\n" $(abspath $(APP)/apps/my_app $(APP)/deps/dep $(APP)/deps/dep/apps/my_dep_app $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  761. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  762. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  763. core-deps-list-deps-with-specified-full-var: init
  764. # We pass $(MAKE) directly so that GNU Make can pass its context forward.
  765. # If we didn't then $(MAKE) would be expanded in the call without context.
  766. $(call add_dep_and_subdep,,$(MAKE))
  767. $i "Bootstrap a new OTP library named $(APP)"
  768. $t mkdir $(APP)/
  769. $t cp ../erlang.mk $(APP)/
  770. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  771. $i "Add $(APP)-dep as a dependency"
  772. $t sed -i.bak '2i\
  773. DEPS = dep\
  774. dep_dep = git file://$(abspath $(APP)_dep) master\
  775. ' $(APP)/Makefile
  776. $t rm $(APP)/Makefile.bak
  777. $i "Create a Git repository for $(APP)"
  778. $t (cd $(APP) && \
  779. git init -q && \
  780. git config user.name "Testsuite" && \
  781. git config user.email "testsuite@erlang.mk" && \
  782. git add . && \
  783. git commit -q --no-gpg-sign -m "Initial commit")
  784. $i "Build application"
  785. $t $(MAKE) -C $(APP) --no-print-directory $v
  786. $t test -d $(APP)/deps/subdep
  787. $i "List application dependencies without FULL"
  788. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  789. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  790. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  791. $i "List application dependencies with empty FULL"
  792. $t $(MAKE) -C $(APP) --no-print-directory list-deps FULL= $v
  793. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  794. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  795. $i "List application dependencies with FULL=1"
  796. $t $(MAKE) -C $(APP) --no-print-directory list-deps FULL=1 $v
  797. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  798. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  799. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  800. core-deps-makefile-change: init
  801. $i "Bootstrap a new OTP application named $(APP)"
  802. $t mkdir $(APP)/
  803. $t cp ../erlang.mk $(APP)/
  804. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  805. $i "Build the application"
  806. $t $(MAKE) -C $(APP) $v
  807. $i "Add Cowlib to the list of dependencies"
  808. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  809. ifdef LEGACY
  810. $i "Add Cowlib to the applications key in the .app.src file"
  811. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  812. endif
  813. $i "Build the application again"
  814. $t $(MAKE) -C $(APP) $v
  815. $i "Check that Cowlib was included in the .app file"
  816. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  817. ok = application:load($(APP)), \
  818. {ok, Apps} = application:get_key($(APP), applications), \
  819. true = lists:member(cowlib, Apps), \
  820. halt()."
  821. core-deps-dep-makefile-change: init
  822. $i "Bootstrap a new OTP application named $(APP)"
  823. $t mkdir $(APP)/
  824. $t cp ../erlang.mk $(APP)/
  825. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  826. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  827. $t mkdir $(APP)/my_dep
  828. $t cp ../erlang.mk $(APP)/my_dep/
  829. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  830. $i "Add my_dep to the list of dependencies"
  831. # We use FORCE_REBUILD to ensure it gets rebuilt even on Windows.
  832. $t perl -ni.bak -e "print;if ($$.==1) {print \"DEPS = my_dep\ndep_my_dep = ln $(CURDIR)/$(APP)/my_dep/\nFORCE_REBUILD = my_dep\n\"}" $(APP)/Makefile
  833. ifdef LEGACY
  834. $i "Add my_dep to the applications key in the .app.src file"
  835. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  836. endif
  837. $i "Build the application"
  838. $t $(MAKE) -C $(APP) NO_AUTOPATCH=my_dep $v
  839. $i "Add Cowlib to the list of dependencies in my_dep"
  840. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib_commit = master\n"}' $(APP)/deps/my_dep/Makefile
  841. ifdef LEGACY
  842. $i "Add Cowlib to the applications key in my_dep's .app.src file"
  843. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/deps/my_dep/src/my_dep.app.src
  844. endif
  845. $i "Build the application again"
  846. $t $(MAKE) -C $(APP) $v
  847. $i "Check that Cowlib was included in my_dep's .app file"
  848. $t $(ERL) -pa $(APP)/deps/my_dep/ebin/ -eval " \
  849. ok = application:load(my_dep), \
  850. {ok, Apps} = application:get_key(my_dep, applications), \
  851. true = lists:member(cowlib, Apps), \
  852. halt()."
  853. core-deps-mv: init
  854. $i "Bootstrap a new OTP library named $(APP)"
  855. $t mkdir $(APP)/
  856. $t cp ../erlang.mk $(APP)/
  857. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  858. $i "Add Cowlib to the list of dependencies"
  859. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  860. $i "Build the application"
  861. $t $(MAKE) -C $(APP) $v
  862. $i "Check that all dependencies were fetched"
  863. $t test -d $(APP)/deps/cowlib
  864. $i "Move the application elsewhere"
  865. $t mv $(APP) $(APP)-moved
  866. $i "Build the application"
  867. $t $(MAKE) -C $(APP)-moved $v
  868. core-deps-mv-rebar: init
  869. $i "Bootstrap a new OTP library named $(APP)"
  870. $t mkdir $(APP)/
  871. $t cp ../erlang.mk $(APP)/
  872. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  873. $i "Add Lager to the list of dependencies"
  874. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile
  875. $i "Build the application"
  876. $t $(MAKE) -C $(APP) $v
  877. $i "Check that all dependencies were fetched"
  878. $t test -d $(APP)/deps/goldrush
  879. $t test -d $(APP)/deps/lager
  880. $i "Move the application elsewhere"
  881. $t mv $(APP) $(APP)-moved
  882. $i "Build the application"
  883. $t $(MAKE) -C $(APP)-moved $v
  884. # A lower-level dependency of the first dependency always
  885. # wins over a lower-level dependency of the second dependency.
  886. core-deps-order-first: init
  887. $i "Bootstrap a new OTP library named $(APP)"
  888. $t mkdir $(APP)/
  889. $t cp ../erlang.mk $(APP)/
  890. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  891. $i "Add Cowboy package and my_dep to the list of dependencies"
  892. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep cowboy\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  893. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  894. $t mkdir $(APP)/my_dep
  895. $t cp ../erlang.mk $(APP)/my_dep/
  896. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  897. $i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
  898. $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
  899. ifdef LEGACY
  900. $i "Add Cowboy and my_dep to the applications key in the .app.src file"
  901. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  902. endif
  903. $i "Build the application"
  904. $t $(MAKE) -C $(APP) $v
  905. $i "Check that all dependencies were fetched"
  906. $t test -d $(APP)/deps/cowboy
  907. $t test -d $(APP)/deps/cowlib
  908. $t test -d $(APP)/deps/my_dep
  909. $t test -d $(APP)/deps/ranch
  910. $i "Check that the application was compiled correctly"
  911. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  912. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, my_dep, ranch]], \
  913. {ok, Deps} = application:get_key($(APP), applications), \
  914. true = lists:member(cowboy, Deps), \
  915. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  916. halt()"
  917. # A higher-level dependency always wins.
  918. core-deps-order-top: init
  919. $i "Bootstrap a new OTP library named $(APP)"
  920. $t mkdir $(APP)/
  921. $t cp ../erlang.mk $(APP)/
  922. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  923. $i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
  924. $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
  925. ifdef LEGACY
  926. $i "Add Cowboy to the applications key in the .app.src file"
  927. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  928. endif
  929. $i "Build the application"
  930. $t $(MAKE) -C $(APP) $v
  931. $i "Check that all dependencies were fetched"
  932. $t test -d $(APP)/deps/cowboy
  933. $t test -d $(APP)/deps/cowlib
  934. $t test -d $(APP)/deps/ranch
  935. $i "Check that the application was compiled correctly"
  936. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  937. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  938. {ok, Deps} = application:get_key($(APP), applications), \
  939. true = lists:member(cowboy, Deps), \
  940. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  941. halt()"
  942. ifndef LEGACY
  943. core-deps-otp: init
  944. $i "Bootstrap a new OTP library named $(APP)"
  945. $t mkdir $(APP)/
  946. $t cp ../erlang.mk $(APP)/
  947. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  948. $i "Add Crypto to the list of OTP dependencies"
  949. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = crypto\n"}' $(APP)/Makefile
  950. $i "Build the application"
  951. $t $(MAKE) -C $(APP) $v
  952. $i "Check that no dependencies were fetched"
  953. $t test ! -e $(APP)/deps
  954. $i "Check that the application was compiled correctly"
  955. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  956. [ok = application:load(App) || App <- [$(APP), crypto]], \
  957. {ok, Deps} = application:get_key($(APP), applications), \
  958. true = lists:member(crypto, Deps), \
  959. halt()"
  960. endif
  961. core-deps-pkg: init
  962. $i "Bootstrap a new OTP library named $(APP)"
  963. $t mkdir $(APP)/
  964. $t cp ../erlang.mk $(APP)/
  965. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  966. $i "Add Cowboy to the list of dependencies"
  967. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  968. ifdef LEGACY
  969. $i "Add Cowboy to the applications key in the .app.src file"
  970. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  971. endif
  972. $i "Build the application"
  973. $t $(MAKE) -C $(APP) $v
  974. $i "Check that all dependencies were fetched"
  975. $t test -d $(APP)/deps/cowboy
  976. $t test -d $(APP)/deps/cowlib
  977. $t test -d $(APP)/deps/ranch
  978. $i "Check that the application was compiled correctly"
  979. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  980. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  981. {ok, Deps} = application:get_key($(APP), applications), \
  982. true = lists:member(cowboy, Deps), \
  983. halt()"
  984. core-deps-rel: init
  985. $i "Bootstrap a new release-enabled OTP library named $(APP)"
  986. $t mkdir $(APP)/
  987. $t cp ../erlang.mk $(APP)/
  988. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
  989. $i "Add Recon to the list of release dependencies"
  990. $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
  991. $i "Add Recon to the relx.config file"
  992. $t $(ERL) -eval " \
  993. {ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
  994. Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
  995. ok = file:write_file(\"$(APP)/relx.config\", \
  996. lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
  997. halt()"
  998. $i "Build the application and its dependencies"
  999. $t $(MAKE) -C $(APP) deps app $v
  1000. $i "Check that no dependencies were fetched"
  1001. $t test ! -e $(APP)/deps
  1002. $i "Check that the application was compiled correctly"
  1003. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1004. [ok = application:load(App) || App <- [$(APP)]], \
  1005. {ok, Deps} = application:get_key($(APP), applications), \
  1006. false = lists:member(recon, Deps), \
  1007. halt()"
  1008. $i "Build the release"
  1009. $t $(MAKE) -C $(APP) $v
  1010. $i "Check that all dependencies were fetched"
  1011. $t test -d $(APP)/deps/recon
  1012. $i "Check that the application was compiled correctly"
  1013. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1014. [ok = application:load(App) || App <- [$(APP), recon]], \
  1015. {ok, Deps} = application:get_key($(APP), applications), \
  1016. false = lists:member(recon, Deps), \
  1017. halt()"
  1018. # @todo Add check for MSYS2 when releases under Windows become usable.
  1019. # $i "Start the release and check that Recon is loaded"
  1020. ifeq ($(PLATFORM),msys2)
  1021. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
  1022. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
  1023. # $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
  1024. # application loaded_applications | grep recon`"
  1025. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
  1026. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
  1027. else
  1028. $i "Start the release and check that Recon is loaded"
  1029. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
  1030. $t apps="Node is not running!"; \
  1031. while test "$$apps" = "Node is not running!"; do \
  1032. apps=$$($(APP)/_rel/$(APP)_release/bin/$(APP)_release \
  1033. rpcterms \ application loaded_applications); \
  1034. done; \
  1035. echo "$$apps" | grep -q recon
  1036. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
  1037. endif
  1038. core-deps-search: init
  1039. $i "Bootstrap a new OTP library named $(APP)"
  1040. $t mkdir $(APP)/
  1041. $t cp ../erlang.mk $(APP)/
  1042. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1043. $i "Run 'make search' and check that it prints packages"
  1044. $t test -n "`$(MAKE) -C $(APP) search`"
  1045. $i "Run 'make search q=cowboy' and check that it prints packages"
  1046. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
  1047. core-deps-shell: init
  1048. $i "Bootstrap a new OTP library named $(APP)"
  1049. $t mkdir $(APP)/
  1050. $t cp ../erlang.mk $(APP)/
  1051. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1052. $i "Bootstrap a new OTP application named my_dep inside $(APP)"
  1053. $t mkdir $(APP)/my_dep
  1054. $t cp ../erlang.mk $(APP)/my_dep/
  1055. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap $v
  1056. $i "Add my_dep to the list of dependencies"
  1057. # We use FORCE_REBUILD to ensure it gets rebuilt even on Windows.
  1058. $t perl -ni.bak -e "print;if ($$.==1) {print \"SHELL_DEPS = my_dep\ndep_my_dep = ln $(CURDIR)/$(APP)/my_dep/\nFORCE_REBUILD = my_dep\n\"}" $(APP)/Makefile
  1059. $i "Build the application and its dependencies"
  1060. $t $(MAKE) -C $(APP) deps app $v
  1061. $i "Check that no dependencies were fetched"
  1062. $t test ! -e $(APP)/deps
  1063. $i "Check that the application was compiled correctly"
  1064. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1065. [ok = application:load(App) || App <- [$(APP)]], \
  1066. {ok, Deps} = application:get_key($(APP), applications), \
  1067. false = lists:member(my_dep, Deps), \
  1068. halt()"
  1069. $i "Run the shell"
  1070. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
  1071. ok = application:load($(APP)), \
  1072. ok = application:load(my_dep), \
  1073. halt()\"" $v
  1074. $i "Check that all dependencies were fetched"
  1075. $t test -d $(APP)/deps/my_dep
  1076. $i "Check that the application was compiled correctly"
  1077. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1078. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  1079. {ok, Deps} = application:get_key($(APP), applications), \
  1080. false = lists:member(my_dep, Deps), \
  1081. halt()"
  1082. core-deps-skip: init
  1083. $i "Bootstrap a new OTP library named $(APP)"
  1084. $t mkdir $(APP)/
  1085. $t cp ../erlang.mk $(APP)/
  1086. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1087. $i "Add Cowboy to the list of dependencies"
  1088. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  1089. ifdef LEGACY
  1090. $i "Add Cowboy to the applications key in the .app.src file"
  1091. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1092. endif
  1093. $i "Build the application with SKIP_DEPS=1"
  1094. $t $(MAKE) -C $(APP) SKIP_DEPS=1 $v
  1095. $i "Check that no dependencies were fetched"
  1096. $t test ! -e $(APP)/deps
  1097. $i "Build the application"
  1098. $t $(MAKE) -C $(APP) $v
  1099. $i "Check that all dependencies were fetched"
  1100. $t test -d $(APP)/deps/cowlib
  1101. $t test -d $(APP)/deps/cowboy
  1102. $t test -d $(APP)/deps/ranch
  1103. $i "Distclean with SKIP_DEPS=1"
  1104. $t $(MAKE) -C $(APP) distclean SKIP_DEPS=1 $v
  1105. $i "Check that no dependencies were removed"
  1106. $t test -d $(APP)/deps/cowlib
  1107. $t test -d $(APP)/deps/cowboy
  1108. $t test -d $(APP)/deps/ranch
  1109. core-deps-test: init
  1110. $i "Bootstrap a new OTP library named $(APP)"
  1111. $t mkdir $(APP)/
  1112. $t cp ../erlang.mk $(APP)/
  1113. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1114. $i "Generate .erl files"
  1115. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1116. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1117. $i "Add triq to the list of test dependencies"
  1118. $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = triq\n"}' $(APP)/Makefile
  1119. $i "Build the application and its dependencies"
  1120. $t $(MAKE) -C $(APP) deps app $v
  1121. $i "Check that no dependencies were fetched"
  1122. $t test ! -e $(APP)/deps
  1123. $i "Check that the application was compiled correctly"
  1124. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1125. [ok = application:load(App) || App <- [$(APP)]], \
  1126. {ok, Deps} = application:get_key($(APP), applications), \
  1127. false = lists:member(triq, Deps), \
  1128. halt()"
  1129. $i "Run tests"
  1130. $t $(MAKE) -C $(APP) tests $v
  1131. $i "Check that all dependencies were fetched"
  1132. $t test -d $(APP)/deps/triq
  1133. $i "Check that the application was compiled correctly"
  1134. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1135. [ok = application:load(App) || App <- [$(APP), triq]], \
  1136. {ok, Deps} = application:get_key($(APP), applications), \
  1137. false = lists:member(triq, Deps), \
  1138. halt()"