mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 19:16:16 +02:00
IDEIntf: added ConsoleVerbosity, pas2js: less hints, fixed getting compiler options, fixed uninitialized result
git-svn-id: trunk@57023 -
This commit is contained in:
parent
4bddb9a44b
commit
76a5a3cd5d
@ -42,6 +42,9 @@ var
|
||||
// the global IDE values
|
||||
IDEMacros: TIDEMacros = nil; // set by the IDE
|
||||
|
||||
var
|
||||
ConsoleVerbosity: integer = 0; // 0=normal, -1=quiet, 1=verbose, 2=very verbose
|
||||
|
||||
procedure RenameIDEMacroInString(var s: string; const OldName, NewName: string);
|
||||
|
||||
implementation
|
||||
|
@ -5,7 +5,8 @@ unit pjscontroller;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, MacroIntf, MacroDefIntf, forms, lazideintf, lazlogger, process ;
|
||||
Classes, SysUtils, MacroIntf, MacroDefIntf, forms, Controls, lazideintf,
|
||||
lazlogger, process ;
|
||||
|
||||
Type
|
||||
|
||||
@ -51,9 +52,9 @@ Type
|
||||
Private
|
||||
FOnRefresh: TNotifyEvent;
|
||||
FServerInstances: TServerInstanceList;
|
||||
function GetPasJSBrowser(const s: string; const Data: PtrInt; var Abort: boolean): string;
|
||||
function GetPasJSNodeJS(const s: string; const Data: PtrInt; var Abort: boolean): string;
|
||||
function GetProjectURL(const s: string; const Data: PtrInt; var Abort: boolean): string;
|
||||
function GetPasJSBrowser(const s: string; const {%H-}Data: PtrInt; var Abort: boolean): string;
|
||||
function GetPasJSNodeJS(const s: string; const {%H-}Data: PtrInt; var Abort: boolean): string;
|
||||
function GetProjectURL(const s: string; const {%H-}Data: PtrInt; var Abort: boolean): string;
|
||||
function MaybeStartServer(Sender: TObject; var Handled: boolean): TModalResult;
|
||||
Public
|
||||
Constructor Create;
|
||||
@ -150,7 +151,8 @@ begin
|
||||
{$IFDEF WINDOWS}
|
||||
FProcess.Options:=[poNoConsole];
|
||||
{$ENDIF}
|
||||
DebugLN(['Starting server from Directory : ',BaseDir]);
|
||||
if ConsoleVerbosity>=0 then
|
||||
DebugLN(['Starting server from Directory : ',BaseDir]);
|
||||
FProcess.CurrentDirectory:=BaseDir;
|
||||
try
|
||||
FProcess.Execute;
|
||||
@ -197,6 +199,8 @@ begin
|
||||
IdeMacros.SubstituteMacros(Result);
|
||||
if (Result<>'') and not FilenameIsAbsolute(Result) then
|
||||
Result:=FindDefaultExecutablePath(Result);
|
||||
if (s<>'') and (ConsoleVerbosity>=0) then
|
||||
debugln(['Hint: (lazarus) [TPJSController.GetPasJSBrowser] ignoring macro Pas2JSBrowser parameter "',s,'"']);
|
||||
end;
|
||||
|
||||
function TPJSController.GetPasJSNodeJS(const s: string; const Data: PtrInt; var Abort: boolean): string;
|
||||
@ -209,6 +213,8 @@ begin
|
||||
IdeMacros.SubstituteMacros(Result);
|
||||
if (Result<>'') and not FilenameIsAbsolute(Result) then
|
||||
Result:=FindDefaultExecutablePath(Result);
|
||||
if (s<>'') and (ConsoleVerbosity>=0) then
|
||||
debugln(['Hint: (lazarus) [TPJSController.GetPasJSNodeJS] ignoring macro Pas2JSNodeJS parameter "',s,'"']);
|
||||
end;
|
||||
|
||||
function TPJSController.GetProjectURL(const s: string; const Data: PtrInt; var Abort: boolean): string;
|
||||
@ -217,16 +223,22 @@ Var
|
||||
FN : String;
|
||||
|
||||
begin
|
||||
DebugLN(['LazarusIDE.ActiveProject.CustomData[PJSProjectWebBrowser]: ',LazarusIDE.ActiveProject.CustomData[PJSProjectWebBrowser]]);
|
||||
if (s<>'') and (ConsoleVerbosity>=0) then
|
||||
debugln(['Hint: (lazarus) [TPJSController.GetProjectURL] ignoring macro Pas2JSProjectURL parameter "',s,'"']);
|
||||
|
||||
if ConsoleVerbosity>0 then
|
||||
DebugLN(['LazarusIDE.ActiveProject.CustomData[PJSProjectWebBrowser]: ',LazarusIDE.ActiveProject.CustomData[PJSProjectWebBrowser]]);
|
||||
Abort:=LazarusIDE.ActiveProject.CustomData[PJSProjectWebBrowser]<>'1';
|
||||
if Abort then
|
||||
exit;
|
||||
DebugLN(['LazarusIDE.ActiveProject.CustomData[PJSProjectURL]: ',LazarusIDE.ActiveProject.CustomData[PJSProjectURL]]);
|
||||
if ConsoleVerbosity>0 then
|
||||
DebugLN(['LazarusIDE.ActiveProject.CustomData[PJSProjectURL]: ',LazarusIDE.ActiveProject.CustomData[PJSProjectURL]]);
|
||||
Result:=LazarusIDE.ActiveProject.CustomData[PJSProjectURL];
|
||||
if (Result='') then
|
||||
begin
|
||||
FN:=LazarusIDE.ActiveProject.CustomData[PJSProjectHTMLFile];
|
||||
DebugLN(['LazarusIDE.ActiveProject.CustomData[PJSProjectHTMLFile]: ',LazarusIDE.ActiveProject.CustomData[PJSProjectHTMLFile]]);
|
||||
if ConsoleVerbosity>0 then
|
||||
DebugLN(['LazarusIDE.ActiveProject.CustomData[PJSProjectHTMLFile]: ',LazarusIDE.ActiveProject.CustomData[PJSProjectHTMLFile]]);
|
||||
if (FN='') then
|
||||
FN:=ChangeFileExt(ExtractFileName(LazarusIDE.ActiveProject.ProjectInfoFile),'.html');
|
||||
Result:=LazarusIDE.ActiveProject.CustomData[PJSProjectPort];
|
||||
@ -240,7 +252,8 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
Abort:=(Result='');
|
||||
DebugLN(['GetProjectURL : ',Result]);
|
||||
if ConsoleVerbosity>0 then
|
||||
DebugLN(['GetProjectURL : ',Result]);
|
||||
end;
|
||||
|
||||
function TPJSController.MaybeStartServer(Sender: TObject; var Handled: boolean): TModalResult;
|
||||
@ -252,11 +265,15 @@ Var
|
||||
aInstance : TServerInstance;
|
||||
|
||||
begin
|
||||
Result:=mrOK;
|
||||
With LazarusIDE.ActiveProject do
|
||||
begin
|
||||
DebugLn(['WebProject:=',CustomData[PJSProjectWebBrowser]]);
|
||||
DebugLn(['ServerPort:=',CustomData[PJSProjectPort]]);
|
||||
DebugLn(['BaseDir:=',ProjectInfoFile]);
|
||||
if ConsoleVerbosity>=0 then
|
||||
begin
|
||||
DebugLn(['WebProject=',CustomData[PJSProjectWebBrowser]]);
|
||||
DebugLn(['ServerPort=',CustomData[PJSProjectPort]]);
|
||||
DebugLn(['BaseDir=',ProjectInfoFile]);
|
||||
end;
|
||||
WebProject:=CustomData[PJSProjectWebBrowser]='1';
|
||||
ServerPort:=StrToIntDef(CustomData[PJSProjectPort],0);
|
||||
BaseDir:=ExtractFilePath(ProjectInfoFile);
|
||||
@ -267,10 +284,12 @@ begin
|
||||
aInstance:=ServerInstances.FindByPort(ServerPort);
|
||||
If Ainstance<>Nil then
|
||||
begin
|
||||
Writeln('Have instance running on port ',ServerPort);
|
||||
if ConsoleVerbosity>=0 then
|
||||
Writeln('Have instance running on port ',ServerPort);
|
||||
if Not SameFileName(BaseDir,aInstance.BaseDir) then
|
||||
begin
|
||||
Writeln('Instance on port ',ServerPort,' serves different directory: ',aInstance.BaseDir);
|
||||
if ConsoleVerbosity>=0 then
|
||||
Writeln('Instance on port ',ServerPort,' serves different directory: ',aInstance.BaseDir);
|
||||
// We should ask the user what to do ?
|
||||
If aInstance.Running then
|
||||
aInstance.StopServer;
|
||||
|
@ -240,9 +240,6 @@ function TProjectPas2JSNodeJSApp.InitProject(AProject: TLazProject ): TModalResu
|
||||
var
|
||||
MainFile : TLazProjectFile;
|
||||
CompOpts : TLazCompilerOptions;
|
||||
RunParams : TAbstractRunParamsOptionsMode;
|
||||
Compiler : String;
|
||||
|
||||
begin
|
||||
Result:=inherited InitProject(AProject);
|
||||
|
||||
@ -250,6 +247,7 @@ begin
|
||||
MainFile.IsPartOfProject:=true;
|
||||
AProject.AddFile(MainFile,false);
|
||||
AProject.MainFileID:=0;
|
||||
CompOpts:=AProject.LazBuildModes.BuildModes[0].LazCompilerOptions;
|
||||
CompOpts.TargetFilename:='project1';
|
||||
SetDefaultNodeJSCompileOptions(AProject.LazCompilerOptions);
|
||||
|
||||
|
@ -143,8 +143,6 @@ procedure TPas2JSProjectOptionsFrame.BResetRunCommandClick(Sender: TObject);
|
||||
|
||||
Var
|
||||
Prj : TLazProject;
|
||||
RP : TAbstractRunParamsOptionsMode;
|
||||
|
||||
begin
|
||||
PRJ:=LazarusIDE.ActiveProject;
|
||||
SetDefaultWebRunParams(Prj.RunParameters.GetOrCreate('Default'));
|
||||
@ -205,7 +203,7 @@ end;
|
||||
Function TPas2JSProjectOptionsFrame.FillFilesCombo(PRJ : TLazProject) : Integer;
|
||||
|
||||
Var
|
||||
I,H : integer;
|
||||
I: integer;
|
||||
HPF,PF : TLazProjectFile;
|
||||
Ext : String;
|
||||
L : TStringList;
|
||||
@ -245,6 +243,7 @@ Var
|
||||
URL : String;
|
||||
|
||||
begin
|
||||
if AOptions=nil then ;
|
||||
PRJ:=LazarusIDE.ActiveProject;
|
||||
HTMLIdx:=FillFilesCombo(PRJ);
|
||||
CBWebProject.Checked:=PRJ.CustomData[PJSProjectWebBrowser]='1';
|
||||
@ -277,6 +276,7 @@ Var
|
||||
end;
|
||||
|
||||
begin
|
||||
if AOptions=nil then ;
|
||||
PRJ:=LazarusIDE.ActiveProject;
|
||||
// Clear everything
|
||||
With PRJ.CustomData do
|
||||
|
@ -39,7 +39,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, Forms, Controls, contnrs, strutils,
|
||||
IDEExternToolIntf, IDEMsgIntf, LazIDEIntf, LazUTF8,
|
||||
IDEExternToolIntf, IDEMsgIntf, LazIDEIntf, MacroIntf, LazUTF8,
|
||||
IDECmdLine, LazarusIDEStrConsts, CompilerOptions, Project,
|
||||
DefineTemplates, TransferMacros, EnvironmentOpts, LazFileUtils;
|
||||
|
||||
|
@ -86,9 +86,6 @@ function ParamsAndCfgCount: Integer;
|
||||
function ParamsAndCfgStr(Idx: Integer): String;
|
||||
procedure ResetParamsAndCfg;
|
||||
|
||||
var
|
||||
ConsoleVerbosity: integer = 0; // 0=normal, -1=quiet, 1=verbose, 2=very verbose
|
||||
|
||||
implementation
|
||||
|
||||
var
|
||||
|
@ -41,7 +41,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, math, lazutf8classes, LazConf, LCLProc,
|
||||
FileProcs, LazFileUtils, IDECmdLine;
|
||||
FileProcs, LazFileUtils, MacroIntf, IDECmdLine;
|
||||
|
||||
procedure ParseGuiCmdLineParams(var SkipAutoLoadingLastProject,
|
||||
StartedByStartLazarus,
|
||||
|
@ -35,7 +35,8 @@ uses
|
||||
// CodeTools
|
||||
BasicCodeTools, SourceLog, FileProcs, CodeToolManager, CodeToolsConfig, CodeCache,
|
||||
// LazUtils
|
||||
FileUtil, LazFileUtils, LazFileCache, LazUTF8, lazutf8classes, Laz2_XMLCfg, AvgLvlTree,
|
||||
FileUtil, LazFileUtils, LazFileCache, LazUTF8, lazutf8classes, Laz2_XMLCfg,
|
||||
AvgLvlTree, MacroIntf,
|
||||
// IDE
|
||||
IDECmdLine, LazConf;
|
||||
|
||||
|
@ -71,14 +71,15 @@ uses
|
||||
// DebuggerIntf
|
||||
DbgIntfBaseTypes, DbgIntfDebuggerBase,
|
||||
// IDE units
|
||||
IDECmdLine, LazarusIDEStrConsts, IDECommands, EditorOptions, EnvironmentOpts,
|
||||
WordCompletion, FindReplaceDialog, IDEProcs, IDEOptionDefs, IDEHelpManager,
|
||||
MacroPromptDlg, TransferMacros, CodeContextForm, SrcEditHintFrm, etMessagesWnd,
|
||||
etSrcEditMarks, CodeMacroPrompt, CodeTemplatesDlg, CodeToolsOptions,
|
||||
editor_general_options, SortSelectionDlg, EncloseSelectionDlg, EncloseIfDef,
|
||||
InvertAssignTool, SourceEditProcs, SourceMarks, CharacterMapDlg, SearchFrm,
|
||||
MultiPasteDlg, EditorMacroListViewer, EditorToolbarStatic, editortoolbar_options,
|
||||
InputhistoryWithSearchOpt, FPDocHints, MainIntf, GotoFrm, BaseDebugManager, Debugger;
|
||||
IDECmdLine, LazarusIDEStrConsts, IDECommands, MacroIntf, EditorOptions,
|
||||
EnvironmentOpts, WordCompletion, FindReplaceDialog, IDEProcs, IDEOptionDefs,
|
||||
IDEHelpManager, MacroPromptDlg, TransferMacros, CodeContextForm,
|
||||
SrcEditHintFrm, etMessagesWnd, etSrcEditMarks, CodeMacroPrompt,
|
||||
CodeTemplatesDlg, CodeToolsOptions, editor_general_options, SortSelectionDlg,
|
||||
EncloseSelectionDlg, EncloseIfDef, InvertAssignTool, SourceEditProcs,
|
||||
SourceMarks, CharacterMapDlg, SearchFrm, MultiPasteDlg, EditorMacroListViewer,
|
||||
EditorToolbarStatic, editortoolbar_options, InputhistoryWithSearchOpt,
|
||||
FPDocHints, MainIntf, GotoFrm, BaseDebugManager, Debugger;
|
||||
|
||||
type
|
||||
TSourceNotebook = class;
|
||||
|
@ -60,7 +60,7 @@ uses
|
||||
// IDE
|
||||
LazarusIDEStrConsts, IDECmdLine, EnvironmentOpts, IDEProcs, LazConf,
|
||||
TransferMacros, DialogProcs, IDETranslations, CompilerOptions, PackageLinks,
|
||||
PackageDefs, ComponentReg;
|
||||
PackageDefs, ComponentReg, MacroIntf;
|
||||
|
||||
const
|
||||
MakefileCompileVersion = 2;
|
||||
|
Loading…
Reference in New Issue
Block a user