Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Microsoft.NET.ILLink package #82407

Merged
merged 3 commits into from
Feb 23, 2023
Merged
Changes from 1 commit
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
25 changes: 24 additions & 1 deletion src/tools/illink/src/linker/Mono.Linker.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<ServerGarbageCollection>true</ServerGarbageCollection>
<AssemblyName>illink</AssemblyName>
<Description>IL Linker</Description>
<RootNamespace>Mono.Linker</RootNamespace>
<IsPackable>true</IsPackable>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to add <IsShipping>false</IsShipping> so we don’t ship this package to NuGet.

Copy link
Contributor Author

@tlakollo tlakollo Feb 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this package is being shipped to Nuget by dotnet/linker (https://www.nuget.org/packages/Microsoft.NET.ILLink), I'm not sure if it's necessary for xamarin purposes though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this package is already shipping, then we shouldn't mark it as non-shipping.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That package should not be on public nuget.org and it was not until net8 p1. We are shipping it via internal feeds only, please remove it from nuget.org.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @sbomer

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking into this

Copy link
Member

@sbomer sbomer Feb 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've requested for the package to be removed from nuget.

It sounds like we should also set IsPackable IsShipping to false here. Per @jkoritzinsky this means that it will be published to the dotnet8-transport feed only (not the dotnet8 feed which is intended for packages that will eventually be published to nuget when we release). Consumers will need to make sure to use that feed as a nuget source. Does this sound ok @marek-safar?

Copy link
Member

@ViktorHofer ViktorHofer Feb 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we need to keep the <IsPackable>true</IsPackable> property. That indicates that the library is packable, i.e. it makes a dotnet pack invocation work locally. If you set it to false, this library will never generate a package, neither locally nor on CI.

To control whether a library should be published to a transport feed but not to a stable feed (i.e. nuget.org), you want to use <IsShipping>false</IsShipping>.

Copy link
Member

@sbomer sbomer Feb 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦 sorry, I meant to write IsShipping.

<PackageId>Microsoft.NET.ILLink</PackageId>
<!-- Disabling baseline validation since this is a brand new package.
Once this package has shipped a stable version, the following line
should be removed in order to re-enable validation. -->
<DisablePackageBaselineValidation>true</DisablePackageBaselineValidation>
<!-- There are currently no translations, so the satellite assemblies are a waste of space. -->
<EnableXlfLocalization>false</EnableXlfLocalization>
<NoWarn Condition="'$(DotNetBuildFromSource)' == 'true'">$(NoWarn);CS8524</NoWarn>
<ContractProject>$(MSBuildThisFileDirectory)ref\Mono.Linker.csproj</ContractProject>
<RollForward>Major</RollForward>
<UseAppHost>false</UseAppHost>
<NoWarn>$(NoWarn);NU5131</NoWarn>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_AddReferenceAssemblyToPackage</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>

<!-- The default pack logic will include the implementation assembly in lib.
This also adds the reference assembly under ref. -->
<Target Name="_AddReferenceAssemblyToPackage">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ViktorHofer - is there a reason why the ref assemblies doesn't get added automatically?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference assemblies aren't part of our core stack packages anymore since .NET 6. AFAIK this package needs the reference assembly, but it would be good to understand why.

<!-- Get the build output of the reference project, which has been built due to the ProjectReference. -->
<MSBuild Projects="$(ContractProject)" Targets="BuiltProjectOutputGroup" Properties="TargetFramework=$(TargetFramework)">
<Output TaskParameter="TargetOutputs" ItemName="_ReferenceAssemblies" />
</MSBuild>
<!-- Check just to be safe. -->
<Error Condition="!Exists('%(_ReferenceAssemblies.Identity)')" Text="Reference assembly %(Identity) does not exist. Ensure it has been built before packaging." />
<!-- Add it to the package. -->
<ItemGroup>
<TfmSpecificPackageFile Include="@(_ReferenceAssemblies)" PackagePath="ref\$(TargetFramework)" />
</ItemGroup>
tlakollo marked this conversation as resolved.
Show resolved Hide resolved
</Target>

<ItemGroup>
<AdditionalFiles Include="BannedSymbols.txt" />
<Compile Remove="ref\**\*.cs" />
Expand Down