core_deps.mk 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  1. # Core: Packages and dependencies.
  2. CORE_DEPS_CASES = build-c-8cc build-c-imagejs build-erl build-js dep-commit dir doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-hex fetch-hg fetch-legacy fetch-svn ignore order-first order-top otp pkg rel search shell test
  3. CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES))
  4. CORE_DEPS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_DEPS_TARGETS))
  5. .PHONY: core-deps $(CORE_DEPS_TARGETS) clean-core-deps $(CORE_DEPS_CLEAN_TARGETS)
  6. clean-core-deps: $(CORE_DEPS_CLEAN_TARGETS)
  7. $(CORE_DEPS_CLEAN_TARGETS):
  8. $t rm -rf $(APP_TO_CLEAN)/
  9. core-deps: $(CORE_DEPS_TARGETS)
  10. ifneq ($(PLATFORM),msys2)
  11. core-deps-build-c-8cc: build clean-core-deps-build-c-8cc
  12. $i "Bootstrap a new OTP library named $(APP)"
  13. $t mkdir $(APP)/
  14. $t cp ../erlang.mk $(APP)/
  15. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  16. $i "Add 8cc to the list of build dependencies"
  17. $t sed -i.bak '2i\
  18. BUILD_DEPS = 8cc\
  19. dep_8cc = git https://github.com/rui314/8cc master\
  20. ' $(APP)/Makefile
  21. $i "Build the application"
  22. $t $(MAKE) -C $(APP) $v
  23. $i "Check that all dependencies were fetched"
  24. $t test -d $(APP)/deps/8cc
  25. $i "Check that 8cc can be started"
  26. $t $(APP)/deps/8cc/8cc -h $v
  27. $i "Check that the application was compiled correctly"
  28. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  29. [ok = application:load(App) || App <- [$(APP)]], \
  30. {ok, Deps} = application:get_key($(APP), applications), \
  31. false = lists:member('8cc', Deps), \
  32. halt()"
  33. endif
  34. core-deps-build-c-imagejs: build clean-core-deps-build-c-imagejs
  35. $i "Bootstrap a new OTP library named $(APP)"
  36. $t mkdir $(APP)/
  37. $t cp ../erlang.mk $(APP)/
  38. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  39. $i "Add imagejs to the list of build dependencies"
  40. $t sed -i.bak '2i\
  41. BUILD_DEPS = imagejs\
  42. dep_imagejs = git https://github.com/jklmnn/imagejs master\
  43. ' $(APP)/Makefile
  44. $i "Build the application"
  45. $t $(MAKE) -C $(APP) $v
  46. $i "Check that all dependencies were fetched"
  47. $t test -d $(APP)/deps/imagejs
  48. $i "Check that imagejs works"
  49. $t $(APP)/deps/imagejs/imagejs bmp $(APP)/deps/imagejs/Makefile
  50. $t test -f $(APP)/deps/imagejs/Makefile.bmp
  51. $i "Check that the application was compiled correctly"
  52. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  53. [ok = application:load(App) || App <- [$(APP)]], \
  54. {ok, Deps} = application:get_key($(APP), applications), \
  55. false = lists:member(imagejs, Deps), \
  56. halt()"
  57. core-deps-build-erl: build clean-core-deps-build-erl
  58. $i "Bootstrap a new OTP library named $(APP)"
  59. $t mkdir $(APP)/
  60. $t cp ../erlang.mk $(APP)/
  61. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  62. $i "Add cowlib to the list of build dependencies"
  63. $t sed -i.bak '2i\
  64. BUILD_DEPS = cowlib\
  65. ' $(APP)/Makefile
  66. $i "Build the application"
  67. $t $(MAKE) -C $(APP) $v
  68. $i "Check that all dependencies were fetched"
  69. $t test -d $(APP)/deps/cowlib
  70. $i "Check that the application was compiled correctly"
  71. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  72. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  73. {ok, Deps} = application:get_key($(APP), applications), \
  74. false = lists:member(cowlib, Deps), \
  75. halt()"
  76. core-deps-build-js: build clean-core-deps-build-js
  77. $i "Bootstrap a new OTP library named $(APP)"
  78. $t mkdir $(APP)/
  79. $t cp ../erlang.mk $(APP)/
  80. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  81. $i "Add jquery to the list of build dependencies"
  82. $t sed -i.bak '2i\
  83. BUILD_DEPS = jquery\
  84. dep_jquery = git https://github.com/jquery/jquery master\
  85. ' $(APP)/Makefile
  86. $i "Build the application"
  87. $t $(MAKE) -C $(APP) $v
  88. $i "Check that all dependencies were fetched"
  89. $t test -d $(APP)/deps/jquery
  90. $i "Check that the application was compiled correctly"
  91. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  92. [ok = application:load(App) || App <- [$(APP)]], \
  93. {ok, Deps} = application:get_key($(APP), applications), \
  94. false = lists:member(jquery, Deps), \
  95. halt()"
  96. core-deps-dep-commit: build clean-core-deps-dep-commit
  97. $i "Bootstrap a new OTP library named $(APP)"
  98. $t mkdir $(APP)/
  99. $t cp ../erlang.mk $(APP)/
  100. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  101. $i "Add Cowboy 1.0.0 to the list of dependencies"
  102. $t sed -i.bak '2i\
  103. DEPS = cowboy\
  104. dep_cowboy_commit = 1.0.0\
  105. ' $(APP)/Makefile
  106. ifdef LEGACY
  107. $i "Add Cowboy to the applications key in the .app.src file"
  108. $t sed -i.bak '8i\
  109. cowboy,' $(APP)/src/$(APP).app.src
  110. endif
  111. $i "Build the application"
  112. $t $(MAKE) -C $(APP) $v
  113. $i "Check that all dependencies were fetched"
  114. $t test -d $(APP)/deps/cowboy
  115. $t test -d $(APP)/deps/cowlib
  116. $t test -d $(APP)/deps/ranch
  117. $i "Check that the application was compiled correctly"
  118. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  119. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  120. {ok, Deps} = application:get_key($(APP), applications), \
  121. true = lists:member(cowboy, Deps), \
  122. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  123. halt()"
  124. core-deps-dir: build clean-core-deps-dir
  125. $i "Bootstrap a new OTP library named $(APP)"
  126. $t mkdir $(APP)/
  127. $t cp ../erlang.mk $(APP)/
  128. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  129. $i "Add Cowboy to the list of dependencies with a custom DEPS_DIR"
  130. $t sed -i.bak '2i\
  131. DEPS = cowboy\
  132. DEPS_DIR ?= \$$(CURDIR)/libs\
  133. ' $(APP)/Makefile
  134. ifdef LEGACY
  135. $i "Add Cowboy to the applications key in the .app.src file"
  136. $t sed -i.bak '8i\
  137. cowboy,' $(APP)/src/$(APP).app.src
  138. endif
  139. $i "Build the application"
  140. $t $(MAKE) -C $(APP) $v
  141. $i "Check that all dependencies were fetched in the custom DEPS_DIR"
  142. $t test -d $(APP)/libs/cowboy
  143. $t test -d $(APP)/libs/cowlib
  144. $t test -d $(APP)/libs/ranch
  145. $i "Check that the application was compiled correctly"
  146. $t $(ERL) -pa $(APP)/ebin/ $(APP)/libs/*/ebin/ -eval " \
  147. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  148. {ok, Deps} = application:get_key($(APP), applications), \
  149. true = lists:member(cowboy, Deps), \
  150. halt()"
  151. core-deps-doc: build clean-core-deps-doc
  152. $i "Bootstrap a new OTP library named $(APP)"
  153. $t mkdir $(APP)/
  154. $t cp ../erlang.mk $(APP)/
  155. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  156. $i "Generate .erl files"
  157. $t echo "-module(boy)." > $(APP)/src/boy.erl
  158. $t echo "-module(girl)." > $(APP)/src/girl.erl
  159. $i "Add Edown as a documentation building dependency"
  160. $t sed -i.bak '2i\
  161. DOC_DEPS = edown\
  162. EDOC_OPTS = {doclet, edown_doclet}\
  163. ' $(APP)/Makefile
  164. $i "Build the application"
  165. $t $(MAKE) -C $(APP) $v
  166. $i "Check that no dependencies were fetched"
  167. $t test ! -e $(APP)/deps
  168. $i "Check that the application was compiled correctly"
  169. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  170. [ok = application:load(App) || App <- [$(APP)]], \
  171. {ok, Deps} = application:get_key($(APP), applications), \
  172. false = lists:member(edown, Deps), \
  173. halt()"
  174. $i "Build the application documentation"
  175. $t $(MAKE) -C $(APP) docs $v
  176. $i "Check that documentation dependencies were fetched"
  177. $t test -d $(APP)/deps/edown
  178. $i "Check the Edown generated Markdown documentation"
  179. $t test -f $(APP)/doc/boy.md
  180. $t test -f $(APP)/doc/girl.md
  181. core-deps-fetch-cp: build clean-core-deps-fetch-cp
  182. $i "Bootstrap a new OTP library named $(APP)"
  183. $t mkdir $(APP)/
  184. $t cp ../erlang.mk $(APP)/
  185. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  186. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  187. $t mkdir $(APP)/my_dep
  188. $t cp ../erlang.mk $(APP)/my_dep/
  189. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  190. $i "Add my_dep to the list of dependencies"
  191. $t sed -i.bak '2i\
  192. DEPS = my_dep\
  193. dep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\
  194. ' $(APP)/Makefile
  195. ifdef LEGACY
  196. $i "Add my_dep to the applications key in the .app.src file"
  197. $t sed -i.bak '8i\
  198. my_dep,' $(APP)/src/$(APP).app.src
  199. endif
  200. $i "Build the application"
  201. $t $(MAKE) -C $(APP) $v
  202. $i "Check that all dependencies were fetched"
  203. $t test -d $(APP)/deps/my_dep
  204. $i "Check that the application was compiled correctly"
  205. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  206. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  207. {ok, Deps} = application:get_key($(APP), applications), \
  208. true = lists:member(my_dep, Deps), \
  209. halt()"
  210. core-deps-fetch-custom: build clean-core-deps-fetch-custom
  211. $i "Bootstrap a new OTP library named $(APP)"
  212. $t mkdir $(APP)/
  213. $t cp ../erlang.mk $(APP)/
  214. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  215. $i "Add dependency boop using custom fetch method beep to the list of dependencies"
  216. $t sed -i.bak '2i\
  217. DEPS = boop\
  218. dep_boop = beep boop\
  219. dep_fetch_beep = mkdir -p \$$(DEPS_DIR)/\$$1/ebin/\
  220. ' $(APP)/Makefile
  221. ifdef LEGACY
  222. $i "Add boop to the applications key in the .app.src file"
  223. $t sed -i.bak '8i\
  224. boop,' $(APP)/src/$(APP).app.src
  225. endif
  226. $i "Build the application"
  227. $t $(MAKE) -C $(APP) $v
  228. $i "Check that all dependencies were fetched"
  229. $t test -d $(APP)/deps/boop
  230. $i "Check that the application was compiled correctly"
  231. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  232. ok = application:load($(APP)), \
  233. {ok, Deps} = application:get_key($(APP), applications), \
  234. true = lists:member(boop, Deps), \
  235. halt()"
  236. core-deps-fetch-fail-bad: build clean-core-deps-fetch-fail-bad
  237. $i "Bootstrap a new OTP library named $(APP)"
  238. $t mkdir $(APP)/
  239. $t cp ../erlang.mk $(APP)/
  240. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  241. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  242. $t sed -i.bak '2i\
  243. DEPS = cowlib\
  244. dep_cowlib = oops https://github.com/ninenines/cowlib 1.0.0\
  245. ' $(APP)/Makefile
  246. $i "Check that building the application fails"
  247. $t if $(MAKE) -C $(APP) $v; then false; fi
  248. core-deps-fetch-fail-unknown: build clean-core-deps-fetch-fail-unknown
  249. $i "Bootstrap a new OTP library named $(APP)"
  250. $t mkdir $(APP)/
  251. $t cp ../erlang.mk $(APP)/
  252. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  253. $i "Add an unknown application as a dependency"
  254. $t sed -i.bak '2i\
  255. DEPS = unknown\
  256. ' $(APP)/Makefile
  257. $i "Check that building the application fails"
  258. $t if $(MAKE) -C $(APP) $v; then false; fi
  259. core-deps-fetch-git: build clean-core-deps-fetch-git
  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 Cowboy 1.0.0 to the list of dependencies"
  265. $t sed -i.bak '2i\
  266. DEPS = cowboy\
  267. dep_cowboy = git https://github.com/ninenines/cowboy 1.0.0\
  268. ' $(APP)/Makefile
  269. ifdef LEGACY
  270. $i "Add Cowboy to the applications key in the .app.src file"
  271. $t sed -i.bak '8i\
  272. cowboy,' $(APP)/src/$(APP).app.src
  273. endif
  274. $i "Build the application"
  275. $t $(MAKE) -C $(APP) $v
  276. $i "Check that all dependencies were fetched"
  277. $t test -d $(APP)/deps/cowboy
  278. $t test -d $(APP)/deps/cowlib
  279. $t test -d $(APP)/deps/ranch
  280. $i "Check that the application was compiled correctly"
  281. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  282. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  283. {ok, Deps} = application:get_key($(APP), applications), \
  284. true = lists:member(cowboy, Deps), \
  285. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  286. halt()"
  287. core-deps-fetch-hex: build clean-core-deps-fetch-hex
  288. $i "Bootstrap a new OTP library named $(APP)"
  289. $t mkdir $(APP)/
  290. $t cp ../erlang.mk $(APP)/
  291. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  292. $i "Add Cowboy 1.0.0 to the list of dependencies"
  293. $t sed -i.bak '2i\
  294. DEPS = cowboy\
  295. dep_cowboy = hex 1.0.0\
  296. ' $(APP)/Makefile
  297. ifdef LEGACY
  298. $i "Add Cowboy to the applications key in the .app.src file"
  299. $t sed -i.bak '8i\
  300. cowboy,' $(APP)/src/$(APP).app.src
  301. endif
  302. $i "Build the application"
  303. $t $(MAKE) -C $(APP) $v
  304. $i "Check that all dependencies were fetched"
  305. $t test -d $(APP)/deps/cowboy
  306. $t test -d $(APP)/deps/cowlib
  307. $t test -d $(APP)/deps/ranch
  308. $i "Check that the application was compiled correctly"
  309. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  310. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  311. {ok, Deps} = application:get_key($(APP), applications), \
  312. true = lists:member(cowboy, Deps), \
  313. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  314. halt()"
  315. core-deps-fetch-hg: build clean-core-deps-fetch-hg
  316. $i "Bootstrap a new OTP library named $(APP)"
  317. $t mkdir $(APP)/
  318. $t cp ../erlang.mk $(APP)/
  319. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  320. $i "Add Ehsa 4.0.3 to the list of dependencies"
  321. $t sed -i.bak '2i\
  322. DEPS = ehsa\
  323. dep_ehsa = hg https://bitbucket.org/a12n/ehsa 4.0.3\
  324. ' $(APP)/Makefile
  325. ifdef LEGACY
  326. $i "Add ehsa to the applications key in the .app.src file"
  327. $t sed -i.bak '8i\
  328. ehsa,' $(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/ehsa
  334. $i "Check that the application was compiled correctly"
  335. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  336. [ok = application:load(App) || App <- [$(APP), ehsa]], \
  337. {ok, Deps} = application:get_key($(APP), applications), \
  338. true = lists:member(ehsa, Deps), \
  339. {ok, \"4.0.3\"} = application:get_key(ehsa, vsn), \
  340. halt()"
  341. # Legacy must fail for the top-level application, but work for dependencies.
  342. core-deps-fetch-legacy: build clean-core-deps-fetch-legacy
  343. $i "Bootstrap a new OTP library named $(APP)"
  344. $t mkdir $(APP)/
  345. $t cp ../erlang.mk $(APP)/
  346. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  347. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  348. $t sed -i.bak '2i\
  349. DEPS = cowlib\
  350. dep_cowlib = https://github.com/ninenines/cowlib 1.0.0\
  351. ' $(APP)/Makefile
  352. $i "Check that building the application fails"
  353. $t if $(MAKE) -C $(APP) $v; then false; fi
  354. $i "Check that building the application works with IS_DEP=1"
  355. $t $(MAKE) -C $(APP) IS_DEP=1 $v
  356. core-deps-fetch-svn: build clean-core-deps-fetch-svn
  357. $i "Bootstrap a new OTP library named $(APP)"
  358. $t mkdir $(APP)/
  359. $t cp ../erlang.mk $(APP)/
  360. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  361. $i "Add Cowlib 1.0.0 to the list of dependencies"
  362. $t sed -i.bak '2i\
  363. DEPS = cowlib\
  364. dep_cowlib = svn https://github.com/ninenines/cowlib/tags/1.0.0\
  365. ' $(APP)/Makefile
  366. ifdef LEGACY
  367. $i "Add Cowlib to the applications key in the .app.src file"
  368. $t sed -i.bak '8i\
  369. cowlib,' $(APP)/src/$(APP).app.src
  370. endif
  371. $i "Build the application"
  372. $t $(MAKE) -C $(APP) $v
  373. $i "Check that all dependencies were fetched"
  374. $t test -d $(APP)/deps/cowlib
  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), cowlib]], \
  378. {ok, Deps} = application:get_key($(APP), applications), \
  379. true = lists:member(cowlib, Deps), \
  380. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  381. halt()"
  382. core-deps-ignore: build clean-core-deps-ignore
  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 "Add Cowboy to dependencies, Ranch to the ignore list and to test dependencies"
  388. $t sed -i.bak '2i\
  389. DEPS = cowboy\
  390. IGNORE_DEPS = ranch\
  391. TEST_DEPS = ranch\
  392. ' $(APP)/Makefile
  393. ifdef LEGACY
  394. $i "Add Cowboy to the applications key in the .app.src file"
  395. $t sed -i.bak '8i\
  396. cowboy,' $(APP)/src/$(APP).app.src
  397. endif
  398. $i "Build the application"
  399. $t $(MAKE) -C $(APP) $v
  400. $i "Check that the correct dependencies were fetched"
  401. $t test -d $(APP)/deps/cowboy
  402. $t test -d $(APP)/deps/cowlib
  403. $t test ! -e $(APP)/deps/ranch
  404. $i "Build the test dependencies"
  405. $t $(MAKE) -C $(APP) test-deps $v
  406. $i "Check that the correct dependencies were fetched"
  407. $t test -d $(APP)/deps/ranch
  408. # A lower-level dependency of the first dependency always
  409. # wins over a lower-level dependency of the second dependency.
  410. core-deps-order-first: build clean-core-deps-order-first
  411. $i "Bootstrap a new OTP library named $(APP)"
  412. $t mkdir $(APP)/
  413. $t cp ../erlang.mk $(APP)/
  414. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  415. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  416. $t mkdir $(APP)/my_dep
  417. $t cp ../erlang.mk $(APP)/my_dep/
  418. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  419. $i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
  420. $t sed -i.bak '2i\
  421. DEPS = cowlib\
  422. dep_cowlib = git https://github.com/ninenines/cowlib 1.0.0\
  423. ' $(APP)/my_dep/Makefile
  424. $i "Add Cowboy package and my_dep to the list of dependencies"
  425. $t sed -i.bak '2i\
  426. DEPS = my_dep cowboy\
  427. dep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\
  428. ' $(APP)/Makefile
  429. ifdef LEGACY
  430. $i "Add Cowboy and my_dep to the applications key in the .app.src file"
  431. $t sed -i.bak '8i\
  432. cowboy,\
  433. my_dep,' $(APP)/src/$(APP).app.src
  434. endif
  435. $i "Build the application"
  436. $t $(MAKE) -C $(APP) $v
  437. $i "Check that all dependencies were fetched"
  438. $t test -d $(APP)/deps/cowboy
  439. $t test -d $(APP)/deps/cowlib
  440. $t test -d $(APP)/deps/my_dep
  441. $t test -d $(APP)/deps/ranch
  442. $i "Check that the application was compiled correctly"
  443. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  444. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, my_dep, ranch]], \
  445. {ok, Deps} = application:get_key($(APP), applications), \
  446. true = lists:member(cowboy, Deps), \
  447. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  448. halt()"
  449. # A higher-level dependency always wins.
  450. core-deps-order-top: build clean-core-deps-order-top
  451. $i "Bootstrap a new OTP library named $(APP)"
  452. $t mkdir $(APP)/
  453. $t cp ../erlang.mk $(APP)/
  454. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  455. $i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
  456. $t sed -i.bak '2i\
  457. DEPS = cowboy cowlib\
  458. dep_cowlib = git https://github.com/ninenines/cowlib 1.0.0\
  459. ' $(APP)/Makefile
  460. ifdef LEGACY
  461. $i "Add Cowboy to the applications key in the .app.src file"
  462. $t sed -i.bak '8i\
  463. cowboy,' $(APP)/src/$(APP).app.src
  464. endif
  465. $i "Build the application"
  466. $t $(MAKE) -C $(APP) $v
  467. $i "Check that all dependencies were fetched"
  468. $t test -d $(APP)/deps/cowboy
  469. $t test -d $(APP)/deps/cowlib
  470. $t test -d $(APP)/deps/ranch
  471. $i "Check that the application was compiled correctly"
  472. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  473. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  474. {ok, Deps} = application:get_key($(APP), applications), \
  475. true = lists:member(cowboy, Deps), \
  476. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  477. halt()"
  478. ifndef LEGACY
  479. core-deps-otp: build clean-core-deps-otp
  480. $i "Bootstrap a new OTP library named $(APP)"
  481. $t mkdir $(APP)/
  482. $t cp ../erlang.mk $(APP)/
  483. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  484. $i "Add Crypto to the list of OTP dependencies"
  485. $t sed -i.bak '2i\
  486. OTP_DEPS = crypto\
  487. ' $(APP)/Makefile
  488. $i "Build the application"
  489. $t $(MAKE) -C $(APP) $v
  490. $i "Check that no dependencies were fetched"
  491. $t test ! -e $(APP)/deps
  492. $i "Check that the application was compiled correctly"
  493. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  494. [ok = application:load(App) || App <- [$(APP), crypto]], \
  495. {ok, Deps} = application:get_key($(APP), applications), \
  496. true = lists:member(crypto, Deps), \
  497. halt()"
  498. endif
  499. core-deps-pkg: build clean-core-deps-pkg
  500. $i "Bootstrap a new OTP library named $(APP)"
  501. $t mkdir $(APP)/
  502. $t cp ../erlang.mk $(APP)/
  503. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  504. $i "Add Cowboy to the list of dependencies"
  505. $t sed -i.bak '2i\
  506. DEPS = cowboy\
  507. ' $(APP)/Makefile
  508. ifdef LEGACY
  509. $i "Add Cowboy to the applications key in the .app.src file"
  510. $t sed -i.bak '8i\
  511. cowboy,' $(APP)/src/$(APP).app.src
  512. endif
  513. $i "Build the application"
  514. $t $(MAKE) -C $(APP) $v
  515. $i "Check that all dependencies were fetched"
  516. $t test -d $(APP)/deps/cowboy
  517. $t test -d $(APP)/deps/cowlib
  518. $t test -d $(APP)/deps/ranch
  519. $i "Check that the application was compiled correctly"
  520. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  521. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  522. {ok, Deps} = application:get_key($(APP), applications), \
  523. true = lists:member(cowboy, Deps), \
  524. halt()"
  525. core-deps-rel: build clean-core-deps-rel
  526. $i "Bootstrap a new release-enabled OTP library named $(APP)"
  527. $t mkdir $(APP)/
  528. $t cp ../erlang.mk $(APP)/
  529. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
  530. $i "Add Recon to the list of release dependencies"
  531. $t sed -i.bak '2i\
  532. REL_DEPS = recon\
  533. ' $(APP)/Makefile
  534. $i "Add Recon to the relx.config file"
  535. $t $(ERL) -eval " \
  536. {ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
  537. Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
  538. ok = file:write_file(\"$(APP)/relx.config\", \
  539. lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
  540. halt()"
  541. $i "Build the application and its dependencies"
  542. $t $(MAKE) -C $(APP) deps app $v
  543. $i "Check that no dependencies were fetched"
  544. $t test ! -e $(APP)/deps
  545. $i "Check that the application was compiled correctly"
  546. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  547. [ok = application:load(App) || App <- [$(APP)]], \
  548. {ok, Deps} = application:get_key($(APP), applications), \
  549. false = lists:member(recon, Deps), \
  550. halt()"
  551. $i "Build the release"
  552. $t $(MAKE) -C $(APP) $v
  553. $i "Check that all dependencies were fetched"
  554. $t test -d $(APP)/deps/recon
  555. $i "Check that the application was compiled correctly"
  556. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  557. [ok = application:load(App) || App <- [$(APP), recon]], \
  558. {ok, Deps} = application:get_key($(APP), applications), \
  559. false = lists:member(recon, Deps), \
  560. halt()"
  561. # @todo Add check for MSYS2 when releases under Windows become usable.
  562. # $i "Start the release and check that Recon is loaded"
  563. ifeq ($(PLATFORM),msys2)
  564. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
  565. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
  566. # $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
  567. # application loaded_applications | grep recon`"
  568. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
  569. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
  570. else
  571. $i "Start the release and check that Recon is loaded"
  572. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
  573. $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release rpcterms \
  574. application loaded_applications | grep recon`"
  575. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
  576. endif
  577. core-deps-search: build clean-core-deps-search
  578. $i "Bootstrap a new OTP library named $(APP)"
  579. $t mkdir $(APP)/
  580. $t cp ../erlang.mk $(APP)/
  581. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  582. $i "Run 'make search' and check that it prints packages"
  583. $t test -n "`$(MAKE) -C $(APP) search`"
  584. $i "Run 'make search q=cowboy' and check that it prints packages"
  585. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
  586. core-deps-shell: build clean-core-deps-shell
  587. $i "Bootstrap a new OTP library named $(APP)"
  588. $t mkdir $(APP)/
  589. $t cp ../erlang.mk $(APP)/
  590. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  591. $i "Add TDDReloader to the list of shell dependencies"
  592. $t sed -i.bak '2i\
  593. SHELL_DEPS = tddreloader\
  594. ' $(APP)/Makefile
  595. $i "Build the application and its dependencies"
  596. $t $(MAKE) -C $(APP) deps app $v
  597. $i "Check that no dependencies were fetched"
  598. $t test ! -e $(APP)/deps
  599. $i "Check that the application was compiled correctly"
  600. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  601. [ok = application:load(App) || App <- [$(APP)]], \
  602. {ok, Deps} = application:get_key($(APP), applications), \
  603. false = lists:member(tddreloader, Deps), \
  604. halt()"
  605. $i "Run the shell"
  606. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
  607. ok = application:load($(APP)), \
  608. ok = application:load(tddreloader), \
  609. halt()\"" $v
  610. $i "Check that all dependencies were fetched"
  611. $t test -d $(APP)/deps/tddreloader
  612. $i "Check that the application was compiled correctly"
  613. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  614. [ok = application:load(App) || App <- [$(APP), tddreloader]], \
  615. {ok, Deps} = application:get_key($(APP), applications), \
  616. false = lists:member(tddreloader, Deps), \
  617. halt()"
  618. core-deps-test: build clean-core-deps-test
  619. $i "Bootstrap a new OTP library named $(APP)"
  620. $t mkdir $(APP)/
  621. $t cp ../erlang.mk $(APP)/
  622. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  623. $i "Generate .erl files"
  624. $t echo "-module(boy)." > $(APP)/src/boy.erl
  625. $t echo "-module(girl)." > $(APP)/src/girl.erl
  626. $i "Add triq to the list of test dependencies"
  627. $t sed -i.bak '2i\
  628. TEST_DEPS = triq\
  629. ' $(APP)/Makefile
  630. $i "Build the application and its dependencies"
  631. $t $(MAKE) -C $(APP) deps app $v
  632. $i "Check that no dependencies were fetched"
  633. $t test ! -e $(APP)/deps
  634. $i "Check that the application was compiled correctly"
  635. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  636. [ok = application:load(App) || App <- [$(APP)]], \
  637. {ok, Deps} = application:get_key($(APP), applications), \
  638. false = lists:member(triq, Deps), \
  639. halt()"
  640. $i "Run tests"
  641. $t $(MAKE) -C $(APP) tests $v
  642. $i "Check that all dependencies were fetched"
  643. $t test -d $(APP)/deps/triq
  644. $i "Check that the application was compiled correctly"
  645. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  646. [ok = application:load(App) || App <- [$(APP), triq]], \
  647. {ok, Deps} = application:get_key($(APP), applications), \
  648. false = lists:member(triq, Deps), \
  649. halt()"