Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions eng/liveILLink.targets
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
<PropertyGroup Condition="'$(_RequiresLiveILLink)' == 'true'">
<!-- Don't use SDK's trimming functionality. -->
<_RequiresILLinkPack>false</_RequiresILLinkPack>
<!-- Keep in sync with SetTargetFramework metadata on the ProjectReference below. -->
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(ToolsILLinkDir)$(NetCoreAppToolCurrent)\ILLink.Tasks.dll</ILLinkTasksAssembly>
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(ToolsILLinkDir)$(NetFrameworkToolCurrent)\ILLink.Tasks.dll</ILLinkTasksAssembly>
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(ToolsILLinkDir)net\ILLink.Tasks.dll</ILLinkTasksAssembly>
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(ToolsILLinkDir)netframework\ILLink.Tasks.dll</ILLinkTasksAssembly>
</PropertyGroup>

<ItemGroup Condition="'$(_RequiresLiveILLink)' == 'true'">
Expand Down
10 changes: 9 additions & 1 deletion eng/packaging.targets
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,21 @@

<!-- Manual invoked target that can be used by toolset packages by adding it to the `TargetsForTfmSpecificContentInPackage` property. -->
<Target Name="AddBuildOutputToToolsPackage">
<PropertyGroup Condition="'$(BuildTaskTargetTfmSpecificFolder)' == ''">
<BuildTaskTargetTfmSpecificFolder Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">net</BuildTaskTargetTfmSpecificFolder>
<BuildTaskTargetTfmSpecificFolder Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">netframework</BuildTaskTargetTfmSpecificFolder>
</PropertyGroup>

<Error Text="The 'BuildTaskTargetTfmSpecificFolder' property must be explicitly set when not targeting .NETCoreApp or .NETFramework"
Condition="'$(BuildTaskTargetTfmSpecificFolder)' == ''" />

<ItemGroup>
<!-- Include build outputs in the package under tools directory. -->
<_BuildOutputPackageFile Include="$(OutputPath)**"
Exclude="$(OutputPath)publish\**;
$(OutputPath)" />
<TfmSpecificPackageFile Include="@(_BuildOutputPackageFile)"
PackagePath="tools/$(TargetFramework)/%(RecursiveDir)%(FileName)%(Extension)" />
PackagePath="tools/$(BuildTaskTargetTfmSpecificFolder)/%(RecursiveDir)%(FileName)%(Extension)" />
<TfmSpecificDebugSymbolsFile Include="@(TfmSpecificPackageFile->WithMetadataValue('Extension', '.pdb'))"
TargetPath="/%(TfmSpecificPackageFile.PackagePath)/%(Filename)%(Extension)"
TargetFramework="$(TargetFramework)"
Expand Down
4 changes: 2 additions & 2 deletions eng/testing/linker/project.csproj.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
the same layout as the NuGet package. -->
<!-- This must be done after the usual nuget props imports, to override the implicitly referenced
Microsoft.NET.ILLink.Tasks.props from the SDK. -->
<Import Project="$(ToolsILLinkDir)$(NetCoreAppToolCurrent)/build/Microsoft.NET.ILLink.Tasks.props" />
<Import Project="$(ToolsILLinkDir)net/build/Microsoft.NET.ILLink.Tasks.props" />

<PropertyGroup>
<!-- Don't use SDK's trimming functionality. -->
<_RequiresILLinkPack>false</_RequiresILLinkPack>
<ILLinkTasksAssembly>$(ToolsILLinkDir)$(NetCoreAppToolCurrent)/ILLink.Tasks.dll</ILLinkTasksAssembly>
<ILLinkTasksAssembly>$(ToolsILLinkDir)net/ILLink.Tasks.dll</ILLinkTasksAssembly>
</PropertyGroup>

