Changes between Version 1 and Version 2 of ManagingFiles


Ignore:
Timestamp:
May 11, 2015, 11:14:26 AM (10 years ago)
Author:
manualwiki
Comment:

Adding ri:add_app(...) section.

Legend:

Unmodified
Added
Removed
Modified
  • ManagingFiles

    v1 v2  
    194194 
    195195Applications can be dropped from the database in the same way as the normal files. 
     196===  Adding applications using unified build tools ri:add_app(1|2) === 
     197 
     198The main goal of this approach to make the application loading method simpler to the end user. 
     199 
     200The loading of files are simplified to the ri:add_app(1|2) interface that is extensible and can support various build tools. 
     201 
     202Control flow details  
     203{{{#!erlang 
     204ri:add_app(1|2) ==> reflib_ui_router:request/2 ==> reflib_ui:add_app/3 ==>  
     205==> refcore_apploader:add_app/3 ==> refcore_confparser:parser/2 ==> refcore_$(parser):parse/2 
     206               + 
     207    refcore_apploader:add_files                                             $(parser) : [rebar, emakefile, erlang_mk, makefile] 
     208}}} 
     209 
     210The confparser tries to recognize the parser primarily by the name of the file if the passed path is a regular file (rebar, Emakefile, erlang.mk, Makefile). 
     211When the passed path is a directory the following priority takes place in detecting the appropriate parser : rebar, rebar.config, Emakefile, erlang.mk, Makefile. 
     212See the configuration of various parsers below: 
     213 
     214see [#point1 Rebar Parser] 
     215 
     216see [#point2 Emakefile Parser] 
     217 
     218see [#point3 erlang_mk Parser] 
     219 
     220see [#point4 Makefile Parse] 
     221 
     222[=#point1]  
     223==== Rebar Parser ==== 
     224 
     225The application directory layout must follow the Rebar and OTP conventions (src, priv, include, ebin), for further details please refer to https://github.com/rebar/rebar/wiki. 
     226The rebar parser reads recursively the directories and the rebar.config files.  
     227The subdirectories inhert the the rebar.config options from the parent directories the rebar.config options from the actual directory may overrides them. 
     228 
     229 
     230Interface options refcore_rebar_parser:parse/2 
     231* BaseDirectoryOrRebarPath - Application base dir or the path including the rebar.config file 
     232* UserOptions - user properties [{rebar_load_tests, true}] 
     233 
     234The parser extracts the following options from rebar.config file: 
     235   * lib_dirs - additional library directories to add to the code path 
     236   * erl_first_files - rrlang files to compile before the rest 
     237   * erl_opts - erlang compiler options 
     238   * sub_dirs - subdirectories 
     239   * deps_dir - location of dependencies. 
     240   * deps - dependencies  
     241When the user property rebar_load_tests is set to true the tests related options are also loaded: 
     242   * ct_dir - test SUITEs location 
     243   * ct_extra_params - option to pass extra parameters when launching Common Test (-dir, -include, -spec )  
     244   * eunit_first_files - same as erl_first_files, but used only when running 'eunit' 
     245   * eunit_compile_opts - additional compile options for eunit. erl_opts is also used (-dir, -include, -spec ),  
     246   * qc_first_files - same as erl_first_files, but used only when running 'qc' 
     247   * qc_compile_opts - additional compile options for qc. erl_opts is also used (-dir, -include, -spec )  
     248 
     249Further details and a more complete example of the rebar.config file is available at: https://github.com/rebar/rebar/blob/master/rebar.config.sample 
     250[=#point2 ]  
     251==== Emakefile Parser ==== 
     252The Emakefile Parser consults the given Emakefile and extracts the files and other information (appbase,def). 
     253 
     254Example Emakefile: 
     255{{{#!erlang 
     256{'src/hello', 
     257 
     258   [debug_info, 
     259     {i,"include"}, 
     260     {outdir, "ebin"} 
     261   ] 
     262 
     263}. 
     264 
     265{'src/*', 
     266   [debug_info] 
     267}. 
     268}}} 
     269 
     270Further reading: http://www.erlang.org/doc/man/make.html. 
     271 
     272refcore_emakefile_parser:parse/2 
     273* DirectoryOrEmakefilePath - Path to the Emakefile or to the application directory 
     274* _  - second argument is ignored during the Emakefile parsing. 
     275[=#point3 ]  
     276==== erlang_mk Parser ==== 
     277 
     278Further reading: https://github.com/ninenines/erlang.mk 
     279[=#point4 ]  
     280==== Makefile Parser ==== 
     281Further reading: http://www.gnu.org/software/make/manual/make.html 
    196282 
    197283== Refreshing your database ==