core_deps.mk 41 KB

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