core_deps.mk 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593
  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. ifndef LEGACY
  966. core-deps-optional: init
  967. $i "Bootstrap a new OTP application named $(APP)"
  968. $t mkdir $(APP)/
  969. $t cp ../erlang.mk $(APP)/
  970. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  971. $i "Add quicer to the list of optional dependencies"
  972. $t perl -ni.bak -e 'print;if ($$.==1) {print "OPTIONAL_DEPS = quicer\n"}' $(APP)/Makefile
  973. $i "Build the application"
  974. $t $(MAKE) -C $(APP) $v
  975. $i "Check that no dependencies were fetched"
  976. $t test ! -e $(APP)/deps
  977. $i "Check that the application was compiled correctly"
  978. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  979. ok = application:start($(APP)), \
  980. {ok, Deps} = application:get_key($(APP), applications), \
  981. true = lists:member(quicer, Deps), \
  982. {ok, [quicer]} = application:get_key($(APP), optional_applications), \
  983. halt()"
  984. endif
  985. # A lower-level dependency of the first dependency always
  986. # wins over a lower-level dependency of the second dependency.
  987. core-deps-order-first: init
  988. $i "Bootstrap a new OTP library named $(APP)"
  989. $t mkdir $(APP)/
  990. $t cp ../erlang.mk $(APP)/
  991. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  992. $i "Add Cowboy package and my_dep to the list of dependencies"
  993. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep cowboy\ndep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\n"}' $(APP)/Makefile
  994. $i "Bootstrap a new OTP library named my_dep inside $(APP)"
  995. $t mkdir $(APP)/my_dep
  996. $t cp ../erlang.mk $(APP)/my_dep/
  997. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
  998. $i "Add Cowlib 1.0.0 to the list of dependencies for my_dep"
  999. $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
  1000. ifdef LEGACY
  1001. $i "Add Cowboy and my_dep to the applications key in the .app.src file"
  1002. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
  1003. endif
  1004. $i "Build the application"
  1005. $t $(MAKE) -C $(APP) $v
  1006. $i "Check that all dependencies were fetched"
  1007. $t test -d $(APP)/deps/cowboy
  1008. $t test -d $(APP)/deps/cowlib
  1009. $t test -d $(APP)/deps/my_dep
  1010. $t test -d $(APP)/deps/ranch
  1011. $i "Check that the application was compiled correctly"
  1012. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1013. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, my_dep, ranch]], \
  1014. {ok, Deps} = application:get_key($(APP), applications), \
  1015. true = lists:member(cowboy, Deps), \
  1016. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  1017. halt()"
  1018. # A higher-level dependency always wins.
  1019. core-deps-order-top: init
  1020. $i "Bootstrap a new OTP library named $(APP)"
  1021. $t mkdir $(APP)/
  1022. $t cp ../erlang.mk $(APP)/
  1023. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1024. $i "Add Cowboy package and Cowlib 1.0.0 to the list of dependencies"
  1025. $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
  1026. ifdef LEGACY
  1027. $i "Add Cowboy to the applications key in the .app.src file"
  1028. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1029. endif
  1030. $i "Build the application"
  1031. $t $(MAKE) -C $(APP) $v
  1032. $i "Check that all dependencies were fetched"
  1033. $t test -d $(APP)/deps/cowboy
  1034. $t test -d $(APP)/deps/cowlib
  1035. $t test -d $(APP)/deps/ranch
  1036. $i "Check that the application was compiled correctly"
  1037. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1038. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  1039. {ok, Deps} = application:get_key($(APP), applications), \
  1040. true = lists:member(cowboy, Deps), \
  1041. {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
  1042. halt()"
  1043. ifndef LEGACY
  1044. core-deps-otp: init
  1045. $i "Bootstrap a new OTP library named $(APP)"
  1046. $t mkdir $(APP)/
  1047. $t cp ../erlang.mk $(APP)/
  1048. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1049. $i "Add Crypto to the list of OTP dependencies"
  1050. $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = crypto\n"}' $(APP)/Makefile
  1051. $i "Build the application"
  1052. $t $(MAKE) -C $(APP) $v
  1053. $i "Check that no dependencies were fetched"
  1054. $t test ! -e $(APP)/deps
  1055. $i "Check that the application was compiled correctly"
  1056. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1057. [ok = application:load(App) || App <- [$(APP), crypto]], \
  1058. {ok, Deps} = application:get_key($(APP), applications), \
  1059. true = lists:member(crypto, Deps), \
  1060. halt()"
  1061. endif
  1062. core-deps-pkg: init
  1063. $i "Bootstrap a new OTP library named $(APP)"
  1064. $t mkdir $(APP)/
  1065. $t cp ../erlang.mk $(APP)/
  1066. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1067. $i "Add Cowboy to the list of dependencies"
  1068. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  1069. ifdef LEGACY
  1070. $i "Add Cowboy to the applications key in the .app.src file"
  1071. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1072. endif
  1073. $i "Build the application"
  1074. $t $(MAKE) -C $(APP) $v
  1075. $i "Check that all dependencies were fetched"
  1076. $t test -d $(APP)/deps/cowboy
  1077. $t test -d $(APP)/deps/cowlib
  1078. $t test -d $(APP)/deps/ranch
  1079. $i "Check that the application was compiled correctly"
  1080. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1081. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  1082. {ok, Deps} = application:get_key($(APP), applications), \
  1083. true = lists:member(cowboy, Deps), \
  1084. halt()"
  1085. core-deps-rel: init
  1086. $i "Bootstrap a new release-enabled OTP library named $(APP)"
  1087. $t mkdir $(APP)/
  1088. $t cp ../erlang.mk $(APP)/
  1089. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v
  1090. $i "Add Recon to the list of release dependencies"
  1091. $t perl -ni.bak -e 'print;if ($$.==1) {print "REL_DEPS = recon\n"}' $(APP)/Makefile
  1092. $i "Add Recon to the relx.config file"
  1093. $t $(ERL) -eval " \
  1094. {ok, Conf0} = file:consult(\"$(APP)/relx.config\"), \
  1095. Conf = lists:keyreplace(release, 1, Conf0, {release, {$(APP)_release, \"1\"}, [$(APP), recon]}), \
  1096. ok = file:write_file(\"$(APP)/relx.config\", \
  1097. lists:map(fun(Term) -> io_lib:format(\"~p.~n\", [Term]) end, Conf)), \
  1098. halt()"
  1099. $i "Build the application and its dependencies"
  1100. $t $(MAKE) -C $(APP) deps app $v
  1101. $i "Check that Recon was not fetched"
  1102. $t test ! -e $(APP)/deps/recon
  1103. $i "Check that the application was compiled correctly"
  1104. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1105. [ok = application:load(App) || App <- [$(APP)]], \
  1106. {ok, Deps} = application:get_key($(APP), applications), \
  1107. false = lists:member(recon, Deps), \
  1108. halt()"
  1109. $i "Build the release"
  1110. $t $(MAKE) -C $(APP) $v
  1111. $i "Check that Recon was fetched"
  1112. $t test -d $(APP)/deps/recon
  1113. $i "Check that the application was compiled correctly"
  1114. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1115. [ok = application:load(App) || App <- [$(APP), recon]], \
  1116. {ok, Deps} = application:get_key($(APP), applications), \
  1117. false = lists:member(recon, Deps), \
  1118. halt()"
  1119. # @todo Add check for MSYS2 when releases under Windows become usable.
  1120. # $i "Start the release and check that Recon is loaded"
  1121. ifeq ($(PLATFORM),msys2)
  1122. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd install $v
  1123. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd start $v
  1124. # $t test -n "`$(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd rpc \
  1125. # application loaded_applications | grep recon`"
  1126. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd stop $v
  1127. # $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release.cmd uninstall $v
  1128. else
  1129. $i "Start the release and check that Recon is loaded"
  1130. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release daemon $v
  1131. $t apps="Node is not running!"; \
  1132. while test "$$apps" = "Node is not running!"; do \
  1133. apps=$$($(APP)/_rel/$(APP)_release/bin/$(APP)_release \
  1134. rpc application loaded_applications); \
  1135. done; \
  1136. echo "$$apps" | grep -q recon
  1137. $t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
  1138. endif
  1139. core-deps-search: init
  1140. $i "Bootstrap a new OTP library named $(APP)"
  1141. $t mkdir $(APP)/
  1142. $t cp ../erlang.mk $(APP)/
  1143. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1144. $i "Run 'make search' and check that it prints packages"
  1145. $t test -n "`$(MAKE) -C $(APP) search`"
  1146. $i "Run 'make search q=cowboy' and check that it prints packages"
  1147. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
  1148. core-deps-shell: init
  1149. $i "Bootstrap a new OTP library named $(APP)"
  1150. $t mkdir $(APP)/
  1151. $t cp ../erlang.mk $(APP)/
  1152. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1153. $i "Bootstrap a new OTP application named my_dep inside $(APP)"
  1154. $t mkdir $(APP)/my_dep
  1155. $t cp ../erlang.mk $(APP)/my_dep/
  1156. $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap $v
  1157. $i "Add my_dep to the list of dependencies"
  1158. # We use FORCE_REBUILD to ensure it gets rebuilt even on Windows.
  1159. $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
  1160. $i "Build the application and its dependencies"
  1161. $t $(MAKE) -C $(APP) deps app $v
  1162. $i "Check that no dependencies were fetched"
  1163. $t test ! -e $(APP)/deps
  1164. $i "Check that the application was compiled correctly"
  1165. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1166. [ok = application:load(App) || App <- [$(APP)]], \
  1167. {ok, Deps} = application:get_key($(APP), applications), \
  1168. false = lists:member(my_dep, Deps), \
  1169. halt()"
  1170. $i "Run the shell"
  1171. $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \
  1172. ok = application:load($(APP)), \
  1173. ok = application:load(my_dep), \
  1174. halt()\"" $v
  1175. $i "Check that all dependencies were fetched"
  1176. $t test -d $(APP)/deps/my_dep
  1177. $i "Check that the application was compiled correctly"
  1178. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1179. [ok = application:load(App) || App <- [$(APP), my_dep]], \
  1180. {ok, Deps} = application:get_key($(APP), applications), \
  1181. false = lists:member(my_dep, Deps), \
  1182. halt()"
  1183. core-deps-skip: init
  1184. $i "Bootstrap a new OTP library named $(APP)"
  1185. $t mkdir $(APP)/
  1186. $t cp ../erlang.mk $(APP)/
  1187. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1188. $i "Add Cowboy to the list of dependencies"
  1189. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\n"}' $(APP)/Makefile
  1190. ifdef LEGACY
  1191. $i "Add Cowboy to the applications key in the .app.src file"
  1192. $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tcowboy,\n"}' $(APP)/src/$(APP).app.src
  1193. endif
  1194. $i "Build the application with SKIP_DEPS=1"
  1195. $t $(MAKE) -C $(APP) SKIP_DEPS=1 $v
  1196. $i "Check that no dependencies were fetched"
  1197. $t test ! -e $(APP)/deps
  1198. $i "Build the application"
  1199. $t $(MAKE) -C $(APP) $v
  1200. $i "Check that all dependencies were fetched"
  1201. $t test -d $(APP)/deps/cowlib
  1202. $t test -d $(APP)/deps/cowboy
  1203. $t test -d $(APP)/deps/ranch
  1204. $i "Distclean with SKIP_DEPS=1"
  1205. $t $(MAKE) -C $(APP) distclean SKIP_DEPS=1 $v
  1206. $i "Check that no dependencies were removed"
  1207. $t test -d $(APP)/deps/cowlib
  1208. $t test -d $(APP)/deps/cowboy
  1209. $t test -d $(APP)/deps/ranch
  1210. core-deps-test: init
  1211. $i "Bootstrap a new OTP library named $(APP)"
  1212. $t mkdir $(APP)/
  1213. $t cp ../erlang.mk $(APP)/
  1214. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1215. $i "Generate .erl files"
  1216. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1217. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1218. $i "Add triq to the list of test dependencies"
  1219. $t perl -ni.bak -e 'print;if ($$.==1) {print "TEST_DEPS = triq\n"}' $(APP)/Makefile
  1220. $i "Build the application and its dependencies"
  1221. $t $(MAKE) -C $(APP) deps app $v
  1222. $i "Check that no dependencies were fetched"
  1223. $t test ! -e $(APP)/deps
  1224. $i "Check that the application was compiled correctly"
  1225. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1226. [ok = application:load(App) || App <- [$(APP)]], \
  1227. {ok, Deps} = application:get_key($(APP), applications), \
  1228. false = lists:member(triq, Deps), \
  1229. halt()"
  1230. $i "Run tests"
  1231. $t $(MAKE) -C $(APP) tests $v
  1232. $i "Check that all dependencies were fetched"
  1233. $t test -d $(APP)/deps/triq
  1234. $i "Check that the application was compiled correctly"
  1235. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  1236. [ok = application:load(App) || App <- [$(APP), triq]], \
  1237. {ok, Deps} = application:get_key($(APP), applications), \
  1238. false = lists:member(triq, Deps), \
  1239. halt()"