Docs: build_lcl_docs. Removes use of default footer file name.

* No default footer file is assumed. Allows output formats to be generated without footers when the --footer option is omitted.
* Removes unused unit LazUtilities from uses clause.
* Renames TFPDocRun.CreateOuputDir to TFPDocRun.CreateOutputDir.
* Fixes strings used in exception and logging messages.
This commit is contained in:
dsiders 2022-02-24 03:42:20 +00:00
parent 6f9144a584
commit 5e581ce962
2 changed files with 23 additions and 24 deletions

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<Flags>
<LRSInOutputDirectory Value="False"/>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InIDEConfig"/>
<MainUnit Value="0"/>
<Title Value="build_lcl_docs"/>
</General>
<BuildModes Count="1">
@ -19,13 +19,13 @@
</PublishOptions>
<RunParams>
<local>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T &apos;Lazarus Run Output&apos; -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default">
<local>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T &apos;Lazarus Run Output&apos; -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
</Mode0>
</Modes>

View File

@ -1,7 +1,7 @@
program update_lcl_docs;
{ Runs FPC's fpdoc document generator to generate LCL documentation,
e.g. in CHM format }
{ Runs the FPC fpdoc document generator to generate LCL and LazUtils
documentation in CHM or HTML format }
{$mode objfpc}{$H+}
{$IFDEF MSWINDOWS}
@ -9,7 +9,7 @@ program update_lcl_docs;
{$ENDIF}
uses
Classes, Sysutils, GetOpts, LazFileUtils, FileUtil, UTF8Process, LazUtilities,
Classes, Sysutils, GetOpts, LazFileUtils, FileUtil, UTF8Process,
LazStringUtils, Process;
var
@ -22,7 +22,7 @@ var
DefaultXCTDir: String;
DefaultFPDocParams: string = '';
DefaultOutFormat: string = 'html';
DefaultFooterFilename: string = 'locallclfooter.xml'; // ToDo
DefaultFooterFilename: string = ''; // default is no footer(s)
type
TFPDocRunStep = (
@ -79,7 +79,7 @@ type
procedure InitVars;
procedure AddFilesToList(Dir: String; List: TStrings);
procedure FindSourceFiles;
procedure CreateOuputDir;
procedure CreateOutputDir;
procedure RunFPDoc;
procedure CopyToXCTDir;
procedure Execute;
@ -94,7 +94,7 @@ type
property PackageName: string read FPackageName;
property PasSrcDir: string read FPasSrcDir write SetPasSrcDir;
property Step: TFPDocRunStep read FStep;
property UsedPkgs: TStringList read FUsedPkgs; // e.g. 'rtl','fcl', 'lazutils'
property UsedPkgs: TStringList read FUsedPkgs; // e.g. 'rtl','fcl', 'lcl', 'lazutils'
property XCTDir: string read FXCTDir write SetXCTDir;
property XMLSrcDir: string read FXMLSrcDir write SetXMLSrcDir;
property XCTFile: string read FXCTFile;
@ -205,7 +205,7 @@ begin
if DefaultOutFormat = '' then
begin
writeln('Error: Param outfmt wrong');
writeln('Error: Parameter outfmt is missing');
PrintHelp;
end;
end;
@ -405,7 +405,7 @@ var
XMLFile, Filename: String;
begin
if ord(Step)>=ord(frsFilesGathered) then
raise Exception.Create('TFPDocRun.FindSourceFiles not again');
raise Exception.Create('TFPDocRun.FindSourceFiles already called');
if ord(Step)<ord(frsVarsInitialized) then
InitVars;
@ -446,18 +446,18 @@ begin
FStep:=frsFilesGathered;
end;
procedure TFPDocRun.CreateOuputDir;
procedure TFPDocRun.CreateOutputDir;
var
TargetCSSFile: String;
begin
if ord(Step)>=ord(frsOutDirCreated) then
raise Exception.Create('TFPDocRun.CreateOuputDir not again');
raise Exception.Create('TFPDocRun.CreateOutputDir already called');
if Not DirectoryExistsUTF8(OutDir) then
begin
writeln('Creating directory "',OutDir,'"');
if not CreateDirUTF8(OutDir) then
raise Exception.Create('unable to create directory "'+OutDir+'"');
raise Exception.Create('Unable to create directory "'+OutDir+'"');
end;
if ord(Step)<ord(frsFilesGathered) then
@ -469,7 +469,7 @@ begin
if CompareFilenames(TargetCSSFile,CSSFile)<>0 then
begin
if not CopyFile(CSSFile,TargetCSSFile) then
raise Exception.Create('unable to copy css file: CSSfile="'+CSSFile+'" to "'+TargetCSSFile+'"');
raise Exception.Create('Unable to copy css file: CSSfile="'+CSSFile+'" to "'+TargetCSSFile+'"');
end;
end;
@ -482,9 +482,9 @@ var
CmdLine: String;
begin
if ord(Step)>=ord(frsFPDocExecuted) then
raise Exception.Create('TFPDocRun.Run not again');
raise Exception.Create('TFPDocRun.Run already called');
if ord(Step)<ord(frsOutDirCreated) then
CreateOuputDir;
CreateOutputDir;
if ShowCmd then
begin
@ -537,7 +537,7 @@ var
TargetXCTFile, SrcCHMFile, TargetCHMFile: String;
begin
if ord(Step)>=ord(frsCopiedToXCTDir) then
raise Exception.Create('TFPDocRun.CopyToXCTDir not again');
raise Exception.Create('TFPDocRun.CopyToXCTDir already called');
if ord(Step)<ord(frsFPDocExecuted) then
RunFPDoc;
@ -548,7 +548,7 @@ begin
if ShowCmd then
writeln('cp ',XCTFile,' ',TargetXCTFile)
else if not CopyFile(XCTFile,TargetXCTFile) then
raise Exception.Create('unable to copy xct file: "'+XCTFile+'" to "'+TargetXCTFile+'"');
raise Exception.Create('Unable to copy xct file: "'+XCTFile+'" to "'+TargetXCTFile+'"');
writeln('Created ',TargetXCTFile);
if OutFormat='chm' then
begin
@ -557,7 +557,7 @@ begin
if ShowCmd then
writeln('cp ',SrcCHMFile,' ',TargetCHMFile)
else if not CopyFile(SrcCHMFile,TargetCHMFile) then
raise Exception.Create('unable to copy chm file: "'+SrcCHMFile+'" to "'+TargetCHMFile+'"');
raise Exception.Create('Unable to copy chm file: "'+SrcCHMFile+'" to "'+TargetCHMFile+'"');
writeln('Created ',TargetCHMFile);
end;
end;
@ -569,7 +569,7 @@ procedure TFPDocRun.Execute;
begin
writeln('===================================================================');
if ord(Step)>=ord(frsComplete) then
raise Exception.Create('TFPDocRun.Execute not again');
raise Exception.Create('TFPDocRun.Execute already called');
if ord(Step)<ord(frsCopiedToXCTDir) then
CopyToXCTDir;
@ -602,6 +602,5 @@ begin
Run.Free;
if ShowCmd then
writeln('Not executing, simulation ended. Stop');
writeln('Not executed... simulation ended');
end.