mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-09 09:59:15 +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 '+
|
||||
'if configured.';
|
||||
|
||||
lisGetExpandText = 'Print the result of substituting macros in the text for the specified build mode.'
|
||||
+' By default, active build mode is used.';
|
||||
lisGetExpandText = 'Print the result of substituting macros in the text. '+
|
||||
'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.';
|
||||
lisGetTargetPath = 'Print the full path to the executable file in the specified build mode.'
|
||||
+' By default, active build mode is used.';
|
||||
|
@ -770,6 +770,8 @@ var
|
||||
|
||||
function StartBuilding : boolean;
|
||||
var
|
||||
i: integer;
|
||||
HasMacro: boolean;
|
||||
NeedBuildAllFlag: Boolean;
|
||||
CfgCode: TCodeBuffer;
|
||||
CfgFilename: String;
|
||||
@ -799,6 +801,17 @@ var
|
||||
MainBuildBoss.SetBuildTargetProject1(true,smsfsSkip);
|
||||
|
||||
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);
|
||||
WriteLn(S);
|
||||
exit(true);
|
||||
|
Loading…
Reference in New Issue
Block a user