core_deps.mk 40 KB

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