<PropertyGroup>
Expand Down
12 changes: 6 additions & 6 deletions src/mono/msbuild/apple/build/AppleBuild.LocalBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
<_MonoAotCrossCompilerPath>$([MSBuild]::NormalizePath($(MonoAotCrossDir), 'mono-aot-cross'))</_MonoAotCrossCompilerPath>
<_MonoAotCrossCompilerPath Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">$(_MonoAotCrossCompilerPath).exe</_MonoAotCrossCompilerPath>

<ILLinkPropsPath>$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'ILLink.Tasks', '$(Configuration)', '$(_NetCoreAppToolCurrent)', 'build', 'Microsoft.NET.ILLink.Tasks.props'))</ILLinkPropsPath>
<ILLinkTargetsPath>$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'ILLink.Tasks', '$(Configuration)', '$(_NetCoreAppToolCurrent)', 'build', 'Microsoft.NET.ILLink.targets'))</ILLinkTargetsPath>
<_ILLinkTasksAssembly>$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'ILLink.Tasks', '$(Configuration)', '$(_NetCoreAppToolCurrent)', 'ILLink.Tasks.dll'))</_ILLinkTasksAssembly>
<ILLinkPropsPath>$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'ILLink.Tasks', '$(Configuration)', 'net', 'build', 'Microsoft.NET.ILLink.Tasks.props'))</ILLinkPropsPath>
<ILLinkTargetsPath>$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'ILLink.Tasks', '$(Configuration)', 'net', 'build', 'Microsoft.NET.ILLink.targets'))</ILLinkTargetsPath>
<_ILLinkTasksAssembly>$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'ILLink.Tasks', '$(Configuration)', 'net', 'ILLink.Tasks.dll'))</_ILLinkTasksAssembly>
</PropertyGroup>

<PropertyGroup Condition="'$(RuntimeSrcDir)' == '' and '$(AppleBuildSupportDir)' != ''">
Expand All @@ -68,9 +68,9 @@
<IlcSdkPath>$([MSBuild]::NormalizeDirectory('$(BuildBaseDir)', 'aotsdk'))</IlcSdkPath>
<IlcFrameworkPath>$(MicrosoftNetCoreAppRuntimePackLibDir)</IlcFrameworkPath>
<IlcFrameworkNativePath>$(MicrosoftNetCoreAppRuntimePackNativeDir)</IlcFrameworkNativePath>
<ILLinkPropsPath>$([MSBuild]::NormalizePath('$(BuildBaseDir)', '$(_NetCoreAppToolCurrent)', 'build', ''Microsoft.NET.ILLink.Tasks.props''))</ILLinkPropsPath>
<ILLinkTargetsPath>$([MSBuild]::NormalizePath('$(BuildBaseDir)', '$(_NetCoreAppToolCurrent)', 'build', 'Microsoft.NET.ILLink.targets'))</ILLinkTargetsPath>
<_ILLinkTasksAssembly>$([MSBuild]::NormalizePath('$(BuildBaseDir)', '$(_NetCoreAppToolCurrent)', 'ILLink.Tasks.dll'))</_ILLinkTasksAssembly>
<ILLinkPropsPath>$([MSBuild]::NormalizePath('$(BuildBaseDir)', 'net', 'build', ''Microsoft.NET.ILLink.Tasks.props''))</ILLinkPropsPath>
<ILLinkTargetsPath>$([MSBuild]::NormalizePath('$(BuildBaseDir)', 'net', 'build', 'Microsoft.NET.ILLink.targets'))</ILLinkTargetsPath>
<_ILLinkTasksAssembly>$([MSBuild]::NormalizePath('$(BuildBaseDir)', 'net', 'ILLink.Tasks.dll'))</_ILLinkTasksAssembly>
<_MonoAotCrossCompilerPath>$([MSBuild]::NormalizePath($(MonoAotCrossDir), 'mono-aot-cross'))</_MonoAotCrossCompilerPath>
<_MonoAotCrossCompilerPath Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">$(_MonoAotCrossCompilerPath).exe</_MonoAotCrossCompilerPath>
</PropertyGroup>
Expand Down
36 changes: 6 additions & 30 deletions src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);AddBuildOutputToToolsPackage</TargetsForTfmSpecificContentInPackage>
<!-- TODO: Add package readme -->
<EnableDefaultPackageReadmeFile>false</EnableDefaultPackageReadmeFile>
<!-- Don't use the TFM but a short form of it without the version to simulate the package layout. -->
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath Condition="'$(TargetFramework)' == '$(NetCoreAppToolCurrent)'">$(OutputPath)net\</OutputPath>
<OutputPath Condition="'$(TargetFramework)' == '$(NetFrameworkToolCurrent)'">$(OutputPath)netframework\</OutputPath>
<IntermediateOutputPath Condition="'$(TargetFramework)' == '$(NetCoreAppToolCurrent)'">$(IntermediateOutputPath)net\</IntermediateOutputPath>
<IntermediateOutputPath Condition="'$(TargetFramework)' == '$(NetFrameworkToolCurrent)'">$(IntermediateOutputPath)netframework\</IntermediateOutputPath>
</PropertyGroup>

