Skip to content

Commit 69813ad

Browse files
authored
Trim workers for linux (#10681)
1 parent cb0a62c commit 69813ad

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

eng/build/Workers.Dotnet.props

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,28 @@
44
<PackageReference Include="Microsoft.Azure.Functions.DotNetIsolatedNativeHost" Version="1.0.12" />
55
</ItemGroup>
66

7-
<Target Name="CleanDotnetWorkerFiles" BeforeTargets="AssignTargetPaths" Condition="$(RuntimeIdentifier.StartsWith(win))">
7+
<Target Name="CleanDotnetWorkerFiles" BeforeTargets="AssignTargetPaths" Condition="'$(RuntimeIdentifier)' != ''">
88
<!-- Remove unnecessary dotnet isolated files -->
9+
<PropertyGroup>
10+
<!-- Using Path.Combine to ensure correct dir separator for the OS. -->
11+
<_DotnetWorkerBinFolder>$([System.IO.Path]::Combine('workers', 'dotnet-isolated', 'bin'))</_DotnetWorkerBinFolder>
12+
<_DotnetWorkerBinFolder>$([MSBuild]::EnsureTrailingSlash($(_DotnetWorkerBinFolder)))</_DotnetWorkerBinFolder>
13+
<_DotnetWorkerManifestFolder>$([System.IO.Path]::Combine('$(_DotnetWorkerBinFolder)', 'prelaunchapps', '_manifest', 'spdx_2.2'))</_DotnetWorkerManifestFolder>
14+
<_DotnetWorkerManifestFolder>$([MSBuild]::EnsureTrailingSlash($(_DotnetWorkerManifestFolder)))</_DotnetWorkerManifestFolder>
15+
</PropertyGroup>
16+
917
<ItemGroup>
10-
<_DotnetWorkerFiles Include="@(None)" Condition="'%(None.DestinationSubDirectory)' == 'workers\dotnet-isolated\bin\'" />
11-
<None Remove="@(_DotnetWorkerFiles)" Condition="'%(Extension)' != '.dll' AND '%(Extension)' != '.exe'" />
18+
<!-- Get all files from the dotnet worker package. -->
19+
<_DotnetWorkerFiles Include="@(None)" Condition="'%(None.NuGetPackageId)' == 'Microsoft.Azure.Functions.DotNetIsolatedNativeHost'" />
20+
<!-- Remove 'bin/prelaunchapps/_manifest' folder for all runtimes. -->
21+
<_DotnetWorkerToRemove Include="@(_DotnetWorkerFiles)" Condition="'%(DestinationSubDirectory)' == '$(_DotnetWorkerManifestFolder)'" />
22+
<!-- Get files immediately under /bin -->
23+
<_DotnetWorkerBinFiles Include="@(_DotnetWorkerFiles)" Condition="'%(DestinationSubDirectory)' == '$(_DotnetWorkerBinFolder)'" />
24+
<!-- For Windows, remove all non .dll and .exe files -->
25+
<_DotnetWorkerToRemove Include="@(_DotnetWorkerBinFiles)" Condition="$(RuntimeIdentifier.StartsWith('win')) AND '%(Extension)' != '.dll' AND '%(Extension)' != '.exe'" />
26+
<!-- For Linux, remove all non no-extension and .so files -->
27+
<_DotnetWorkerToRemove Include="@(_DotnetWorkerBinFiles)" Condition="$(RuntimeIdentifier.StartsWith('linux')) AND '%(Extension)' != '.so' AND '%(Extension)' != ''" />
28+
<None Remove="@(_DotnetWorkerToRemove)" />
1229
</ItemGroup>
1330
</Target>
1431

eng/build/Workers.Powershell.props

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.4" Version="4.0.4026" />
77
</ItemGroup>
88

9-
<Target Name="RemovePowershellWorkerRuntimes" BeforeTargets="AssignTargetPaths" Condition="$(RuntimeIdentifier.StartsWith(win))">
9+
<Target Name="RemovePowershellWorkerRuntimes" BeforeTargets="AssignTargetPaths" Condition="'$(RuntimeIdentifier)' != ''">
1010
<ItemGroup>
11-
<_KeepPowerShellRuntime Include="win;win-x86;win10-x86;win-x64;win10-x64" />
11+
<_KeepPowerShellRuntime Include="win;win-x86;win10-x86;win-x64;win10-x64" Condition="$(RuntimeIdentifier.StartsWith(win))" />
12+
<_KeepPowerShellRuntime Include="linux;linux-x64" Condition="$(RuntimeIdentifier.StartsWith(linux))" />
1213
</ItemGroup>
1314

1415
<PropertyGroup>
@@ -26,4 +27,5 @@
2627
<None Remove="@(_PowershellRuntimeToRemove)" />
2728
</ItemGroup>
2829
</Target>
30+
2931
</Project>

0 commit comments

Comments
 (0)