Skip to content

Commit

Permalink
Remove the use of IsPartialFacadeAssembly in refererences
Browse files Browse the repository at this point in the history
This flag requires assembly-re-writing to replace type-defs in reference
assemblies with type forwards, when the same type exists in references.

We've pretty much exclusively used this on .NETFramework, since it's
not friendly to source build (CCI isn't part of source build).
.NETFramework isn't going to be changing so it doesn't save us much
to generate these typeforwards in the build.

We also used these to make sure the netstandard surface area was
compatible with .NETFramework facades (we'd use the pre-rewritten
reference assemblies for contract), but this need goes away now that we
have package validation based APICompat that compares netstandard refs
to net4x facades.
  • Loading branch information
ericstj committed May 14, 2021
1 parent 5045334 commit 93347f3
Show file tree
Hide file tree
Showing 50 changed files with 1,296 additions and 155 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
<IsPartialFacadeAssembly Condition="$(TargetFramework.StartsWith('net4'))">true</IsPartialFacadeAssembly>
</PropertyGroup>
<ItemGroup>
<Compile Include="Microsoft.Win32.Registry.cs" />
<Compile Condition="'$(TargetFramework)' != 'net461'" Include="Microsoft.Win32.Registry.cs" />
<Compile Condition="'$(TargetFramework)' == 'net461'" Include="Microsoft.Win32.Registry.net461.cs" />
</ItemGroup>
<ItemGroup Condition="!$(TargetFramework.StartsWith('net4'))">
<ItemGroup Condition="'$(TargetFramework)' != 'net461'">
<ProjectReference Include="..\..\System.Security.AccessControl\ref\System.Security.AccessControl.csproj" />
<ProjectReference Include="..\..\System.Security.Principal.Windows\ref\System.Security.Principal.Windows.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// ------------------------------------------------------------------------------
// Changes to this file must follow the https://aka.ms/api-review process.
// ------------------------------------------------------------------------------

using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.RegistryAccessRule))]
[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.RegistryAuditRule))]
[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.RegistryRights))]
[assembly: TypeForwardedTo(typeof(System.Security.AccessControl.RegistrySecurity))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.Registry))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.RegistryHive))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.RegistryKey))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.RegistryKeyPermissionCheck))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.RegistryOptions))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.RegistryValueKind))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.RegistryValueOptions))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.RegistryView))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SafeHandles.SafeRegistryHandle))]
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
<IsPartialFacadeAssembly Condition="$(TargetFramework.StartsWith('net4'))">true</IsPartialFacadeAssembly>
</PropertyGroup>
<ItemGroup>
<Compile Include="Microsoft.Win32.SystemEvents.cs" />
<Compile Condition="'$(TargetFramework)' != 'net461'" Include="Microsoft.Win32.SystemEvents.cs" />
<Compile Condition="'$(TargetFramework)' == 'net461'" Include="Microsoft.Win32.SystemEvents.Forwards.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// ------------------------------------------------------------------------------
// Changes to this file must follow the https://aka.ms/api-review process.
// ------------------------------------------------------------------------------

using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(Microsoft.Win32.PowerModeChangedEventArgs))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.PowerModeChangedEventHandler))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.PowerModes))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SessionEndedEventArgs))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SessionEndedEventHandler))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SessionEndingEventArgs))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SessionEndingEventHandler))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SessionEndReasons))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SessionSwitchEventArgs))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SessionSwitchEventHandler))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SessionSwitchReason))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.SystemEvents))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.TimerElapsedEventArgs))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.TimerElapsedEventHandler))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.UserPreferenceCategory))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.UserPreferenceChangedEventArgs))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.UserPreferenceChangedEventHandler))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.UserPreferenceChangingEventArgs))]
[assembly: TypeForwardedTo(typeof(Microsoft.Win32.UserPreferenceChangingEventHandler))]
9 changes: 3 additions & 6 deletions src/libraries/System.CodeDom/ref/System.CodeDom.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
<IsPartialFacadeAssembly Condition="$(TargetFramework.StartsWith('net4'))">true</IsPartialFacadeAssembly>
</PropertyGroup>
<ItemGroup>
<Compile Include="System.CodeDom.cs" />
<Compile Condition="'$(TargetFramework)' != 'net461'" Include="System.CodeDom.cs" />
<Compile Condition="'$(TargetFramework)' == 'net461'" Include="System.CodeDom.net461.cs" />
</ItemGroup>
<ItemGroup Condition="!$(TargetFramework.StartsWith('net4'))">
<ItemGroup Condition="'$(TargetFramework)' != 'net461'">
<ProjectReference Include="..\..\System.Security.Permissions\ref\System.Security.Permissions.csproj" />
</ItemGroup>
</Project>
113 changes: 113 additions & 0 deletions src/libraries/System.CodeDom/ref/System.CodeDom.net461.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// ------------------------------------------------------------------------------
// Changes to this file must follow the https://aka.ms/api-review process.
// ------------------------------------------------------------------------------

