|
@@ -32,6 +32,7 @@ Type
|
|
{ TFppkgOptionSection }
|
|
{ TFppkgOptionSection }
|
|
|
|
|
|
TCompilerOptions = class;
|
|
TCompilerOptions = class;
|
|
|
|
+ TFppkgOptions = class;
|
|
TFppkgOptionSection = class(TPersistent)
|
|
TFppkgOptionSection = class(TPersistent)
|
|
private
|
|
private
|
|
FOptionParser: TTemplateParser;
|
|
FOptionParser: TTemplateParser;
|
|
@@ -137,6 +138,25 @@ Type
|
|
property Prefix: string read GetPrefix write SetPrefix;
|
|
property Prefix: string read GetPrefix write SetPrefix;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ { TFppkgIncludeFilesOptionSection }
|
|
|
|
+
|
|
|
|
+ TFppkgIncludeFilesOptionSection = class(TFppkgOptionSection)
|
|
|
|
+ private
|
|
|
|
+ FOptions: TFppkgOptions;
|
|
|
|
+ // Only used for logging
|
|
|
|
+ FOptionCache: TStringList;
|
|
|
|
+ FCurrentDir: String;
|
|
|
|
+
|
|
|
|
+ procedure IncludeFile(AFileName: string);
|
|
|
|
+ procedure IncludeFileMask(AFileNameMask: string);
|
|
|
|
+ public
|
|
|
|
+ constructor Create(AnOptionParser: TTemplateParser; AnOptions: TFppkgOptions; ACurrentDir: string);
|
|
|
|
+ destructor Destroy; override;
|
|
|
|
+ procedure AddKeyValue(const AKey, AValue: string); override;
|
|
|
|
+ procedure LogValues(ALogLevel: TLogLevel); override;
|
|
|
|
+ function AllowDuplicate: Boolean; override;
|
|
|
|
+ end;
|
|
|
|
+
|
|
{ TFppkgCommandLineOptionSection }
|
|
{ TFppkgCommandLineOptionSection }
|
|
|
|
|
|
TFppkgCommandLineOptionSection = class(TFppkgOptionSection)
|
|
TFppkgCommandLineOptionSection = class(TFppkgOptionSection)
|
|
@@ -260,6 +280,7 @@ Const
|
|
KeyGlobalSection = 'Global';
|
|
KeyGlobalSection = 'Global';
|
|
KeyRepositorySection = 'Repository';
|
|
KeyRepositorySection = 'Repository';
|
|
KeySrcRepositorySection = 'UninstalledSourceRepository';
|
|
KeySrcRepositorySection = 'UninstalledSourceRepository';
|
|
|
|
+ KeyIncludeFilesSection = 'IncludeFiles';
|
|
KeyRemoteMirrorsURL = 'RemoteMirrors';
|
|
KeyRemoteMirrorsURL = 'RemoteMirrors';
|
|
KeyRemoteRepository = 'RemoteRepository';
|
|
KeyRemoteRepository = 'RemoteRepository';
|
|
KeyLocalRepository = 'LocalRepository';
|
|
KeyLocalRepository = 'LocalRepository';
|
|
@@ -277,6 +298,9 @@ Const
|
|
KeyRepositoryPath = 'Path';
|
|
KeyRepositoryPath = 'Path';
|
|
KeyRepositoryPrefix = 'Prefix';
|
|
KeyRepositoryPrefix = 'Prefix';
|
|
|
|
|
|
|
|
+ KeyIncludeFile = 'File';
|
|
|
|
+ KeyIncludeFileMask = 'FileMask';
|
|
|
|
+
|
|
// Compiler dependent config
|
|
// Compiler dependent config
|
|
KeyGlobalPrefix = 'GlobalPrefix';
|
|
KeyGlobalPrefix = 'GlobalPrefix';
|
|
KeyLocalPrefix = 'LocalPrefix';
|
|
KeyLocalPrefix = 'LocalPrefix';
|
|
@@ -287,6 +311,91 @@ Const
|
|
KeyCompilerCPU = 'CPU';
|
|
KeyCompilerCPU = 'CPU';
|
|
KeyCompilerVersion = 'Version';
|
|
KeyCompilerVersion = 'Version';
|
|
|
|
|
|
|
|
+{ TFppkgIncludeFilesOptionSection }
|
|
|
|
+
|
|
|
|
+procedure TFppkgIncludeFilesOptionSection.IncludeFile(AFileName: string);
|
|
|
|
+begin
|
|
|
|
+ AFileName := FOptionParser.ParseString(AFileName);
|
|
|
|
+ if FileExists(AFileName) then
|
|
|
|
+ begin
|
|
|
|
+ FOptions.LoadFromFile(AFileName);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ log(llWarning, SLogIncludeFileDoesNotExist, [AFileName]);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TFppkgIncludeFilesOptionSection.IncludeFileMask(AFileNameMask: string);
|
|
|
|
+var
|
|
|
|
+ FileDir: string;
|
|
|
|
+ SR: TSearchRec;
|
|
|
|
+begin
|
|
|
|
+ AFileNameMask := FOptionParser.ParseString(AFileNameMask);
|
|
|
|
+ FileDir := IncludeTrailingPathDelimiter(ExtractFileDir(AFileNameMask));
|
|
|
|
+
|
|
|
|
+ if IsRelativePath(AFileNameMask) then
|
|
|
|
+ FileDir := ConcatPaths([FCurrentDir, FileDir]);
|
|
|
|
+
|
|
|
|
+ if DirectoryExists(FileDir) then
|
|
|
|
+ begin
|
|
|
|
+ if IsRelativePath(AFileNameMask) then
|
|
|
|
+ AFileNameMask := ConcatPaths([FCurrentDir, AFileNameMask]);
|
|
|
|
+
|
|
|
|
+ if FindFirst(AFileNameMask, faAnyFile-faDirectory, SR)=0 then
|
|
|
|
+ begin
|
|
|
|
+ repeat
|
|
|
|
+ IncludeFile(FileDir+SR.Name);
|
|
|
|
+ until FindNext(SR)<>0;
|
|
|
|
+ end;
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ log(llWarning, SLogIncludeFileMaskDoesNotExist, [FileDir, AFileNameMask]);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+constructor TFppkgIncludeFilesOptionSection.Create(AnOptionParser: TTemplateParser;
|
|
|
|
+ AnOptions: TFppkgOptions; ACurrentDir: string);
|
|
|
|
+begin
|
|
|
|
+ inherited Create(AnOptionParser);
|
|
|
|
+ FOptions := AnOptions;
|
|
|
|
+ FCurrentDir := ACurrentDir;
|
|
|
|
+ FOptionCache := TStringList.Create;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+destructor TFppkgIncludeFilesOptionSection.Destroy;
|
|
|
|
+begin
|
|
|
|
+ FOptionCache.Free;
|
|
|
|
+ inherited Destroy;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TFppkgIncludeFilesOptionSection.AddKeyValue(const AKey, AValue: string);
|
|
|
|
+begin
|
|
|
|
+ if SameText(AKey,KeyIncludeFile) then
|
|
|
|
+ begin
|
|
|
|
+ FOptionCache.Append(SLogIncludeFile + '=' + AValue);
|
|
|
|
+ IncludeFile(AValue);
|
|
|
|
+ end
|
|
|
|
+ else if SameText(AKey,KeyIncludeFileMask) then
|
|
|
|
+ begin
|
|
|
|
+ FOptionCache.Append(SLogIncludeFileMask + '=' + AValue);
|
|
|
|
+ IncludeFileMask(AValue);
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TFppkgIncludeFilesOptionSection.LogValues(ALogLevel: TLogLevel);
|
|
|
|
+var
|
|
|
|
+ i: Integer;
|
|
|
|
+begin
|
|
|
|
+ inherited LogValues(ALogLevel);
|
|
|
|
+ for i := 0 to FOptionCache.Count -1 do
|
|
|
|
+ begin
|
|
|
|
+ log(ALogLevel, FOptionCache.Names[i], [FOptionCache.ValueFromIndex[i], FOptionParser.ParseString(FOptionCache.ValueFromIndex[i])]);
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function TFppkgIncludeFilesOptionSection.AllowDuplicate: Boolean;
|
|
|
|
+begin
|
|
|
|
+ Result := inherited AllowDuplicate;
|
|
|
|
+end;
|
|
|
|
+
|
|
{ TFppkgRepositoryOptionSection }
|
|
{ TFppkgRepositoryOptionSection }
|
|
|
|
|
|
procedure TFppkgRepositoryOptionSection.SetDescription(AValue: string);
|
|
procedure TFppkgRepositoryOptionSection.SetDescription(AValue: string);
|
|
@@ -697,6 +806,8 @@ begin
|
|
CurrentSection := TFppkgRepositoryOptionSection.Create(FOptionParser)
|
|
CurrentSection := TFppkgRepositoryOptionSection.Create(FOptionParser)
|
|
else if SameText(s, KeySrcRepositorySection) then
|
|
else if SameText(s, KeySrcRepositorySection) then
|
|
CurrentSection := TFppkgUninstalledSourceRepositoryOptionSection.Create(FOptionParser)
|
|
CurrentSection := TFppkgUninstalledSourceRepositoryOptionSection.Create(FOptionParser)
|
|
|
|
+ else if SameText(s, KeyIncludeFilesSection) then
|
|
|
|
+ CurrentSection := TFppkgIncludeFilesOptionSection.Create(FOptionParser, Self, ExtractFileDir(AFileName))
|
|
else
|
|
else
|
|
CurrentSection := TFppkgCustomOptionSection.Create(FOptionParser);
|
|
CurrentSection := TFppkgCustomOptionSection.Create(FOptionParser);
|
|
FSectionList.Add(CurrentSection);
|
|
FSectionList.Add(CurrentSection);
|