mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 13:59:29 +02:00
pastojs: option -FE
git-svn-id: trunk@38983 -
This commit is contained in:
parent
59e79bb8f6
commit
8a5c519f2d
@ -172,6 +172,7 @@ const
|
||||
nCantAssignValuesToConstVariable = 3110;
|
||||
nIllegalAssignmentToForLoopVar = 3111;
|
||||
nFunctionHidesIdentifier_NonProc = 3112;
|
||||
// Note: use one of the free IDs above
|
||||
|
||||
// using same IDs as FPC
|
||||
nVirtualMethodXHasLowerVisibility = 3250;
|
||||
@ -286,7 +287,6 @@ resourcestring
|
||||
sMissingFieldsX = 'Missing fields: "%s"';
|
||||
sCantAssignValuesToConstVariable = 'Can''t assign values to const variable';
|
||||
sIllegalAssignmentToForLoopVar = 'Illegal assignment to for-loop variable "%s"';
|
||||
// sFunctionHidesIdentifier_NonProc = sFunctionHidesIdentifier
|
||||
|
||||
type
|
||||
{ TResolveData - base class for data stored in TPasElement.CustomData }
|
||||
|
@ -3129,6 +3129,7 @@ begin
|
||||
inc(p);
|
||||
case c of
|
||||
'e': Log.OutputFilename:=String(p);
|
||||
'E': FileCache.MainOutputPath:=String(p);
|
||||
'i': if not FileCache.AddIncludePaths(String(p),FromCmdLine,ErrorMsg) then
|
||||
ParamFatal('invalid include path (-Fi) "'+ErrorMsg+'"');
|
||||
'N': if not FileCache.AddNamespaces(String(p),FromCmdLine,ErrorMsg) then
|
||||
@ -3972,6 +3973,7 @@ begin
|
||||
l(' R : Object checks. Verify method calls and object type casts.');
|
||||
l(' -F... Set file names and paths:');
|
||||
l(' -Fe<x> : Redirect output to file <x>. UTF-8 encoded.');
|
||||
l(' -FE<x> : Set main output path to <x>');
|
||||
l(' -Fi<x> : Add <x> to include paths');
|
||||
l(' -FN<x> : add <x> to namespaces. Namespaces with trailing - are removed.');
|
||||
l(' Delphi calls this flag "unit scope names".');
|
||||
@ -4144,6 +4146,7 @@ begin
|
||||
for i:=0 to FileCache.IncludePaths.Count-1 do
|
||||
WriteFolder('include path',FileCache.IncludePaths[i]);
|
||||
WriteFolder('unit output path',FileCache.UnitOutputPath);
|
||||
WriteFolder('main output path',FileCache.MainOutputPath);
|
||||
Log.LogMsgIgnoreFilter(nNameValue,['output file',QuoteStr(FileCache.MainJSFile)]);
|
||||
end;
|
||||
|
||||
|
@ -261,6 +261,7 @@ type
|
||||
TPas2jsFilesCache = class
|
||||
private
|
||||
FBaseDirectory: string;
|
||||
FDefaultOutputPath: string;
|
||||
FDirectoryCache: TPas2jsCachedDirectories;
|
||||
FFiles: TAVLTree; // tree of TPas2jsCachedFile sorted for Filename
|
||||
FForeignUnitPaths: TStringList;
|
||||
@ -295,6 +296,7 @@ type
|
||||
procedure SetBaseDirectory(AValue: string);
|
||||
function AddSearchPaths(const Paths: string; Kind: TPas2jsSearchPathKind;
|
||||
FromCmdLine: boolean; var List: TStringList; var CmdLineCount: integer): string;
|
||||
procedure SetDefaultOutputPath(AValue: string);
|
||||
procedure SetMainJSFile(AValue: string);
|
||||
procedure SetOptions(AValue: TP2jsFileCacheOptions);
|
||||
procedure SetSearchLikeFPC(const AValue: boolean);
|
||||
@ -332,6 +334,7 @@ type
|
||||
public
|
||||
property AllJSIntoMainJS: Boolean read GetAllJSIntoMainJS write SetAllJSIntoMainJS;
|
||||
property BaseDirectory: string read FBaseDirectory write SetBaseDirectory; // includes trailing pathdelim
|
||||
property MainOutputPath: string read FDefaultOutputPath write SetDefaultOutputPath; // includes trailing pathdelim
|
||||
property DirectoryCache: TPas2jsCachedDirectories read FDirectoryCache;
|
||||
property ForeignUnitPaths: TStringList read FForeignUnitPaths;
|
||||
property ForeignUnitPathsFromCmdLine: integer read FForeignUnitPathsFromCmdLine;
|
||||
@ -1651,6 +1654,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPas2jsFilesCache.SetDefaultOutputPath(AValue: string);
|
||||
begin
|
||||
AValue:=ExpandDirectory(AValue,BaseDirectory);
|
||||
if FDefaultOutputPath=AValue then Exit;
|
||||
FDefaultOutputPath:=AValue;
|
||||
end;
|
||||
|
||||
procedure TPas2jsFilesCache.SetMainJSFile(AValue: string);
|
||||
begin
|
||||
if FMainJSFile=AValue then Exit;
|
||||
@ -1904,21 +1914,31 @@ begin
|
||||
FMainJSFileResolved:=''
|
||||
else begin
|
||||
FMainJSFileResolved:=MainJSFile;
|
||||
if FMainJSFileResolved='' then
|
||||
if FMainJSFileResolved<>'' then
|
||||
begin
|
||||
// no option -o
|
||||
if UnitOutputPath<>'' then
|
||||
// has option -o
|
||||
if ExtractFilePath(FMainJSFileResolved)='' then
|
||||
begin
|
||||
// option -FU and no -o => put into UnitOutputPath
|
||||
FMainJSFileResolved:=UnitOutputPath+ChangeFileExt(ExtractFilename(MainSrcFile),'.js')
|
||||
end else begin
|
||||
// no -FU and no -o => put into source directory
|
||||
FMainJSFileResolved:=ChangeFileExt(MainSrcFile,'.js');
|
||||
// -o<FileWithoutPath>
|
||||
if MainOutputPath<>'' then
|
||||
FMainJSFileResolved:=MainOutputPath+FMainJSFileResolved
|
||||
else if UnitOutputPath<>'' then
|
||||
FMainJSFileResolved:=UnitOutputPath+FMainJSFileResolved;
|
||||
end;
|
||||
end else begin
|
||||
// has option -o
|
||||
if (ExtractFilePath(FMainJSFileResolved)='') and (UnitOutputPath<>'') then
|
||||
FMainJSFileResolved:=UnitOutputPath+FMainJSFileResolved;
|
||||
// no option -o
|
||||
FMainJSFileResolved:=ChangeFileExt(MainSrcFile,'.js');
|
||||
if MainOutputPath<>'' then
|
||||
begin
|
||||
// option -FE and no -o => put into MainOutputPath
|
||||
FMainJSFileResolved:=MainOutputPath+ExtractFilename(FMainJSFileResolved)
|
||||
end else if UnitOutputPath<>'' then
|
||||
begin
|
||||
// option -FU and no -o => put into UnitOutputPath
|
||||
FMainJSFileResolved:=UnitOutputPath+ExtractFilename(FMainJSFileResolved)
|
||||
end else begin
|
||||
// no -FU and no -o => put into source directory
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Include(FStates,cfsMainJSFileResolved);
|
||||
|
@ -139,6 +139,7 @@ Put + after a boolean switch option to enable it, - to disable it
|
||||
R : Object checks. Verify method calls and object type casts.
|
||||
-F... Set file names and paths:
|
||||
-Fe<x> : Redirect output to file <x>. UTF-8 encoded.
|
||||
-FE<x> : Set main output path to <x>
|
||||
-Fi<x> : Add <x> to include paths
|
||||
-FN<x> : add <x> to namespaces. Namespaces with trailing - are removed.
|
||||
Delphi calls this flag "unit scope names".
|
||||
|
Loading…
Reference in New Issue
Block a user