using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeArgumentReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeArrayCreateExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeArrayIndexerExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeAssignStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeAttachEventStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeAttributeArgument))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeAttributeArgumentCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeAttributeDeclaration))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeAttributeDeclarationCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeBaseReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeBinaryOperatorExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeBinaryOperatorType))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeCastExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeCatchClause))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeCatchClauseCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeChecksumPragma))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeComment))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeCommentStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeCommentStatementCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeCompileUnit))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeConditionStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeConstructor))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeDefaultValueExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeDelegateCreateExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeDelegateInvokeExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeDirectionExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeDirective))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeDirectiveCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeEntryPointMethod))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeEventReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeExpressionCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeExpressionStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeFieldReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeGotoStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeIndexerExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeIterationStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeLabeledStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeLinePragma))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeMemberEvent))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeMemberField))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeMemberMethod))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeMemberProperty))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeMethodInvokeExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeMethodReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeMethodReturnStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeNamespace))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeNamespaceCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeNamespaceImport))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeNamespaceImportCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeObject))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeObjectCreateExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeParameterDeclarationExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeParameterDeclarationExpressionCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodePrimitiveExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodePropertyReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodePropertySetValueReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeRegionDirective))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeRegionMode))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeRemoveEventStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeSnippetCompileUnit))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeSnippetExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeSnippetStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeSnippetTypeMember))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeStatementCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeThisReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeThrowExceptionStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTryCatchFinallyStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeConstructor))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeDeclaration))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeDeclarationCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeDelegate))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeMember))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeMemberCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeOfExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeParameter))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeParameterCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeReference))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeReferenceCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeTypeReferenceOptions))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeVariableDeclarationStatement))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.CodeVariableReferenceExpression))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.FieldDirection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.MemberAttributes))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CodeCompiler))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CodeDomProvider))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CodeGenerator))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CodeGeneratorOptions))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CodeParser))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CompilerError))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CompilerErrorCollection))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CompilerInfo))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CompilerParameters))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.CompilerResults))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.Executor))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.GeneratorSupport))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.ICodeCompiler))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.ICodeGenerator))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.ICodeParser))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.LanguageOptions))]
[assembly: TypeForwardedTo(typeof(System.CodeDom.Compiler.TempFileCollection))]
[assembly: TypeForwardedTo(typeof(Microsoft.VisualBasic.VBCodeProvider))]
[assembly: TypeForwardedTo(typeof(Microsoft.CSharp.CSharpCodeProvider))]
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<NoWarn>$(NoWarn);CS0618</NoWarn>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
<IsPartialFacadeAssembly Condition="$(TargetFramework.StartsWith('net4'))">true</IsPartialFacadeAssembly>
</PropertyGroup>
<ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net461'">
<Compile Include="System.Configuration.ConfigurationManager.cs" />
<Compile Include="$(CommonPath)System\Obsoletions.cs" Link="Common\System\Obsoletions.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<Compile Include="System.Configuration.ConfigurationManager.net461.cs" />
<Reference Include="System.Configuration" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Security.Permissions\ref\System.Security.Permissions.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' == 'true'">
<Reference Include="System.Configuration" />
</ItemGroup>
</Project>
Loading

0 comments on commit 93347f3

Please sign in to comment.