Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Gocke <angocke@microsoft.com>2022-03-29 22:48:23 +0300
committerGitHub <noreply@github.com>2022-03-29 22:48:23 +0300
commitf83bd449c27e93a8fef94c0522d14164b5e8af99 (patch)
tree8092d33816758f49d29cbec4b08adcf6eb965ccf
parente9cfb5413a6a7a7b5bfc3b9a73671be2b18642cf (diff)
parent01c4f5905959c29f86781b85187bb676fc517ee9 (diff)
Merge pull request #2712 from dotnet/release/6.0.2xx
Merge 6.0.2xx into 6.0.x
-rw-r--r--eng/Version.Details.xml8
-rw-r--r--eng/Versions.props2
-rw-r--r--eng/common/templates/job/execute-sdl.yml69
-rw-r--r--eng/common/templates/jobs/codeql-build.yml2
-rw-r--r--eng/common/templates/jobs/jobs.yml4
-rw-r--r--eng/common/templates/steps/execute-sdl.yml68
-rw-r--r--eng/common/templates/steps/source-build.yml4
-rw-r--r--eng/common/templates/variables/sdl-variables.yml7
-rw-r--r--global.json4
-rw-r--r--src/linker/Linker.Steps/MarkStep.cs50
-rw-r--r--test/Mono.Linker.Tests.Cases/ComponentModel/TypeDescriptionProviderAttributeOnType.cs64
11 files changed, 142 insertions, 140 deletions
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 52ee43aad..f185d51fe 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -3,14 +3,14 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
- <Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.22116.15">
+ <Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.22166.2">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>40eacd2afc9cfd2ba892b5eadb3e728c1008fa38</Sha>
+ <Sha>3c5f86af982adcb2bbd3932b54cd61f5e5888edc</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
- <Dependency Name="Microsoft.DotNet.ApiCompat" Version="6.0.0-beta.22116.15">
+ <Dependency Name="Microsoft.DotNet.ApiCompat" Version="6.0.0-beta.22166.2">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>40eacd2afc9cfd2ba892b5eadb3e728c1008fa38</Sha>
+ <Sha>3c5f86af982adcb2bbd3932b54cd61f5e5888edc</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Sdk.IL" Version="7.0.0-alpha.1.21524.4">
<Uri>https://github.com/dotnet/runtime</Uri>
diff --git a/eng/Versions.props b/eng/Versions.props
index 34e40d879..b96ebe10c 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -18,7 +18,7 @@
<SystemReflectionMetadataVersion>5.0.0</SystemReflectionMetadataVersion>
<MicrosoftBuildFrameworkVersion>17.0.0-preview-21267-01</MicrosoftBuildFrameworkVersion>
<MicrosoftBuildUtilitiesCoreVersion>17.0.0-preview-21267-01</MicrosoftBuildUtilitiesCoreVersion>
- <MicrosoftDotNetApiCompatVersion>6.0.0-beta.22116.15</MicrosoftDotNetApiCompatVersion>
+ <MicrosoftDotNetApiCompatVersion>6.0.0-beta.22166.2</MicrosoftDotNetApiCompatVersion>
<MicrosoftDotNetCodeAnalysisVersion>6.0.0-beta.21271.1</MicrosoftDotNetCodeAnalysisVersion>
<MicrosoftCodeAnalysisCSharpCodeStyleVersion>3.10.0-2.final</MicrosoftCodeAnalysisCSharpCodeStyleVersion>
<MicrosoftCodeAnalysisVersion>3.10.0-2.final</MicrosoftCodeAnalysisVersion>
diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml
index d0a1ea8b0..24cec0424 100644
--- a/eng/common/templates/job/execute-sdl.yml
+++ b/eng/common/templates/job/execute-sdl.yml
@@ -43,14 +43,9 @@ jobs:
value: ${{ parameters.AzDOPipelineId }}
- name: AzDOBuildId
value: ${{ parameters.AzDOBuildId }}
- # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in
- # sync with the packages.config file.
- - name: DefaultGuardianVersion
- value: 0.110.1
+ - template: /eng/common/templates/variables/sdl-variables.yml
- name: GuardianVersion
value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }}
- - name: GuardianPackagesConfigFile
- value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config
pool:
# We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com)
${{ if eq(variables['System.TeamProject'], 'DevDiv') }}:
@@ -126,57 +121,11 @@ jobs:
displayName: Extract Archive Artifacts
continueOnError: ${{ parameters.sdlContinueOnError }}
- - ${{ if ne(parameters.overrideGuardianVersion, '') }}:
- - powershell: |
- $content = Get-Content $(GuardianPackagesConfigFile)
-
- Write-Host "packages.config content was:`n$content"
-
- $content = $content.Replace('$(DefaultGuardianVersion)', '$(GuardianVersion)')
- $content | Set-Content $(GuardianPackagesConfigFile)
-
- Write-Host "packages.config content updated to:`n$content"
- displayName: Use overridden Guardian version ${{ parameters.overrideGuardianVersion }}
-
- - task: NuGetToolInstaller@1
- displayName: 'Install NuGet.exe'
- - task: NuGetCommand@2
- displayName: 'Install Guardian'
- inputs:
- restoreSolution: $(Build.SourcesDirectory)\eng\common\sdl\packages.config
- feedsToUse: config
- nugetConfigPath: $(Build.SourcesDirectory)\eng\common\sdl\NuGet.config
- externalFeedCredentials: GuardianConnect
- restoreDirectory: $(Build.SourcesDirectory)\.packages
-
- - ${{ if ne(parameters.overrideParameters, '') }}:
- - powershell: ${{ parameters.executeAllSdlToolsScript }} ${{ parameters.overrideParameters }}
- displayName: Execute SDL
- continueOnError: ${{ parameters.sdlContinueOnError }}
- - ${{ if eq(parameters.overrideParameters, '') }}:
- - powershell: ${{ parameters.executeAllSdlToolsScript }}
- -GuardianPackageName Microsoft.Guardian.Cli.$(GuardianVersion)
- -NugetPackageDirectory $(Build.SourcesDirectory)\.packages
- -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw)
- ${{ parameters.additionalParameters }}
- displayName: Execute SDL
- continueOnError: ${{ parameters.sdlContinueOnError }}
-
- - ${{ if ne(parameters.publishGuardianDirectoryToPipeline, 'false') }}:
- # We want to publish the Guardian results and configuration for easy diagnosis. However, the
- # '.gdn' dir is a mix of configuration, results, extracted dependencies, and Guardian default
- # tooling files. Some of these files are large and aren't useful during an investigation, so
- # exclude them by simply deleting them before publishing. (As of writing, there is no documented
- # way to selectively exclude a dir from the pipeline artifact publish task.)
- - task: DeleteFiles@1
- displayName: Delete Guardian dependencies to avoid uploading
- inputs:
- SourceFolder: $(Agent.BuildDirectory)/.gdn
- Contents: |
- c
- i
- condition: succeededOrFailed()
- - publish: $(Agent.BuildDirectory)/.gdn
- artifact: GuardianConfiguration
- displayName: Publish GuardianConfiguration
- condition: succeededOrFailed()
+ - template: /eng/common/templates/steps/execute-sdl.yml
+ parameters:
+ overrideGuardianVersion: ${{ parameters.overrideGuardianVersion }}
+ executeAllSdlToolsScript: ${{ parameters.executeAllSdlToolsScript }}
+ overrideParameters: ${{ parameters.overrideParameters }}
+ additionalParameters: ${{ parameters.additionalParameters }}
+ publishGuardianDirectoryToPipeline: ${{ parameters.publishGuardianDirectoryToPipeline }}
+ sdlContinueOnError: ${{ parameters.sdlContinueOnError }}
diff --git a/eng/common/templates/jobs/codeql-build.yml b/eng/common/templates/jobs/codeql-build.yml
index f7dc5ea4a..54c393af4 100644
--- a/eng/common/templates/jobs/codeql-build.yml
+++ b/eng/common/templates/jobs/codeql-build.yml
@@ -21,7 +21,7 @@ jobs:
# The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in
# sync with the packages.config file.
- name: DefaultGuardianVersion
- value: 0.109.0
+ value: 0.110.1
- name: GuardianPackagesConfigFile
value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config
- name: GuardianVersion
diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml
index 70d44735a..554e71cfc 100644
--- a/eng/common/templates/jobs/jobs.yml
+++ b/eng/common/templates/jobs/jobs.yml
@@ -8,10 +8,6 @@ parameters:
# Optional: Enable publishing using release pipelines
enablePublishUsingPipelines: false
- # Optional: Disable component governance detection. In general, component governance
- # should be on for all jobs. Use only in the event of issues.
- disableComponentGovernance: false
-
# Optional: Enable running the source-build jobs to build repo from source
enableSourceBuild: false
diff --git a/eng/common/templates/steps/execute-sdl.yml b/eng/common/templates/steps/execute-sdl.yml
new file mode 100644
index 000000000..7b8ee18a2
--- /dev/null
+++ b/eng/common/templates/steps/execute-sdl.yml
@@ -0,0 +1,68 @@
+parameters:
+ overrideGuardianVersion: ''
+ executeAllSdlToolsScript: ''
+ overrideParameters: ''
+ additionalParameters: ''
+ publishGuardianDirectoryToPipeline: false
+ sdlContinueOnError: false
+ condition: ''
+
+steps:
+- ${{ if ne(parameters.overrideGuardianVersion, '') }}:
+ - powershell: |
+ $content = Get-Content $(GuardianPackagesConfigFile)
+
+ Write-Host "packages.config content was:`n$content"
+
+ $content = $content.Replace('$(DefaultGuardianVersion)', '$(GuardianVersion)')
+ $content | Set-Content $(GuardianPackagesConfigFile)
+
+ Write-Host "packages.config content updated to:`n$content"
+ displayName: Use overridden Guardian version ${{ parameters.overrideGuardianVersion }}
+
+- task: NuGetToolInstaller@1
+ displayName: 'Install NuGet.exe'
+
+- task: NuGetCommand@2
+ displayName: 'Install Guardian'
+ inputs:
+ restoreSolution: $(Build.SourcesDirectory)\eng\common\sdl\packages.config
+ feedsToUse: config
+ nugetConfigPath: $(Build.SourcesDirectory)\eng\common\sdl\NuGet.config
+ externalFeedCredentials: GuardianConnect
+ restoreDirectory: $(Build.SourcesDirectory)\.packages
+
+- ${{ if ne(parameters.overrideParameters, '') }}:
+ - powershell: ${{ parameters.executeAllSdlToolsScript }} ${{ parameters.overrideParameters }}
+ displayName: Execute SDL
+ continueOnError: ${{ parameters.sdlContinueOnError }}
+ condition: ${{ parameters.condition }}
+
+- ${{ if eq(parameters.overrideParameters, '') }}:
+ - powershell: ${{ parameters.executeAllSdlToolsScript }}
+ -GuardianPackageName Microsoft.Guardian.Cli.$(GuardianVersion)
+ -NugetPackageDirectory $(Build.SourcesDirectory)\.packages
+ -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw)
+ ${{ parameters.additionalParameters }}
+ displayName: Execute SDL
+ continueOnError: ${{ parameters.sdlContinueOnError }}
+ condition: ${{ parameters.condition }}
+
+- ${{ if ne(parameters.publishGuardianDirectoryToPipeline, 'false') }}:
+ # We want to publish the Guardian results and configuration for easy diagnosis. However, the
+ # '.gdn' dir is a mix of configuration, results, extracted dependencies, and Guardian default
+ # tooling files. Some of these files are large and aren't useful during an investigation, so
+ # exclude them by simply deleting them before publishing. (As of writing, there is no documented
+ # way to selectively exclude a dir from the pipeline artifact publish task.)
+ - task: DeleteFiles@1
+ displayName: Delete Guardian dependencies to avoid uploading
+ inputs:
+ SourceFolder: $(Agent.BuildDirectory)/.gdn
+ Contents: |
+ c
+ i
+ condition: succeededOrFailed()
+ - publish: $(Agent.BuildDirectory)/.gdn
+ artifact: GuardianConfiguration
+ displayName: Publish GuardianConfiguration
+ condition: succeededOrFailed() \ No newline at end of file
diff --git a/eng/common/templates/steps/source-build.yml b/eng/common/templates/steps/source-build.yml
index ba40dc82f..abb1b2bcd 100644
--- a/eng/common/templates/steps/source-build.yml
+++ b/eng/common/templates/steps/source-build.yml
@@ -43,8 +43,8 @@ steps:
# In that case, add variables to allow the download of internal runtimes if the specified versions are not found
# in the default public locations.
internalRuntimeDownloadArgs=
- if [ '$(dotnetclimsrc-read-sas-token-base64)' != '$''(dotnetclimsrc-read-sas-token-base64)' ]; then
- internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://dotnetclimsrc.blob.core.windows.net/dotnet /p:DotNetRuntimeSourceFeedKey=$(dotnetclimsrc-read-sas-token-base64) --runtimesourcefeed https://dotnetclimsrc.blob.core.windows.net/dotnet --runtimesourcefeedkey $(dotnetclimsrc-read-sas-token-base64)'
+ if [ '$(dotnetbuilds-internal-container-read-token-base64)' != '$''(dotnetbuilds-internal-container-read-token-base64)' ]; then
+ internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64) --runtimesourcefeed https://dotnetbuilds.blob.core.windows.net/internal --runtimesourcefeedkey $(dotnetbuilds-internal-container-read-token-base64)'
fi
buildConfig=Release
diff --git a/eng/common/templates/variables/sdl-variables.yml b/eng/common/templates/variables/sdl-variables.yml
new file mode 100644
index 000000000..1a860bd04
--- /dev/null
+++ b/eng/common/templates/variables/sdl-variables.yml
@@ -0,0 +1,7 @@
+variables:
+# The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in
+# sync with the packages.config file.
+- name: DefaultGuardianVersion
+ value: 0.110.1
+- name: GuardianPackagesConfigFile
+ value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config \ No newline at end of file
diff --git a/global.json b/global.json
index 6ecad1fff..546b417b1 100644
--- a/global.json
+++ b/global.json
@@ -1,9 +1,9 @@
{
"tools": {
- "dotnet": "6.0.101"
+ "dotnet": "6.0.103"
},
"msbuild-sdks": {
- "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.22116.15",
+ "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.22166.2",
"Microsoft.FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0",
"Microsoft.NET.Sdk.IL": "7.0.0-alpha.1.21524.4"
}
diff --git a/src/linker/Linker.Steps/MarkStep.cs b/src/linker/Linker.Steps/MarkStep.cs
index 1d1b95555..621ca734c 100644
--- a/src/linker/Linker.Steps/MarkStep.cs
+++ b/src/linker/Linker.Steps/MarkStep.cs
@@ -819,7 +819,6 @@ namespace Mono.Linker.Steps
continue;
MarkCustomAttribute (ca, reason);
- MarkSpecialCustomAttributeDependencies (ca, provider);
}
}
@@ -1570,7 +1569,6 @@ namespace Mono.Linker.Steps
markOccurred = true;
using (ScopeStack.PushScope (scope)) {
MarkCustomAttribute (customAttribute, reason);
- MarkSpecialCustomAttributeDependencies (customAttribute, provider);
}
}
@@ -2070,30 +2068,10 @@ namespace Mono.Linker.Steps
if (MarkMethodsIf (type.Methods, MethodDefinitionExtensions.IsPublicInstancePropertyMethod, new DependencyInfo (DependencyKind.ReferencedBySpecialAttribute, type)))
Tracer.AddDirectDependency (attribute, new DependencyInfo (DependencyKind.CustomAttribute, type), marked: false);
break;
- case "TypeDescriptionProviderAttribute" when attrType.Namespace == "System.ComponentModel":
- MarkTypeConverterLikeDependency (attribute, l => l.IsDefaultConstructor (), type);
- break;
}
}
}
- //
- // Used for known framework attributes which can be applied to any element
- //
- bool MarkSpecialCustomAttributeDependencies (CustomAttribute ca, ICustomAttributeProvider provider)
- {
- var dt = ca.Constructor.DeclaringType;
- if (dt.Name == "TypeConverterAttribute" && dt.Namespace == "System.ComponentModel") {
- MarkTypeConverterLikeDependency (ca, l =>
- l.IsDefaultConstructor () ||
- l.Parameters.Count == 1 && l.Parameters[0].ParameterType.IsTypeOf ("System", "Type"),
- provider);
- return true;
- }
-
- return false;
- }
-
void MarkMethodSpecialCustomAttributes (MethodDefinition method)
{
if (!method.HasCustomAttributes)
@@ -2116,34 +2094,6 @@ namespace Mono.Linker.Steps
}
}
- protected virtual void MarkTypeConverterLikeDependency (CustomAttribute attribute, Func<MethodDefinition, bool> predicate, ICustomAttributeProvider provider)
- {
- var args = attribute.ConstructorArguments;
- if (args.Count < 1)
- return;
-
- TypeDefinition? typeDefinition = null;
- switch (attribute.ConstructorArguments[0].Value) {
- case string s:
- if (!Context.TypeNameResolver.TryResolveTypeName (s, ScopeStack.CurrentScope.Origin.Provider, out TypeReference? typeRef, out AssemblyDefinition? assemblyDefinition))
- break;
- typeDefinition = Context.TryResolve (typeRef);
- if (typeDefinition != null)
- MarkingHelpers.MarkMatchingExportedType (typeDefinition, assemblyDefinition, new DependencyInfo (DependencyKind.CustomAttribute, provider));
-
- break;
- case TypeReference type:
- typeDefinition = Context.Resolve (type);
- break;
- }
-
- if (typeDefinition == null)
- return;
-
- Tracer.AddDirectDependency (attribute, new DependencyInfo (DependencyKind.CustomAttribute, provider), marked: false);
- MarkMethodsIf (typeDefinition.Methods, predicate, new DependencyInfo (DependencyKind.ReferencedBySpecialAttribute, attribute));
- }
-
static readonly Regex DebuggerDisplayAttributeValueRegex = new Regex ("{[^{}]+}", RegexOptions.Compiled);
void MarkTypeWithDebuggerDisplayAttribute (TypeDefinition type, CustomAttribute attribute)
diff --git a/test/Mono.Linker.Tests.Cases/ComponentModel/TypeDescriptionProviderAttributeOnType.cs b/test/Mono.Linker.Tests.Cases/ComponentModel/TypeDescriptionProviderAttributeOnType.cs
index 07de3e5f8..ca6099f9c 100644
--- a/test/Mono.Linker.Tests.Cases/ComponentModel/TypeDescriptionProviderAttributeOnType.cs
+++ b/test/Mono.Linker.Tests.Cases/ComponentModel/TypeDescriptionProviderAttributeOnType.cs
@@ -1,37 +1,69 @@
+using System;
using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;
+
namespace Mono.Linker.Tests.Cases.ComponentModel
{
- [TypeDescriptionProvider (typeof (CustomTDP))]
-
- [Kept]
- [KeptAttributeAttribute (typeof (TypeDescriptionProviderAttribute))]
- class CustomTypeDescriptionProvider_1
+ [Reference ("System.dll")]
+ [ExpectedNoWarnings]
+ public class TypeDescriptionProviderAttributeOnType
{
- [Kept]
- public CustomTypeDescriptionProvider_1 ()
+ public static void Main ()
{
+ var r1 = new CustomTypeDescriptionProvider_1 ();
+ IInterface v = InterfaceTypeConverter.CreateVisual (typeof (System.String));
}
+ [TypeDescriptionProvider (typeof (CustomTDP))]
[Kept]
- [KeptBaseType (typeof (TypeDescriptionProvider))]
- class CustomTDP : TypeDescriptionProvider
+ [KeptAttributeAttribute (typeof (TypeDescriptionProviderAttribute))]
+ class CustomTypeDescriptionProvider_1
{
[Kept]
- public CustomTDP ()
+ public CustomTypeDescriptionProvider_1 ()
{
}
+
+ [Kept]
+ [KeptBaseType (typeof (TypeDescriptionProvider))]
+ class CustomTDP : TypeDescriptionProvider
+ {
+ [Kept]
+ public CustomTDP ()
+ {
+ }
+ }
}
- }
- [Reference ("System.dll")]
- public class TypeDescriptionProviderAttributeOnType
- {
- public static void Main ()
+ [Kept]
+ [KeptAttributeAttribute (typeof (TypeConverterAttribute))]
+ [TypeConverter (typeof (InterfaceTypeConverter))]
+ public interface IInterface
+ { }
+
+ [Kept]
+ [KeptBaseType (typeof (TypeConverter))]
+ public class InterfaceTypeConverter : TypeConverter
{
- var r1 = new CustomTypeDescriptionProvider_1 ();
+ [Kept]
+ public static IInterface CreateVisual (
+ [KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))]
+ [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
+ Type visualType)
+ {
+ try {
+ return (IInterface) Activator.CreateInstance (visualType);
+ } catch {
+ }
+
+ return null;
+ }
+
+ [Kept]
+ public InterfaceTypeConverter () { }
}
}
}