core_deps.mk 39 KB

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