mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-13 05:29:26 +02:00
DocMgr: fixed project settings, improved --input values
git-svn-id: trunk@35050 -
This commit is contained in:
parent
cfad485584
commit
eb69a933a4
@ -4,7 +4,7 @@
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<SessionStorage Value="InIDEConfig"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="FPDocManager"/>
|
||||
<ResourceType Value="res"/>
|
||||
@ -109,7 +109,7 @@
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="..\..\..\fpc-trunk\utils\fpdoc"/>
|
||||
<OtherUnitFiles Value="$(FPCSrcDir)\utils\fpdoc"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
|
@ -188,8 +188,10 @@ var
|
||||
sec: TStringList;
|
||||
begin
|
||||
sec := AddSection(Section);
|
||||
sec.Assign(Strings);
|
||||
FDirty:=True; //optimize?
|
||||
if not sec.Equals(Strings) then begin
|
||||
sec.Assign(Strings);
|
||||
FDirty:=True;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TConfigFile.WriteSectionValues(const Section: string;
|
||||
|
@ -845,7 +845,7 @@
|
||||
</element>
|
||||
<!-- function Visibility: public -->
|
||||
<element name="TFPDocMaker.CleanXML">
|
||||
<short/>
|
||||
<short>Return True and (try) kill file if no element tag found.</short>
|
||||
<descr/>
|
||||
<errors/>
|
||||
<seealso/>
|
||||
|
@ -15,33 +15,20 @@
|
||||
}
|
||||
|
||||
(* --- Version 1.0 ---
|
||||
The TFPDocMaker class shall support the following functionality:
|
||||
- Project generation from a commandline.
|
||||
uMakeSkel merges the FPDoc and MakeSkel functionality, for use in applications.
|
||||
|
||||
The TFPDocMaker class supports the following functionality:
|
||||
- Project generation from a commandline, lpk or lpi file.
|
||||
- FPDoc documentation generation, optionally syntax check only.
|
||||
- MakeSkel skeleton generation or update.
|
||||
- Processing of single units or entire packages.
|
||||
- Added and extended commandline options.
|
||||
|
||||
Everything else is done in a separate documentation manager.
|
||||
The documentation manager maintains its own projects
|
||||
and creates temporary TFPDocProjects and TFPDocPackages on demand.
|
||||
*)
|
||||
|
||||
(* Version 0.0 - requires patched FPDoc units!
|
||||
The TFPDocMaker class supports the following functionality:
|
||||
- documentation generation (FPDoc),
|
||||
- for all units in a package
|
||||
- for a selected unit (optionally syntax check only)
|
||||
- project generation
|
||||
- from input and description directories
|
||||
- from a commandline
|
||||
- skeleton generation
|
||||
- for all units in a package
|
||||
- for selected unit (MakeSkel)
|
||||
- documentation sync with source (MakeSkel UpdateMode)
|
||||
- for all units in a package
|
||||
- output into one or more files
|
||||
- for selected unit
|
||||
- skeleton and sync at once
|
||||
*)
|
||||
unit umakeskel;
|
||||
|
||||
interface
|
||||
@ -168,13 +155,12 @@ type
|
||||
procedure SetDryRun(AValue: boolean);
|
||||
procedure SetPackage(AValue: TFPDocPackage);
|
||||
procedure SetWriteProjectFile(AValue: string);
|
||||
function ParseCommon(var Cmd, Arg: string): TCreatorAction;
|
||||
function ParseCommon(var Cmd, Arg: string): TCreatorAction;
|
||||
public
|
||||
Function DocumentPackage(Const APackageName,AOutputName: string; InputFiles, DescrFiles : TStrings) : String;
|
||||
procedure CreateUnitDocumentation(const AUnit: string; ParseOnly: Boolean);
|
||||
public
|
||||
ImportDir: string;
|
||||
SelectedUnit: string;
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure AddDirToFileList(List: TStrings; const ADirName, AMask: String);
|
||||
@ -884,22 +870,30 @@ procedure TFPDocMaker.AddDirToFileList(List: TStrings; const ADirName, AMask: St
|
||||
|
||||
Var
|
||||
Info : TSearchRec;
|
||||
D : String;
|
||||
|
||||
D, opts : String;
|
||||
i: integer;
|
||||
begin
|
||||
if (ADirName<>'') and not DirectoryExists(ADirName) then
|
||||
DoLog('Directory '+ADirName+' does not exist')
|
||||
i := Pos(',', ADirName);
|
||||
if i > 0 then begin
|
||||
opts := ' ' + Copy(ADirName, i+1, Length(ADirName));
|
||||
D := Copy(ADirName, 1, i-1);
|
||||
end else begin
|
||||
D := ADirName;
|
||||
opts := '';
|
||||
end;
|
||||
if (D<>'') and not DirectoryExists(D) then
|
||||
DoLog('Directory '+D+' does not exist')
|
||||
else
|
||||
begin
|
||||
if (ADirName='.') or (ADirName='') then
|
||||
if (D='.') then
|
||||
D:=''
|
||||
else
|
||||
D:=IncludeTrailingPathDelimiter(ADirName);
|
||||
D:=IncludeTrailingPathDelimiter(D);
|
||||
If (FindFirst(D+AMask,0,Info)=0) then
|
||||
try
|
||||
Repeat
|
||||
If (Info.Attr and faDirectory)=0 then
|
||||
List.Add(D+Info.name);
|
||||
List.Add(D+Info.name + opts);
|
||||
Until FindNext(Info)<>0;
|
||||
finally
|
||||
FindClose(Info);
|
||||
@ -910,20 +904,29 @@ end;
|
||||
procedure TFPDocMaker.AddToFileList(List: TStrings; const FileName: String);
|
||||
var
|
||||
f: Text;
|
||||
s: String;
|
||||
s, opts: String;
|
||||
i: integer;
|
||||
begin
|
||||
if Copy(FileName, 1, 1) = '@' then
|
||||
i := Pos(',', FileName);
|
||||
if i > 0 then begin
|
||||
opts := ' ' + Copy(FileName, i+1, Length(FileName));
|
||||
s := Copy(FileName, 1, i-1);
|
||||
end else begin
|
||||
s := FileName;
|
||||
opts := '';
|
||||
end;
|
||||
if s[1] = '@' then
|
||||
begin
|
||||
AssignFile(f, Copy(FileName, 2, Length(FileName)));
|
||||
AssignFile(f, Copy(s, 2, Length(s)));
|
||||
Reset(f);
|
||||
while not EOF(f) do
|
||||
begin
|
||||
ReadLn(f, s);
|
||||
List.Add(s);
|
||||
List.Add(s + opts);
|
||||
end;
|
||||
Close(f);
|
||||
end else
|
||||
List.Add(FileName);
|
||||
List.Add(s + opts);
|
||||
end;
|
||||
|
||||
function TFPDocMaker.ParseCommon(var Cmd, Arg: string): TCreatorAction;
|
||||
@ -935,12 +938,6 @@ begin
|
||||
CmdAction := caUsage;
|
||||
exit(caUsage);
|
||||
end;
|
||||
{$IFDEF v0}
|
||||
if Cmd = '--makeskel' then
|
||||
Options.CreateSkeleton := True
|
||||
else
|
||||
{$ELSE}
|
||||
{$ENDIF}
|
||||
if Cmd = '--update' then
|
||||
CmdOptions.UpdateMode := True
|
||||
else if (Cmd = '-n') or (Cmd = '--dry-run') then
|
||||
@ -1004,17 +1001,10 @@ begin
|
||||
Options.CPUTarget := Arg
|
||||
else if (Cmd = '-l') or (Cmd = '--lang') then
|
||||
Options.Language := Arg
|
||||
{$IFDEF new}
|
||||
else if (Cmd = '--common-options') then
|
||||
SelectedPackage.CommonOptions:=Arg
|
||||
{$ELSE}
|
||||
{$ENDIF}
|
||||
else if Cmd = '--mo-dir' then
|
||||
Options.modir := Arg
|
||||
else if (Cmd = '-o') or (Cmd = '--output') then
|
||||
SelectedPackage.Output := Arg
|
||||
else if (Cmd = '--unit') then //-u= UpdateMode
|
||||
SelectedUnit:= Arg
|
||||
else if (Cmd = '-v') or (Cmd = '--verbose') then
|
||||
Verbose:=true
|
||||
else if Cmd = '--write-project' then begin
|
||||
|
@ -41,6 +41,8 @@ TFPDocWriter based writers create an file for every module:
|
||||
*)
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
{$DEFINE EasyImports} //EasyImports.patch applied?
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
@ -424,7 +426,11 @@ begin
|
||||
//add Imports
|
||||
for i := 0 to Requires.Count - 1 do begin
|
||||
s := Requires[i];
|
||||
imp := Manager.RootDir + s + '.xct,../' + s + '/';
|
||||
{$IFDEF EasyImports}
|
||||
imp := Manager.RootDir + s;
|
||||
{$ELSE}
|
||||
imp := Manager.RootDir + s + '.xct,../' + s + '/'; //valid for HTML, not for CHM!
|
||||
{$ENDIF}
|
||||
APrj.ParseFPDocOption('--import=' + imp);
|
||||
end;
|
||||
//add options
|
||||
@ -914,7 +920,12 @@ begin
|
||||
if not Result then
|
||||
exit;
|
||||
try
|
||||
Helper.ParseFPDocOption('--output=' + AOutput);
|
||||
Helper.ParseFPDocOption(Format('--output="%s"', [AOutput]));
|
||||
if Options.Backend = 'chm' then begin
|
||||
Helper.ParseFPDocOption('--auto-toc');
|
||||
Helper.ParseFPDocOption('--auto-index');
|
||||
end;
|
||||
Helper.ParseFPDocOption('--make-searchable'); //always?
|
||||
//Result :=
|
||||
Helper.CreateUnitDocumentation(AUnit, False);
|
||||
finally
|
||||
|
Loading…
Reference in New Issue
Block a user