core_deps.mk 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754
  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-ln 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-ln: 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 "Bootstrap a new OTP library named my_dep inside $(APP)"
  847. $t mkdir $(APP)/my_dep
  848. $t cp ../erlang.mk $(APP)/my_dep/
  849. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  850. $i "Add my_dep to the list of dependencies"
  851. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = ln $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  852. ifdef LEGACY
  853. $i "Add my_dep to the applications key in the .app.src file"
  854. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  855. endif
  856. $i "Build the application"
  857. $t $(MAKE) -C $(APP) $v
  858. $i "Check that all dependencies were fetched"
  859. $t test -d $(APP)/deps/my_dep
  860. $i "Check that the application was compiled correctly"
  861. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  862. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  863. {ok, Deps} = application:get_key($(APP), applications), \
  864. true = lists:member(my_dep, Deps), \
  865. halt()"
  866. core-deps-fetch-svn: build clean
  867. $i "Bootstrap a new OTP library named $(APP)"
  868. $t mkdir $(APP)/
  869. $t cp ../erlang.mk $(APP)/
  870. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  871. $i "Add Cowlib 1.0.0 to the list of dependencies"
  872. $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
  873. ifdef LEGACY
  874. $i "Add Cowlib to the applications key in the .app.src file"
  875. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  876. endif
  877. $i "Build the application"
  878. $t $(MAKE) -C $(APP) $v
  879. $i "Check that all dependencies were fetched"
  880. $t test -d $(APP)/deps/cowlib
  881. $i "Check that the application was compiled correctly"
  882. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  883. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  884. {ok, Deps} = application:get_key($(APP), applications), \
  885. true = lists:member(cowlib, Deps), \
  886. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  887. halt()"
  888. core-deps-ignore: build clean
  889. $i "Bootstrap a new OTP library named $(APP)"
  890. $t mkdir $(APP)/
  891. $t cp ../erlang.mk $(APP)/
  892. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  893. $i "Add Cowboy to dependencies, Ranch to the ignore list and to test dependencies"
  894. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nIGNORE_DEPS = ranch\nTEST_DEPS = ranch\n"}' $(APP)/Makefile
  895. ifdef LEGACY
  896. $i "Add Cowboy to the applications key in the .app.src file"
  897. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  898. endif
  899. $i "Build the application"
  900. $t $(MAKE) -C $(APP) $v
  901. $i "Check that the correct dependencies were fetched"
  902. $t test -d $(APP)/deps/cowboy
  903. $t test -d $(APP)/deps/cowlib
  904. $t test ! -e $(APP)/deps/ranch
  905. $i "Build the test dependencies"
  906. $t $(MAKE) -C $(APP) test-deps $v
  907. $i "Check that the correct dependencies were fetched"
  908. $t test -d $(APP)/deps/ranch
  909. define add_dep_and_subdep
  910. $i "Bootstrap a new OTP library named $(APP)-$(1)subdep"
  911. $t mkdir $(APP)-$(1)subdep/
  912. $t cp ../erlang.mk $(APP)-$(1)subdep/
  913. $t $(MAKE) -C $(APP)-$(1)subdep --no-print-directory -f erlang.mk bootstrap-lib $$v
  914. $i "Create a Git repository for $(APP)-$(1)subdep"
  915. $t (cd $(APP)-$(1)subdep && \
  916. git init -q && \
  917. git config user.name "Testsuite" && \
  918. git config user.email "testsuite@erlang.mk" && \
  919. git add . && \
  920. git commit -q --no-gpg-sign -m "Initial commit")
  921. $i "Bootstrap a new OTP library named $(APP)-$(1)dep"
  922. $t mkdir $(APP)-$(1)dep/
  923. $t cp ../erlang.mk $(APP)-$(1)dep/
  924. $t $(MAKE) -C $(APP)-$(1)dep --no-print-directory -f erlang.mk bootstrap-lib $$v
  925. $i "Add $(APP)-$(1)subdep as a dependency"
  926. $t perl -ni.bak -e \
  927. 'print;if ($$.==1) {print "DEPS = $(1)subdep\ndep_$(1)subdep = git file://$(abspath $(APP)-$(1)subdep) master\n"}' \
  928. $(APP)-$(1)dep/Makefile
  929. $t rm $(APP)-$(1)dep/Makefile.bak
  930. $i "Create a Git repository for $(APP)-$(1)dep"
  931. $t (cd $(APP)-$(1)dep && \
  932. git init -q && \
  933. git config user.name "Testsuite" && \
  934. git config user.email "testsuite@erlang.mk" && \
  935. git add . && \
  936. git commit -q --no-gpg-sign -m "Initial commit")
  937. endef
  938. core-deps-list-deps: build clean
  939. $(call add_dep_and_subdep,)
  940. $(call add_dep_and_subdep,doc)
  941. $(call add_dep_and_subdep,rel)
  942. $(call add_dep_and_subdep,test)
  943. $(call add_dep_and_subdep,shell)
  944. $i "Bootstrap a new OTP library named $(APP)"
  945. $t mkdir $(APP)/
  946. $t cp ../erlang.mk $(APP)/
  947. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  948. $i "Add $(APP)-dep and $(APP)-testdep as a dependency"
  949. $t sed -i.bak '2i\
  950. DEPS = dep\
  951. DOC_DEPS = docdep\
  952. REL_DEPS = reldep\
  953. TEST_DEPS = testdep\
  954. SHELL_DEPS = shelldep\
  955. dep_dep = git file://$(abspath $(APP)-dep) master\
  956. dep_docdep = git file://$(abspath $(APP)-docdep) master\
  957. dep_reldep = git file://$(abspath $(APP)-reldep) master\
  958. dep_testdep = git file://$(abspath $(APP)-testdep) master\
  959. dep_shelldep = git file://$(abspath $(APP)-shelldep) master\
  960. ' $(APP)/Makefile
  961. $t rm $(APP)/Makefile.bak
  962. $i "Create a Git repository for $(APP)"
  963. $t (cd $(APP) && \
  964. git init -q && \
  965. git config user.name "Testsuite" && \
  966. git config user.email "testsuite@erlang.mk" && \
  967. git add . && \
  968. git commit -q --no-gpg-sign -m "Initial commit")
  969. $i "List application dependencies"
  970. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  971. $t test -d $(APP)/deps/subdep
  972. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  973. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  974. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  975. $i "List application doc dependencies"
  976. $t $(MAKE) -C $(APP) --no-print-directory list-doc-deps $v
  977. $t test -d $(APP)/deps/subdep
  978. $t test -d $(APP)/deps/docsubdep
  979. $t printf "%s\n%s\n%s\n%s\n" \
  980. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/docdep $(APP)/deps/docsubdep) \
  981. | sort > $(APP)/expected-doc-deps.txt
  982. $t cmp $(APP)/expected-doc-deps.txt $(APP)/.erlang.mk/recursive-doc-deps-list.log
  983. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  984. $i "List application rel dependencies"
  985. $t $(MAKE) -C $(APP) --no-print-directory list-rel-deps $v
  986. $t test -d $(APP)/deps/subdep
  987. $t test -d $(APP)/deps/relsubdep
  988. $t printf "%s\n%s\n%s\n%s\n" \
  989. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/reldep $(APP)/deps/relsubdep) \
  990. | sort > $(APP)/expected-rel-deps.txt
  991. $t cmp $(APP)/expected-rel-deps.txt $(APP)/.erlang.mk/recursive-rel-deps-list.log
  992. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  993. $i "List application test dependencies"
  994. $t $(MAKE) -C $(APP) --no-print-directory list-test-deps $v
  995. $t test -d $(APP)/deps/subdep
  996. $t test -d $(APP)/deps/testsubdep
  997. $t printf "%s\n%s\n%s\n%s\n" \
  998. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/testdep $(APP)/deps/testsubdep) \
  999. | sort > $(APP)/expected-test-deps.txt
  1000. $t cmp $(APP)/expected-test-deps.txt $(APP)/.erlang.mk/recursive-test-deps-list.log
  1001. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  1002. $i "List application shell dependencies"
  1003. $t $(MAKE) -C $(APP) --no-print-directory list-shell-deps $v
  1004. $t test -d $(APP)/deps/subdep
  1005. $t test -d $(APP)/deps/shellsubdep
  1006. $t printf "%s\n%s\n%s\n%s\n" \
  1007. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
  1008. | sort > $(APP)/expected-shell-deps.txt
  1009. $t cmp $(APP)/expected-shell-deps.txt $(APP)/.erlang.mk/recursive-shell-deps-list.log
  1010. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  1011. $i "List application all dependencies (all kinds)"
  1012. $t $(MAKE) -C $(APP) --no-print-directory list-deps DEP_TYPES='doc rel test shell' $v
  1013. $t test -d $(APP)/deps/subdep
  1014. $t test -d $(APP)/deps/docsubdep
  1015. $t test -d $(APP)/deps/relsubdep
  1016. $t test -d $(APP)/deps/testsubdep
  1017. $t test -d $(APP)/deps/shellsubdep
  1018. $t printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
  1019. $(abspath \
  1020. $(APP)/deps/dep $(APP)/deps/subdep \
  1021. $(APP)/deps/docdep $(APP)/deps/docsubdep \
  1022. $(APP)/deps/reldep $(APP)/deps/relsubdep \
  1023. $(APP)/deps/testdep $(APP)/deps/testsubdep \
  1024. $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
  1025. | sort > $(APP)/expected-all-deps.txt
  1026. $t cmp $(APP)/expected-all-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  1027. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  1028. core-deps-mv: build clean
  1029. $i "Bootstrap a new OTP library named $(APP)"
  1030. $t mkdir $(APP)/
  1031. $t cp ../erlang.mk $(APP)/
  1032. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1033. $i "Add Cowlib to the list of dependencies"
  1034. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  1035. $i "Build the application"
  1036. $t $(MAKE) -C $(APP) $v
  1037. $i "Check that all dependencies were fetched"
  1038. $t test -d $(APP)/deps/cowlib
  1039. $i "Move the application elsewhere"
  1040. $t mv $(APP) $(APP)-moved
  1041. $i "Build the application"
  1042. $t $(MAKE) -C $(APP)-moved $v
  1043. core-deps-mv-rebar: build clean
  1044. $i "Bootstrap a new OTP library named $(APP)"
  1045. $t mkdir $(APP)/
  1046. $t cp ../erlang.mk $(APP)/
  1047. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1048. $i "Add Lager to the list of dependencies"
  1049. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile
  1050. $i "Build the application"
  1051. $t $(MAKE) -C $(APP) $v
  1052. $i "Check that all dependencies were fetched"
  1053. $t test -d $(APP)/deps/goldrush
  1054. $t test -d $(APP)/deps/lager
  1055. $i "Move the application elsewhere"
  1056. $t mv $(APP) $(APP)-moved
  1057. $i "Build the application"
  1058. $t $(MAKE) -C $(APP)-moved $v
  1059. # A lower-level dependency of the first dependency always
  1060. # wins over a lower-level dependency of the second dependency.
  1061. core-deps-order-first: build clean
  1062. $i "Bootstrap a new OTP library named $(APP)"
  1063. $t mkdir $(APP)/
  1064. $t cp ../erlang.mk $(APP)/
  1065. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1066. $i "Add Cowboy package and my_dep to the list of dependencies"
  1067. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep cowboy\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  1068. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  1069. $t mkdir $(APP)/my_dep
  1070. $t cp ../erlang.mk $(APP)/my_dep/
  1071. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  1072. $i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
  1073. $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
  1074. ifdef LEGACY
  1075. $i "Add Cowboy and my_dep to the applications key in the .app.src file"
  1076. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  1077. endif
  1078. $i "Build the application"
  1079. $t $(MAKE) -C $(APP) $v
  1080. $i "Check that all dependencies were fetched"
  1081. $t test -d $(APP)/deps/cowboy
  1082. $t test -d $(APP)/deps/cowlib
  1083. $t test -d $(APP)/deps/my_dep
  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, my_dep, 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. # A higher-level dependency always wins.
  1093. core-deps-order-top: build clean
  1094. $i "Bootstrap a new OTP library named $(APP)"
  1095. $t mkdir $(APP)/
  1096. $t cp ../erlang.mk $(APP)/
  1097. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1098. $i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
  1099. $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
  1100. ifdef LEGACY
  1101. $i "Add Cowboy to the applications key in the .app.src file"
  1102. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1103. endif
  1104. $i "Build the application"
  1105. $t $(MAKE) -C $(APP) $v
  1106. $i "Check that all dependencies were fetched"
  1107. $t test -d $(APP)/deps/cowboy
  1108. $t test -d $(APP)/deps/cowlib
  1109. $t test -d $(APP)/deps/ranch
  1110. $i "Check that the application was compiled correctly"
  1111. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1112. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  1113. {ok, Deps} = application:get_key($(APP), applications), \
  1114. true = lists:member(cowboy, Deps), \
  1115. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  1116. halt()"
  1117. core-deps-no-autopatch: build clean
  1118. $i "Bootstrap a new OTP library named $(APP)"
  1119. $t mkdir $(APP)/
  1120. $t cp ../erlang.mk $(APP)/
  1121. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1122. $i "Add Cowboy to the list of dependencies and Cowlib to the NO_AUTOPATCH list"
  1123. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nNO_AUTOPATCH = cowlib\n"}' $(APP)/Makefile
  1124. $i "Build the application"
  1125. $t $(MAKE) -C $(APP) $v
  1126. $i "Check that all dependencies were fetched"
  1127. $t test -d $(APP)/deps/cowboy
  1128. $t test -d $(APP)/deps/cowlib
  1129. $t test -d $(APP)/deps/ranch
  1130. $i "Check that Cowlib was not autopatched"
  1131. $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
  1132. core-deps-no-autopatch-erlang-mk: build clean
  1133. $i "Bootstrap a new OTP library named $(APP)"
  1134. $t mkdir $(APP)/
  1135. $t cp ../erlang.mk $(APP)/
  1136. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1137. $i "Add Cowlib to the list of dependencies and set NO_AUTOPATCH_ERLANG_MK=1"
  1138. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\nNO_AUTOPATCH_ERLANG_MK = 1\n"}' $(APP)/Makefile
  1139. $i "Build the application"
  1140. $t $(MAKE) -C $(APP) $v
  1141. $i "Check that all dependencies were fetched"
  1142. $t test -d $(APP)/deps/cowlib
  1143. $i "Check that Erlang.mk was not autopatched"
  1144. $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
  1145. core-deps-no-autopatch-rebar: build clean
  1146. $i "Bootstrap a new OTP library named $(APP)"
  1147. $t mkdir $(APP)/
  1148. $t cp ../erlang.mk $(APP)/
  1149. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1150. $i "Add Lager to the list of dependencies and to the NO_AUTOPATCH list"
  1151. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\nNO_AUTOPATCH = lager\n"}' $(APP)/Makefile
  1152. $i "Build the application"
  1153. $t $(MAKE) -C $(APP) $v
  1154. $i "Check that all dependencies were fetched"
  1155. $t test -d $(APP)/deps/goldrush
  1156. $t test -d $(APP)/deps/lager
  1157. $i "Check that Lager was not autopatched"
  1158. $t if grep -q erlang\.mk $(APP)/deps/goldrush/Makefile; then false; fi
  1159. $t if grep -q erlang\.mk $(APP)/deps/lager/Makefile; then false; fi
  1160. ifndef LEGACY
  1161. core-deps-otp: build clean
  1162. $i "Bootstrap a new OTP library named $(APP)"
  1163. $t mkdir $(APP)/
  1164. $t cp ../erlang.mk $(APP)/
  1165. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1166. $i "Add Crypto to the list of OTP dependencies"
  1167. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = crypto\n"}' $(APP)/Makefile
  1168. $i "Build the application"
  1169. $t $(MAKE) -C $(APP) $v
  1170. $i "Check that no dependencies were fetched"
  1171. $t test ! -e $(APP)/deps
  1172. $i "Check that the application was compiled correctly"
  1173. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1174. [ok = application:load(App) || App <- [$(APP), crypto]], \
  1175. {ok, Deps} = application:get_key($(APP), applications), \
  1176. true = lists:member(crypto, Deps), \
  1177. halt()"
  1178. endif
  1179. core-deps-pkg: build clean
  1180. $i "Bootstrap a new OTP library named $(APP)"
  1181. $t mkdir $(APP)/
  1182. $t cp ../erlang.mk $(APP)/
  1183. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1184. $i "Add Cowboy to the list of dependencies"
  1185. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  1186. ifdef LEGACY
  1187. $i "Add Cowboy to the applications key in the .app.src file"
  1188. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1189. endif
  1190. $i "Build the application"
  1191. $t $(MAKE) -C $(APP) $v
  1192. $i "Check that all dependencies were fetched"
  1193. $t test -d $(APP)/deps/cowboy
  1194. $t test -d $(APP)/deps/cowlib
  1195. $t test -d $(APP)/deps/ranch
  1196. $i "Check that the application was compiled correctly"
  1197. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1198. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  1199. {ok, Deps} = application:get_key($(APP), applications), \
  1200. true = lists:member(cowboy, Deps), \
  1201. halt()"
  1202. core-deps-rel: build clean
  1203. $i "Bootstrap a new release-enabled OTP library named $(APP)"
  1204. $t mkdir $(APP)/
  1205. $t cp ../erlang.mk $(APP)/
  1206. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
  1207. $i "Add Recon to the list of release dependencies"
  1208. $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
  1209. $i "Add Recon to the relx.config file"
  1210. $t $(ERL) -eval " \
  1211. {ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
  1212. Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
  1213. ok = file:write_file(\"$(APP)/relx.config\", \
  1214. lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
  1215. halt()"
  1216. $i "Build the application and its dependencies"
  1217. $t $(MAKE) -C $(APP) deps app $v
  1218. $i "Check that no dependencies were fetched"
  1219. $t test ! -e $(APP)/deps
  1220. $i "Check that the application was compiled correctly"
  1221. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1222. [ok = application:load(App) || App <- [$(APP)]], \
  1223. {ok, Deps} = application:get_key($(APP), applications), \
  1224. false = lists:member(recon, Deps), \
  1225. halt()"
  1226. $i "Build the release"
  1227. $t $(MAKE) -C $(APP) $v
  1228. $i "Check that all dependencies were fetched"
  1229. $t test -d $(APP)/deps/recon
  1230. $i "Check that the application was compiled correctly"
  1231. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1232. [ok = application:load(App) || App <- [$(APP), recon]], \
  1233. {ok, Deps} = application:get_key($(APP), applications), \
  1234. false = lists:member(recon, Deps), \
  1235. halt()"
  1236. # @todo Add check for MSYS2 when releases under Windows become usable.
  1237. # $i "Start the release and check that Recon is loaded"
  1238. ifeq ($(PLATFORM),msys2)
  1239. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
  1240. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
  1241. # $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
  1242. # application loaded_applications | grep recon`"
  1243. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
  1244. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
  1245. else
  1246. $i "Start the release and check that Recon is loaded"
  1247. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
  1248. $t apps="Node is not running!"; \
  1249. while test "$$apps" = "Node is not running!"; do \
  1250. apps=$$($(APP)/_rel/$(APP)_release/bin/$(APP)_release \
  1251. rpcterms \ application loaded_applications); \
  1252. done; \
  1253. echo "$$apps" | grep -q recon
  1254. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
  1255. endif
  1256. core-deps-search: build clean
  1257. $i "Bootstrap a new OTP library named $(APP)"
  1258. $t mkdir $(APP)/
  1259. $t cp ../erlang.mk $(APP)/
  1260. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1261. $i "Run 'make search' and check that it prints packages"
  1262. $t test -n "`$(MAKE) -C $(APP) search`"
  1263. $i "Run 'make search q=cowboy' and check that it prints packages"
  1264. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
  1265. core-deps-shell: build clean
  1266. $i "Bootstrap a new OTP library named $(APP)"
  1267. $t mkdir $(APP)/
  1268. $t cp ../erlang.mk $(APP)/
  1269. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1270. $i "Add TDDReloader to the list of shell dependencies"
  1271. $t perl -ni.bak -e 'print;if ($$.==1) {print "SHELL_DEPS = tddreloader\n"}' $(APP)/Makefile
  1272. $i "Build the application and its dependencies"
  1273. $t $(MAKE) -C $(APP) deps app $v
  1274. $i "Check that no dependencies were fetched"
  1275. $t test ! -e $(APP)/deps
  1276. $i "Check that the application was compiled correctly"
  1277. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1278. [ok = application:load(App) || App <- [$(APP)]], \
  1279. {ok, Deps} = application:get_key($(APP), applications), \
  1280. false = lists:member(tddreloader, Deps), \
  1281. halt()"
  1282. $i "Run the shell"
  1283. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
  1284. ok = application:load($(APP)), \
  1285. ok = application:load(tddreloader), \
  1286. halt()\"" $v
  1287. $i "Check that all dependencies were fetched"
  1288. $t test -d $(APP)/deps/tddreloader
  1289. $i "Check that the application was compiled correctly"
  1290. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1291. [ok = application:load(App) || App <- [$(APP), tddreloader]], \
  1292. {ok, Deps} = application:get_key($(APP), applications), \
  1293. false = lists:member(tddreloader, Deps), \
  1294. halt()"
  1295. core-deps-skip: build clean
  1296. $i "Bootstrap a new OTP library named $(APP)"
  1297. $t mkdir $(APP)/
  1298. $t cp ../erlang.mk $(APP)/
  1299. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1300. $i "Add Cowboy to the list of dependencies"
  1301. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  1302. ifdef LEGACY
  1303. $i "Add Cowboy to the applications key in the .app.src file"
  1304. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1305. endif
  1306. $i "Build the application with SKIP_DEPS=1"
  1307. $t $(MAKE) -C $(APP) SKIP_DEPS=1 $v
  1308. $i "Check that no dependencies were fetched"
  1309. $t test ! -e $(APP)/deps
  1310. $i "Build the application"
  1311. $t $(MAKE) -C $(APP) $v
  1312. $i "Check that all dependencies were fetched"
  1313. $t test -d $(APP)/deps/cowlib
  1314. $t test -d $(APP)/deps/cowboy
  1315. $t test -d $(APP)/deps/ranch
  1316. $i "Distclean with SKIP_DEPS=1"
  1317. $t $(MAKE) -C $(APP) distclean SKIP_DEPS=1 $v
  1318. $i "Check that no dependencies were removed"
  1319. $t test -d $(APP)/deps/cowlib
  1320. $t test -d $(APP)/deps/cowboy
  1321. $t test -d $(APP)/deps/ranch
  1322. core-deps-test: build clean
  1323. $i "Bootstrap a new OTP library named $(APP)"
  1324. $t mkdir $(APP)/
  1325. $t cp ../erlang.mk $(APP)/
  1326. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1327. $i "Generate .erl files"
  1328. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1329. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1330. $i "Add triq to the list of test dependencies"
  1331. $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = triq\n"}' $(APP)/Makefile
  1332. $i "Build the application and its dependencies"
  1333. $t $(MAKE) -C $(APP) deps app $v
  1334. $i "Check that no dependencies were fetched"
  1335. $t test ! -e $(APP)/deps
  1336. $i "Check that the application was compiled correctly"
  1337. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1338. [ok = application:load(App) || App <- [$(APP)]], \
  1339. {ok, Deps} = application:get_key($(APP), applications), \
  1340. false = lists:member(triq, Deps), \
  1341. halt()"
  1342. $i "Run tests"
  1343. $t $(MAKE) -C $(APP) tests $v
  1344. $i "Check that all dependencies were fetched"
  1345. $t test -d $(APP)/deps/triq
  1346. $i "Check that the application was compiled correctly"
  1347. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1348. [ok = application:load(App) || App <- [$(APP), triq]], \
  1349. {ok, Deps} = application:get_key($(APP), applications), \
  1350. false = lists:member(triq, Deps), \
  1351. halt()"