CE project, use global match in the exclusions

This commit is contained in:
Basile Burg 2016-03-14 03:50:12 +01:00
parent f0bd30c948
commit 50cdac06b4
1 changed files with 27 additions and 23 deletions

View File

@ -11,8 +11,9 @@ uses
{$IFNDEF CEBUILD} {$IFNDEF CEBUILD}
ce_dialogs, ce_dialogs,
{$ENDIF} {$ENDIF}
Classes, SysUtils, process, strUtils, ce_common, ce_writableComponent, Classes, SysUtils, process, strUtils, RegExpr,
ce_dmdwrap, ce_observer, ce_interfaces, ce_processes, LazFileUtils; ce_common, ce_writableComponent, ce_dmdwrap, ce_observer, ce_interfaces,
ce_processes, LazFileUtils;
type type
@ -390,39 +391,43 @@ end;
procedure TCENativeProject.getOpts(const aList: TStrings); procedure TCENativeProject.getOpts(const aList: TStrings);
var var
rel, abs: string; rel: string;
i: Integer; i: Integer;
ex_files: TStringList; exc: TStringList;
ex_folds: TStringList;
libAliasesPtr: TStringList; libAliasesPtr: TStringList;
str: string; str: string;
begin begin
if fConfIx = -1 then exit; if fConfIx = -1 then exit;
ex_files := TStringList.Create; exc := TStringList.Create;
ex_folds := TStringList.Create;
try try
// prepares the exclusions // prepares the exclusions
for i := 0 to currentConfiguration.pathsOptions.exclusions.Count-1 do for i := 0 to currentConfiguration.pathsOptions.exclusions.Count-1 do
begin begin
str := symbolExpander.get(currentConfiguration.pathsOptions.exclusions[i]); str := symbolExpander.get(currentConfiguration.pathsOptions.exclusions[i]);
rel := expandFilenameEx(fBasePath, currentConfiguration.pathsOptions.exclusions[i]); exc.Add(str)
if str.fileExists then
ex_files.Add(str)
else if str.dirExists then
ex_folds.Add(str);
if rel.fileExists then
ex_files.Add(rel)
else if rel.dirExists then
ex_folds.Add(rel);
end; end;
// sources // sources
for rel in fSrcs do if rel <> '' then for rel in fSrcs do if rel <> '' then
aList.Add(expandFilenameEx(fBasePath, rel)); // note: process.inc ln 249. double quotes are added if there's a space.
// exclusions
if exc.Count > 0 then with TRegExpr.Create do
try
for str in exc do
begin begin
abs := expandFilenameEx(fBasePath, rel); try
if ex_files.IndexOf(abs) = -1 then Expression:= globToReg(str);
if ex_folds.IndexOf(abs.extractFilePath) = -1 Compile;
then aList.Add(abs); // note: process.inc ln 249. double quotes are added if there's a space. for i := aList.Count-1 downto 0 do
if Exec(aList[i]) then
aList.Delete(i);
except
continue;
end; end;
end;
finally
free;
end;
// libraries: an asterisk in list selects all the entries // libraries: an asterisk in list selects all the entries
libAliasesPtr := fLibAliases; libAliasesPtr := fLibAliases;
if (fLibAliases.Count > 0) and (fLibAliases[0] = '*') then if (fLibAliases.Count > 0) and (fLibAliases[0] = '*') then
@ -444,8 +449,7 @@ begin
else else
currentConfiguration.getOpts(aList); currentConfiguration.getOpts(aList);
finally finally
ex_files.Free; exc.Free;
ex_folds.Free;
end; end;
end; end;