<!-- Include the illink.runtimeconfig.pack.json file (which depends on the runtimeversion being built)
Expand Down Expand Up @@ -78,34 +84,4 @@
</ProjectReference>
</ItemGroup>

<Target Name="GenerateBuildMetadata" BeforeTargets="BeforeBuild"
Inputs="$(MSBuildProjectFile)"
Outputs="$(IntermediateOutputPath)Generated_BuildMetadata.cs">

<PropertyGroup>
<BuildMetadataContents>
<![CDATA[
// <autogenerated />

internal static class BuildMetadata
{
public const string ILLinkImplFramework = "$(NetCoreAppToolCurrent)";
}
]]>
</BuildMetadataContents>
</PropertyGroup>

<WriteLinesToFile
File="$(IntermediateOutputPath)Generated_BuildMetadata.cs"
Lines="$([MSBuild]::Escape($(BuildMetadataContents)))"
Overwrite="true" />

<ItemGroup>
<Compile Include="$(IntermediateOutputPath)Generated_BuildMetadata.cs" />

<!-- Append to FileWrites so the file will be removed on clean -->
<FileWrites Include="$(IntermediateOutputPath)Generated_BuildMetadata.cs" />
</ItemGroup>
</Target>

</Project>
3 changes: 1 addition & 2 deletions src/tools/illink/src/ILLink.Tasks/LinkTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ public string ILLinkPath {
#pragma warning restore IL3000 // Avoid accessing Assembly file path when publishing as a single file

// IL Linker always runs on .NET Core, even when using desktop MSBuild to host ILLink.Tasks.
// ILLinkImplFramework ()= NetCoreAppToolCurrent) was used to build the corresponding illink.dll
string path = Path.Combine (Path.GetDirectoryName (taskDirectory), BuildMetadata.ILLinkImplFramework, "illink.dll");
string path = Path.Combine (Path.GetDirectoryName (taskDirectory), "net", "illink.dll");

Log.LogMessage(MessageImportance.Normal, $"ILLink.Tasks path: {path}");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Copyright (c) .NET Foundation. All rights reserved.
<!-- Older SDKs used this property as a sentinel instead, to control the import of this file
(but not the targets, which were included with the SDK). -->
<UsingILLinkTasksSdk>true</UsingILLinkTasksSdk>
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)..\tools\net9.0\ILLink.Tasks.dll</ILLinkTasksAssembly>
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)..\tools\net472\ILLink.Tasks.dll</ILLinkTasksAssembly>
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)..\tools\net\ILLink.Tasks.dll</ILLinkTasksAssembly>
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)..\tools\netframework\ILLink.Tasks.dll</ILLinkTasksAssembly>

<ILLinkAnalyzersPropsPath Condition="'$(ILLinkAnalyzersPropsPath)' == ''">$(MSBuildThisFileDirectory)Microsoft.NET.ILLink.Analyzers.props</ILLinkAnalyzersPropsPath>
</PropertyGroup>
Expand Down
Loading