core_deps.mk 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. # Core: Packages and dependencies.
  2. CORE_DEPS_CASES = build-c-8cc build-c-imagejs build-erl build-js dep-commit doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-hex fetch-hg fetch-legacy fetch-svn 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/ $(APP)/deps/*/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/ $(APP)/deps/*/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/ $(APP)/deps/*/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-doc: build clean-core-deps-doc
  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 "Generate .erl files"
  130. $t echo "-module(boy)." > $(APP)/src/boy.erl
  131. $t echo "-module(girl)." > $(APP)/src/girl.erl
  132. $i "Add Edown as a documentation building dependency"
  133. $t sed -i.bak '2i\
  134. DOC_DEPS = edown\
  135. EDOC_OPTS = {doclet, edown_doclet}\
  136. ' $(APP)/Makefile
  137. $i "Build the application"
  138. $t $(MAKE) -C $(APP) $v
  139. $i "Check that no dependencies were fetched"
  140. $t test ! -e $(APP)/deps
  141. $i "Check that the application was compiled correctly"
  142. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  143. [ok = application:load(App) || App <- [$(APP)]], \
  144. {ok, Deps} = application:get_key($(APP), applications), \
  145. false = lists:member(edown, Deps), \
  146. halt()"
  147. $i "Build the application documentation"
  148. $t $(MAKE) -C $(APP) docs $v
  149. $i "Check that documentation dependencies were fetched"
  150. $t test -d $(APP)/deps/edown
  151. $i "Check the Edown generated Markdown documentation"
  152. $t test -f $(APP)/doc/boy.md
  153. $t test -f $(APP)/doc/girl.md
  154. core-deps-fetch-cp: build clean-core-deps-fetch-cp
  155. $i "Bootstrap a new OTP library named $(APP)"
  156. $t mkdir $(APP)/
  157. $t cp ../erlang.mk $(APP)/
  158. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  159. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  160. $t mkdir $(APP)/my_dep
  161. $t cp ../erlang.mk $(APP)/my_dep/
  162. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  163. $i "Add my_dep to the list of dependencies"
  164. $t sed -i.bak '2i\
  165. DEPS = my_dep\
  166. dep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\
  167. ' $(APP)/Makefile
  168. ifdef LEGACY
  169. $i "Add my_dep to the applications key in the .app.src file"
  170. $t sed -i.bak '8i\
  171. my_dep,' $(APP)/src/$(APP).app.src
  172. endif
  173. $i "Build the application"
  174. $t $(MAKE) -C $(APP) $v
  175. $i "Check that all dependencies were fetched"
  176. $t test -d $(APP)/deps/my_dep
  177. $i "Check that the application was compiled correctly"
  178. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  179. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  180. {ok, Deps} = application:get_key($(APP), applications), \
  181. true = lists:member(my_dep, Deps), \
  182. halt()"
  183. core-deps-fetch-custom: build clean-core-deps-fetch-custom
  184. $i "Bootstrap a new OTP library named $(APP)"
  185. $t mkdir $(APP)/
  186. $t cp ../erlang.mk $(APP)/
  187. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  188. $i "Add dependency boop using custom fetch method beep to the list of dependencies"
  189. $t sed -i.bak '2i\
  190. DEPS = boop\
  191. dep_boop = beep boop\
  192. dep_fetch_beep = mkdir -p \$$(DEPS_DIR)/\$$1\
  193. ' $(APP)/Makefile
  194. ifdef LEGACY
  195. $i "Add boop to the applications key in the .app.src file"
  196. $t sed -i.bak '8i\
  197. boop,' $(APP)/src/$(APP).app.src
  198. endif
  199. $i "Build the application"
  200. $t $(MAKE) -C $(APP) $v
  201. $i "Check that all dependencies were fetched"
  202. $t test -d $(APP)/deps/boop
  203. $i "Check that the application was compiled correctly"
  204. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  205. ok = application:load($(APP)), \
  206. {ok, Deps} = application:get_key($(APP), applications), \
  207. true = lists:member(boop, Deps), \
  208. halt()"
  209. core-deps-fetch-fail-bad: build clean-core-deps-fetch-fail-bad
  210. $i "Bootstrap a new OTP library named $(APP)"
  211. $t mkdir $(APP)/
  212. $t cp ../erlang.mk $(APP)/
  213. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  214. $i "Add Cowlib as a dependency using a non-existing fetch method named oops"
  215. $t sed -i.bak '2i\
  216. DEPS = cowlib\
  217. dep_cowlib = oops https://github.com/ninenines/cowlib 1.0.0\
  218. ' $(APP)/Makefile
  219. $i "Check that building the application fails"
  220. $t if $(MAKE) -C $(APP) $v; then false; fi
  221. core-deps-fetch-fail-unknown: build clean-core-deps-fetch-fail-unknown
  222. $i "Bootstrap a new OTP library named $(APP)"
  223. $t mkdir $(APP)/
  224. $t cp ../erlang.mk $(APP)/
  225. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  226. $i "Add an unknown application as a dependency"
  227. $t sed -i.bak '2i\
  228. DEPS = unknown\
  229. ' $(APP)/Makefile
  230. $i "Check that building the application fails"
  231. $t if $(MAKE) -C $(APP) $v; then false; fi
  232. core-deps-fetch-git: build clean-core-deps-fetch-git
  233. $i "Bootstrap a new OTP library named $(APP)"
  234. $t mkdir $(APP)/
  235. $t cp ../erlang.mk $(APP)/
  236. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  237. $i "Add Cowboy 1.0.0 to the list of dependencies"
  238. $t sed -i.bak '2i\
  239. DEPS = cowboy\
  240. dep_cowboy = git https://github.com/ninenines/cowboy 1.0.0\
  241. ' $(APP)/Makefile
  242. ifdef LEGACY
  243. $i "Add Cowboy to the applications key in the .app.src file"
  244. $t sed -i.bak '8i\
  245. cowboy,' $(APP)/src/$(APP).app.src
  246. endif
  247. $i "Build the application"
  248. $t $(MAKE) -C $(APP) $v
  249. $i "Check that all dependencies were fetched"
  250. $t test -d $(APP)/deps/cowboy
  251. $t test -d $(APP)/deps/cowlib
  252. $t test -d $(APP)/deps/ranch
  253. $i "Check that the application was compiled correctly"
  254. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  255. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  256. {ok, Deps} = application:get_key($(APP), applications), \
  257. true = lists:member(cowboy, Deps), \
  258. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  259. halt()"
  260. core-deps-fetch-hex: build clean-core-deps-fetch-hex
  261. $i "Bootstrap a new OTP library named $(APP)"
  262. $t mkdir $(APP)/
  263. $t cp ../erlang.mk $(APP)/
  264. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  265. $i "Add Cowboy 1.0.0 to the list of dependencies"
  266. $t sed -i.bak '2i\
  267. DEPS = cowboy\
  268. dep_cowboy = hex 1.0.0\
  269. ' $(APP)/Makefile
  270. ifdef LEGACY
  271. $i "Add Cowboy to the applications key in the .app.src file"
  272. $t sed -i.bak '8i\
  273. cowboy,' $(APP)/src/$(APP).app.src
  274. endif
  275. $i "Build the application"
  276. $t $(MAKE) -C $(APP) $v
  277. $i "Check that all dependencies were fetched"
  278. $t test -d $(APP)/deps/cowboy
  279. $t test -d $(APP)/deps/cowlib
  280. $t test -d $(APP)/deps/ranch
  281. $i "Check that the application was compiled correctly"
  282. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  283. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  284. {ok, Deps} = application:get_key($(APP), applications), \
  285. true = lists:member(cowboy, Deps), \
  286. {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
  287. halt()"
  288. core-deps-fetch-hg: build clean-core-deps-fetch-hg
  289. $i "Bootstrap a new OTP library named $(APP)"
  290. $t mkdir $(APP)/
  291. $t cp ../erlang.mk $(APP)/
  292. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  293. $i "Add Ehsa 4.0.3 to the list of dependencies"
  294. $t sed -i.bak '2i\
  295. DEPS = ehsa\
  296. dep_ehsa = hg https://bitbucket.org/a12n/ehsa 4.0.3\
  297. ' $(APP)/Makefile
  298. ifdef LEGACY
  299. $i "Add ehsa to the applications key in the .app.src file"
  300. $t sed -i.bak '8i\
  301. ehsa,' $(APP)/src/$(APP).app.src
  302. endif
  303. $i "Build the application"
  304. $t $(MAKE) -C $(APP) $v
  305. $i "Check that all dependencies were fetched"
  306. $t test -d $(APP)/deps/ehsa
  307. $i "Check that the application was compiled correctly"
  308. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  309. [ok = application:load(App) || App <- [$(APP), ehsa]], \
  310. {ok, Deps} = application:get_key($(APP), applications), \
  311. true = lists:member(ehsa, Deps), \
  312. {ok, \"4.0.3\"} = application:get_key(ehsa, vsn), \
  313. halt()"
  314. # Legacy must fail for the top-level application, but work for dependencies.
  315. core-deps-fetch-legacy: build clean-core-deps-fetch-legacy
  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 Cowlib as a dependency using a non-existing fetch method named oops"
  321. $t sed -i.bak '2i\
  322. DEPS = cowlib\
  323. dep_cowlib = https://github.com/ninenines/cowlib 1.0.0\
  324. ' $(APP)/Makefile
  325. $i "Check that building the application fails"
  326. $t if $(MAKE) -C $(APP) $v; then false; fi
  327. $i "Check that building the application works with IS_DEP=1"
  328. $t $(MAKE) -C $(APP) IS_DEP=1 $v
  329. core-deps-fetch-svn: build clean-core-deps-fetch-svn
  330. $i "Bootstrap a new OTP library named $(APP)"
  331. $t mkdir $(APP)/
  332. $t cp ../erlang.mk $(APP)/
  333. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  334. $i "Add Cowlib 1.0.0 to the list of dependencies"
  335. $t sed -i.bak '2i\
  336. DEPS = cowlib\
  337. dep_cowlib = svn https://github.com/ninenines/cowlib/tags/1.0.0\
  338. ' $(APP)/Makefile
  339. ifdef LEGACY
  340. $i "Add Cowlib to the applications key in the .app.src file"
  341. $t sed -i.bak '8i\
  342. cowlib,' $(APP)/src/$(APP).app.src
  343. endif
  344. $i "Build the application"
  345. $t $(MAKE) -C $(APP) $v
  346. $i "Check that all dependencies were fetched"
  347. $t test -d $(APP)/deps/cowlib
  348. $i "Check that the application was compiled correctly"
  349. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  350. [ok = application:load(App) || App <- [$(APP), cowlib]], \
  351. {ok, Deps} = application:get_key($(APP), applications), \
  352. true = lists:member(cowlib, Deps), \
  353. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  354. halt()"
  355. ifndef LEGACY
  356. core-deps-otp: build clean-core-deps-otp
  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 Crypto to the list of OTP dependencies"
  362. $t sed -i.bak '2i\
  363. OTP_DEPS = crypto\
  364. ' $(APP)/Makefile
  365. $i "Build the application"
  366. $t $(MAKE) -C $(APP) $v
  367. $i "Check that no dependencies were fetched"
  368. $t test ! -e $(APP)/deps
  369. $i "Check that the application was compiled correctly"
  370. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  371. [ok = application:load(App) || App <- [$(APP), crypto]], \
  372. {ok, Deps} = application:get_key($(APP), applications), \
  373. true = lists:member(crypto, Deps), \
  374. halt()"
  375. endif
  376. core-deps-pkg: build clean-core-deps-pkg
  377. $i "Bootstrap a new OTP library named $(APP)"
  378. $t mkdir $(APP)/
  379. $t cp ../erlang.mk $(APP)/
  380. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  381. $i "Add Cowboy to the list of dependencies"
  382. $t sed -i.bak '2i\
  383. DEPS = cowboy\
  384. ' $(APP)/Makefile
  385. ifdef LEGACY
  386. $i "Add Cowboy to the applications key in the .app.src file"
  387. $t sed -i.bak '8i\
  388. cowboy,' $(APP)/src/$(APP).app.src
  389. endif
  390. $i "Build the application"
  391. $t $(MAKE) -C $(APP) $v
  392. $i "Check that all dependencies were fetched"
  393. $t test -d $(APP)/deps/cowboy
  394. $t test -d $(APP)/deps/cowlib
  395. $t test -d $(APP)/deps/ranch
  396. $i "Check that the application was compiled correctly"
  397. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  398. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  399. {ok, Deps} = application:get_key($(APP), applications), \
  400. true = lists:member(cowboy, Deps), \
  401. halt()"
  402. core-deps-rel: build clean-core-deps-rel
  403. $i "Bootstrap a new release-enabled OTP library named $(APP)"
  404. $t mkdir $(APP)/
  405. $t cp ../erlang.mk $(APP)/
  406. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
  407. $i "Add Recon to the list of release dependencies"
  408. $t sed -i.bak '2i\
  409. REL_DEPS = recon\
  410. ' $(APP)/Makefile
  411. $i "Add Recon to the relx.config file"
  412. $t $(ERL) -eval " \
  413. {ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
  414. Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
  415. ok = file:write_file(\"$(APP)/relx.config\", \
  416. lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
  417. halt()"
  418. $i "Build the application and its dependencies"
  419. $t $(MAKE) -C $(APP) deps app $v
  420. $i "Check that no dependencies were fetched"
  421. $t test ! -e $(APP)/deps
  422. $i "Check that the application was compiled correctly"
  423. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  424. [ok = application:load(App) || App <- [$(APP)]], \
  425. {ok, Deps} = application:get_key($(APP), applications), \
  426. false = lists:member(recon, Deps), \
  427. halt()"
  428. $i "Build the release"
  429. $t $(MAKE) -C $(APP) $v
  430. $i "Check that all dependencies were fetched"
  431. $t test -d $(APP)/deps/recon
  432. $i "Check that the application was compiled correctly"
  433. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  434. [ok = application:load(App) || App <- [$(APP)]], \
  435. {ok, Deps} = application:get_key($(APP), applications), \
  436. false = lists:member(recon, Deps), \
  437. halt()"
  438. # @todo Add check for MSYS2 when releases under Windows become usable.
  439. # $i "Start the release and check that Recon is loaded"
  440. ifeq ($(PLATFORM),msys2)
  441. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
  442. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
  443. # $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpcterms \
  444. # application loaded_applications | grep recon`"
  445. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
  446. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
  447. else
  448. $i "Start the release and check that Recon is loaded"
  449. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release start $v
  450. $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release rpcterms \
  451. application loaded_applications | grep recon`"
  452. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
  453. endif
  454. core-deps-search: build clean-core-deps-search
  455. $i "Bootstrap a new OTP library named $(APP)"
  456. $t mkdir $(APP)/
  457. $t cp ../erlang.mk $(APP)/
  458. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  459. $i "Run 'make search' and check that it prints packages"
  460. $t test -n "`$(MAKE) -C $(APP) search`"
  461. $i "Run 'make search q=cowboy' and check that it prints packages"
  462. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
  463. core-deps-shell: build clean-core-deps-shell
  464. $i "Bootstrap a new OTP library named $(APP)"
  465. $t mkdir $(APP)/
  466. $t cp ../erlang.mk $(APP)/
  467. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  468. $i "Add TDDReloader to the list of shell dependencies"
  469. $t sed -i.bak '2i\
  470. SHELL_DEPS = tddreloader\
  471. ' $(APP)/Makefile
  472. $i "Build the application and its dependencies"
  473. $t $(MAKE) -C $(APP) deps app $v
  474. $i "Check that no dependencies were fetched"
  475. $t test ! -e $(APP)/deps
  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)]], \
  479. {ok, Deps} = application:get_key($(APP), applications), \
  480. false = lists:member(tddreloader, Deps), \
  481. halt()"
  482. $i "Run the shell"
  483. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
  484. ok = application:load($(APP)), \
  485. ok = application:load(tddreloader), \
  486. halt()\"" $v
  487. $i "Check that all dependencies were fetched"
  488. $t test -d $(APP)/deps/tddreloader
  489. $i "Check that the application was compiled correctly"
  490. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  491. [ok = application:load(App) || App <- [$(APP)]], \
  492. {ok, Deps} = application:get_key($(APP), applications), \
  493. false = lists:member(tddreloader, Deps), \
  494. halt()"
  495. core-deps-test: build clean-core-deps-test
  496. $i "Bootstrap a new OTP library named $(APP)"
  497. $t mkdir $(APP)/
  498. $t cp ../erlang.mk $(APP)/
  499. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  500. $i "Generate .erl files"
  501. $t echo "-module(boy)." > $(APP)/src/boy.erl
  502. $t echo "-module(girl)." > $(APP)/src/girl.erl
  503. $i "Add triq to the list of test dependencies"
  504. $t sed -i.bak '2i\
  505. TEST_DEPS = triq\
  506. ' $(APP)/Makefile
  507. $i "Build the application and its dependencies"
  508. $t $(MAKE) -C $(APP) deps app $v
  509. $i "Check that no dependencies were fetched"
  510. $t test ! -e $(APP)/deps
  511. $i "Check that the application was compiled correctly"
  512. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  513. [ok = application:load(App) || App <- [$(APP)]], \
  514. {ok, Deps} = application:get_key($(APP), applications), \
  515. false = lists:member(triq, Deps), \
  516. halt()"
  517. $i "Run tests"
  518. $t $(MAKE) -C $(APP) tests $v
  519. $i "Check that all dependencies were fetched"
  520. $t test -d $(APP)/deps/triq
  521. $i "Check that the application was compiled correctly"
  522. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  523. [ok = application:load(App) || App <- [$(APP)]], \
  524. {ok, Deps} = application:get_key($(APP), applications), \
  525. false = lists:member(triq, Deps), \
  526. halt()"