Quantcast
Channel: Delphi – The Wiert Corner – irregular stream of stuff
Viewing all articles
Browse latest Browse all 1440

Delphi XE8 does not adhere the `$(PROJECTNAME)` in a “Unit Output Directory”, but does recognise `$(SanitizedProjectName)`…

$
0
0

The background here was a quick project at a client where many .dproj files were in the same directory, but they suffered from conditional define differences. Which meant that even if they were all using the  DEBUG configuration, some defines in the .dproj directories were different therefore poisoning shared .DCU files (as Delphi does not automatically rebuild them when the sources have not changed even though the IDE switched to a new project).

There was no quick possibility to reorganise the project structure (a combination of a version system history being problematic and potentially lots of relative path references in the .dproj and .dpr files could still be broken) so I wanted different “Unit Output Directories” for each project preferably using non-hardcoded project name.

So I tried putting $(PROJECTNAME) in a “Unit Output Directory”. But unlike build-events – where that one has a value – in the Directory it hadn’t.

To cut things short, Uwe Raabe did some spelunking in the .dproj file and found that $(SanitizedProjectName) was recognised so I switched to .\$(Platform)\$(Config)\$(SanitizedProjectName)

So I did some more spelunking coming with the below list. Remember though:

Only tested for Win32 applications for Delphi XE8

I assembled the list by doing a quick sed on a Delphi XE8 Win32 .dproj file transforming all XML element names to $() form then running it through a uniq like script. After that I added each of them in a “Unit Output Directory” prepended with .\_\ (well I cheated a bit, I did them in groups separated by a back-slash and went back to single items in case of failures. A kind of ‘binary search’).

These expand to empty strings:

$(Android_LauncherIcon144)
$(Android_LauncherIcon36)
$(Android_LauncherIcon48)
$(Android_LauncherIcon72)
$(Android_LauncherIcon96)
$(Android_SplashImage426)
$(Android_SplashImage470)
$(Android_SplashImage640)
$(Android_SplashImage960)
$(Base_Android)
$(Base_iOSDevice32)
$(Base_iOSDevice64)
$(Base_iOSSimulator)
$(Base_OSX32)
$(Base_Win64)
$(Borland)
$(BorlandProject)
$(BuildConfiguration)
$(Cfg_2)
$(Cfg_2_Win32)
$(DCC_DebugInformation)
$(DCC_LocalDebugSymbols)
$(DCC_SymbolReferenceInfo)
$(DCCReference)
$(DelphiCompile)
$(DeployClass)
$(DeployFile)
$(Deployment)
$(EnabledSysJars)
$(Excluded_Packages)
$(Extensions)
$(Import)
$(ItemGroup)
$(Key)
$(Operation)
$(Overwrite)
$(Platforms)
$(ProjectExtensions)
$(ProjectFileVersion)
$(ProjectRoot)
$(PropertyGroup)
$(RemoteDir)
$(RemoteName)

These expand to a usable string that can be used in a Directory:

$(AppType)
$(Base)
$(Base_Win32)
$(Cfg_1)
$(Cfg_1_Win32)
$(CfgParent)
$(Config)
$(DCC_ConsoleTarget)
$(DCC_DebugDCUs)
$(DCC_DebugInfoInExe)
$(DCC_E)
$(DCC_F)
$(DCC_GenerateStackFrames)
$(DCC_K)
$(DCC_N)
$(DCC_Optimize)
$(DCC_RemoteDebug)
$(DCC_S)
$(FrameworkType)
$(MainSource)
$(Platform)
$(ProjectGuid)
$(ProjectVersion)
$(SanitizedProjectName)
$(Source)
$(TargetedPlatforms)
$(VerInfo_Locale)

These work sort of as they expand in a string with one or more back-slashes:

$(DCC_DcuOutput)
$(DCC_ExeOutput)

These fail as they expand to something not usable in a directory

$(DCC_Define)
$(DCC_Namespace)
$(Delphi)
$(DCC_UsePackage)
$(Manifest_File)
$(VerInfo_Keys)

Various error messages you get for failed parameters:

[Fatal Error] The "HasTrailingSlash" function only accepts a scalar value, but its argument "$(DCC_DcuOutput)" evaluates to ".\VerInfo_Keys=CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=" which is not a scalar value.  c:\program files (x86)\embarcadero\studio\16.0\Bin\CodeGear.Delphi.Targets
[MakeDir Error] Unable to create directory ".\Manifest_File=c:\program files (x86)\embarcadero\studio\16.0\bin\default_app.manifest". The given path's format is not supported.
[Fatal Error] The "HasTrailingSlash" function only accepts a scalar value, but its argument "$(DCC_DcuOutput)" evaluates to ".\DCC_UsePackage=frxADO22;FireDACTDataDriver;FireDACSqliteDriver;...;IndyIPClient;" which is not a scalar value.  c:\program files (x86)\embarcadero\studio\16.0\Bin\CodeGear.Delphi.Targets
[MakeDir Error] Unable to create directory ".\Delphi=c:\program files (x86)\embarcadero\studio\16.0". The given path's format is not supported.
[Fatal Error] The "HasTrailingSlash" function only accepts a scalar value, but its argument "$(DCC_DcuOutput)" evaluates to ".\Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;System;Xml;Data;Datasnap;Web;Soap;" which is not a scalar value.  c:\program files (x86)\embarcadero\studio\16.0\Bin\CodeGear.Delphi.Targets
[Fatal Error] The "HasTrailingSlash" function only accepts a scalar value, but its argument "$(DCC_DcuOutput)" evaluates to ".\DCC_Define=DEBUG;" which is not a scalar value.  c:\program files (x86)\embarcadero\studio\16.0\Bin\CodeGear.Delphi.Targets

–jeroen

Source: Since Delphi (XE8) does not adhere the $(PROJECTNAME) in a “Unit Output…


Filed under: Delphi, Delphi XE8, Development, Software Development

Viewing all articles
Browse latest Browse all 1440

Trending Articles