mirror of https://gitlab.com/basile.b/dexed.git
fix #423 - Add compiler switches for project
This commit is contained in:
parent
6750020d16
commit
e7708131db
|
@ -135,6 +135,7 @@ type
|
||||||
fMsgs: IMessagesDisplay;
|
fMsgs: IMessagesDisplay;
|
||||||
fNextTerminatedCommand: TDubCommand;
|
fNextTerminatedCommand: TDubCommand;
|
||||||
fAsProjectItf: ICommonProject;
|
fAsProjectItf: ICommonProject;
|
||||||
|
fMetaEnv: TStringList;
|
||||||
procedure doModified;
|
procedure doModified;
|
||||||
procedure updateFields;
|
procedure updateFields;
|
||||||
procedure updatePackageNameFromJson;
|
procedure updatePackageNameFromJson;
|
||||||
|
@ -148,8 +149,8 @@ type
|
||||||
procedure dubProcTerminated(proc: TObject);
|
procedure dubProcTerminated(proc: TObject);
|
||||||
function getCurrentCustomConfig: TJSONObject;
|
function getCurrentCustomConfig: TJSONObject;
|
||||||
procedure executeDub(command: TDubCommand; const runArgs: string = '');
|
procedure executeDub(command: TDubCommand; const runArgs: string = '');
|
||||||
procedure restorePersistentConfigId;
|
procedure restorePersistentMetadata;
|
||||||
procedure storePersistentConfigId;
|
procedure storePersistentMetadata;
|
||||||
public
|
public
|
||||||
constructor create(aOwner: TComponent); override;
|
constructor create(aOwner: TComponent); override;
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
|
@ -192,6 +193,7 @@ type
|
||||||
procedure run(const runArgs: string = '');
|
procedure run(const runArgs: string = '');
|
||||||
procedure test;
|
procedure test;
|
||||||
function targetUpToDate: boolean;
|
function targetUpToDate: boolean;
|
||||||
|
function getPersistentEnvironment: TStrings;
|
||||||
|
|
||||||
property json: TJSONObject read fJSON;
|
property json: TJSONObject read fJSON;
|
||||||
property packageName: string read fPackageName;
|
property packageName: string read fPackageName;
|
||||||
|
@ -683,6 +685,8 @@ begin
|
||||||
fImportPaths := TStringList.Create;
|
fImportPaths := TStringList.Create;
|
||||||
fImportPaths.Sorted:=true;
|
fImportPaths.Sorted:=true;
|
||||||
fImportPaths.Duplicates:=dupIgnore;
|
fImportPaths.Duplicates:=dupIgnore;
|
||||||
|
fMetaEnv:= TStringList.create;
|
||||||
|
fMetaEnv.LineBreak:=';';
|
||||||
|
|
||||||
json.Add('name', '');
|
json.Add('name', '');
|
||||||
endModification;
|
endModification;
|
||||||
|
@ -695,8 +699,8 @@ end;
|
||||||
|
|
||||||
destructor TDubProject.destroy;
|
destructor TDubProject.destroy;
|
||||||
begin
|
begin
|
||||||
if not inGroup and fHasLoaded then
|
if fHasLoaded then
|
||||||
storePersistentConfigId();
|
storePersistentMetadata();
|
||||||
killProcess(fDubProc);
|
killProcess(fDubProc);
|
||||||
subjProjClosing(fProjectSubject, self);
|
subjProjClosing(fProjectSubject, self);
|
||||||
fProjectSubject.free;
|
fProjectSubject.free;
|
||||||
|
@ -706,6 +710,7 @@ begin
|
||||||
fConfigs.Free;
|
fConfigs.Free;
|
||||||
fSrcs.Free;
|
fSrcs.Free;
|
||||||
fImportPaths.Free;
|
fImportPaths.Free;
|
||||||
|
fMetaEnv.free;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
{$ENDREGION --------------------------------------------------------------------}
|
{$ENDREGION --------------------------------------------------------------------}
|
||||||
|
@ -842,7 +847,7 @@ begin
|
||||||
|
|
||||||
updateFields;
|
updateFields;
|
||||||
if not inGroup then
|
if not inGroup then
|
||||||
restorePersistentConfigId();
|
restorePersistentMetadata();
|
||||||
|
|
||||||
subjProjChanged(fProjectSubject, self);
|
subjProjChanged(fProjectSubject, self);
|
||||||
fModified := false;
|
fModified := false;
|
||||||
|
@ -947,7 +952,7 @@ end;
|
||||||
{$ENDREGION --------------------------------------------------------------------}
|
{$ENDREGION --------------------------------------------------------------------}
|
||||||
|
|
||||||
{$REGION ICommonProject: configs ---------------------------------------------}
|
{$REGION ICommonProject: configs ---------------------------------------------}
|
||||||
procedure TDubProject.restorePersistentConfigId;
|
procedure TDubProject.restorePersistentMetadata;
|
||||||
var
|
var
|
||||||
f: string;
|
f: string;
|
||||||
t: string;
|
t: string;
|
||||||
|
@ -971,12 +976,14 @@ begin
|
||||||
setActiveConfigurationIndex(i);
|
setActiveConfigurationIndex(i);
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
|
fMetaEnv.Clear;
|
||||||
|
fMetaEnv.AddText(values['project_environment_vars']);
|
||||||
finally
|
finally
|
||||||
free;
|
free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDubProject.storePersistentConfigId;
|
procedure TDubProject.storePersistentMetadata;
|
||||||
var
|
var
|
||||||
f: string;
|
f: string;
|
||||||
n: string;
|
n: string;
|
||||||
|
@ -998,6 +1005,7 @@ begin
|
||||||
try
|
try
|
||||||
values['last_dexed_buildType'] := t;
|
values['last_dexed_buildType'] := t;
|
||||||
values['last_dexed_config'] := c;
|
values['last_dexed_config'] := c;
|
||||||
|
values['project_environment_vars'] := fMetaEnv.text;
|
||||||
try
|
try
|
||||||
SaveToFile(f);
|
SaveToFile(f);
|
||||||
except
|
except
|
||||||
|
@ -1087,6 +1095,8 @@ procedure TDubProject.executeDub(command: TDubCommand; const runArgs: string = '
|
||||||
var
|
var
|
||||||
prjname: string;
|
prjname: string;
|
||||||
rargs: TStringList;
|
rargs: TStringList;
|
||||||
|
i: integer;
|
||||||
|
e: string;
|
||||||
begin
|
begin
|
||||||
if fDubProc.isNotNil and fDubProc.Active then
|
if fDubProc.isNotNil and fDubProc.Active then
|
||||||
begin
|
begin
|
||||||
|
@ -1120,6 +1130,19 @@ begin
|
||||||
begin
|
begin
|
||||||
fDubProc.Options := fDubProc.Options + [poWaitOnExit, poNewConsole];
|
fDubProc.Options := fDubProc.Options + [poWaitOnExit, poNewConsole];
|
||||||
end;
|
end;
|
||||||
|
if fMetaEnv.Count <> 0 then
|
||||||
|
begin
|
||||||
|
for i := 0 to fMetaEnv.Count-1 do
|
||||||
|
begin
|
||||||
|
e := fMetaEnv.Strings[i];
|
||||||
|
fDubProc.Environment.Add(e);
|
||||||
|
end;
|
||||||
|
for i := 0 to GetEnvironmentVariableCount-1 do
|
||||||
|
begin
|
||||||
|
e := GetEnvironmentString(i);
|
||||||
|
fDubProc.Environment.Add(e);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
fDubProc.CurrentDirectory := fFilename.extractFilePath;
|
fDubProc.CurrentDirectory := fFilename.extractFilePath;
|
||||||
fDubProc.XTermProgram:=consoleProgram;
|
fDubProc.XTermProgram:=consoleProgram;
|
||||||
fDubProc.Parameters.Add(dubCmd2Arg[command]);
|
fDubProc.Parameters.Add(dubCmd2Arg[command]);
|
||||||
|
@ -1171,6 +1194,11 @@ begin
|
||||||
// rebuilding is done automatically when the command is 'run'
|
// rebuilding is done automatically when the command is 'run'
|
||||||
result := true;
|
result := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TDubProject.getPersistentEnvironment: TStrings;
|
||||||
|
begin
|
||||||
|
result := fMetaEnv;
|
||||||
|
end;
|
||||||
{$ENDREGION --------------------------------------------------------------------}
|
{$ENDREGION --------------------------------------------------------------------}
|
||||||
|
|
||||||
{$REGION JSON to internal fields -----------------------------------------------}
|
{$REGION JSON to internal fields -----------------------------------------------}
|
||||||
|
|
|
@ -12,7 +12,6 @@ object MainForm: TMainForm
|
||||||
OnResize = FormResize
|
OnResize = FormResize
|
||||||
OnWindowStateChange = FormWindowStateChange
|
OnWindowStateChange = FormWindowStateChange
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
LCLVersion = '2.0.0.3'
|
|
||||||
object mainMenu: TMainMenu
|
object mainMenu: TMainMenu
|
||||||
top = 1
|
top = 1
|
||||||
object MenuItem1: TMenuItem
|
object MenuItem1: TMenuItem
|
||||||
|
@ -223,6 +222,9 @@ object MainForm: TMainForm
|
||||||
object MenuItem108: TMenuItem
|
object MenuItem108: TMenuItem
|
||||||
Action = actProjDscan
|
Action = actProjDscan
|
||||||
end
|
end
|
||||||
|
object MenuItem117: TMenuItem
|
||||||
|
Action = actProjSetEnv
|
||||||
|
end
|
||||||
object MenuItem40: TMenuItem
|
object MenuItem40: TMenuItem
|
||||||
Caption = '-'
|
Caption = '-'
|
||||||
end
|
end
|
||||||
|
@ -846,6 +848,11 @@ object MainForm: TMainForm
|
||||||
Caption = 'Git pull'
|
Caption = 'Git pull'
|
||||||
OnExecute = actProjGitPullExecute
|
OnExecute = actProjGitPullExecute
|
||||||
end
|
end
|
||||||
|
object actProjSetEnv: TAction
|
||||||
|
Category = 'Project'
|
||||||
|
Caption = 'Set persistent environment...'
|
||||||
|
OnExecute = actProjSetEnvExecute
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object ApplicationProperties1: TApplicationProperties
|
object ApplicationProperties1: TApplicationProperties
|
||||||
OnActivate = ApplicationProperties1Activate
|
OnActivate = ApplicationProperties1Activate
|
||||||
|
|
|
@ -117,6 +117,7 @@ type
|
||||||
actFileCloseAll: TAction;
|
actFileCloseAll: TAction;
|
||||||
actFileNewClip: TAction;
|
actFileNewClip: TAction;
|
||||||
actEdFormat: TAction;
|
actEdFormat: TAction;
|
||||||
|
actProjSetEnv: TAction;
|
||||||
actProjGitPull: TAction;
|
actProjGitPull: TAction;
|
||||||
actProjGitBranchesUpd: TAction;
|
actProjGitBranchesUpd: TAction;
|
||||||
actProjNewDialog: TAction;
|
actProjNewDialog: TAction;
|
||||||
|
@ -182,6 +183,7 @@ type
|
||||||
MenuItem114: TMenuItem;
|
MenuItem114: TMenuItem;
|
||||||
MenuItem115: TMenuItem;
|
MenuItem115: TMenuItem;
|
||||||
MenuItem116: TMenuItem;
|
MenuItem116: TMenuItem;
|
||||||
|
MenuItem117: TMenuItem;
|
||||||
mnuGitBranch: TMenuItem;
|
mnuGitBranch: TMenuItem;
|
||||||
mnuItemDubDialog: TMenuItem;
|
mnuItemDubDialog: TMenuItem;
|
||||||
mnuItemHelp: TMenuItem;
|
mnuItemHelp: TMenuItem;
|
||||||
|
@ -322,6 +324,7 @@ type
|
||||||
procedure actProjSaveGroupAsExecute(Sender: TObject);
|
procedure actProjSaveGroupAsExecute(Sender: TObject);
|
||||||
procedure actProjSaveGroupExecute(Sender: TObject);
|
procedure actProjSaveGroupExecute(Sender: TObject);
|
||||||
procedure actProjSelUngroupedExecute(Sender: TObject);
|
procedure actProjSelUngroupedExecute(Sender: TObject);
|
||||||
|
procedure actProjSetEnvExecute(Sender: TObject);
|
||||||
procedure actProjStopCompExecute(Sender: TObject);
|
procedure actProjStopCompExecute(Sender: TObject);
|
||||||
procedure actProjTestExecute(Sender: TObject);
|
procedure actProjTestExecute(Sender: TObject);
|
||||||
procedure actSetRunnableSwExecute(Sender: TObject);
|
procedure actSetRunnableSwExecute(Sender: TObject);
|
||||||
|
@ -4253,6 +4256,24 @@ begin
|
||||||
fFreeProj.activate;
|
fFreeProj.activate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.actProjSetEnvExecute(Sender: TObject);
|
||||||
|
var
|
||||||
|
p: TDubProject;
|
||||||
|
e: TStrings;
|
||||||
|
s: string;
|
||||||
|
begin
|
||||||
|
if not assigned(fProject) or (fProject.getFormat <> pfDUB) then
|
||||||
|
exit;
|
||||||
|
p := TDubProject(fProject.getProject);
|
||||||
|
e := p.getPersistentEnvironment;
|
||||||
|
s := e.strictText;
|
||||||
|
if InputQuery('Persistent project environment', 'values (key=value;key=value;...)', s) then
|
||||||
|
begin
|
||||||
|
e.Clear;
|
||||||
|
e.AddText(s);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainForm.actNewGroupExecute(Sender: TObject);
|
procedure TMainForm.actNewGroupExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if fProjectGroup.groupModified then
|
if fProjectGroup.groupModified then
|
||||||
|
|
Loading…
Reference in New Issue