core_deps.mk 41 KB

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