chore: add Imagoverum fleet management package
This commit is contained in:
201
ImagoverumFleetManagement/Extension.Assemblies.targets
Normal file
201
ImagoverumFleetManagement/Extension.Assemblies.targets
Normal file
@@ -0,0 +1,201 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<!--
|
||||
Layout assumptions
|
||||
|
||||
This .targets file lives in:
|
||||
{ExtensionPath}\Extension.Assemblies.targets
|
||||
|
||||
We want to copy to:
|
||||
BasePackage\Assemblies\
|
||||
→ {ExtensionPath}\BasePackage\Assemblies\
|
||||
|
||||
Root\InstalledPackages\Assemblies\{ExtensionId}\
|
||||
→ {ExtensionPath}\..\Root\InstalledPackages\Assemblies\{ExtensionId}\
|
||||
|
||||
Properties:
|
||||
- M42BasePackageAssembliesDir (can override in csproj)
|
||||
- M42RootAssembliesDir (needs M42ExtensionId)
|
||||
- M42AssemblyPattern (default: $(MSBuildProjectName)*.*)
|
||||
- M42DefaultRids (default: win-x64;linux-x64)
|
||||
- M42ExtensionId (set in csproj)
|
||||
- M42EnableRidBuild (true for net8.0 w/ RIDs, false for netstandard)
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<!-- BasePackage under extension root -->
|
||||
<M42BasePackageAssembliesDir Condition="'$(M42BasePackageAssembliesDir)' == ''">$(MSBuildThisFileDirectory)BasePackage\Assemblies\</M42BasePackageAssembliesDir>
|
||||
|
||||
<!-- Root one level above extension root -->
|
||||
<M42RootAssembliesDir Condition="'$(M42RootAssembliesDir)' == '' AND '$(M42ExtensionId)' != ''">$(MSBuildThisFileDirectory)..\Root\InstalledPackages\Assemblies\$(M42ExtensionId)\</M42RootAssembliesDir>
|
||||
|
||||
<!-- Pattern & default RIDs -->
|
||||
<M42AssemblyPattern Condition="'$(M42AssemblyPattern)' == ''">$(MSBuildProjectName)*.*</M42AssemblyPattern>
|
||||
<M42DefaultRids Condition="'$(M42DefaultRids)' == ''">win-x64;linux-x64</M42DefaultRids>
|
||||
|
||||
<!-- Enable multi-RID builds per project; can be set to false in csproj -->
|
||||
<M42EnableRidBuild Condition="'$(M42EnableRidBuild)' == ''">true</M42EnableRidBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<!--
|
||||
M42_BuildAllRids
|
||||
|
||||
If no RuntimeIdentifier was specified and M42EnableRidBuild=true,
|
||||
re-build the project for all RIDs in M42DefaultRids.
|
||||
|
||||
Works both locally and in CI (we do NOT check TF_BUILD here).
|
||||
-->
|
||||
<Target Name="M42_BuildAllRids"
|
||||
BeforeTargets="Build"
|
||||
Condition="'$(RuntimeIdentifier)' == '' AND '$(M42EnableRidBuild)' == 'true'">
|
||||
|
||||
<ItemGroup>
|
||||
<_M42RidList Include="$(M42DefaultRids)" />
|
||||
</ItemGroup>
|
||||
|
||||
<MSBuild Projects="$(MSBuildProjectFullPath)"
|
||||
Targets="Restore;Build"
|
||||
Properties="RuntimeIdentifier=%(_M42RidList.Identity);Configuration=$(Configuration);AppendRuntimeIdentifierToOutputPath=true"
|
||||
BuildInParallel="true" />
|
||||
|
||||
<PropertyGroup>
|
||||
<SkipBuild>true</SkipBuild>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
|
||||
<!--
|
||||
M42_PostBuild_CopyRidless
|
||||
|
||||
For RID-less builds (RuntimeIdentifier == ''),
|
||||
copy top-level output files that match M42AssemblyPattern from $(TargetDir) to:
|
||||
|
||||
1) BasePackage\Assemblies\
|
||||
2) Root\InstalledPackages\Assemblies\{ExtId}\ (if configured)
|
||||
|
||||
Used for netstandard2.0 or when M42EnableRidBuild=false.
|
||||
-->
|
||||
<Target Name="M42_PostBuild_CopyRidless"
|
||||
AfterTargets="Build"
|
||||
Condition="'$(RuntimeIdentifier)' == ''">
|
||||
|
||||
<Message Text="M42: RID-less copy from $(TargetDir) → $(M42BasePackageAssembliesDir)" Importance="high" />
|
||||
|
||||
<ItemGroup>
|
||||
<_M42FlatRootRidless Include="$(TargetDir)$(M42AssemblyPattern)" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- BasePackage flat copy -->
|
||||
<MakeDir Directories="$(M42BasePackageAssembliesDir)"
|
||||
Condition="!Exists('$(M42BasePackageAssembliesDir)')" />
|
||||
|
||||
<Copy
|
||||
SourceFiles="@(_M42FlatRootRidless)"
|
||||
DestinationFolder="$(M42BasePackageAssembliesDir)"
|
||||
SkipUnchangedFiles="true"
|
||||
Condition="Exists('$(TargetDir)')" />
|
||||
|
||||
<!-- Root flat copy (if configured) -->
|
||||
<Message Text="M42: RID-less copy to Root → $(M42RootAssembliesDir)" Importance="high"
|
||||
Condition="'$(M42RootAssembliesDir)' != ''" />
|
||||
|
||||
<MakeDir Directories="$(M42RootAssembliesDir)"
|
||||
Condition="'$(M42RootAssembliesDir)' != '' AND !Exists('$(M42RootAssembliesDir)')" />
|
||||
|
||||
<Copy
|
||||
SourceFiles="@(_M42FlatRootRidless)"
|
||||
DestinationFolder="$(M42RootAssembliesDir)"
|
||||
SkipUnchangedFiles="true"
|
||||
Condition="'$(M42RootAssembliesDir)' != '' AND Exists('$(TargetDir)')" />
|
||||
|
||||
</Target>
|
||||
|
||||
|
||||
<!--
|
||||
M42_PostBuild_CopyRID
|
||||
|
||||
For RID-specific builds (RuntimeIdentifier != ''),
|
||||
copy assemblies to:
|
||||
|
||||
1) BasePackage\Assemblies\ (FLAT, from RID-less bin\...\netX\)
|
||||
2) BasePackage\Assemblies\<RID>\... (RECURSIVE, from current RID build)
|
||||
|
||||
And, if M42RootAssembliesDir is set:
|
||||
|
||||
3) Root\InstalledPackages\Assemblies\{ExtId}\ (FLAT)
|
||||
4) Root\InstalledPackages\Assemblies\{ExtId}\<RID>\ (RECURSIVE)
|
||||
-->
|
||||
<Target Name="M42_PostBuild_CopyRID"
|
||||
AfterTargets="Build"
|
||||
Condition="'$(RuntimeIdentifier)' != ''">
|
||||
|
||||
<Message Text="M42: RID=$(RuntimeIdentifier) TargetDir=$(TargetDir)" Importance="high" />
|
||||
|
||||
<!-- Parent of ...\netX\<rid>\ -->
|
||||
<PropertyGroup>
|
||||
<M42_RidlessTargetDir>$([System.IO.Path]::GetFullPath('$(TargetDir)..\'))</M42_RidlessTargetDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- 1) FLAT copy from rid-less netX to BasePackage\Assemblies -->
|
||||
<Message Text="M42: flat copy from $(M42_RidlessTargetDir) → $(M42BasePackageAssembliesDir)" Importance="high" />
|
||||
|
||||
<ItemGroup>
|
||||
<_M42FlatRoot Include="$(M42_RidlessTargetDir)$(M42AssemblyPattern)" />
|
||||
</ItemGroup>
|
||||
|
||||
<MakeDir Directories="$(M42BasePackageAssembliesDir)"
|
||||
Condition="!Exists('$(M42BasePackageAssembliesDir)')" />
|
||||
|
||||
<Copy
|
||||
SourceFiles="@(_M42FlatRoot)"
|
||||
DestinationFolder="$(M42BasePackageAssembliesDir)"
|
||||
SkipUnchangedFiles="true"
|
||||
Condition="Exists('$(M42_RidlessTargetDir)')" />
|
||||
|
||||
|
||||
<!-- 1b) FLAT copy to Root if configured -->
|
||||
<Message Text="M42: flat copy to Root → $(M42RootAssembliesDir)" Importance="high"
|
||||
Condition="'$(M42RootAssembliesDir)' != ''" />
|
||||
|
||||
<MakeDir Directories="$(M42RootAssembliesDir)"
|
||||
Condition="'$(M42RootAssembliesDir)' != '' AND !Exists('$(M42RootAssembliesDir)')" />
|
||||
|
||||
<Copy
|
||||
SourceFiles="@(_M42FlatRoot)"
|
||||
DestinationFolder="$(M42RootAssembliesDir)"
|
||||
SkipUnchangedFiles="true"
|
||||
Condition="'$(M42RootAssembliesDir)' != '' AND Exists('$(M42_RidlessTargetDir)')" />
|
||||
|
||||
|
||||
<!-- 2) RID copy to BasePackage\Assemblies\<RID>\... -->
|
||||
<Message Text="M42: RID copy → $(M42BasePackageAssembliesDir)$(RuntimeIdentifier)\" Importance="high" />
|
||||
|
||||
<ItemGroup>
|
||||
<_M42Rid Include="$(TargetDir)**\$(M42AssemblyPattern)" />
|
||||
</ItemGroup>
|
||||
|
||||
<MakeDir Directories="$(M42BasePackageAssembliesDir)$(RuntimeIdentifier)"
|
||||
Condition="!Exists('$(M42BasePackageAssembliesDir)$(RuntimeIdentifier)')" />
|
||||
|
||||
<Copy
|
||||
SourceFiles="@(_M42Rid)"
|
||||
DestinationFolder="$(M42BasePackageAssembliesDir)$(RuntimeIdentifier)\%(RecursiveDir)"
|
||||
SkipUnchangedFiles="true" />
|
||||
|
||||
|
||||
<!-- 2b) RID copy to Root\...\<RID>\... -->
|
||||
<Message Text="M42: RID copy to Root → $(M42RootAssembliesDir)$(RuntimeIdentifier)\" Importance="high"
|
||||
Condition="'$(M42RootAssembliesDir)' != ''" />
|
||||
|
||||
<MakeDir Directories="$(M42RootAssembliesDir)$(RuntimeIdentifier)"
|
||||
Condition="'$(M42RootAssembliesDir)' != '' AND !Exists('$(M42RootAssembliesDir)$(RuntimeIdentifier)')" />
|
||||
|
||||
<Copy
|
||||
SourceFiles="@(_M42Rid)"
|
||||
DestinationFolder="$(M42RootAssembliesDir)$(RuntimeIdentifier)\%(RecursiveDir)"
|
||||
SkipUnchangedFiles="true"
|
||||
Condition="'$(M42RootAssembliesDir)' != ''" />
|
||||
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user