Forum > General

$(TargetFile) bug for DLLs with set Host application?

(1/1)

CCRDude:
I've written an IDE plugin to integrate codesigning into the IDE workflow. To determine the output of the binary, I use $(TargetFile).


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TCodeSigningHelper.DoProjectBuildingFinished(ASender: TObject; ABuildSuccessful: boolean);var   s: string;   sTargetOS: string;   b: boolean;begin   s := '$(TargetFile)';   sTargetOS := GetTargetOS;   if IDEMacros.SubstituteMacros(s) then begin      if ABuildSuccessful then begin         b := False;         if TMicrosoftSignToolSigner.SupportsLazarusTargetOS(sTargetOS) then begin            b := CodeSigningOptions.MicrosoftSignToolOptions.AutoSign;         end else if TAppleCodeSignSigner.SupportsLazarusTargetOS(sTargetOS) then begin            b := CodeSigningOptions.AppleCodeSignOptions.AutoSign;         end else if TJavaKeyToolSigner.SupportsLazarusTargetOS(sTargetOS) then begin            b := CodeSigningOptions.JavaKeyToolOptions.AutoSign;         end;         if b then begin            AddIDEMessage(mluNone, rsCodeSigningStatusSigning, '', 0, 0, rsCodeSigningViewCodeSign);            CertificateSignExecutable(s);         end; 
Today, I was trying to sign a DLL for which I had set a Host application in Run Parameters. The signing code then tried to sign this host application executable, not my library.

According to the Wiki, $(TargetFile) is the stuff to use for 'Execute after'.
According to Macros in the Wiki, libraries are clearly included: "TargetFile - the output file of the current project (e.g. the executable or the library)"


* I use Lazarus 1.8.2 64 bit secondary (but only) installation as the current stable version
* Set Host application in Run Parameters to a 64 bit Total Commander executable, and code above will use the TC executable for IDEMacros.SubstituteMacros('$(TargetFile)')
* If I remove the Host application setting, the code above will use the correct project DLL file.
I assume this is a bug? Or am I missing something?

(Update: I verified this on another machine with a November 2017 trunk svn version, with a different DLL project with different host application, and could verify it. Lazarus wouldn't compile the updated trunk any longer, so I can't confirm for the latest svn version yet)
(Update #2: meanwhile confirmed with the latest trunk)

CCRDude:
Got a fresh IDE installed today and verified again; it can be verified much easier using post compile events, here's the reference to Mantis where I now reported it:

https://bugs.freepascal.org/view.php?id=33560

CCRDude:
Small update: it's a duplicate of this one:
https://bugs.freepascal.org/view.php?id=27729

I would love to write a better fix for this, but I need some feedback which direction that should take before creating patches.

Navigation

[0] Message Index

Go to full version