core_deps.mk 53 KB

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