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

Linker into runtime diff #77569

Closed

Conversation

tlakollo
Copy link
Contributor

@tlakollo tlakollo commented Oct 27, 2022

Updating the consolidation branch into a new branch called LinkerIntoRuntime inside the runtime repo and adding on top of all the commits in #77149 for an easier updated review.
For more information about these changes please refer to #75278.

tlakollo and others added 14 commits October 27, 2022 13:20
…ill use the runtime arcade infra

Remove build.cmd/build.sh and lint.cmd/lint.sh in src\tools\linker directory since now they will execute via a subset
Remove/Merge common files from src\tools\linker root:
 - .editorconfig
 - .gitattributes
 - .gitignore
 - .github
 - .gitmodules
 - after.illink.sln.targets
 - code_of_conduct.md
 - global.json
 - LICENSE.txt
 - NuGet.config
 - THIRD-PARTY-NOTICES.TXT
Remove/Merge common files from src\tools\linker\eng:
 - Publishing.props
 - Signing.props
 - SourceBuild.props
 - SourceBuildPrebuiltBaseline.xml
 - Tools.props
 - Version.Details.xml
 - Versions.props
Create a subsets tools.linker and tools.linkertests that build and test the different csproj files
Add arcade cecil package to Version.Details.xml and Versions.props
Delete cecil from the external folder and its related files
Add PackageReference of cecil in Mono.Linker.csproj
Tweaks to make things build
Tweaks to make dotnet format to work
Set UsingToolMicrosoftNetILLinkTasks to true to not use the recently build package in CI
Remove the PackageId name to workaround the cyclic dependency in the dependency graph
Do not use relative paths to find stuff instead use msbuild properties
Fix cecil test that checks for an old cecil package version
Change source lines since now we are using spaces instead of tabs (pending issue with pdbs and symbols on assemblies)
Workaround the deletion of RefSafetyRulesAttribute and their associated types injected by the compiler
For now add extra ExpectedWarnings on warnings being duplicated by the analyzer (pending investigation)
…related tests will fail

Upgrade to MicrosoftCodeAnalysisVersion 4.5+ generates a different type of analysis callbacks, the CheckAttributeInstantiation method is no longer needed. And a bug in which a warning was printed twice by the analyzer is fixed.
Typo on Cecil.Pdb package
Update names in csproj's
Add warning for file header mismatch/missing
Add condition for test group to any change in src/tools/linker
Remove extra tool in global.json
Add a dummy line change to test if CI triggers
…er changes

Exclude building the clr in linker testing
@tlakollo tlakollo self-assigned this Oct 27, 2022
@tlakollo tlakollo added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Oct 27, 2022
@ghost
Copy link

ghost commented Oct 27, 2022

Tagging subscribers to this area: @dotnet/area-system-reflection-metadata
See info in area-owners.md if you want to be subscribed.

Issue Details

null

Author: tlakollo
Assignees: tlakollo
Labels:

NO-MERGE, area-System.Reflection.Metadata

Milestone: -

@tlakollo tlakollo added area-Infrastructure area-Tools-ILLink .NET linker development as well as trimming analyzers and removed area-System.Reflection.Metadata labels Oct 27, 2022
@ghost
Copy link

ghost commented Oct 27, 2022

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Issue Details

Updating the consolidation branch into a new branch called LinkerIntoRuntime inside the runtime repo and adding on top of all the commits in #77149 for an easier updated review.
For more information about these changes please refer to #75278.

Author: tlakollo
Assignees: tlakollo
Labels:

NO-MERGE, area-System.Reflection.Metadata, area-Infrastructure, area-Tools-linker

Milestone: -

@tlakollo
Copy link
Contributor Author

Adding @dotnet/runtime-infrastructure for review

Copy link
Member

@sbomer sbomer left a comment

Choose a reason for hiding this comment

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

It might be helpful to adopt the runtime's code style settings in dotnet/linker to make it easier to port commits over after the initial change.

