mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-22 11:39:30 +02:00
LazBuild: Allow just the macro name to be specified in "get-expand-text" parameter. By n7800.
This commit is contained in:
parent
7f000a6970
commit
a82d8be15b
@ -174,8 +174,9 @@ resourcestring
|
|||||||
'info file after build. If not specified, build number will be incremented '+
|
'info file after build. If not specified, build number will be incremented '+
|
||||||
'if configured.';
|
'if configured.';
|
||||||
|
|
||||||
lisGetExpandText = 'Print the result of substituting macros in the text for the specified build mode.'
|
lisGetExpandText = 'Print the result of substituting macros in the text. '+
|
||||||
+' By default, active build mode is used.';
|
'The absence of macros in the text means the name of the macro. '+
|
||||||
|
'By default, active build mode is used.';
|
||||||
lisGetBuildModes = 'Print a list of build modes in the project. Active mode is listed first.';
|
lisGetBuildModes = 'Print a list of build modes in the project. Active mode is listed first.';
|
||||||
lisGetTargetPath = 'Print the full path to the executable file in the specified build mode.'
|
lisGetTargetPath = 'Print the full path to the executable file in the specified build mode.'
|
||||||
+' By default, active build mode is used.';
|
+' By default, active build mode is used.';
|
||||||
|
@ -770,6 +770,8 @@ var
|
|||||||
|
|
||||||
function StartBuilding : boolean;
|
function StartBuilding : boolean;
|
||||||
var
|
var
|
||||||
|
i: integer;
|
||||||
|
HasMacro: boolean;
|
||||||
NeedBuildAllFlag: Boolean;
|
NeedBuildAllFlag: Boolean;
|
||||||
CfgCode: TCodeBuffer;
|
CfgCode: TCodeBuffer;
|
||||||
CfgFilename: String;
|
CfgFilename: String;
|
||||||
@ -799,6 +801,17 @@ var
|
|||||||
MainBuildBoss.SetBuildTargetProject1(true,smsfsSkip);
|
MainBuildBoss.SetBuildTargetProject1(true,smsfsSkip);
|
||||||
|
|
||||||
if HasLongOptIgnoreCase('get-expand-text',S) then begin
|
if HasLongOptIgnoreCase('get-expand-text',S) then begin
|
||||||
|
// check for macros
|
||||||
|
HasMacro := false;
|
||||||
|
for i := 1 to length(S) - 1 do // skip last char
|
||||||
|
if (S[i] = '$') and (S[i + 1] <> '$') then begin // skip escaped '$'
|
||||||
|
HasMacro := true;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
// if a macro is not specified, its name is assumed
|
||||||
|
if not HasMacro then
|
||||||
|
S := '$(' + S + ')';
|
||||||
|
// expand
|
||||||
Project1.MacroEngine.SubstituteStr(S);
|
Project1.MacroEngine.SubstituteStr(S);
|
||||||
WriteLn(S);
|
WriteLn(S);
|
||||||
exit(true);
|
exit(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user