mirror of
https://github.com/correl/rebar.git
synced 2024-11-27 19:19:53 +00:00
Add support for first_files to port compiler
This patch adds support for first_files to the port_compiler, via the new `port_first_files` rebar config element.
This commit is contained in:
parent
d228e94137
commit
0e3e94c253
1 changed files with 22 additions and 3 deletions
|
@ -88,19 +88,38 @@
|
|||
%%
|
||||
|
||||
compile(Config, AppFile) ->
|
||||
%% Allow the user to specify that dependent files get built first
|
||||
FirstFiles = expand_sources(rebar_config:get(Config,
|
||||
port_first_files, []), []),
|
||||
|
||||
%% Compose list of sources from config file -- defaults to c_src/*.c
|
||||
Sources = expand_sources(rebar_config:get_list(Config, port_sources,
|
||||
["c_src/*.c"]), []),
|
||||
Env = setup_env(Config),
|
||||
|
||||
{FirstNewBins, FirstExistingBins} = case FirstFiles of
|
||||
[] ->
|
||||
{[], []};
|
||||
_ ->
|
||||
compile_each(FirstFiles, Config,
|
||||
Env, [], [])
|
||||
end,
|
||||
case Sources of
|
||||
[] ->
|
||||
ok;
|
||||
_ ->
|
||||
Env = setup_env(Config),
|
||||
|
||||
%% Remove first files from found files
|
||||
RestFiles = [Source || Source <- Sources,
|
||||
not lists:member(Source, FirstFiles)],
|
||||
|
||||
%% Compile each of the sources
|
||||
{NewBins, ExistingBins} = compile_each(Sources, Config, Env,
|
||||
{NewBins, ExistingBins} = compile_each(RestFiles, Config, Env,
|
||||
[], []),
|
||||
|
||||
NewBins = FirstNewBins ++ NewBins,
|
||||
ExistingBins = FirstExistingBins ++ ExistingBins,
|
||||
|
||||
%% Construct the driver name and make sure priv/ exists
|
||||
SoSpecs = so_specs(Config, AppFile, NewBins ++ ExistingBins),
|
||||
?INFO("Using specs ~p\n", [SoSpecs]),
|
||||
|
|
Loading…
Reference in a new issue