core_deps.mk 59 KB

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