core_deps.mk 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753
  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-apps: 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. # Bootstrap the application manually to make sure it works as intended.
  11. $i "Bootstrap a repository-local application my_app"
  12. $t mkdir -p $(APP)/apps/my_app/src/
  13. $t touch $(APP)/apps/file.erl
  14. $t echo "DEPS = cowlib" > $(APP)/apps/my_app/Makefile
  15. $t echo "include ../../erlang.mk" >> $(APP)/apps/my_app/Makefile
  16. $t echo "-module(boy)." > $(APP)/apps/my_app/src/boy.erl
  17. $t echo "-module(girl)." > $(APP)/apps/my_app/src/girl.erl
  18. $i "Build the application"
  19. $t $(MAKE) -C $(APP) $v
  20. $i "Check that all compiled files exist"
  21. $t test -f $(APP)/$(APP).d
  22. $t test -f $(APP)/ebin/$(APP).app
  23. $t test -f $(APP)/apps/my_app/my_app.d
  24. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  25. $t test -f $(APP)/apps/my_app/ebin/boy.beam
  26. $t test -f $(APP)/apps/my_app/ebin/girl.beam
  27. $t test -f $(APP)/deps/cowlib/ebin/cowlib.app
  28. # Applications in apps are compiled automatically but not added
  29. # to the application resource file unless they are listed in LOCAL_DEPS.
  30. $i "Check that the application was compiled correctly"
  31. $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
  32. [ok = application:load(App) || App <- [$(APP), my_app]], \
  33. {ok, Deps} = application:get_key($(APP), applications), \
  34. false = lists:member(my_app, Deps), \
  35. {ok, MyAppDeps} = application:get_key(my_app, applications), \
  36. true = lists:member(cowlib, MyAppDeps), \
  37. {ok, []} = application:get_key($(APP), modules), \
  38. {ok, Mods = [boy, girl]} = application:get_key(my_app, modules), \
  39. [{module, M} = code:load_file(M) || M <- Mods], \
  40. halt()"
  41. $i "Clean Cowlib"
  42. $t $(MAKE) -C $(APP)/deps/cowlib clean $v
  43. $i "Check that Cowlib compiled files were removed"
  44. $t test ! -e $(APP)/deps/cowlib/ebin/cowlib.app
  45. $i "Build the application again"
  46. $t $(MAKE) -C $(APP) $v
  47. $i "Check that Cowlib compiled files exist"
  48. $t test -f $(APP)/deps/cowlib/ebin/cowlib.app
  49. $i "Clean the application"
  50. $t $(MAKE) -C $(APP) clean $v
  51. $i "Check that Cowlib is still here"
  52. $t test -d $(APP)/deps/cowlib
  53. $i "Check that all relevant files were removed"
  54. $t test ! -e $(APP)/$(APP).d
  55. $t test ! -e $(APP)/ebin/$(APP).app
  56. $t test ! -e $(APP)/apps/my_app/my_app.d
  57. $t test ! -e $(APP)/apps/my_app/ebin/my_app.app
  58. $t test ! -e $(APP)/apps/my_app/ebin/boy.beam
  59. $t test ! -e $(APP)/apps/my_app/ebin/girl.beam
  60. $i "Distclean the application"
  61. $t $(MAKE) -C $(APP) distclean $v
  62. $i "Check that all relevant files were removed"
  63. $t test ! -e $(APP)/deps
  64. $i "Add my_app to the local dependencies"
  65. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = my_app\n"}' $(APP)/Makefile
  66. ifdef LEGACY
  67. $i "Add my_app to the applications key in the .app.src file"
  68. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_app,\n"}' $(APP)/src/$(APP).app.src
  69. endif
  70. $i "Build the application"
  71. $t $(MAKE) -C $(APP) $v
  72. $i "Check that all compiled files exist"
  73. $t test -f $(APP)/$(APP).d
  74. $t test -f $(APP)/ebin/$(APP).app
  75. $t test -f $(APP)/apps/my_app/my_app.d
  76. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  77. $t test -f $(APP)/apps/my_app/ebin/boy.beam
  78. $t test -f $(APP)/apps/my_app/ebin/girl.beam
  79. $t test -d $(APP)/deps/cowlib
  80. $i "Check that the application was compiled correctly"
  81. $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
  82. [ok = application:load(App) || App <- [$(APP), my_app]], \
  83. {ok, Deps} = application:get_key($(APP), applications), \
  84. true = lists:member(my_app, Deps), \
  85. {ok, MyAppDeps} = application:get_key(my_app, applications), \
  86. true = lists:member(cowlib, MyAppDeps), \
  87. {ok, []} = application:get_key($(APP), modules), \
  88. {ok, Mods = [boy, girl]} = application:get_key(my_app, modules), \
  89. [{module, M} = code:load_file(M) || M <- Mods], \
  90. halt()"
  91. core-deps-apps-build-count: build clean
  92. $i "Bootstrap a new OTP library named $(APP)"
  93. $t mkdir $(APP)/
  94. $t cp ../erlang.mk $(APP)/
  95. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  96. $t mkdir -p "$(APP)/priv/dep"
  97. $t echo "PROJECT = fake_dep" > $(APP)/priv/dep/Makefile
  98. $t echo "include ../../erlang.mk" >> $(APP)/priv/dep/Makefile
  99. $i "Bootstrap a repository-local application my_app"
  100. $t echo "DEPS = dep1 dep2 dep3 dep4" > $(APP)/Makefile
  101. $t echo "dep_dep1 = cp ./priv/dep" >> $(APP)/Makefile
  102. $t echo "dep_dep2 = cp ./priv/dep" >> $(APP)/Makefile
  103. $t echo "dep_dep3 = cp ./priv/dep" >> $(APP)/Makefile
  104. $t echo "dep_dep4 = cp ./priv/dep" >> $(APP)/Makefile
  105. $t echo "include erlang.mk" >> $(APP)/Makefile
  106. $i "Create a new application app_one"
  107. $t $(MAKE) -C $(APP) new-app in=app_one $v
  108. $t echo "all::" >> $(APP)/apps/app_one/Makefile
  109. $t echo " @printf '#' >> count" >> $(APP)/apps/app_one/Makefile
  110. $i "Create a new application app_two"
  111. $t $(MAKE) -C $(APP) new-app in=app_two $v
  112. $t echo "all::" >> $(APP)/apps/app_two/Makefile
  113. $t echo " @printf '#' >> count" >> $(APP)/apps/app_two/Makefile
  114. $i "Build the application"
  115. $t $(MAKE) -C $(APP) $v
  116. $i "Check the number of times each app was compiled"
  117. $t test "`wc -c $(APP)/apps/app_one/count | awk '{printf $$1}'`" -eq 1
  118. $t test "`wc -c $(APP)/apps/app_two/count | awk '{printf $$1}'`" -eq 1
  119. core-deps-apps-conflict: build clean
  120. $i "Bootstrap a new OTP library named $(APP)"
  121. $t mkdir $(APP)/
  122. $t cp ../erlang.mk $(APP)/
  123. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  124. $i "Add Cowlib to the list of dependencies"
  125. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  126. $i "Create a new library Cowlib"
  127. $t $(MAKE) -C $(APP) new-lib in=cowlib $v
  128. $i "Check that building the application fails because of a conflict"
  129. $t ! $(MAKE) -C $(APP) $v
  130. $i "Check that Cowlib wasn't fetched"
  131. $t test ! -e $(APP)/deps/cowlib
  132. core-deps-apps-deep-conflict: build clean
  133. $i "Bootstrap a new OTP library named $(APP)"
  134. $t mkdir $(APP)/
  135. $t cp ../erlang.mk $(APP)/
  136. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  137. $i "Add Cowboy to the list of dependencies"
  138. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  139. $i "Create a new library Cowlib"
  140. $t $(MAKE) -C $(APP) new-lib in=cowlib $v
  141. $i "Check that building the application fails because of a conflict"
  142. $t ! $(MAKE) -C $(APP) $v
  143. $i "Check that Cowlib wasn't fetched"
  144. $t test ! -e $(APP)/deps/cowlib
  145. core-deps-apps-dir: build clean
  146. $i "Bootstrap a new OTP library named $(APP)"
  147. $t mkdir $(APP)/
  148. $t cp ../erlang.mk $(APP)/
  149. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  150. $i "Set a custom APPS_DIR"
  151. $t perl -ni.bak -e 'print;if ($$.==1) {print "APPS_DIR ?= \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
  152. $i "Create a new library my_app"
  153. $t $(MAKE) -C $(APP) new-lib in=my_app $v
  154. $i "Add Cowlib as a dependency to my_app"
  155. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/deep/libs/my_app/Makefile
  156. ifdef LEGACY
  157. $i "Add Cowlib to the applications key in the .app.src file"
  158. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/deep/libs/my_app/src/my_app.app.src
  159. endif
  160. $i "Generate .erl files in my_app"
  161. $t echo "-module(boy)." > $(APP)/deep/libs/my_app/src/boy.erl
  162. $t echo "-module(girl)." > $(APP)/deep/libs/my_app/src/girl.erl
  163. $i "Build the application"
  164. $t $(MAKE) -C $(APP) $v
  165. $i "Check that all compiled files exist"
  166. $t test -f $(APP)/$(APP).d
  167. $t test -f $(APP)/ebin/$(APP).app
  168. $t test -f $(APP)/deep/libs/my_app/my_app.d
  169. $t test -f $(APP)/deep/libs/my_app/ebin/my_app.app
  170. $t test -f $(APP)/deep/libs/my_app/ebin/boy.beam
  171. $t test -f $(APP)/deep/libs/my_app/ebin/girl.beam
  172. $t test -d $(APP)/deps/cowlib
  173. # Applications in apps are compiled automatically but not added
  174. # to the application resource file unless they are listed in LOCAL_DEPS.
  175. $i "Check that the application was compiled correctly"
  176. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deep/libs/*/ebin/ -eval " \
  177. [ok = application:load(App) || App <- [$(APP), my_app]], \
  178. {ok, Deps} = application:get_key($(APP), applications), \
  179. false = lists:member(my_app, Deps), \
  180. {ok, MyAppDeps} = application:get_key(my_app, applications), \
  181. true = lists:member(cowlib, MyAppDeps), \
  182. {ok, []} = application:get_key($(APP), modules), \
  183. {ok, Mods = [boy, girl]} = application:get_key(my_app, modules), \
  184. [{module, M} = code:load_file(M) || M <- Mods], \
  185. halt()"
  186. $i "Clean the application"
  187. $t $(MAKE) -C $(APP) clean $v
  188. $i "Check that Cowlib is still here"
  189. $t test -d $(APP)/deps/cowlib
  190. $i "Check that all relevant files were removed"
  191. $t test ! -e $(APP)/$(APP).d
  192. $t test ! -e $(APP)/ebin/$(APP).app
  193. $t test ! -e $(APP)/libs/my_app/my_app.d
  194. $t test ! -e $(APP)/libs/my_app/ebin/my_app.app
  195. $t test ! -e $(APP)/libs/my_app/ebin/boy.beam
  196. $t test ! -e $(APP)/libs/my_app/ebin/girl.beam
  197. $i "Distclean the application"
  198. $t $(MAKE) -C $(APP) distclean $v
  199. $i "Check that all relevant files were removed"
  200. $t test ! -e $(APP)/deps
  201. core-deps-apps-dir-include-lib: build clean
  202. $i "Bootstrap a new OTP library named $(APP)"
  203. $t mkdir $(APP)/
  204. $t cp ../erlang.mk $(APP)/
  205. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  206. $i "Set a custom APPS_DIR"
  207. $t perl -ni.bak -e 'print;if ($$.==1) {print "APPS_DIR ?= \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
  208. $i "Create new libraries boy_app and girl_app"
  209. $t $(MAKE) -C $(APP) new-lib in=boy_app $v
  210. $t $(MAKE) -C $(APP) new-lib in=girl_app $v
  211. $i "Generate .erl and .hrl files in apps with mutual include_lib()"
  212. $t echo '-module(boy). -include_lib("girl_app/include/girl.hrl").' > $(APP)/deep/libs/boy_app/src/boy.erl
  213. $t echo '-module(girl). -include_lib("boy_app/include/boy.hrl").' > $(APP)/deep/libs/girl_app/src/girl.erl
  214. $t mkdir -p $(APP)/deep/libs/boy_app/include
  215. $t echo '%% boy' > $(APP)/deep/libs/boy_app/include/boy.hrl
  216. $t mkdir -p $(APP)/deep/libs/girl_app/include
  217. $t echo '%% girl' > $(APP)/deep/libs/girl_app/include/girl.hrl
  218. $i "Build the application"
  219. $t $(MAKE) -C $(APP) $v
  220. $i "Check that all compiled files exist"
  221. $t test -f $(APP)/$(APP).d
  222. $t test -f $(APP)/ebin/$(APP).app
  223. $t test -f $(APP)/deep/libs/boy_app/boy_app.d
  224. $t test -f $(APP)/deep/libs/boy_app/ebin/boy_app.app
  225. $t test -f $(APP)/deep/libs/boy_app/ebin/boy.beam
  226. $t test -f $(APP)/deep/libs/girl_app/girl_app.d
  227. $t test -f $(APP)/deep/libs/girl_app/ebin/girl_app.app
  228. $t test -f $(APP)/deep/libs/girl_app/ebin/girl.beam
  229. $i "Distclean the application"
  230. $t $(MAKE) -C $(APP) distclean $v
  231. core-deps-apps-new-app: build clean
  232. $i "Bootstrap a new OTP library named $(APP)"
  233. $t mkdir $(APP)/
  234. $t cp ../erlang.mk $(APP)/
  235. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  236. $i "Create a new application my_app"
  237. $t $(MAKE) -C $(APP) new-app in=my_app $v
  238. $i "Check that all bootstrapped files exist"
  239. $t test -f $(APP)/apps/my_app/Makefile
  240. ifdef LEGACY
  241. $t test -f $(APP)/apps/my_app/src/my_app.app.src
  242. endif
  243. $t test -f $(APP)/apps/my_app/src/my_app_app.erl
  244. $t test -f $(APP)/apps/my_app/src/my_app_sup.erl
  245. $i "Create a new module my_server in my_app"
  246. $t $(MAKE) -C $(APP) new t=gen_server n=my_server in=my_app $v
  247. $i "Check that the file exists"
  248. $t test -f $(APP)/apps/my_app/src/my_server.erl
  249. $i "Build the application"
  250. $t $(MAKE) -C $(APP) $v
  251. $i "Check that all compiled files exist"
  252. $t test -f $(APP)/$(APP).d
  253. $t test -f $(APP)/ebin/$(APP).app
  254. $t test -f $(APP)/apps/my_app/my_app.d
  255. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  256. $t test -f $(APP)/apps/my_app/ebin/my_app_app.beam
  257. $t test -f $(APP)/apps/my_app/ebin/my_app_sup.beam
  258. $t test -f $(APP)/apps/my_app/ebin/my_server.beam
  259. $i "Check that the application was compiled correctly"
  260. $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
  261. ok = application:start(my_app), \
  262. {ok, [my_app_app, my_app_sup, my_server]} = application:get_key(my_app, modules), \
  263. {module, my_app_app} = code:load_file(my_app_app), \
  264. {module, my_app_sup} = code:load_file(my_app_sup), \
  265. {module, my_server} = code:load_file(my_server), \
  266. halt()"
  267. core-deps-apps-new-lib: build clean
  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 "Create a new application my_app"
  273. $t $(MAKE) -C $(APP) new-lib in=my_app $v
  274. $i "Check that all bootstrapped files exist"
  275. $t test -f $(APP)/apps/my_app/Makefile
  276. ifdef LEGACY
  277. $t test -f $(APP)/apps/my_app/src/my_app.app.src
  278. endif
  279. $i "Create a new module my_server in my_app"
  280. $t $(MAKE) -C $(APP) new t=gen_server n=my_server in=my_app $v
  281. $i "Check that the file exists"
  282. $t test -f $(APP)/apps/my_app/src/my_server.erl
  283. $i "Build the application"
  284. $t $(MAKE) -C $(APP) $v
  285. $i "Check that all compiled files exist"
  286. $t test -f $(APP)/$(APP).d
  287. $t test -f $(APP)/ebin/$(APP).app
  288. $t test -f $(APP)/apps/my_app/my_app.d
  289. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  290. $t test -f $(APP)/apps/my_app/ebin/my_server.beam
  291. $i "Check that the application was compiled correctly"
  292. $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
  293. ok = application:start(my_app), \
  294. {ok, [my_server]} = application:get_key(my_app, modules), \
  295. {module, my_server} = code:load_file(my_server), \
  296. halt()"
  297. core-deps-apps-new-tpl: build clean
  298. $i "Bootstrap a new OTP library named $(APP)"
  299. $t mkdir $(APP)/
  300. $t cp ../erlang.mk $(APP)/
  301. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  302. $i "Create a new library my_app"
  303. $t $(MAKE) -C $(APP) new-lib in=my_app $v
  304. $i "Generate one of each template"
  305. $t $(MAKE) -C $(APP) --no-print-directory new in=my_app t=gen_fsm n=my_fsm
  306. $t $(MAKE) -C $(APP) --no-print-directory new in=my_app t=gen_server n=my_server
  307. $t $(MAKE) -C $(APP) --no-print-directory new in=my_app t=supervisor n=my_sup
  308. # Here we disable warnings because templates contain missing behaviors.
  309. $i "Build the application"
  310. $t $(MAKE) -C $(APP)/apps/my_app ERLC_OPTS=+debug_info $v
  311. $i "Check that all compiled files exist"
  312. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  313. $t test -f $(APP)/apps/my_app/ebin/my_fsm.beam
  314. $t test -f $(APP)/apps/my_app/ebin/my_server.beam
  315. $t test -f $(APP)/apps/my_app/ebin/my_sup.beam
  316. $i "Check that all the modules can be loaded"
  317. $t $(ERL) -pa $(APP)/ebin/ $(APP)/apps/*/ebin/ -eval " \
  318. ok = application:start(my_app), \
  319. {ok, Mods = [my_fsm, my_server, my_sup]} = application:get_key(my_app, modules), \
  320. [{module, M} = code:load_file(M) || M <- Mods], \
  321. halt()"
  322. core-deps-apps-only: build clean
  323. $i "Create a multi application repository with no root application"
  324. $t mkdir $(APP)/
  325. $t cp ../erlang.mk $(APP)/
  326. $t echo "include erlang.mk" > $(APP)/Makefile
  327. $i "Create a new application my_app"
  328. $t $(MAKE) -C $(APP) new-app in=my_app $v
  329. $i "Create a module my_server from gen_server template in my_app"
  330. $t $(MAKE) -C $(APP) new t=gen_server n=my_server in=my_app $v
  331. $i "Add Cowlib to the list of dependencies"
  332. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/apps/my_app/Makefile
  333. $i "Build the application"
  334. $t $(MAKE) -C $(APP) $v
  335. $i "Check that all compiled files exist"
  336. $t test -f $(APP)/apps/my_app/my_app.d
  337. $t test -f $(APP)/apps/my_app/ebin/my_app.app
  338. $t test -f $(APP)/apps/my_app/ebin/my_app_app.beam
  339. $t test -f $(APP)/apps/my_app/ebin/my_app_sup.beam
  340. $t test -f $(APP)/apps/my_app/ebin/my_server.beam
  341. $t test -f $(APP)/deps/cowlib/ebin/cowlib.app
  342. $i "Check that the application was compiled correctly"
  343. $t $(ERL) -pa $(APP)/apps/*/ebin/ -eval " \
  344. ok = application:load(my_app), \
  345. {ok, Mods = [my_app_app, my_app_sup, my_server]} = application:get_key(my_app, modules), \
  346. [{module, M} = code:load_file(M) || M <- Mods], \
  347. halt()"
  348. $i "Clean Cowlib"
  349. $t $(MAKE) -C $(APP)/deps/cowlib clean $v
  350. $i "Check that Cowlib compiled files were removed"
  351. $t test ! -e $(APP)/deps/cowlib/ebin/cowlib.app
  352. $i "Build the application again"
  353. $t $(MAKE) -C $(APP) $v
  354. $i "Check that Cowlib compiled files exist"
  355. $t test -f $(APP)/deps/cowlib/ebin/cowlib.app
  356. $i "Clean the application"
  357. $t $(MAKE) -C $(APP) clean $v
  358. $i "Check that Cowlib is still here"
  359. $t test -d $(APP)/deps/cowlib
  360. $i "Check that all relevant files were removed"
  361. $t test ! -e $(APP)/apps/my_app/my_app.d
  362. $t test ! -e $(APP)/apps/my_app/ebin/my_app.app
  363. $t test ! -e $(APP)/apps/my_app/ebin/my_app_app.beam
  364. $t test ! -e $(APP)/apps/my_app/ebin/my_app_sup.beam
  365. $t test ! -e $(APP)/apps/my_app/ebin/my_server.beam
  366. $i "Distclean the application"
  367. $t $(MAKE) -C $(APP) distclean $v
  368. $i "Check that all relevant files were removed"
  369. $t test ! -e $(APP)/deps
  370. core-deps-apps-local-deps: build clean
  371. $i "Bootstrap a new OTP library named $(APP)"
  372. $t mkdir $(APP)/
  373. $t cp ../erlang.mk $(APP)/
  374. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  375. $i "Create a new application my_app_1"
  376. $t $(MAKE) -C $(APP) new-app in=my_app_1 $v
  377. $i "Add Lager to the list of dependencies of my_app_1, and add the lager parse_transform"
  378. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\nERLC_OPTS+=+{parse_transform,lager_transform}\n"}' $(APP)/apps/my_app_1/Makefile
  379. $i "Add a lager:error/2 call to my_app_1_app.erl that will fail if the parse_transform doesn't run"
  380. $t perl -ni.bak -e 'print;if (/^-export/){print "\n-export([log/0]).\n"} if (eof) {print "\nlog() -> lager:error(\"test\", []).\n"}' $(APP)/apps/my_app_1/src/my_app_1_app.erl
  381. $i "Create a new application my_app_2"
  382. $t $(MAKE) -C $(APP) new-app in=my_app_2 $v
  383. $i "Add my_app_1 to the list of local dependencies of my_app_2, don't add lager, but add the lager parse_transform (this will fail unless my_app_1 was indeed built first)"
  384. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = my_app_1\nERLC_OPTS+=+{parse_transform,lager_transform}\n"}' $(APP)/apps/my_app_2/Makefile
  385. $i "Add a lager:error/2 call to my_app_2_app.erl that will fail if the parse_transform doesn't run"
  386. $t perl -ni.bak -e 'print;if (/^-export/){print "\n-export([log/0]).\n"} if (eof) {print "\nlog() -> lager:error(\"test\", []).\n"}' $(APP)/apps/my_app_2/src/my_app_2_app.erl
  387. $i "Build the application"
  388. $t $(MAKE) -C $(APP) $v
  389. $i "Check that all compiled files exist"
  390. $t test -f $(APP)/$(APP).d
  391. $t test -f $(APP)/ebin/$(APP).app
  392. $t test -f $(APP)/apps/my_app_1/my_app_1.d
  393. $t test -f $(APP)/apps/my_app_1/ebin/my_app_1.app
  394. $t test -f $(APP)/apps/my_app_1/ebin/my_app_1_app.beam
  395. $t test -f $(APP)/apps/my_app_1/ebin/my_app_1_sup.beam
  396. $t test -f $(APP)/apps/my_app_2/my_app_2.d
  397. $t test -f $(APP)/apps/my_app_2/ebin/my_app_2.app
  398. $t test -f $(APP)/apps/my_app_2/ebin/my_app_2_app.beam
  399. $t test -f $(APP)/apps/my_app_2/ebin/my_app_2_sup.beam
  400. $t test -f $(APP)/deps/lager/ebin/lager.app
  401. $i "Distclean the application"
  402. $t $(MAKE) -C $(APP) distclean $v
  403. $i "Test after swapping my_app_1 and my_app_2 to make sure lexical ordering didnt incidentally build the correct app first"
  404. $i "Add my_app_2 to the list of local dependencies of my_app_1, don't add lager, but add the lager parse_transform (this will fail unless my_app_2 was indeed built first)"
  405. $t mv $(APP)/apps/my_app_1/Makefile{.bak,}
  406. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = my_app_2\nERLC_OPTS+=+{parse_transform,lager_transform}\n"}' $(APP)/apps/my_app_1/Makefile
  407. $i "Add Lager to the list of dependencies of my_app_2, and add the lager parse_transform"
  408. $t mv $(APP)/apps/my_app_2/Makefile{.bak,}
  409. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\nERLC_OPTS+=+{parse_transform,lager_transform}\n"}' $(APP)/apps/my_app_2/Makefile
  410. $i "Build the application"
  411. $t $(MAKE) -C $(APP) $v
  412. $i "Check that all compiled files exist"
  413. $t test -f $(APP)/$(APP).d
  414. $t test -f $(APP)/ebin/$(APP).app
  415. $t test -f $(APP)/apps/my_app_1/my_app_1.d
  416. $t test -f $(APP)/apps/my_app_1/ebin/my_app_1.app
  417. $t test -f $(APP)/apps/my_app_1/ebin/my_app_1_app.beam
  418. $t test -f $(APP)/apps/my_app_1/ebin/my_app_1_sup.beam
  419. $t test -f $(APP)/apps/my_app_2/my_app_2.d
  420. $t test -f $(APP)/apps/my_app_2/ebin/my_app_2.app
  421. $t test -f $(APP)/apps/my_app_2/ebin/my_app_2_app.beam
  422. $t test -f $(APP)/apps/my_app_2/ebin/my_app_2_sup.beam
  423. $t test -f $(APP)/deps/lager/ebin/lager.app
  424. core-deps-apps-local-deps-circular: build clean
  425. $i "Bootstrap a new OTP library named $(APP)"
  426. $t mkdir $(APP)/
  427. $t cp ../erlang.mk $(APP)/
  428. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  429. $i "Create a new application my_app_1"
  430. $t $(MAKE) -C $(APP) new-app in=my_app_1 $v
  431. $i "Create a new application my_app_2"
  432. $t $(MAKE) -C $(APP) new-app in=my_app_2 $v
  433. $i "Add my_app_1 to the list of local dependencies of my_app_2"
  434. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = my_app_1\n"}' $(APP)/apps/my_app_2/Makefile
  435. $i "Add my_app_2 to the list of local dependencies of my_app_1"
  436. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = my_app_2\n"}' $(APP)/apps/my_app_1/Makefile
  437. $i "Build the application"
  438. $t $(MAKE) -C $(APP) $v
  439. $i "Check that all compiled files exist"
  440. $t test -f $(APP)/$(APP).d
  441. $t test -f $(APP)/ebin/$(APP).app
  442. $t test -f $(APP)/apps/my_app_1/my_app_1.d
  443. $t test -f $(APP)/apps/my_app_1/ebin/my_app_1.app
  444. $t test -f $(APP)/apps/my_app_1/ebin/my_app_1_app.beam
  445. $t test -f $(APP)/apps/my_app_1/ebin/my_app_1_sup.beam
  446. $t test -f $(APP)/apps/my_app_2/my_app_2.d
  447. $t test -f $(APP)/apps/my_app_2/ebin/my_app_2.app
  448. $t test -f $(APP)/apps/my_app_2/ebin/my_app_2_app.beam
  449. $t test -f $(APP)/apps/my_app_2/ebin/my_app_2_sup.beam
  450. core-deps-apps-toplevel-local-deps: build clean
  451. $i "Bootstrap a new OTP library named $(APP)"
  452. $t mkdir $(APP)/
  453. $t cp ../erlang.mk $(APP)/
  454. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  455. $i "Create a new application my_app_1"
  456. $t $(MAKE) -C $(APP) new-app in=my_app_1 $v
  457. $i "Add my_app_1 to the list of toplevel local dependencies"
  458. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = my_app_1\n"}' $(APP)/Makefile
  459. $i "Create a new application my_app_2"
  460. $t $(MAKE) -C $(APP) new-app in=my_app_2 $v
  461. $i "Build the application"
  462. $t $(MAKE) -C $(APP) $v
  463. $i "Check that all compiled files exist"
  464. $t test -f $(APP)/$(APP).d
  465. $t test -f $(APP)/ebin/$(APP).app
  466. $t test -f $(APP)/apps/my_app_1/my_app_1.d
  467. $t test -f $(APP)/apps/my_app_1/ebin/my_app_1.app
  468. $t test -f $(APP)/apps/my_app_1/ebin/my_app_1_app.beam
  469. $t test -f $(APP)/apps/my_app_1/ebin/my_app_1_sup.beam
  470. $i "Check that my_app_2 compiled files DO NOT exist"
  471. $t test ! -e $(APP)/apps/my_app_2/my_app_2.d
  472. $t test ! -e $(APP)/apps/my_app_2/ebin/my_app_2.app
  473. $t test ! -e $(APP)/apps/my_app_2/ebin/my_app_2_app.beam
  474. $t test ! -e $(APP)/apps/my_app_2/ebin/my_app_2_sup.beam
  475. $i "Add my_app_2 to the list of local dependencies of my_app_1"
  476. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = my_app_2\n"}' $(APP)/apps/my_app_1/Makefile
  477. $i "Rebuild the application"
  478. $t $(MAKE) -C $(APP) $v
  479. $i "Check that my_app_2 compiled files exist"
  480. $t test -f $(APP)/apps/my_app_2/my_app_2.d
  481. $t test -f $(APP)/apps/my_app_2/ebin/my_app_2.app
  482. $t test -f $(APP)/apps/my_app_2/ebin/my_app_2_app.beam
  483. $t test -f $(APP)/apps/my_app_2/ebin/my_app_2_sup.beam
  484. core-deps-autopatch-rebar: build clean
  485. $i "Bootstrap a new OTP library named $(APP)"
  486. $t mkdir $(APP)/
  487. $t cp ../erlang.mk $(APP)/
  488. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  489. $i "Add erlsha2 to the list of dependencies"
  490. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = erlsha2\n"}' $(APP)/Makefile
  491. $i "Build the application"
  492. $t $(MAKE) -C $(APP) $v
  493. $i "Check that erlsha2 was fetched and built"
  494. $t test -d $(APP)/deps/erlsha2
  495. $t test -f $(APP)/deps/erlsha2/ebin/erlsha2.beam
  496. ifneq ($(PLATFORM),msys2)
  497. $t test -f $(APP)/deps/erlsha2/priv/erlsha2_nif.so
  498. endif
  499. ifneq ($(PLATFORM),msys2)
  500. core-deps-build-c-8cc: build clean
  501. $i "Bootstrap a new OTP library named $(APP)"
  502. $t mkdir $(APP)/
  503. $t cp ../erlang.mk $(APP)/
  504. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  505. $i "Add 8cc to the list of build dependencies"
  506. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = 8cc\ndep_8cc = git https://github.com/rui314/8cc master\n"}' $(APP)/Makefile
  507. $i "Build the application"
  508. $t $(MAKE) -C $(APP) $v
  509. $i "Check that all dependencies were fetched"
  510. $t test -d $(APP)/deps/8cc
  511. $i "Check that 8cc can be started"
  512. $t $(APP)/deps/8cc/8cc -h $v
  513. $i "Check that the application was compiled correctly"
  514. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  515. [ok = application:load(App) || App <- [$(APP)]], \
  516. {ok, Deps} = application:get_key($(APP), applications), \
  517. false = lists:member('8cc', Deps), \
  518. halt()"
  519. endif
  520. ifneq ($(PLATFORM),freebsd)
  521. core-deps-build-c-imagejs: build clean
  522. $i "Bootstrap a new OTP library named $(APP)"
  523. $t mkdir $(APP)/
  524. $t cp ../erlang.mk $(APP)/
  525. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  526. $i "Add imagejs to the list of build dependencies"
  527. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = imagejs\ndep_imagejs = git https://github.com/jklmnn/imagejs master\n"}' $(APP)/Makefile
  528. $i "Build the application"
  529. $t $(MAKE) -C $(APP) $v
  530. $i "Check that all dependencies were fetched"
  531. $t test -d $(APP)/deps/imagejs
  532. $i "Check that imagejs works"
  533. $t $(APP)/deps/imagejs/imagejs bmp $(APP)/deps/imagejs/Makefile
  534. $t test -f $(APP)/deps/imagejs/Makefile.bmp
  535. $i "Check that the application was compiled correctly"
  536. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  537. [ok = application:load(App) || App <- [$(APP)]], \
  538. {ok, Deps} = application:get_key($(APP), applications), \
  539. false = lists:member(imagejs, Deps), \
  540. halt()"
  541. endif
  542. core-deps-build-erl: build clean
  543. $i "Bootstrap a new OTP library named $(APP)"
  544. $t mkdir $(APP)/
  545. $t cp ../erlang.mk $(APP)/
  546. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  547. $i "Add cowlib to the list of build dependencies"
  548. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = cowlib\n"}' $(APP)/Makefile
  549. $i "Build the application"
  550. $t $(MAKE) -C $(APP) $v
  551. $i "Check that all dependencies were fetched"
  552. $t test -d $(APP)/deps/cowlib
  553. $i "Check that the application was compiled correctly"
  554. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  555. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  556. {ok, Deps} = application:get_key($(APP), applications), \
  557. false = lists:member(cowlib, Deps), \
  558. halt()"
  559. core-deps-build-js: build clean
  560. $i "Bootstrap a new OTP library named $(APP)"
  561. $t mkdir $(APP)/
  562. $t cp ../erlang.mk $(APP)/
  563. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  564. $i "Add jquery to the list of build dependencies"
  565. $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = jquery\ndep_jquery = git https://github.com/jquery/jquery master\n"}' $(APP)/Makefile
  566. $i "Build the application"
  567. $t $(MAKE) -C $(APP) $v
  568. $i "Check that all dependencies were fetched"
  569. $t test -d $(APP)/deps/jquery
  570. $i "Check that the application was compiled correctly"
  571. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  572. [ok = application:load(App) || App <- [$(APP)]], \
  573. {ok, Deps} = application:get_key($(APP), applications), \
  574. false = lists:member(jquery, Deps), \
  575. halt()"
  576. core-deps-dep-commit: build clean
  577. $i "Bootstrap a new OTP library named $(APP)"
  578. $t mkdir $(APP)/
  579. $t cp ../erlang.mk $(APP)/
  580. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  581. $i "Add Cowboy 1.0.0 to the list of dependencies"
  582. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 1.0.0\n"}' $(APP)/Makefile
  583. ifdef LEGACY
  584. $i "Add Cowboy to the applications key in the .app.src file"
  585. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  586. endif
  587. $i "Build the application"
  588. $t $(MAKE) -C $(APP) $v
  589. $i "Check that all dependencies were fetched"
  590. $t test -d $(APP)/deps/cowboy
  591. $t test -d $(APP)/deps/cowlib
  592. $t test -d $(APP)/deps/ranch
  593. $i "Check that the application was compiled correctly"
  594. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  595. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  596. {ok, Deps} = application:get_key($(APP), applications), \
  597. true = lists:member(cowboy, Deps), \
  598. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  599. halt()"
  600. core-deps-dir: build clean
  601. $i "Bootstrap a new OTP library named $(APP)"
  602. $t mkdir $(APP)/
  603. $t cp ../erlang.mk $(APP)/
  604. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  605. $i "Add Cowboy to the list of dependencies with a custom DEPS_DIR"
  606. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nDEPS_DIR ?= \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
  607. ifdef LEGACY
  608. $i "Add Cowboy to the applications key in the .app.src file"
  609. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  610. endif
  611. $i "Build the application"
  612. $t $(MAKE) -C $(APP) $v
  613. $i "Check that all dependencies were fetched in the custom DEPS_DIR"
  614. $t test -d $(APP)/deep/libs/cowboy
  615. $t test -d $(APP)/deep/libs/cowlib
  616. $t test -d $(APP)/deep/libs/ranch
  617. $i "Check that the application was compiled correctly"
  618. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deep/libs/*/ebin/ -eval " \
  619. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  620. {ok, Deps} = application:get_key($(APP), applications), \
  621. true = lists:member(cowboy, Deps), \
  622. halt()"
  623. core-deps-doc: build clean
  624. $i "Bootstrap a new OTP library named $(APP)"
  625. $t mkdir $(APP)/
  626. $t cp ../erlang.mk $(APP)/
  627. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  628. $i "Generate .erl files"
  629. $t echo "-module(boy)." > $(APP)/src/boy.erl
  630. $t echo "-module(girl)." > $(APP)/src/girl.erl
  631. $i "Add Edown as a documentation building dependency"
  632. $t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = edown\nEDOC_OPTS = {doclet, edown_doclet}\n"}' $(APP)/Makefile
  633. $i "Build the application"
  634. $t $(MAKE) -C $(APP) $v
  635. $i "Check that no dependencies were fetched"
  636. $t test ! -e $(APP)/deps
  637. $i "Check that the application was compiled correctly"
  638. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  639. [ok = application:load(App) || App <- [$(APP)]], \
  640. {ok, Deps} = application:get_key($(APP), applications), \
  641. false = lists:member(edown, Deps), \
  642. halt()"
  643. $i "Build the application documentation"
  644. $t $(MAKE) -C $(APP) edoc $v
  645. $i "Check that documentation dependencies were fetched"
  646. $t test -d $(APP)/deps/edown
  647. $i "Check the Edown generated Markdown documentation"
  648. $t test -f $(APP)/doc/boy.md
  649. $t test -f $(APP)/doc/girl.md
  650. core-deps-fetch-cp: build clean
  651. $i "Bootstrap a new OTP library named $(APP)"
  652. $t mkdir $(APP)/
  653. $t cp ../erlang.mk $(APP)/
  654. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  655. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  656. $t mkdir $(APP)/my_dep
  657. $t cp ../erlang.mk $(APP)/my_dep/
  658. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  659. $i "Add my_dep to the list of dependencies"
  660. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  661. ifdef LEGACY
  662. $i "Add my_dep to the applications key in the .app.src file"
  663. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  664. endif
  665. $i "Build the application"
  666. $t $(MAKE) -C $(APP) $v
  667. $i "Check that all dependencies were fetched"
  668. $t test -d $(APP)/deps/my_dep
  669. $i "Check that the application was compiled correctly"
  670. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  671. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  672. {ok, Deps} = application:get_key($(APP), applications), \
  673. true = lists:member(my_dep, Deps), \
  674. halt()"
  675. core-deps-fetch-custom: build clean
  676. $i "Bootstrap a new OTP library named $(APP)"
  677. $t mkdir $(APP)/
  678. $t cp ../erlang.mk $(APP)/
  679. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  680. $i "Add dependency boop using custom fetch method beep to the list of dependencies"
  681. $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
  682. ifdef LEGACY
  683. $i "Add boop to the applications key in the .app.src file"
  684. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tboop,\n"}' $(APP)/src/$(APP).app.src
  685. endif
  686. $i "Build the application"
  687. $t $(MAKE) -C $(APP) $v
  688. $i "Check that all dependencies were fetched"
  689. $t test -d $(APP)/deps/boop
  690. $i "Check that the application was compiled correctly"
  691. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  692. ok = application:load($(APP)), \
  693. {ok, Deps} = application:get_key($(APP), applications), \
  694. true = lists:member(boop, Deps), \
  695. halt()"
  696. core-deps-fetch-fail-bad: build clean
  697. $i "Bootstrap a new OTP library named $(APP)"
  698. $t mkdir $(APP)/
  699. $t cp ../erlang.mk $(APP)/
  700. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  701. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  702. $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
  703. $i "Check that building the application fails"
  704. $t ! $(MAKE) -C $(APP) $v
  705. core-deps-fetch-fail-unknown: build clean
  706. $i "Bootstrap a new OTP library named $(APP)"
  707. $t mkdir $(APP)/
  708. $t cp ../erlang.mk $(APP)/
  709. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  710. $i "Add an unknown application as a dependency"
  711. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = unknown\n"}' $(APP)/Makefile
  712. $i "Check that building the application fails"
  713. $t ! $(MAKE) -C $(APP) $v
  714. core-deps-fetch-git: build clean
  715. $i "Bootstrap a new OTP library named $(APP)"
  716. $t mkdir $(APP)/
  717. $t cp ../erlang.mk $(APP)/
  718. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  719. $i "Add Cowboy 1.0.0 to the list of dependencies"
  720. $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
  721. ifdef LEGACY
  722. $i "Add Cowboy to the applications key in the .app.src file"
  723. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  724. endif
  725. $i "Build the application"
  726. $t $(MAKE) -C $(APP) $v
  727. $i "Check that all dependencies were fetched"
  728. $t test -d $(APP)/deps/cowboy
  729. $t test -d $(APP)/deps/cowlib
  730. $t test -d $(APP)/deps/ranch
  731. $i "Check that the application was compiled correctly"
  732. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  733. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  734. {ok, Deps} = application:get_key($(APP), applications), \
  735. true = lists:member(cowboy, Deps), \
  736. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  737. halt()"
  738. core-deps-fetch-git-submodule: build clean
  739. $i "Bootstrap a new OTP library named $(APP)"
  740. $t mkdir $(APP)/
  741. $t cp ../erlang.mk $(APP)/
  742. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  743. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  744. $t mkdir $(APP)/my_dep
  745. $t cp ../erlang.mk $(APP)/my_dep/
  746. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  747. # Create an empty file so src/ gets committed.
  748. $t touch $(APP)/my_dep/src/README
  749. $t cd $(APP)/my_dep && \
  750. git init -q && \
  751. git config user.email "testsuite@erlang.mk" && \
  752. git config user.name "test suite" && \
  753. git add . && \
  754. git commit -q --no-gpg-sign -m "Tests"
  755. $i "Add the submodule to my_dep"
  756. $t mkdir $(APP)/deps
  757. $t cd $(APP) && \
  758. git init -q && \
  759. git submodule -q add file://$(abspath $(APP)/my_dep) deps/my_dep && \
  760. git config user.email "testsuite@erlang.mk" && \
  761. git config user.name "test suite" && \
  762. git add . && \
  763. git commit -q --no-gpg-sign -m "Tests"
  764. $i "Distclean the application"
  765. $t $(MAKE) -C $(APP) distclean $v
  766. $i "Add my_dep to the list of dependencies"
  767. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = git-submodule\n"}' $(APP)/Makefile
  768. ifdef LEGACY
  769. $i "Add my_dep to the applications key in the .app.src file"
  770. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  771. endif
  772. $i "Build the application"
  773. $t $(MAKE) -C $(APP) $v
  774. $i "Check that all dependencies were fetched"
  775. $t test -d $(APP)/deps/my_dep
  776. $i "Check that the application was compiled correctly"
  777. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  778. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  779. {ok, Deps} = application:get_key($(APP), applications), \
  780. true = lists:member(my_dep, Deps), \
  781. halt()"
  782. core-deps-fetch-hex: 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 Cowboy 1.0.0 to the list of dependencies"
  788. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 1.0.0\n"}' $(APP)/Makefile
  789. ifdef LEGACY
  790. $i "Add Cowboy to the applications key in the .app.src file"
  791. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  792. endif
  793. $i "Build the application"
  794. $t $(MAKE) -C $(APP) $v
  795. $i "Check that all dependencies were fetched"
  796. $t test -d $(APP)/deps/cowboy
  797. $t test -d $(APP)/deps/cowlib
  798. $t test -d $(APP)/deps/ranch
  799. $i "Check that the application was compiled correctly"
  800. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  801. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  802. {ok, Deps} = application:get_key($(APP), applications), \
  803. true = lists:member(cowboy, Deps), \
  804. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  805. halt()"
  806. core-deps-fetch-hg: build clean
  807. $i "Bootstrap a new OTP library named $(APP)"
  808. $t mkdir $(APP)/
  809. $t cp ../erlang.mk $(APP)/
  810. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  811. $i "Add Ehsa 4.0.3 to the list of dependencies"
  812. $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
  813. ifdef LEGACY
  814. $i "Add ehsa to the applications key in the .app.src file"
  815. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tehsa,\n"}' $(APP)/src/$(APP).app.src
  816. endif
  817. $i "Build the application"
  818. $t $(MAKE) -C $(APP) $v
  819. $i "Check that all dependencies were fetched"
  820. $t test -d $(APP)/deps/ehsa
  821. $i "Check that the application was compiled correctly"
  822. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  823. [ok = application:load(App) || App <- [$(APP), ehsa]], \
  824. {ok, Deps} = application:get_key($(APP), applications), \
  825. true = lists:member(ehsa, Deps), \
  826. {ok, \"4.0.3\"} = application:get_key(ehsa, vsn), \
  827. halt()"
  828. # Legacy must fail for the top-level application, but work for dependencies.
  829. core-deps-fetch-legacy: build clean
  830. $i "Bootstrap a new OTP library named $(APP)"
  831. $t mkdir $(APP)/
  832. $t cp ../erlang.mk $(APP)/
  833. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  834. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  835. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
  836. $i "Check that building the application fails"
  837. $t ! $(MAKE) -C $(APP) $v
  838. $i "Check that building the application works with IS_DEP=1"
  839. $t $(MAKE) -C $(APP) IS_DEP=1 $v
  840. core-deps-fetch-ln: build clean
  841. $i "Bootstrap a new OTP library named $(APP)"
  842. $t mkdir $(APP)/
  843. $t cp ../erlang.mk $(APP)/
  844. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  845. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  846. $t mkdir $(APP)/my_dep
  847. $t cp ../erlang.mk $(APP)/my_dep/
  848. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  849. $i "Add my_dep to the list of dependencies"
  850. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = ln $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  851. ifdef LEGACY
  852. $i "Add my_dep to the applications key in the .app.src file"
  853. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  854. endif
  855. $i "Build the application"
  856. $t $(MAKE) -C $(APP) $v
  857. $i "Check that all dependencies were fetched"
  858. $t test -d $(APP)/deps/my_dep
  859. $i "Check that the application was compiled correctly"
  860. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  861. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  862. {ok, Deps} = application:get_key($(APP), applications), \
  863. true = lists:member(my_dep, Deps), \
  864. halt()"
  865. core-deps-fetch-svn: build clean
  866. $i "Bootstrap a new OTP library named $(APP)"
  867. $t mkdir $(APP)/
  868. $t cp ../erlang.mk $(APP)/
  869. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  870. $i "Add Cowlib 1.0.0 to the list of dependencies"
  871. $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
  872. ifdef LEGACY
  873. $i "Add Cowlib to the applications key in the .app.src file"
  874. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  875. endif
  876. $i "Build the application"
  877. $t $(MAKE) -C $(APP) $v
  878. $i "Check that all dependencies were fetched"
  879. $t test -d $(APP)/deps/cowlib
  880. $i "Check that the application was compiled correctly"
  881. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  882. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  883. {ok, Deps} = application:get_key($(APP), applications), \
  884. true = lists:member(cowlib, Deps), \
  885. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  886. halt()"
  887. core-deps-ignore: build clean
  888. $i "Bootstrap a new OTP library named $(APP)"
  889. $t mkdir $(APP)/
  890. $t cp ../erlang.mk $(APP)/
  891. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  892. $i "Add Cowboy to dependencies, Ranch to the ignore list and to test dependencies"
  893. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nIGNORE_DEPS = ranch\nTEST_DEPS = ranch\n"}' $(APP)/Makefile
  894. ifdef LEGACY
  895. $i "Add Cowboy to the applications key in the .app.src file"
  896. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  897. endif
  898. $i "Build the application"
  899. $t $(MAKE) -C $(APP) $v
  900. $i "Check that the correct dependencies were fetched"
  901. $t test -d $(APP)/deps/cowboy
  902. $t test -d $(APP)/deps/cowlib
  903. $t test ! -e $(APP)/deps/ranch
  904. $i "Build the test dependencies"
  905. $t $(MAKE) -C $(APP) test-deps $v
  906. $i "Check that the correct dependencies were fetched"
  907. $t test -d $(APP)/deps/ranch
  908. define add_dep_and_subdep
  909. $i "Bootstrap a new OTP library named $(APP)-$(1)subdep"
  910. $t mkdir $(APP)-$(1)subdep/
  911. $t cp ../erlang.mk $(APP)-$(1)subdep/
  912. $t $(MAKE) -C $(APP)-$(1)subdep --no-print-directory -f erlang.mk bootstrap-lib $$v
  913. $i "Create a Git repository for $(APP)-$(1)subdep"
  914. $t (cd $(APP)-$(1)subdep && \
  915. git init -q && \
  916. git config user.name "Testsuite" && \
  917. git config user.email "testsuite@erlang.mk" && \
  918. git add . && \
  919. git commit -q --no-gpg-sign -m "Initial commit")
  920. $i "Bootstrap a new OTP library named $(APP)-$(1)dep"
  921. $t mkdir $(APP)-$(1)dep/
  922. $t cp ../erlang.mk $(APP)-$(1)dep/
  923. $t $(MAKE) -C $(APP)-$(1)dep --no-print-directory -f erlang.mk bootstrap-lib $$v
  924. $i "Add $(APP)-$(1)subdep as a dependency"
  925. $t perl -ni.bak -e \
  926. 'print;if ($$.==1) {print "DEPS = $(1)subdep\ndep_$(1)subdep = git file://$(abspath $(APP)-$(1)subdep) master\n"}' \
  927. $(APP)-$(1)dep/Makefile
  928. $t rm $(APP)-$(1)dep/Makefile.bak
  929. $i "Create a Git repository for $(APP)-$(1)dep"
  930. $t (cd $(APP)-$(1)dep && \
  931. git init -q && \
  932. git config user.name "Testsuite" && \
  933. git config user.email "testsuite@erlang.mk" && \
  934. git add . && \
  935. git commit -q --no-gpg-sign -m "Initial commit")
  936. endef
  937. core-deps-list-deps: build clean
  938. $(call add_dep_and_subdep,)
  939. $(call add_dep_and_subdep,doc)
  940. $(call add_dep_and_subdep,rel)
  941. $(call add_dep_and_subdep,test)
  942. $(call add_dep_and_subdep,shell)
  943. $i "Bootstrap a new OTP library named $(APP)"
  944. $t mkdir $(APP)/
  945. $t cp ../erlang.mk $(APP)/
  946. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  947. $i "Add $(APP)-dep and $(APP)-testdep as a dependency"
  948. $t sed -i.bak '2i\
  949. DEPS = dep\
  950. DOC_DEPS = docdep\
  951. REL_DEPS = reldep\
  952. TEST_DEPS = testdep\
  953. SHELL_DEPS = shelldep\
  954. dep_dep = git file://$(abspath $(APP)-dep) master\
  955. dep_docdep = git file://$(abspath $(APP)-docdep) master\
  956. dep_reldep = git file://$(abspath $(APP)-reldep) master\
  957. dep_testdep = git file://$(abspath $(APP)-testdep) master\
  958. dep_shelldep = git file://$(abspath $(APP)-shelldep) master\
  959. ' $(APP)/Makefile
  960. $t rm $(APP)/Makefile.bak
  961. $i "Create a Git repository for $(APP)"
  962. $t (cd $(APP) && \
  963. git init -q && \
  964. git config user.name "Testsuite" && \
  965. git config user.email "testsuite@erlang.mk" && \
  966. git add . && \
  967. git commit -q --no-gpg-sign -m "Initial commit")
  968. $i "List application dependencies"
  969. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  970. $t test -d $(APP)/deps/subdep
  971. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  972. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  973. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  974. $i "List application doc dependencies"
  975. $t $(MAKE) -C $(APP) --no-print-directory list-doc-deps $v
  976. $t test -d $(APP)/deps/subdep
  977. $t test -d $(APP)/deps/docsubdep
  978. $t printf "%s\n%s\n%s\n%s\n" \
  979. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/docdep $(APP)/deps/docsubdep) \
  980. | sort > $(APP)/expected-doc-deps.txt
  981. $t cmp $(APP)/expected-doc-deps.txt $(APP)/.erlang.mk/recursive-doc-deps-list.log
  982. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  983. $i "List application rel dependencies"
  984. $t $(MAKE) -C $(APP) --no-print-directory list-rel-deps $v
  985. $t test -d $(APP)/deps/subdep
  986. $t test -d $(APP)/deps/relsubdep
  987. $t printf "%s\n%s\n%s\n%s\n" \
  988. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/reldep $(APP)/deps/relsubdep) \
  989. | sort > $(APP)/expected-rel-deps.txt
  990. $t cmp $(APP)/expected-rel-deps.txt $(APP)/.erlang.mk/recursive-rel-deps-list.log
  991. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  992. $i "List application test dependencies"
  993. $t $(MAKE) -C $(APP) --no-print-directory list-test-deps $v
  994. $t test -d $(APP)/deps/subdep
  995. $t test -d $(APP)/deps/testsubdep
  996. $t printf "%s\n%s\n%s\n%s\n" \
  997. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/testdep $(APP)/deps/testsubdep) \
  998. | sort > $(APP)/expected-test-deps.txt
  999. $t cmp $(APP)/expected-test-deps.txt $(APP)/.erlang.mk/recursive-test-deps-list.log
  1000. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  1001. $i "List application shell dependencies"
  1002. $t $(MAKE) -C $(APP) --no-print-directory list-shell-deps $v
  1003. $t test -d $(APP)/deps/subdep
  1004. $t test -d $(APP)/deps/shellsubdep
  1005. $t printf "%s\n%s\n%s\n%s\n" \
  1006. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
  1007. | sort > $(APP)/expected-shell-deps.txt
  1008. $t cmp $(APP)/expected-shell-deps.txt $(APP)/.erlang.mk/recursive-shell-deps-list.log
  1009. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  1010. $i "List application all dependencies (all kinds)"
  1011. $t $(MAKE) -C $(APP) --no-print-directory list-deps DEP_TYPES='doc rel test shell' $v
  1012. $t test -d $(APP)/deps/subdep
  1013. $t test -d $(APP)/deps/docsubdep
  1014. $t test -d $(APP)/deps/relsubdep
  1015. $t test -d $(APP)/deps/testsubdep
  1016. $t test -d $(APP)/deps/shellsubdep
  1017. $t printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
  1018. $(abspath \
  1019. $(APP)/deps/dep $(APP)/deps/subdep \
  1020. $(APP)/deps/docdep $(APP)/deps/docsubdep \
  1021. $(APP)/deps/reldep $(APP)/deps/relsubdep \
  1022. $(APP)/deps/testdep $(APP)/deps/testsubdep \
  1023. $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
  1024. | sort > $(APP)/expected-all-deps.txt
  1025. $t cmp $(APP)/expected-all-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  1026. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  1027. core-deps-mv: build clean
  1028. $i "Bootstrap a new OTP library named $(APP)"
  1029. $t mkdir $(APP)/
  1030. $t cp ../erlang.mk $(APP)/
  1031. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1032. $i "Add Cowlib to the list of dependencies"
  1033. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  1034. $i "Build the application"
  1035. $t $(MAKE) -C $(APP) $v
  1036. $i "Check that all dependencies were fetched"
  1037. $t test -d $(APP)/deps/cowlib
  1038. $i "Move the application elsewhere"
  1039. $t mv $(APP) $(APP)-moved
  1040. $i "Build the application"
  1041. $t $(MAKE) -C $(APP)-moved $v
  1042. core-deps-mv-rebar: build clean
  1043. $i "Bootstrap a new OTP library named $(APP)"
  1044. $t mkdir $(APP)/
  1045. $t cp ../erlang.mk $(APP)/
  1046. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1047. $i "Add Lager to the list of dependencies"
  1048. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile
  1049. $i "Build the application"
  1050. $t $(MAKE) -C $(APP) $v
  1051. $i "Check that all dependencies were fetched"
  1052. $t test -d $(APP)/deps/goldrush
  1053. $t test -d $(APP)/deps/lager
  1054. $i "Move the application elsewhere"
  1055. $t mv $(APP) $(APP)-moved
  1056. $i "Build the application"
  1057. $t $(MAKE) -C $(APP)-moved $v
  1058. # A lower-level dependency of the first dependency always
  1059. # wins over a lower-level dependency of the second dependency.
  1060. core-deps-order-first: build clean
  1061. $i "Bootstrap a new OTP library named $(APP)"
  1062. $t mkdir $(APP)/
  1063. $t cp ../erlang.mk $(APP)/
  1064. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1065. $i "Add Cowboy package and my_dep to the list of dependencies"
  1066. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep cowboy\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  1067. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  1068. $t mkdir $(APP)/my_dep
  1069. $t cp ../erlang.mk $(APP)/my_dep/
  1070. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  1071. $i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
  1072. $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
  1073. ifdef LEGACY
  1074. $i "Add Cowboy and my_dep to the applications key in the .app.src file"
  1075. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  1076. endif
  1077. $i "Build the application"
  1078. $t $(MAKE) -C $(APP) $v
  1079. $i "Check that all dependencies were fetched"
  1080. $t test -d $(APP)/deps/cowboy
  1081. $t test -d $(APP)/deps/cowlib
  1082. $t test -d $(APP)/deps/my_dep
  1083. $t test -d $(APP)/deps/ranch
  1084. $i "Check that the application was compiled correctly"
  1085. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1086. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, my_dep, ranch]], \
  1087. {ok, Deps} = application:get_key($(APP), applications), \
  1088. true = lists:member(cowboy, Deps), \
  1089. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  1090. halt()"
  1091. # A higher-level dependency always wins.
  1092. core-deps-order-top: build clean
  1093. $i "Bootstrap a new OTP library named $(APP)"
  1094. $t mkdir $(APP)/
  1095. $t cp ../erlang.mk $(APP)/
  1096. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1097. $i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
  1098. $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
  1099. ifdef LEGACY
  1100. $i "Add Cowboy to the applications key in the .app.src file"
  1101. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1102. endif
  1103. $i "Build the application"
  1104. $t $(MAKE) -C $(APP) $v
  1105. $i "Check that all dependencies were fetched"
  1106. $t test -d $(APP)/deps/cowboy
  1107. $t test -d $(APP)/deps/cowlib
  1108. $t test -d $(APP)/deps/ranch
  1109. $i "Check that the application was compiled correctly"
  1110. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1111. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  1112. {ok, Deps} = application:get_key($(APP), applications), \
  1113. true = lists:member(cowboy, Deps), \
  1114. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  1115. halt()"
  1116. core-deps-no-autopatch: build clean
  1117. $i "Bootstrap a new OTP library named $(APP)"
  1118. $t mkdir $(APP)/
  1119. $t cp ../erlang.mk $(APP)/
  1120. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1121. $i "Add Cowboy to the list of dependencies and Cowlib to the NO_AUTOPATCH list"
  1122. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nNO_AUTOPATCH = cowlib\n"}' $(APP)/Makefile
  1123. $i "Build the application"
  1124. $t $(MAKE) -C $(APP) $v
  1125. $i "Check that all dependencies were fetched"
  1126. $t test -d $(APP)/deps/cowboy
  1127. $t test -d $(APP)/deps/cowlib
  1128. $t test -d $(APP)/deps/ranch
  1129. $i "Check that Cowlib was not autopatched"
  1130. $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
  1131. core-deps-no-autopatch-erlang-mk: build clean
  1132. $i "Bootstrap a new OTP library named $(APP)"
  1133. $t mkdir $(APP)/
  1134. $t cp ../erlang.mk $(APP)/
  1135. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1136. $i "Add Cowlib to the list of dependencies and set NO_AUTOPATCH_ERLANG_MK=1"
  1137. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\nNO_AUTOPATCH_ERLANG_MK = 1\n"}' $(APP)/Makefile
  1138. $i "Build the application"
  1139. $t $(MAKE) -C $(APP) $v
  1140. $i "Check that all dependencies were fetched"
  1141. $t test -d $(APP)/deps/cowlib
  1142. $i "Check that Erlang.mk was not autopatched"
  1143. $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
  1144. core-deps-no-autopatch-rebar: build clean
  1145. $i "Bootstrap a new OTP library named $(APP)"
  1146. $t mkdir $(APP)/
  1147. $t cp ../erlang.mk $(APP)/
  1148. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1149. $i "Add Lager to the list of dependencies and to the NO_AUTOPATCH list"
  1150. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\nNO_AUTOPATCH = lager\n"}' $(APP)/Makefile
  1151. $i "Build the application"
  1152. $t $(MAKE) -C $(APP) $v
  1153. $i "Check that all dependencies were fetched"
  1154. $t test -d $(APP)/deps/goldrush
  1155. $t test -d $(APP)/deps/lager
  1156. $i "Check that Lager was not autopatched"
  1157. $t if grep -q erlang\.mk $(APP)/deps/goldrush/Makefile; then false; fi
  1158. $t if grep -q erlang\.mk $(APP)/deps/lager/Makefile; then false; fi
  1159. ifndef LEGACY
  1160. core-deps-otp: build clean
  1161. $i "Bootstrap a new OTP library named $(APP)"
  1162. $t mkdir $(APP)/
  1163. $t cp ../erlang.mk $(APP)/
  1164. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1165. $i "Add Crypto to the list of OTP dependencies"
  1166. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = crypto\n"}' $(APP)/Makefile
  1167. $i "Build the application"
  1168. $t $(MAKE) -C $(APP) $v
  1169. $i "Check that no dependencies were fetched"
  1170. $t test ! -e $(APP)/deps
  1171. $i "Check that the application was compiled correctly"
  1172. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1173. [ok = application:load(App) || App <- [$(APP), crypto]], \
  1174. {ok, Deps} = application:get_key($(APP), applications), \
  1175. true = lists:member(crypto, Deps), \
  1176. halt()"
  1177. endif
  1178. core-deps-pkg: build clean
  1179. $i "Bootstrap a new OTP library named $(APP)"
  1180. $t mkdir $(APP)/
  1181. $t cp ../erlang.mk $(APP)/
  1182. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1183. $i "Add Cowboy to the list of dependencies"
  1184. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  1185. ifdef LEGACY
  1186. $i "Add Cowboy to the applications key in the .app.src file"
  1187. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1188. endif
  1189. $i "Build the application"
  1190. $t $(MAKE) -C $(APP) $v
  1191. $i "Check that all dependencies were fetched"
  1192. $t test -d $(APP)/deps/cowboy
  1193. $t test -d $(APP)/deps/cowlib
  1194. $t test -d $(APP)/deps/ranch
  1195. $i "Check that the application was compiled correctly"
  1196. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1197. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  1198. {ok, Deps} = application:get_key($(APP), applications), \
  1199. true = lists:member(cowboy, Deps), \
  1200. halt()"
  1201. core-deps-rel: build clean
  1202. $i "Bootstrap a new release-enabled OTP library named $(APP)"
  1203. $t mkdir $(APP)/
  1204. $t cp ../erlang.mk $(APP)/
  1205. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
  1206. $i "Add Recon to the list of release dependencies"
  1207. $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
  1208. $i "Add Recon to the relx.config file"
  1209. $t $(ERL) -eval " \
  1210. {ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
  1211. Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
  1212. ok = file:write_file(\"$(APP)/relx.config\", \
  1213. lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
  1214. halt()"
  1215. $i "Build the application and its dependencies"
  1216. $t $(MAKE) -C $(APP) deps app $v
  1217. $i "Check that no dependencies were fetched"
  1218. $t test ! -e $(APP)/deps
  1219. $i "Check that the application was compiled correctly"
  1220. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1221. [ok = application:load(App) || App <- [$(APP)]], \
  1222. {ok, Deps} = application:get_key($(APP), applications), \
  1223. false = lists:member(recon, Deps), \
  1224. halt()"
  1225. $i "Build the release"
  1226. $t $(MAKE) -C $(APP) $v
  1227. $i "Check that all dependencies were fetched"
  1228. $t test -d $(APP)/deps/recon
  1229. $i "Check that the application was compiled correctly"
  1230. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1231. [ok = application:load(App) || App <- [$(APP), recon]], \
  1232. {ok, Deps} = application:get_key($(APP), applications), \
  1233. false = lists:member(recon, Deps), \
  1234. halt()"
  1235. # @todo Add check for MSYS2 when releases under Windows become usable.
  1236. # $i "Start the release and check that Recon is loaded"
  1237. ifeq ($(PLATFORM),msys2)
  1238. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
  1239. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
  1240. # $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
  1241. # application loaded_applications | grep recon`"
  1242. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
  1243. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
  1244. else
  1245. $i "Start the release and check that Recon is loaded"
  1246. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
  1247. $t apps="Node is not running!"; \
  1248. while test "$$apps" = "Node is not running!"; do \
  1249. apps=$$($(APP)/_rel/$(APP)_release/bin/$(APP)_release \
  1250. rpcterms \ application loaded_applications); \
  1251. done; \
  1252. echo "$$apps" | grep -q recon
  1253. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
  1254. endif
  1255. core-deps-search: build clean
  1256. $i "Bootstrap a new OTP library named $(APP)"
  1257. $t mkdir $(APP)/
  1258. $t cp ../erlang.mk $(APP)/
  1259. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1260. $i "Run 'make search' and check that it prints packages"
  1261. $t test -n "`$(MAKE) -C $(APP) search`"
  1262. $i "Run 'make search q=cowboy' and check that it prints packages"
  1263. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
  1264. core-deps-shell: build clean
  1265. $i "Bootstrap a new OTP library named $(APP)"
  1266. $t mkdir $(APP)/
  1267. $t cp ../erlang.mk $(APP)/
  1268. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1269. $i "Add TDDReloader to the list of shell dependencies"
  1270. $t perl -ni.bak -e 'print;if ($$.==1) {print "SHELL_DEPS = tddreloader\n"}' $(APP)/Makefile
  1271. $i "Build the application and its dependencies"
  1272. $t $(MAKE) -C $(APP) deps app $v
  1273. $i "Check that no dependencies were fetched"
  1274. $t test ! -e $(APP)/deps
  1275. $i "Check that the application was compiled correctly"
  1276. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1277. [ok = application:load(App) || App <- [$(APP)]], \
  1278. {ok, Deps} = application:get_key($(APP), applications), \
  1279. false = lists:member(tddreloader, Deps), \
  1280. halt()"
  1281. $i "Run the shell"
  1282. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
  1283. ok = application:load($(APP)), \
  1284. ok = application:load(tddreloader), \
  1285. halt()\"" $v
  1286. $i "Check that all dependencies were fetched"
  1287. $t test -d $(APP)/deps/tddreloader
  1288. $i "Check that the application was compiled correctly"
  1289. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1290. [ok = application:load(App) || App <- [$(APP), tddreloader]], \
  1291. {ok, Deps} = application:get_key($(APP), applications), \
  1292. false = lists:member(tddreloader, Deps), \
  1293. halt()"
  1294. core-deps-skip: build clean
  1295. $i "Bootstrap a new OTP library named $(APP)"
  1296. $t mkdir $(APP)/
  1297. $t cp ../erlang.mk $(APP)/
  1298. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1299. $i "Add Cowboy to the list of dependencies"
  1300. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  1301. ifdef LEGACY
  1302. $i "Add Cowboy to the applications key in the .app.src file"
  1303. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1304. endif
  1305. $i "Build the application with SKIP_DEPS=1"
  1306. $t $(MAKE) -C $(APP) SKIP_DEPS=1 $v
  1307. $i "Check that no dependencies were fetched"
  1308. $t test ! -e $(APP)/deps
  1309. $i "Build the application"
  1310. $t $(MAKE) -C $(APP) $v
  1311. $i "Check that all dependencies were fetched"
  1312. $t test -d $(APP)/deps/cowlib
  1313. $t test -d $(APP)/deps/cowboy
  1314. $t test -d $(APP)/deps/ranch
  1315. $i "Distclean with SKIP_DEPS=1"
  1316. $t $(MAKE) -C $(APP) distclean SKIP_DEPS=1 $v
  1317. $i "Check that no dependencies were removed"
  1318. $t test -d $(APP)/deps/cowlib
  1319. $t test -d $(APP)/deps/cowboy
  1320. $t test -d $(APP)/deps/ranch
  1321. core-deps-test: build clean
  1322. $i "Bootstrap a new OTP library named $(APP)"
  1323. $t mkdir $(APP)/
  1324. $t cp ../erlang.mk $(APP)/
  1325. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1326. $i "Generate .erl files"
  1327. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1328. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1329. $i "Add triq to the list of test dependencies"
  1330. $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = triq\n"}' $(APP)/Makefile
  1331. $i "Build the application and its dependencies"
  1332. $t $(MAKE) -C $(APP) deps app $v
  1333. $i "Check that no dependencies were fetched"
  1334. $t test ! -e $(APP)/deps
  1335. $i "Check that the application was compiled correctly"
  1336. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1337. [ok = application:load(App) || App <- [$(APP)]], \
  1338. {ok, Deps} = application:get_key($(APP), applications), \
  1339. false = lists:member(triq, Deps), \
  1340. halt()"
  1341. $i "Run tests"
  1342. $t $(MAKE) -C $(APP) tests $v
  1343. $i "Check that all dependencies were fetched"
  1344. $t test -d $(APP)/deps/triq
  1345. $i "Check that the application was compiled correctly"
  1346. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1347. [ok = application:load(App) || App <- [$(APP), triq]], \
  1348. {ok, Deps} = application:get_key($(APP), applications), \
  1349. false = lists:member(triq, Deps), \
  1350. halt()"