Skip to content

Commit

Permalink
Build ilasm/ildasm packages for the host machine (#111512)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkoritzinsky authored Jan 18, 2025
1 parent 112fa51 commit 3998f4a
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 8 deletions.
1 change: 1 addition & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<PropertyGroup>
<!-- Define properties that depend on the host SDK RID here. -->
<BuildHostTools Condition="'$(DotNetBuildOrchestrator)' == 'true' and '$(OutputRID)' != '$(NETCoreSdkRuntimeIdentifier)'">true</BuildHostTools>
<BuildHostILTools Condition="'$(BuildHostTools)' == 'true' and $([MSBuild]::IsOsPlatform(Windows))">true</BuildHostILTools>
</PropertyGroup>

<!-- The Default behavior in VS is to show files for the first target framework in TargetFrameworks property.
Expand Down
8 changes: 8 additions & 0 deletions eng/Publishing.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
Mark assets as Vertical visibility when building in the VMR
-->
<ItemGroup Condition="'$(DotNetBuildOrchestrator)' == 'true'">
<Artifact Condition="'$(OutputRID)' != '$(NETCoreSdkRuntimeIdentifier)'"
Update="$(ArtifactsPackagesDir)**\runtime.$(NETCoreSdkRuntimeIdentifier).Microsoft.NETCore.ILAsm.*.nupkg"
Visibility="Vertical"
IsShipping="false" />
<Artifact Condition="'$(OutputRID)' != '$(NETCoreSdkRuntimeIdentifier)'"
Update="$(ArtifactsPackagesDir)**\runtime.$(NETCoreSdkRuntimeIdentifier).Microsoft.NETCore.ILDAsm.*.nupkg"
Visibility="Vertical"
IsShipping="false" />
<Artifact Condition="'$(RuntimeFlavor)' != 'Mono' and '$(OutputRID)' != '$(NETCoreSdkRuntimeIdentifier)'"
Update="$(ArtifactsPackagesDir)**\Microsoft.NETCore.App.Crossgen2.$(NETCoreSdkRuntimeIdentifier).*.nupkg"
Visibility="Vertical"
Expand Down
18 changes: 15 additions & 3 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,24 @@
<!--
Build the CoreCLR cross tools when we're doing a cross build and either we're building any CoreCLR native tools for platforms CoreCLR fully supports or when someone explicitly requests them.
The cross tools are used as part of the build process with the downloaded build tools, so we need to build them for the host architecture and build them as unsanitized binaries.
Additionally, in a vertical orchestrated build, we need to produce an ilasm and ildasm for use by upstack repositories.
However, these repositories only build on Windows, so we can limit this to only execute on Windows to avoid additional infrastructure work when not necessary.
-->
<ItemGroup Condition="(('$(ClrRuntimeBuildSubsets)' != '' and ('$(PrimaryRuntimeFlavor)' == 'CoreCLR' or '$(TargetsMobile)' == 'true')) or $(_subset.Contains('+clr.crossarchtools+'))) and ('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(EnableNativeSanitizers)' != '')">
<PropertyGroup>
<_BuildAnyCrossArch Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(EnableNativeSanitizers)' != ''">true</_BuildAnyCrossArch>
<_BuildCrossComponents Condition="$(_subset.Contains('+clr.crossarchtools+'))">true</_BuildCrossComponents>
<_BuildCrossComponents Condition="'$(ClrRuntimeBuildSubsets)' != '' and ('$(PrimaryRuntimeFlavor)' == 'CoreCLR' or '$(TargetsMobile)' == 'true')">true</_BuildCrossComponents>
</PropertyGroup>

<ItemGroup>
<_CrossToolSubset Condition="'$(_BuildCrossComponents)' == 'true'" Include="ClrCrossComponentsSubset=true" />
<_CrossToolSubset Condition="'$(BuildHostILTools)' == 'true'" Include="ClrILToolsSubset=true" />
</ItemGroup>

<ItemGroup Condition="'$(_BuildAnyCrossArch)' == 'true' and '@(_CrossToolSubset)' != ''">
<ProjectToBuild
Include="$(CoreClrProjectRoot)runtime.proj"
AdditionalProperties="%(AdditionalProperties);
ClrCrossComponentsSubset=true;
AdditionalProperties="%(AdditionalProperties);@(_CrossToolSubset);
HostArchitecture=$(BuildArchitecture);
HostCrossOS=$(HostOS);
PgoInstrument=false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
</PropertyGroup>

<ItemGroup>
<NativeBinary Include="$(RuntimeBinDir)ilasm$(ExeSuffix)" />
<NativeBinary Condition="'$(PackCrossComponent)' != 'true'" Include="$(RuntimeBinDir)ilasm$(ExeSuffix)" />
<NativeBinary Condition="'$(PackCrossComponent)' == 'true'" Include="$(RuntimeBinDir)$(BuildArchitecture)/ilasm$(ExeSuffix)" />
</ItemGroup>

<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<Project Sdk="Microsoft.Build.Traversal">
<PropertyGroup>
<IsILToolPackage>true</IsILToolPackage>
</PropertyGroup>
<ItemGroup>
<!-- identity project, runtime specific projects are included by props above -->
<Project Include="$(MSBuildProjectName).pkgproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
</PropertyGroup>

<ItemGroup>
<NativeBinary Include="$(RuntimeBinDir)ildasm$(ExeSuffix)" />
<NativeBinary Condition="'$(PackCrossComponent)' != 'true'" Include="$(RuntimeBinDir)ildasm$(ExeSuffix)" />
<NativeBinary Condition="'$(PackCrossComponent)' == 'true'" Include="$(RuntimeBinDir)$(BuildArchitecture)/ildasm$(ExeSuffix)" />
</ItemGroup>

<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<Project Sdk="Microsoft.Build.Traversal">
<PropertyGroup>
<IsILToolPackage>true</IsILToolPackage>
</PropertyGroup>
<ItemGroup>
<!-- identity project, runtime specific projects are included by props above -->
<Project Include="$(MSBuildProjectName).pkgproj" />
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/.nuget/builds.targets
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<ItemGroup Condition="'$(BuildIdentityPackage)' == 'true'">
<_projectsToBuild Include="@(Project)" Condition="'%(Project.PackageTargetRuntime)' == ''" />
</ItemGroup>
<ItemGroup Condition="'$(BuildHostILTools)' == 'true' and '$(IsILToolPackage)' == 'true'">
<_projectsToBuild Include="@(Project)" Condition="'%(Project.PackageTargetRuntime)' == '$(NETCoreSdkRuntimeIdentifier)'" AdditionalProperties="%(Project.AdditionalProperties);PackCrossComponent=true" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="@(_projectsToBuild)" />
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ endif()
# Include libraries native shims
#-------------------------------
if(NOT CLR_CROSS_COMPONENTS_BUILD)
set(STATIC_LIBS_ONLY 1)
add_subdirectory(${CLR_SRC_NATIVE_DIR}/libs libs-native)
endif(NOT CLR_CROSS_COMPONENTS_BUILD)
set(STATIC_LIBS_ONLY 1)
add_subdirectory(${CLR_SRC_NATIVE_DIR}/libs libs-native)
endif()

#-----------------------------------------
# Add Projects
Expand Down

0 comments on commit 3998f4a

Please sign in to comment.