core_deps.mk 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449
  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-force-full: 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 "Build the application"
  141. $t $(MAKE) -C $(APP) $v
  142. $i "Touch one cowlib file to mark it for recompilation"
  143. $t $(SLEEP)
  144. $t touch $(APP)/deps/cowlib/src/cow_http.erl
  145. $i "Check that cowlib is not rebuilt if \`force_rebuild_dep\` returns false"
  146. $t touch $(APP)/EXPECT
  147. $t $(SLEEP)
  148. $t $(MAKE) -C $(APP) force_rebuild_dep='test $$(1) != $(CURDIR)/$(APP)/deps/cowlib' $v
  149. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | sort | diff $(APP)/EXPECT -
  150. $t rm $(APP)/EXPECT
  151. $i "Check that cowlib is rebuilt if \`force_rebuild_dep\` returns true"
  152. $t printf "%s\n" \
  153. $(APP)/deps/cowlib/cowlib.d \
  154. $(APP)/deps/cowlib/ebin/cowlib.app \
  155. $(APP)/deps/cowlib/ebin/cow_http.beam \
  156. $(APP)/deps/cowlib/ebin/dep_built | sort > $(APP)/EXPECT
  157. $t $(SLEEP)
  158. $t $(MAKE) -C $(APP) force_rebuild_dep='test $$(1) = $(CURDIR)/$(APP)/deps/cowlib' $v
  159. # Files in .git might end up modified due to the id generation in the .app file.
  160. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT -
  161. $t rm $(APP)/EXPECT
  162. $i "Touch one cowlib file to mark it for recompilation"
  163. $t $(SLEEP)
  164. $t touch $(APP)/deps/cowlib/src/cow_http.erl
  165. $i "Check that cowlib is not rebuilt if \`FORCE_REBUILD\` is empty"
  166. $t touch $(APP)/EXPECT
  167. $t $(SLEEP)
  168. $t $(MAKE) -C $(APP) FORCE_REBUILD= $v
  169. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | sort | diff $(APP)/EXPECT -
  170. $t rm $(APP)/EXPECT
  171. $i "Check that cowlib is not rebuilt if \`FORCE_REBUILD\` does not mention cowlib"
  172. $t touch $(APP)/EXPECT
  173. $t $(SLEEP)
  174. $t $(MAKE) -C $(APP) FORCE_REBUILD='other_dep' $v
  175. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | sort | diff $(APP)/EXPECT -
  176. $t rm $(APP)/EXPECT
  177. $i "Check that cowlib is rebuilt if \`FORCE_REBUILD\` contains cowlib"
  178. $t printf "%s\n" \
  179. $(APP)/deps/cowlib/cowlib.d \
  180. $(APP)/deps/cowlib/ebin/cowlib.app \
  181. $(APP)/deps/cowlib/ebin/cow_http.beam \
  182. $(APP)/deps/cowlib/ebin/dep_built | sort > $(APP)/EXPECT
  183. $t $(SLEEP)
  184. $t $(MAKE) -C $(APP) FORCE_REBUILD='other_dep cowlib' $v
  185. # Files in .git might end up modified due to the id generation in the .app file.
  186. $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT -
  187. $t rm $(APP)/EXPECT
  188. core-deps-dep-built-ln: init
  189. $i "Bootstrap a new OTP library named $(APP)"
  190. $t mkdir $(APP)/
  191. $t cp ../erlang.mk $(APP)/
  192. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  193. $i "Add cowlib to the list of dependencies"
  194. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  195. $i "Clone cowlib manually inside $(APP)"
  196. $t git clone -q https://github.com/ninenines/cowlib $(APP)/cowlib
  197. $i "Link to cowlib instead of fetching the dependency"
  198. $t mkdir -p $(APP)/deps
  199. $t ln -s ../cowlib $(APP)/deps/cowlib
  200. $i "Build the application"
  201. $t $(MAKE) -C $(APP) $v
  202. # On MSYS2 "ln" will by default not create symbolic links because
  203. # it requires an option to be enabled and administrative privileges.
  204. # The "rebuild" part of the test is therefore skipped on Windows.
  205. ifneq ($(PLATFORM),msys2)
  206. $i "Touch one cowlib file to mark it for recompilation"
  207. $t $(SLEEP)
  208. $t touch $(APP)/deps/cowlib/src/cow_http.erl
  209. $i "Check that cowlib is rebuilt; symlinked deps don't create dep_built"
  210. $t printf "%s\n" \
  211. $(APP)/cowlib/cowlib.d \
  212. $(APP)/cowlib/ebin/cowlib.app \
  213. $(APP)/cowlib/ebin/cow_http.beam | sort > $(APP)/EXPECT
  214. $t $(SLEEP)
  215. $t $(MAKE) -C $(APP) $v
  216. # Files in .git might end up modified due to the id generation in the .app file.
  217. $t find $(APP)/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT -
  218. $t rm $(APP)/EXPECT
  219. endif
  220. core-deps-dep-commit: init
  221. $i "Bootstrap a new OTP library named $(APP)"
  222. $t mkdir $(APP)/
  223. $t cp ../erlang.mk $(APP)/
  224. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  225. $i "Add Cowboy 1.0.0 to the list of dependencies"
  226. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy_commit = 1.0.0\n"}' $(APP)/Makefile
  227. ifdef LEGACY
  228. $i "Add Cowboy to the applications key in the .app.src file"
  229. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  230. endif
  231. $i "Build the application"
  232. $t $(MAKE) -C $(APP) $v
  233. $i "Check that all dependencies were fetched"
  234. $t test -d $(APP)/deps/cowboy
  235. $t test -d $(APP)/deps/cowlib
  236. $t test -d $(APP)/deps/ranch
  237. $i "Check that the application was compiled correctly"
  238. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  239. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  240. {ok, Deps} = application:get_key($(APP), applications), \
  241. true = lists:member(cowboy, Deps), \
  242. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  243. halt()"
  244. core-deps-dir: init
  245. $i "Bootstrap a new OTP library named $(APP)"
  246. $t mkdir $(APP)/
  247. $t cp ../erlang.mk $(APP)/
  248. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  249. $i "Add Cowboy to the list of dependencies with a custom DEPS_DIR"
  250. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nDEPS_DIR ?= \$$(CURDIR)/deep/libs\n"}' $(APP)/Makefile
  251. ifdef LEGACY
  252. $i "Add Cowboy to the applications key in the .app.src file"
  253. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  254. endif
  255. $i "Build the application"
  256. $t $(MAKE) -C $(APP) $v
  257. $i "Check that all dependencies were fetched in the custom DEPS_DIR"
  258. $t test -d $(APP)/deep/libs/cowboy
  259. $t test -d $(APP)/deep/libs/cowlib
  260. $t test -d $(APP)/deep/libs/ranch
  261. $i "Check that the application was compiled correctly"
  262. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deep/libs/*/ebin/ -eval " \
  263. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  264. {ok, Deps} = application:get_key($(APP), applications), \
  265. true = lists:member(cowboy, Deps), \
  266. halt()"
  267. core-deps-doc: init
  268. $i "Bootstrap a new OTP library named $(APP)"
  269. $t mkdir $(APP)/
  270. $t cp ../erlang.mk $(APP)/
  271. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  272. $i "Generate .erl files"
  273. $t echo "-module(boy)." > $(APP)/src/boy.erl
  274. $t echo "-module(girl)." > $(APP)/src/girl.erl
  275. $i "Add Edown as a documentation building dependency"
  276. $t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = edown\nEDOC_OPTS = {doclet, edown_doclet}\n"}' $(APP)/Makefile
  277. $i "Build the application"
  278. $t $(MAKE) -C $(APP) $v
  279. $i "Check that no dependencies were fetched"
  280. $t test ! -e $(APP)/deps
  281. $i "Check that the application was compiled correctly"
  282. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  283. [ok = application:load(App) || App <- [$(APP)]], \
  284. {ok, Deps} = application:get_key($(APP), applications), \
  285. false = lists:member(edown, Deps), \
  286. halt()"
  287. $i "Build the application documentation"
  288. $t $(MAKE) -C $(APP) edoc $v
  289. $i "Check that documentation dependencies were fetched"
  290. $t test -d $(APP)/deps/edown
  291. $i "Check the Edown generated Markdown documentation"
  292. $t test -f $(APP)/doc/boy.md
  293. $t test -f $(APP)/doc/girl.md
  294. core-deps-fetch-cp: init
  295. $i "Bootstrap a new OTP library named $(APP)"
  296. $t mkdir $(APP)/
  297. $t cp ../erlang.mk $(APP)/
  298. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  299. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  300. $t mkdir $(APP)/my_dep
  301. $t cp ../erlang.mk $(APP)/my_dep/
  302. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  303. $i "Add my_dep to the list of dependencies"
  304. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  305. ifdef LEGACY
  306. $i "Add my_dep to the applications key in the .app.src file"
  307. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\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/my_dep
  313. $i "Check that the application was compiled correctly"
  314. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  315. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  316. {ok, Deps} = application:get_key($(APP), applications), \
  317. true = lists:member(my_dep, Deps), \
  318. halt()"
  319. core-deps-fetch-custom: init
  320. $i "Bootstrap a new OTP library named $(APP)"
  321. $t mkdir $(APP)/
  322. $t cp ../erlang.mk $(APP)/
  323. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  324. $i "Add dependency boop using custom fetch method beep to the list of dependencies"
  325. $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
  326. ifdef LEGACY
  327. $i "Add boop to the applications key in the .app.src file"
  328. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tboop,\n"}' $(APP)/src/$(APP).app.src
  329. endif
  330. $i "Build the application"
  331. $t $(MAKE) -C $(APP) $v
  332. $i "Check that all dependencies were fetched"
  333. $t test -d $(APP)/deps/boop
  334. $i "Check that the application was compiled correctly"
  335. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  336. ok = application:load($(APP)), \
  337. {ok, Deps} = application:get_key($(APP), applications), \
  338. true = lists:member(boop, Deps), \
  339. halt()"
  340. core-deps-fetch-fail-bad: init
  341. $i "Bootstrap a new OTP library named $(APP)"
  342. $t mkdir $(APP)/
  343. $t cp ../erlang.mk $(APP)/
  344. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  345. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  346. $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
  347. $i "Check that building the application fails"
  348. $t ! $(MAKE) -C $(APP) $v
  349. core-deps-fetch-fail-unknown: init
  350. $i "Bootstrap a new OTP library named $(APP)"
  351. $t mkdir $(APP)/
  352. $t cp ../erlang.mk $(APP)/
  353. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  354. $i "Add an unknown application as a dependency"
  355. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = unknown\n"}' $(APP)/Makefile
  356. $i "Check that building the application fails"
  357. $t ! $(MAKE) -C $(APP) $v
  358. core-deps-fetch-git: init
  359. $i "Bootstrap a new OTP library named $(APP)"
  360. $t mkdir $(APP)/
  361. $t cp ../erlang.mk $(APP)/
  362. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  363. $i "Add Cowboy 1.0.0 to the list of dependencies"
  364. $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
  365. ifdef LEGACY
  366. $i "Add Cowboy to the applications key in the .app.src file"
  367. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  368. endif
  369. $i "Build the application"
  370. $t $(MAKE) -C $(APP) $v
  371. $i "Check that all dependencies were fetched"
  372. $t test -d $(APP)/deps/cowboy
  373. $t test -d $(APP)/deps/cowlib
  374. $t test -d $(APP)/deps/ranch
  375. $i "Check that the application was compiled correctly"
  376. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  377. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  378. {ok, Deps} = application:get_key($(APP), applications), \
  379. true = lists:member(cowboy, Deps), \
  380. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  381. halt()"
  382. core-deps-fetch-git-subfolder: init
  383. $i "Bootstrap a new OTP library named $(APP)"
  384. $t mkdir $(APP)/
  385. $t cp ../erlang.mk $(APP)/
  386. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  387. $i "Bootstrap a new OTP library named my_dep as a subfolder inside $(APP)"
  388. $t mkdir -p $(APP)/git_repo/my_dep
  389. $t cp ../erlang.mk $(APP)/git_repo/my_dep/
  390. $t $(MAKE) -C $(APP)/git_repo/my_dep/ -f erlang.mk bootstrap-lib $v
  391. # Create an empty file so src/ gets committed.
  392. $t touch $(APP)/git_repo/my_dep/src/README
  393. $t cd $(APP)/git_repo && \
  394. git init -q && \
  395. git config user.email "testsuite@erlang.mk" && \
  396. git config user.name "test suite" && \
  397. git add . && \
  398. git commit -q --no-gpg-sign -m "Tests"
  399. $i "Add my_dep to the list of dependencies"
  400. $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
  401. ifdef LEGACY
  402. $i "Add my_dep to the applications key in the .app.src file"
  403. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  404. endif
  405. $i "Build the application"
  406. $t $(MAKE) -C $(APP) $v
  407. $i "Check that the dependency was fetched"
  408. $t test -d $(APP)/deps/my_dep
  409. $i "Check that the application was compiled correctly"
  410. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  411. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  412. {ok, Deps} = application:get_key($(APP), applications), \
  413. true = lists:member(my_dep, Deps), \
  414. halt()"
  415. core-deps-fetch-git-submodule: init
  416. $i "Bootstrap a new OTP library named $(APP)"
  417. $t mkdir $(APP)/
  418. $t cp ../erlang.mk $(APP)/
  419. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  420. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  421. $t mkdir $(APP)/my_dep
  422. $t cp ../erlang.mk $(APP)/my_dep/
  423. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  424. # Create an empty file so src/ gets committed.
  425. $t touch $(APP)/my_dep/src/README
  426. $t cd $(APP)/my_dep && \
  427. git init -q && \
  428. git config user.email "testsuite@erlang.mk" && \
  429. git config user.name "test suite" && \
  430. git add . && \
  431. git commit -q --no-gpg-sign -m "Tests"
  432. $i "Add the submodule to my_dep"
  433. $t mkdir $(APP)/deps
  434. $t cd $(APP) && \
  435. git init -q && \
  436. git submodule -q add file://$(abspath $(APP)/my_dep) deps/my_dep && \
  437. git config user.email "testsuite@erlang.mk" && \
  438. git config user.name "test suite" && \
  439. git add . && \
  440. git commit -q --no-gpg-sign -m "Tests"
  441. $i "Distclean the application"
  442. $t $(MAKE) -C $(APP) distclean $v
  443. $i "Add my_dep to the list of dependencies"
  444. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = git-submodule\n"}' $(APP)/Makefile
  445. ifdef LEGACY
  446. $i "Add my_dep to the applications key in the .app.src file"
  447. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  448. endif
  449. $i "Build the application"
  450. $t $(MAKE) -C $(APP) $v
  451. $i "Check that all dependencies were fetched"
  452. $t test -d $(APP)/deps/my_dep
  453. $i "Check that the application was compiled correctly"
  454. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  455. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  456. {ok, Deps} = application:get_key($(APP), applications), \
  457. true = lists:member(my_dep, Deps), \
  458. halt()"
  459. core-deps-fetch-hex: init
  460. $i "Bootstrap a new OTP library named $(APP)"
  461. $t mkdir $(APP)/
  462. $t cp ../erlang.mk $(APP)/
  463. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  464. $i "Add Cowboy 1.0.0 to the list of dependencies"
  465. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 1.0.0\n"}' $(APP)/Makefile
  466. ifdef LEGACY
  467. $i "Add Cowboy to the applications key in the .app.src file"
  468. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  469. endif
  470. $i "Build the application"
  471. $t $(MAKE) -C $(APP) $v
  472. $i "Check that all dependencies were fetched"
  473. $t test -d $(APP)/deps/cowboy
  474. $t test -d $(APP)/deps/cowlib
  475. $t test -d $(APP)/deps/ranch
  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), cowboy, cowlib, ranch]], \
  479. {ok, Deps} = application:get_key($(APP), applications), \
  480. true = lists:member(cowboy, Deps), \
  481. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  482. halt()"
  483. core-deps-fetch-hg: init
  484. $i "Bootstrap a new OTP library named $(APP)"
  485. $t mkdir $(APP)/
  486. $t cp ../erlang.mk $(APP)/
  487. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  488. $i "Add Ehsa 4.0.3 to the list of dependencies"
  489. $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
  490. ifdef LEGACY
  491. $i "Add ehsa to the applications key in the .app.src file"
  492. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tehsa,\n"}' $(APP)/src/$(APP).app.src
  493. endif
  494. $i "Build the application"
  495. $t $(MAKE) -C $(APP) $v
  496. $i "Check that all dependencies were fetched"
  497. $t test -d $(APP)/deps/ehsa
  498. $i "Check that the application was compiled correctly"
  499. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  500. [ok = application:load(App) || App <- [$(APP), ehsa]], \
  501. {ok, Deps} = application:get_key($(APP), applications), \
  502. true = lists:member(ehsa, Deps), \
  503. {ok, \"4.0.3\"} = application:get_key(ehsa, vsn), \
  504. halt()"
  505. # Legacy must fail for the top-level application, but work for dependencies.
  506. core-deps-fetch-legacy: init
  507. $i "Bootstrap a new OTP library named $(APP)"
  508. $t mkdir $(APP)/
  509. $t cp ../erlang.mk $(APP)/
  510. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  511. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  512. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = https://github.com/ninenines/cowlib 1.0.0\n"}' $(APP)/Makefile
  513. $i "Check that building the application fails"
  514. $t ! $(MAKE) -C $(APP) $v
  515. $i "Check that building the application works with IS_DEP=1"
  516. $t $(MAKE) -C $(APP) IS_DEP=1 $v
  517. core-deps-fetch-ln: init
  518. $i "Bootstrap a new OTP library named $(APP)"
  519. $t mkdir $(APP)/
  520. $t cp ../erlang.mk $(APP)/
  521. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  522. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  523. $t mkdir $(APP)/my_dep
  524. $t cp ../erlang.mk $(APP)/my_dep/
  525. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  526. $i "Add my_dep to the list of dependencies"
  527. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = ln $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  528. ifdef LEGACY
  529. $i "Add my_dep to the applications key in the .app.src file"
  530. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  531. endif
  532. $i "Build the application"
  533. $t $(MAKE) -C $(APP) $v
  534. $i "Check that all dependencies were fetched"
  535. $t test -d $(APP)/deps/my_dep
  536. $i "Check that the application was compiled correctly"
  537. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  538. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  539. {ok, Deps} = application:get_key($(APP), applications), \
  540. true = lists:member(my_dep, Deps), \
  541. halt()"
  542. core-deps-fetch-svn: init
  543. $i "Bootstrap a new OTP library named $(APP)"
  544. $t mkdir $(APP)/
  545. $t cp ../erlang.mk $(APP)/
  546. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  547. $i "Add Cowlib 1.0.0 to the list of dependencies"
  548. $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
  549. ifdef LEGACY
  550. $i "Add Cowlib to the applications key in the .app.src file"
  551. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  552. endif
  553. $i "Build the application"
  554. $t $(MAKE) -C $(APP) $v
  555. $i "Check that all dependencies were fetched"
  556. $t test -d $(APP)/deps/cowlib
  557. $i "Check that the application was compiled correctly"
  558. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  559. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  560. {ok, Deps} = application:get_key($(APP), applications), \
  561. true = lists:member(cowlib, Deps), \
  562. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  563. halt()"
  564. core-deps-ignore: init
  565. $i "Bootstrap a new OTP library named $(APP)"
  566. $t mkdir $(APP)/
  567. $t cp ../erlang.mk $(APP)/
  568. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  569. $i "Add Cowboy to dependencies, Ranch to the ignore list and to test dependencies"
  570. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nIGNORE_DEPS = ranch\nTEST_DEPS = ranch\n"}' $(APP)/Makefile
  571. ifdef LEGACY
  572. $i "Add Cowboy to the applications key in the .app.src file"
  573. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  574. endif
  575. $i "Build the application"
  576. $t $(MAKE) -C $(APP) $v
  577. $i "Check that the correct dependencies were fetched"
  578. $t test -d $(APP)/deps/cowboy
  579. $t test -d $(APP)/deps/cowlib
  580. $t test ! -e $(APP)/deps/ranch
  581. $i "Build the test dependencies"
  582. $t $(MAKE) -C $(APP) test-deps $v
  583. $i "Check that the correct dependencies were fetched"
  584. $t test -d $(APP)/deps/ranch
  585. define add_dep_and_subdep
  586. $i "Bootstrap a new OTP library named $(APP)_$(1)subdep"
  587. $t mkdir $(APP)_$(1)subdep/
  588. $t cp ../erlang.mk $(APP)_$(1)subdep/
  589. $t $2 -C $(APP)_$(1)subdep --no-print-directory -f erlang.mk bootstrap-lib $$v
  590. $i "Create a Git repository for $(APP)_$(1)subdep"
  591. $t (cd $(APP)_$(1)subdep && \
  592. git init -q && \
  593. git config user.name "Testsuite" && \
  594. git config user.email "testsuite@erlang.mk" && \
  595. git add . && \
  596. git commit -q --no-gpg-sign -m "Initial commit")
  597. $i "Bootstrap a new OTP library named $(APP)_$(1)dep"
  598. $t mkdir $(APP)_$(1)dep/
  599. $t cp ../erlang.mk $(APP)_$(1)dep/
  600. $t $2 -C $(APP)_$(1)dep --no-print-directory -f erlang.mk bootstrap-lib $$v
  601. $i "Add $(APP)_$(1)subdep as a dependency"
  602. $t perl -ni.bak -e \
  603. 'print;if ($$.==1) {print "DEPS = $(1)subdep\ndep_$(1)subdep = git file://$(abspath $(APP)_$(1)subdep) master\n"}' \
  604. $(APP)_$(1)dep/Makefile
  605. $t rm $(APP)_$(1)dep/Makefile.bak
  606. $i "Create a Git repository for $(APP)_$(1)dep"
  607. $t (cd $(APP)_$(1)dep && \
  608. git init -q && \
  609. git config user.name "Testsuite" && \
  610. git config user.email "testsuite@erlang.mk" && \
  611. git add . && \
  612. git commit -q --no-gpg-sign -m "Initial commit")
  613. endef
  614. core-deps-list-deps: init
  615. # We pass $(MAKE) directly so that GNU Make can pass its context forward.
  616. # If we didn't then $(MAKE) would be expanded in the call without context.
  617. $(call add_dep_and_subdep,,$(MAKE))
  618. $(call add_dep_and_subdep,doc,$(MAKE))
  619. $(call add_dep_and_subdep,rel,$(MAKE))
  620. $(call add_dep_and_subdep,test,$(MAKE))
  621. $(call add_dep_and_subdep,shell,$(MAKE))
  622. $i "Bootstrap a new OTP library named $(APP)"
  623. $t mkdir $(APP)/
  624. $t cp ../erlang.mk $(APP)/
  625. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  626. $i "Add $(APP)-dep and $(APP)-testdep as a dependency"
  627. $t sed -i.bak '2i\
  628. DEPS = dep\
  629. DOC_DEPS = docdep\
  630. REL_DEPS = reldep\
  631. TEST_DEPS = testdep\
  632. SHELL_DEPS = shelldep\
  633. dep_dep = git file://$(abspath $(APP)_dep) master\
  634. dep_docdep = git file://$(abspath $(APP)_docdep) master\
  635. dep_reldep = git file://$(abspath $(APP)_reldep) master\
  636. dep_testdep = git file://$(abspath $(APP)_testdep) master\
  637. dep_shelldep = git file://$(abspath $(APP)_shelldep) master\
  638. ' $(APP)/Makefile
  639. $t rm $(APP)/Makefile.bak
  640. $i "Create a Git repository for $(APP)"
  641. $t (cd $(APP) && \
  642. git init -q && \
  643. git config user.name "Testsuite" && \
  644. git config user.email "testsuite@erlang.mk" && \
  645. git add . && \
  646. git commit -q --no-gpg-sign -m "Initial commit")
  647. $i "List application dependencies"
  648. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  649. $t test -d $(APP)/deps/subdep
  650. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  651. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  652. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  653. $i "List application doc dependencies"
  654. $t $(MAKE) -C $(APP) --no-print-directory list-doc-deps $v
  655. $t test -d $(APP)/deps/subdep
  656. $t test -d $(APP)/deps/docsubdep
  657. $t printf "%s\n%s\n%s\n%s\n" \
  658. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/docdep $(APP)/deps/docsubdep) \
  659. | sort > $(APP)/expected-doc-deps.txt
  660. $t cmp $(APP)/expected-doc-deps.txt $(APP)/.erlang.mk/recursive-doc-deps-list.log
  661. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  662. $i "List application rel dependencies"
  663. $t $(MAKE) -C $(APP) --no-print-directory list-rel-deps $v
  664. $t test -d $(APP)/deps/subdep
  665. $t test -d $(APP)/deps/relsubdep
  666. $t printf "%s\n%s\n%s\n%s\n" \
  667. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/reldep $(APP)/deps/relsubdep) \
  668. | sort > $(APP)/expected-rel-deps.txt
  669. $t cmp $(APP)/expected-rel-deps.txt $(APP)/.erlang.mk/recursive-rel-deps-list.log
  670. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  671. $i "List application test dependencies"
  672. $t $(MAKE) -C $(APP) --no-print-directory list-test-deps $v
  673. $t test -d $(APP)/deps/subdep
  674. $t test -d $(APP)/deps/testsubdep
  675. $t printf "%s\n%s\n%s\n%s\n" \
  676. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/testdep $(APP)/deps/testsubdep) \
  677. | sort > $(APP)/expected-test-deps.txt
  678. $t cmp $(APP)/expected-test-deps.txt $(APP)/.erlang.mk/recursive-test-deps-list.log
  679. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  680. $i "List application shell dependencies"
  681. $t $(MAKE) -C $(APP) --no-print-directory list-shell-deps $v
  682. $t test -d $(APP)/deps/subdep
  683. $t test -d $(APP)/deps/shellsubdep
  684. $t printf "%s\n%s\n%s\n%s\n" \
  685. $(abspath $(APP)/deps/dep $(APP)/deps/subdep $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
  686. | sort > $(APP)/expected-shell-deps.txt
  687. $t cmp $(APP)/expected-shell-deps.txt $(APP)/.erlang.mk/recursive-shell-deps-list.log
  688. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  689. $i "List application all dependencies (all kinds)"
  690. $t $(MAKE) -C $(APP) --no-print-directory list-deps DEP_TYPES='doc rel test shell' $v
  691. $t test -d $(APP)/deps/subdep
  692. $t test -d $(APP)/deps/docsubdep
  693. $t test -d $(APP)/deps/relsubdep
  694. $t test -d $(APP)/deps/testsubdep
  695. $t test -d $(APP)/deps/shellsubdep
  696. $t printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
  697. $(abspath \
  698. $(APP)/deps/dep $(APP)/deps/subdep \
  699. $(APP)/deps/docdep $(APP)/deps/docsubdep \
  700. $(APP)/deps/reldep $(APP)/deps/relsubdep \
  701. $(APP)/deps/testdep $(APP)/deps/testsubdep \
  702. $(APP)/deps/shelldep $(APP)/deps/shellsubdep) \
  703. | sort > $(APP)/expected-all-deps.txt
  704. $t cmp $(APP)/expected-all-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  705. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  706. core-deps-list-deps-with-apps: init
  707. # We pass $(MAKE) directly so that GNU Make can pass its context forward.
  708. # If we didn't then $(MAKE) would be expanded in the call without context.
  709. $(call add_dep_and_subdep,,$(MAKE))
  710. $i "Bootstrap a new OTP library named $(APP)"
  711. $t mkdir $(APP)/
  712. $t cp ../erlang.mk $(APP)/
  713. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  714. $i "Bootstrap another APP named $(APP)_app in $(APP) repository"
  715. $t $(MAKE) -C $(APP) --no-print-directory new-lib in=my_app $v
  716. $i "Bootstrap another APP named $(APP)_dep_app in $(APP)_dep repository"
  717. $t $(MAKE) -C $(APP)_dep --no-print-directory new-lib in=my_dep_app $v
  718. $t sed -i.bak '2i\
  719. APPS_DIR := $$(CURDIR)/apps\
  720. LOCAL_DEPS = my_dep_app ssl\
  721. ' $(APP)_dep/Makefile
  722. $t echo 'unexport APPS_DIR' >> $(APP)_dep/Makefile
  723. $t rm $(APP)_dep/Makefile.bak
  724. $t cd $(APP)_dep && git add .
  725. $t cd $(APP)_dep && git commit -q --no-gpg-sign -m "Add application"
  726. $i "Add $(APP)-dep as a dependency"
  727. $t sed -i.bak '2i\
  728. DEPS = dep\
  729. dep_dep = git file://$(abspath $(APP)_dep) master\
  730. ' $(APP)/Makefile
  731. $t rm $(APP)/Makefile.bak
  732. $i "Create a Git repository for $(APP)"
  733. $t (cd $(APP) && \
  734. git init -q && \
  735. git config user.name "Testsuite" && \
  736. git config user.email "testsuite@erlang.mk" && \
  737. git add . && \
  738. git commit -q --no-gpg-sign -m "Initial commit")
  739. $i "List application dependencies ($(APP)_app is missing)"
  740. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  741. $t test -d $(APP)/deps/subdep
  742. $t printf "%s\n%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/dep/apps/my_dep_app $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  743. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  744. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  745. $i "Add $(APP)_app as a dependency"
  746. $t sed -i.bak '3i\
  747. LOCAL_DEPS = my_app\
  748. ' $(APP)/Makefile
  749. $t rm $(APP)/Makefile.bak
  750. $i "List application dependencies ($(APP)_app is listed)"
  751. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  752. $t test -d $(APP)/deps/subdep
  753. $t printf "%s\n%s\n%s\n%s\n" $(abspath $(APP)/apps/my_app $(APP)/deps/dep $(APP)/deps/dep/apps/my_dep_app $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  754. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  755. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  756. core-deps-list-deps-with-specified-full-var: init
  757. # We pass $(MAKE) directly so that GNU Make can pass its context forward.
  758. # If we didn't then $(MAKE) would be expanded in the call without context.
  759. $(call add_dep_and_subdep,,$(MAKE))
  760. $i "Bootstrap a new OTP library named $(APP)"
  761. $t mkdir $(APP)/
  762. $t cp ../erlang.mk $(APP)/
  763. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  764. $i "Add $(APP)-dep as a dependency"
  765. $t sed -i.bak '2i\
  766. DEPS = dep\
  767. dep_dep = git file://$(abspath $(APP)_dep) master\
  768. ' $(APP)/Makefile
  769. $t rm $(APP)/Makefile.bak
  770. $i "Create a Git repository for $(APP)"
  771. $t (cd $(APP) && \
  772. git init -q && \
  773. git config user.name "Testsuite" && \
  774. git config user.email "testsuite@erlang.mk" && \
  775. git add . && \
  776. git commit -q --no-gpg-sign -m "Initial commit")
  777. $i "Build application"
  778. $t $(MAKE) -C $(APP) --no-print-directory $v
  779. $t test -d $(APP)/deps/subdep
  780. $i "List application dependencies without FULL"
  781. $t $(MAKE) -C $(APP) --no-print-directory list-deps $v
  782. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  783. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  784. $i "List application dependencies with empty FULL"
  785. $t $(MAKE) -C $(APP) --no-print-directory list-deps FULL= $v
  786. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  787. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  788. $i "List application dependencies with FULL=1"
  789. $t $(MAKE) -C $(APP) --no-print-directory list-deps FULL=1 $v
  790. $t printf "%s\n%s\n" $(abspath $(APP)/deps/dep $(APP)/deps/subdep) > $(APP)/expected-deps.txt
  791. $t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/recursive-deps-list.log
  792. $t $(MAKE) -C $(APP) --no-print-directory distclean $v
  793. core-deps-makefile-change: init
  794. $i "Bootstrap a new OTP application named $(APP)"
  795. $t mkdir $(APP)/
  796. $t cp ../erlang.mk $(APP)/
  797. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  798. $i "Build the application"
  799. $t $(MAKE) -C $(APP) $v
  800. $i "Add Cowlib to the list of dependencies"
  801. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  802. ifdef LEGACY
  803. $i "Add Cowlib to the applications key in the .app.src file"
  804. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/src/$(APP).app.src
  805. endif
  806. $i "Build the application again"
  807. $t $(MAKE) -C $(APP) $v
  808. $i "Check that Cowlib was included in the .app file"
  809. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  810. ok = application:load($(APP)), \
  811. {ok, Apps} = application:get_key($(APP), applications), \
  812. true = lists:member(cowlib, Apps), \
  813. halt()."
  814. core-deps-dep-makefile-change: init
  815. $i "Bootstrap a new OTP application named $(APP)"
  816. $t mkdir $(APP)/
  817. $t cp ../erlang.mk $(APP)/
  818. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  819. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  820. $t mkdir $(APP)/my_dep
  821. $t cp ../erlang.mk $(APP)/my_dep/
  822. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  823. $i "Add my_dep to the list of dependencies"
  824. # We use FORCE_REBUILD to ensure it gets rebuilt even on Windows.
  825. $t perl -ni.bak -e "print;if ($$.==1) {print \"DEPS = my_dep\ndep_my_dep = ln $(CURDIR)/$(APP)/my_dep/\nFORCE_REBUILD = my_dep\n\"}" $(APP)/Makefile
  826. ifdef LEGACY
  827. $i "Add my_dep to the applications key in the .app.src file"
  828. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  829. endif
  830. $i "Build the application"
  831. $t $(MAKE) -C $(APP) NO_AUTOPATCH=my_dep $v
  832. $i "Add Cowlib to the list of dependencies in my_dep"
  833. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib_commit = master\n"}' $(APP)/deps/my_dep/Makefile
  834. ifdef LEGACY
  835. $i "Add Cowlib to the applications key in my_dep's .app.src file"
  836. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowlib,\n"}' $(APP)/deps/my_dep/src/my_dep.app.src
  837. endif
  838. $i "Build the application again"
  839. $t $(MAKE) -C $(APP) $v
  840. $i "Check that Cowlib was included in my_dep's .app file"
  841. $t $(ERL) -pa $(APP)/deps/my_dep/ebin/ -eval " \
  842. ok = application:load(my_dep), \
  843. {ok, Apps} = application:get_key(my_dep, applications), \
  844. true = lists:member(cowlib, Apps), \
  845. halt()."
  846. core-deps-mv: init
  847. $i "Bootstrap a new OTP library named $(APP)"
  848. $t mkdir $(APP)/
  849. $t cp ../erlang.mk $(APP)/
  850. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  851. $i "Add Cowlib to the list of dependencies"
  852. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
  853. $i "Build the application"
  854. $t $(MAKE) -C $(APP) $v
  855. $i "Check that all dependencies were fetched"
  856. $t test -d $(APP)/deps/cowlib
  857. $i "Move the application elsewhere"
  858. $t mv $(APP) $(APP)-moved
  859. $i "Build the application"
  860. $t $(MAKE) -C $(APP)-moved $v
  861. core-deps-mv-rebar: init
  862. $i "Bootstrap a new OTP library named $(APP)"
  863. $t mkdir $(APP)/
  864. $t cp ../erlang.mk $(APP)/
  865. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  866. $i "Add Lager to the list of dependencies"
  867. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile
  868. $i "Build the application"
  869. $t $(MAKE) -C $(APP) $v
  870. $i "Check that all dependencies were fetched"
  871. $t test -d $(APP)/deps/goldrush
  872. $t test -d $(APP)/deps/lager
  873. $i "Move the application elsewhere"
  874. $t mv $(APP) $(APP)-moved
  875. $i "Build the application"
  876. $t $(MAKE) -C $(APP)-moved $v
  877. # A lower-level dependency of the first dependency always
  878. # wins over a lower-level dependency of the second dependency.
  879. core-deps-order-first: init
  880. $i "Bootstrap a new OTP library named $(APP)"
  881. $t mkdir $(APP)/
  882. $t cp ../erlang.mk $(APP)/
  883. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  884. $i "Add Cowboy package and my_dep to the list of dependencies"
  885. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep cowboy\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  886. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  887. $t mkdir $(APP)/my_dep
  888. $t cp ../erlang.mk $(APP)/my_dep/
  889. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  890. $i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
  891. $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
  892. ifdef LEGACY
  893. $i "Add Cowboy and my_dep to the applications key in the .app.src file"
  894. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  895. endif
  896. $i "Build the application"
  897. $t $(MAKE) -C $(APP) $v
  898. $i "Check that all dependencies were fetched"
  899. $t test -d $(APP)/deps/cowboy
  900. $t test -d $(APP)/deps/cowlib
  901. $t test -d $(APP)/deps/my_dep
  902. $t test -d $(APP)/deps/ranch
  903. $i "Check that the application was compiled correctly"
  904. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  905. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, my_dep, ranch]], \
  906. {ok, Deps} = application:get_key($(APP), applications), \
  907. true = lists:member(cowboy, Deps), \
  908. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  909. halt()"
  910. # A higher-level dependency always wins.
  911. core-deps-order-top: init
  912. $i "Bootstrap a new OTP library named $(APP)"
  913. $t mkdir $(APP)/
  914. $t cp ../erlang.mk $(APP)/
  915. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  916. $i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
  917. $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
  918. ifdef LEGACY
  919. $i "Add Cowboy to the applications key in the .app.src file"
  920. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  921. endif
  922. $i "Build the application"
  923. $t $(MAKE) -C $(APP) $v
  924. $i "Check that all dependencies were fetched"
  925. $t test -d $(APP)/deps/cowboy
  926. $t test -d $(APP)/deps/cowlib
  927. $t test -d $(APP)/deps/ranch
  928. $i "Check that the application was compiled correctly"
  929. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  930. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  931. {ok, Deps} = application:get_key($(APP), applications), \
  932. true = lists:member(cowboy, Deps), \
  933. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  934. halt()"
  935. ifndef LEGACY
  936. core-deps-otp: init
  937. $i "Bootstrap a new OTP library named $(APP)"
  938. $t mkdir $(APP)/
  939. $t cp ../erlang.mk $(APP)/
  940. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  941. $i "Add Crypto to the list of OTP dependencies"
  942. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = crypto\n"}' $(APP)/Makefile
  943. $i "Build the application"
  944. $t $(MAKE) -C $(APP) $v
  945. $i "Check that no dependencies were fetched"
  946. $t test ! -e $(APP)/deps
  947. $i "Check that the application was compiled correctly"
  948. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  949. [ok = application:load(App) || App <- [$(APP), crypto]], \
  950. {ok, Deps} = application:get_key($(APP), applications), \
  951. true = lists:member(crypto, Deps), \
  952. halt()"
  953. endif
  954. core-deps-pkg: init
  955. $i "Bootstrap a new OTP library named $(APP)"
  956. $t mkdir $(APP)/
  957. $t cp ../erlang.mk $(APP)/
  958. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  959. $i "Add Cowboy to the list of dependencies"
  960. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  961. ifdef LEGACY
  962. $i "Add Cowboy to the applications key in the .app.src file"
  963. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  964. endif
  965. $i "Build the application"
  966. $t $(MAKE) -C $(APP) $v
  967. $i "Check that all dependencies were fetched"
  968. $t test -d $(APP)/deps/cowboy
  969. $t test -d $(APP)/deps/cowlib
  970. $t test -d $(APP)/deps/ranch
  971. $i "Check that the application was compiled correctly"
  972. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  973. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  974. {ok, Deps} = application:get_key($(APP), applications), \
  975. true = lists:member(cowboy, Deps), \
  976. halt()"
  977. core-deps-rel: init
  978. $i "Bootstrap a new release-enabled OTP library named $(APP)"
  979. $t mkdir $(APP)/
  980. $t cp ../erlang.mk $(APP)/
  981. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
  982. $i "Add Recon to the list of release dependencies"
  983. $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
  984. $i "Add Recon to the relx.config file"
  985. $t $(ERL) -eval " \
  986. {ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
  987. Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
  988. ok = file:write_file(\"$(APP)/relx.config\", \
  989. lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
  990. halt()"
  991. $i "Build the application and its dependencies"
  992. $t $(MAKE) -C $(APP) deps app $v
  993. $i "Check that no dependencies were fetched"
  994. $t test ! -e $(APP)/deps
  995. $i "Check that the application was compiled correctly"
  996. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  997. [ok = application:load(App) || App <- [$(APP)]], \
  998. {ok, Deps} = application:get_key($(APP), applications), \
  999. false = lists:member(recon, Deps), \
  1000. halt()"
  1001. $i "Build the release"
  1002. $t $(MAKE) -C $(APP) $v
  1003. $i "Check that all dependencies were fetched"
  1004. $t test -d $(APP)/deps/recon
  1005. $i "Check that the application was compiled correctly"
  1006. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1007. [ok = application:load(App) || App <- [$(APP), recon]], \
  1008. {ok, Deps} = application:get_key($(APP), applications), \
  1009. false = lists:member(recon, Deps), \
  1010. halt()"
  1011. # @todo Add check for MSYS2 when releases under Windows become usable.
  1012. # $i "Start the release and check that Recon is loaded"
  1013. ifeq ($(PLATFORM),msys2)
  1014. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
  1015. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
  1016. # $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
  1017. # application loaded_applications | grep recon`"
  1018. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
  1019. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
  1020. else
  1021. $i "Start the release and check that Recon is loaded"
  1022. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
  1023. $t apps="Node is not running!"; \
  1024. while test "$$apps" = "Node is not running!"; do \
  1025. apps=$$($(APP)/_rel/$(APP)_release/bin/$(APP)_release \
  1026. rpcterms \ application loaded_applications); \
  1027. done; \
  1028. echo "$$apps" | grep -q recon
  1029. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
  1030. endif
  1031. core-deps-search: init
  1032. $i "Bootstrap a new OTP library named $(APP)"
  1033. $t mkdir $(APP)/
  1034. $t cp ../erlang.mk $(APP)/
  1035. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1036. $i "Run 'make search' and check that it prints packages"
  1037. $t test -n "`$(MAKE) -C $(APP) search`"
  1038. $i "Run 'make search q=cowboy' and check that it prints packages"
  1039. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
  1040. core-deps-shell: init
  1041. $i "Bootstrap a new OTP library named $(APP)"
  1042. $t mkdir $(APP)/
  1043. $t cp ../erlang.mk $(APP)/
  1044. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1045. $i "Bootstrap a new OTP application named my_dep inside $(APP)"
  1046. $t mkdir $(APP)/my_dep
  1047. $t cp ../erlang.mk $(APP)/my_dep/
  1048. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap $v
  1049. $i "Add my_dep to the list of dependencies"
  1050. # We use FORCE_REBUILD to ensure it gets rebuilt even on Windows.
  1051. $t perl -ni.bak -e "print;if ($$.==1) {print \"SHELL_DEPS = my_dep\ndep_my_dep = ln $(CURDIR)/$(APP)/my_dep/\nFORCE_REBUILD = my_dep\n\"}" $(APP)/Makefile
  1052. $i "Build the application and its dependencies"
  1053. $t $(MAKE) -C $(APP) deps app $v
  1054. $i "Check that no dependencies were fetched"
  1055. $t test ! -e $(APP)/deps
  1056. $i "Check that the application was compiled correctly"
  1057. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1058. [ok = application:load(App) || App <- [$(APP)]], \
  1059. {ok, Deps} = application:get_key($(APP), applications), \
  1060. false = lists:member(my_dep, Deps), \
  1061. halt()"
  1062. $i "Run the shell"
  1063. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
  1064. ok = application:load($(APP)), \
  1065. ok = application:load(my_dep), \
  1066. halt()\"" $v
  1067. $i "Check that all dependencies were fetched"
  1068. $t test -d $(APP)/deps/my_dep
  1069. $i "Check that the application was compiled correctly"
  1070. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1071. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  1072. {ok, Deps} = application:get_key($(APP), applications), \
  1073. false = lists:member(my_dep, Deps), \
  1074. halt()"
  1075. core-deps-skip: init
  1076. $i "Bootstrap a new OTP library named $(APP)"
  1077. $t mkdir $(APP)/
  1078. $t cp ../erlang.mk $(APP)/
  1079. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1080. $i "Add Cowboy to the list of dependencies"
  1081. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  1082. ifdef LEGACY
  1083. $i "Add Cowboy to the applications key in the .app.src file"
  1084. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1085. endif
  1086. $i "Build the application with SKIP_DEPS=1"
  1087. $t $(MAKE) -C $(APP) SKIP_DEPS=1 $v
  1088. $i "Check that no dependencies were fetched"
  1089. $t test ! -e $(APP)/deps
  1090. $i "Build the application"
  1091. $t $(MAKE) -C $(APP) $v
  1092. $i "Check that all dependencies were fetched"
  1093. $t test -d $(APP)/deps/cowlib
  1094. $t test -d $(APP)/deps/cowboy
  1095. $t test -d $(APP)/deps/ranch
  1096. $i "Distclean with SKIP_DEPS=1"
  1097. $t $(MAKE) -C $(APP) distclean SKIP_DEPS=1 $v
  1098. $i "Check that no dependencies were removed"
  1099. $t test -d $(APP)/deps/cowlib
  1100. $t test -d $(APP)/deps/cowboy
  1101. $t test -d $(APP)/deps/ranch
  1102. core-deps-test: init
  1103. $i "Bootstrap a new OTP library named $(APP)"
  1104. $t mkdir $(APP)/
  1105. $t cp ../erlang.mk $(APP)/
  1106. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1107. $i "Generate .erl files"
  1108. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1109. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1110. $i "Add triq to the list of test dependencies"
  1111. $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = triq\n"}' $(APP)/Makefile
  1112. $i "Build the application and its dependencies"
  1113. $t $(MAKE) -C $(APP) deps app $v
  1114. $i "Check that no dependencies were fetched"
  1115. $t test ! -e $(APP)/deps
  1116. $i "Check that the application was compiled correctly"
  1117. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1118. [ok = application:load(App) || App <- [$(APP)]], \
  1119. {ok, Deps} = application:get_key($(APP), applications), \
  1120. false = lists:member(triq, Deps), \
  1121. halt()"
  1122. $i "Run tests"
  1123. $t $(MAKE) -C $(APP) tests $v
  1124. $i "Check that all dependencies were fetched"
  1125. $t test -d $(APP)/deps/triq
  1126. $i "Check that the application was compiled correctly"
  1127. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1128. [ok = application:load(App) || App <- [$(APP), triq]], \
  1129. {ok, Deps} = application:get_key($(APP), applications), \
  1130. false = lists:member(triq, Deps), \
  1131. halt()"