eng/Subsets.props Outdated Show resolved Hide resolved
eng/Subsets.props Outdated Show resolved Hide resolved
eng/Version.Details.xml Show resolved Hide resolved
eng/Versions.props Outdated Show resolved Hide resolved
eng/Versions.props Outdated Show resolved Hide resolved
eng/pipelines/coreclr/templates/build-job.yml Outdated Show resolved Hide resolved
eng/pipelines/coreclr/templates/build-job.yml Outdated Show resolved Hide resolved
src/tools/linker/external/Mono.Options/Options.cs Outdated Show resolved Hide resolved
Comment on lines 341 to 354
<ItemGroup Condition="$(_subset.Contains('+tools.linkertests+'))">
<ProjectToBuild Include="$(ToolsProjectRoot)linker\test\Mono.Linker.Tests\Mono.Linker.Tests.csproj"
Test="true" Category="tools" Condition="'$(DotNetBuildFromSource)' != 'true'"/>
<ProjectToBuild Include="$(ToolsProjectRoot)linker\test\Mono.Linker.Tests.Cases\Mono.Linker.Tests.Cases.csproj"
Test="true" Category="tools" Condition="'$(DotNetBuildFromSource)' != 'true'"/>
<ProjectToBuild Include="$(ToolsProjectRoot)linker\test\Mono.Linker.Tests.Cases.Expectations\Mono.Linker.Tests.Cases.Expectations.csproj"
Test="true" Category="tools" Condition="'$(DotNetBuildFromSource)' != 'true'"/>
<ProjectToBuild Include="$(ToolsProjectRoot)linker\test\ILLink.Tasks.Tests\ILLink.Tasks.Tests.csproj"
Test="true" Category="tools" Condition="'$(DotNetBuildFromSource)' != 'true'"/>
<ProjectToBuild Include="$(ToolsProjectRoot)linker\test\ILLink.RoslynAnalyzer.Tests\ILLink.RoslynAnalyzer.Tests.csproj"
Test="true" Category="tools" Condition="'$(DotNetBuildFromSource)' != 'true'"/>
<ProjectToBuild Include="$(ToolsProjectRoot)linker\test\ILLink.RoslynAnalyzer.Tests.Generator\ILLink.RoslynAnalyzer.Tests.Generator.csproj"
Test="true" Category="tools" Condition="'$(DotNetBuildFromSource)' != 'true'"/>
</ItemGroup>
Copy link
Member

Choose a reason for hiding this comment

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

I don't think that you need the DotNetBuildFromSource condition here as that subset won't be built automatically. Similar to the libs.tests subset which isn't built automatically either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now, I think we don't want the burden of everyone building linker even if they won't use it and therefore I'm not including it in the DefaultSubsets. I will remove the conditions for DotNetBuildFromSource

eng/Versions.props Outdated Show resolved Hide resolved
@@ -12,7 +12,7 @@ Method can return constant value if its code will always return the same value (
public bool Is32Bit { get => false; }
```

On 64bit platforms the property is compiled with constant value, and ILLInk can determine this. It's also possible to use substitutions to overwrite method's return value to a constant via the [substitutions XML file](../data-formats.md#substitution-format).
On 64bit platforms the property is compiled with constant value, and ILLInk can determine this. It's also possible to use substitutions to overwrite method's return value to a constant via the [substitutions XML file](../data-formats.md#substitution-format).
Copy link
Member

Choose a reason for hiding this comment

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

When we consolidated corefx, coreclr, core-setup and mono into dotnet/runtime, we also moved all the docs into a consolidated location: runtime/docs/. It might make sense to move these into the consolidated location as well.

Copy link
Member

Choose a reason for hiding this comment

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

You marked this comment as resolved but didn't respond. The proposed docs consolidation doesn't need to happen now (or ever, if others disagree) but I would like to know what you think it about my suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this PR I actually moved the docs, that's why I marked it as resolved. But a couple of people in the team tried to review the PR and it was difficult due to non-functional changes. So we decided to keep things that don't affect build/test for follow-up. Sorry for the confusion, I opened #78052 to track moving the docs

@ViktorHofer
Copy link
Member

ViktorHofer commented Oct 28, 2022

With these changes, the tools.linket subset doesn't build automatically. Is that intentional as part of this change? If not, you want to add the subset to the DefaultSubsets property:

<DefaultSubsets>clr+mono+libs+host+packs</DefaultSubsets>

eng/Versions.props Outdated Show resolved Hide resolved
eng/Versions.props Outdated Show resolved Hide resolved
eng/pipelines/coreclr/templates/build-job.yml Outdated Show resolved Hide resolved
@@ -1,123 +1,125 @@
// Licensed to the .NET Foundation under one or more agreements.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you unify these files with copies under src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/ ?

Copy link
Member

Choose a reason for hiding this comment

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

cc @jkotas

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I gave a shot to this very briefly and the NativeAOT files start to add more dependencies very quickly, so I will leave it as a separate item that can be investigated after the first commit (see #77868).

src/tools/linker/Directory.Build.props Outdated Show resolved Hide resolved
@agocke agocke self-assigned this Nov 7, 2022
@tlakollo
Copy link
Contributor Author

tlakollo commented Nov 8, 2022

I will close this PR to give priority to #78049 which is a newer sync with linker, does not include non functional changes and renames the linker to illink

@tlakollo tlakollo closed this Nov 8, 2022
This was referenced Nov 8, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2022
@tlakollo tlakollo deleted the LinkerIntoRuntimeDiff branch January 16, 2023 05:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants