Skip to content

Commit

Permalink
Remove reference projecs from nearly all OOBs
Browse files Browse the repository at this point in the history
Contributes to dotnet#58163

This is a POC that demonstrates that most out-of-band reference
projects in dotnet/runtime can be deleted. See reasoning in the linked
issue.

The remaining OOBs are more challenging as they are depend on the
PNSE or PartialFacade infrastructure which itself depends on the
reference source / reference assembly:

System.Management (PNSE)
System.Net.Http.WinHttpHandler (PNSE)
System.Reflection.Context (PNSE)
System.Security.Cryptography.Pkcs (Facade)
System.Security.Cryptography.ProtectedData (Facade + PNSE)
System.Security.Cryptography.Xml (Facade)
System.Security.Permissions (Facade)
System.ServiceModel.Syndication (Facade)
System.ServiceProcess.ServiceController (Facade + PNSE)
System.Speech (PNSE)
System.Threading.AccessControl (Facade + PNSE)
System.Windows.Extensions (PNSE)
  • Loading branch information
ViktorHofer committed Mar 2, 2022
1 parent 2330b4b commit d79344f
Show file tree
Hide file tree
Showing 103 changed files with 667 additions and 1,490 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// 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.
// This file is auto-generated and any changes to it will be lost.
// ------------------------------------------------------------------------------

[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.Extensions.DependencyInjection.ServiceCollection))]
20 changes: 20 additions & 0 deletions eng/resolveContract.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<ContractDependencyPaths Condition="'$(ContractDependencyPaths)' == ''">@(ReferencePath->'%(RelativeDir)'->Distinct())</ContractDependencyPaths>
<!-- Fall back to the targeting pack dir for NetCoreAppCurrent to avoid passing through dependencies from ref to src. -->
<ContractDependencyPaths Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', '$(NetCoreAppCurrent)'))">$(ContractDependencyPaths);$(MicrosoftNetCoreAppRefPackRefDir)</ContractDependencyPaths>

<!-- Ignore the .ref.cs file-->
<ReferenceSourceTargetName>$(TargetName).ref.g.cs</ReferenceSourceTargetName>
<!-- Rename to DefaultExcludesInProjectFolder when https://github.com/dotnet/sdk/pull/24063 is merged and consumed. -->
<DefaultItemExcludesInProjectFolder>$(ReferenceSourceTargetName)</DefaultItemExcludesInProjectFolder>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -14,6 +19,21 @@
<GenAPILangVersion Condition="'$(LangVersion)' != ''">$(LangVersion)</GenAPILangVersion>
</PropertyGroup>

<!-- Create a reference source file from the platform agnostic NetCoreAppCurrent assembly and make sure that it isn't treated as a compile input. -->
<PropertyGroup Condition="'$(ProduceReferenceAssembly)' == 'true' and
'$(IsSourceProject)' == 'true' and
'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '$(NETCoreAppCurrentVersion)')) and
'$(TargetFrameworkSuffix)' == '' and
'$(DotNetBuildFromSource)' != 'true'">
<!-- Use a different header and don't feed in an attribute exclusion list. -->
<GenAPITargetPath>$(MSBuildProjectDirectory)\$(ReferenceSourceTargetName)</GenAPITargetPath>
<GenAPIHeaderFile>$(RepositoryEngineeringDir)LicenseHeader.Generated.txt</GenAPIHeaderFile>
<GenAPIExcludeAttributesList />
<GenerateReferenceAssemblySource Condition="'$(GenerateReferenceAssemblySource)' == ''">true</GenerateReferenceAssemblySource>
<TargetsTriggeredByCompilation>$(TargetsTriggeredByCompilation);GenerateReferenceAssemblySource</TargetsTriggeredByCompilation>
</PropertyGroup>

<PropertyGroup Condition="'$(IsSourceProject)' == 'true'">
<ContractProject Condition="'$(ContractProject)' == ''">$(LibrariesProjectRoot)$(MSBuildProjectName)\ref\$(MSBuildProjectName).csproj</ContractProject>
<HasMatchingContract Condition="'$(HasMatchingContract)' == '' and Exists('$(ContractProject)')">true</HasMatchingContract>
Expand Down
3 changes: 2 additions & 1 deletion src/libraries/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@
<PropertyGroup>
<!-- Default any assembly not specifying a key to use the Open Key -->
<StrongNameKeyId>Open</StrongNameKeyId>
<!-- Microsoft.Extensions projects have a separate StrongNameKeyId -->
<!-- Microsoft.Extensions projects have a separate StrongNameKeyId and no dedicated reference project. -->
<StrongNameKeyId Condition="$(MSBuildProjectName.StartsWith('Microsoft.Extensions.'))">MicrosoftAspNetCore</StrongNameKeyId>
<ProduceReferenceAssembly Condition="$(MSBuildProjectName.StartsWith('Microsoft.Extensions.')) and '$(IsSourceProject)' == 'true'">true</ProduceReferenceAssembly>
<!-- We can't generate an apphost without restoring the targeting pack. -->
<UseAppHost>false</UseAppHost>
<EnableDefaultItems>false</EnableDefaultItems>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// 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.
// This file is auto-generated and any changes to it will be lost.
// ------------------------------------------------------------------------------

namespace Microsoft.Extensions.Caching.Distributed
Expand All @@ -22,6 +23,7 @@ public DistributedCacheEntryOptions() { }
public static partial class DistributedCacheExtensions
{
public static string? GetString(this Microsoft.Extensions.Caching.Distributed.IDistributedCache cache, string key) { throw null; }
[System.Diagnostics.DebuggerStepThroughAttribute]
public static System.Threading.Tasks.Task<string?> GetStringAsync(this Microsoft.Extensions.Caching.Distributed.IDistributedCache cache, string key, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) { throw null; }
public static void Set(this Microsoft.Extensions.Caching.Distributed.IDistributedCache cache, string key, byte[] value) { }
public static System.Threading.Tasks.Task SetAsync(this Microsoft.Extensions.Caching.Distributed.IDistributedCache cache, string key, byte[] value, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) { throw null; }
Expand Down Expand Up @@ -60,6 +62,7 @@ public static partial class CacheEntryExtensions
public static partial class CacheExtensions
{
public static object? Get(this Microsoft.Extensions.Caching.Memory.IMemoryCache cache, object key) { throw null; }
[System.Diagnostics.DebuggerStepThroughAttribute]
public static System.Threading.Tasks.Task<TItem?> GetOrCreateAsync<TItem>(this Microsoft.Extensions.Caching.Memory.IMemoryCache cache, object key, System.Func<Microsoft.Extensions.Caching.Memory.ICacheEntry, System.Threading.Tasks.Task<TItem>> factory) { throw null; }
public static TItem? GetOrCreate<TItem>(this Microsoft.Extensions.Caching.Memory.IMemoryCache cache, object key, System.Func<Microsoft.Extensions.Caching.Memory.ICacheEntry, TItem> factory) { throw null; }
public static TItem? Get<TItem>(this Microsoft.Extensions.Caching.Memory.IMemoryCache cache, object key) { throw null; }
Expand Down Expand Up @@ -120,17 +123,17 @@ public partial class MemoryCacheEntryOptions
public MemoryCacheEntryOptions() { }
public System.DateTimeOffset? AbsoluteExpiration { get { throw null; } set { } }
public System.TimeSpan? AbsoluteExpirationRelativeToNow { get { throw null; } set { } }
public System.Collections.Generic.IList<Microsoft.Extensions.Primitives.IChangeToken> ExpirationTokens { get { throw null; } }
public System.Collections.Generic.IList<Microsoft.Extensions.Caching.Memory.PostEvictionCallbackRegistration> PostEvictionCallbacks { get { throw null; } }
public Microsoft.Extensions.Caching.Memory.CacheItemPriority Priority { get { throw null; } set { } }
public System.Collections.Generic.IList<Microsoft.Extensions.Primitives.IChangeToken> ExpirationTokens { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public System.Collections.Generic.IList<Microsoft.Extensions.Caching.Memory.PostEvictionCallbackRegistration> PostEvictionCallbacks { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public Microsoft.Extensions.Caching.Memory.CacheItemPriority Priority { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public long? Size { get { throw null; } set { } }
public System.TimeSpan? SlidingExpiration { get { throw null; } set { } }
}
public partial class PostEvictionCallbackRegistration
{
public PostEvictionCallbackRegistration() { }
public Microsoft.Extensions.Caching.Memory.PostEvictionDelegate? EvictionCallback { get { throw null; } set { } }
public object? State { get { throw null; } set { } }
public Microsoft.Extensions.Caching.Memory.PostEvictionDelegate? EvictionCallback { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public object? State { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public delegate void PostEvictionDelegate(object key, object? value, Microsoft.Extensions.Caching.Memory.EvictionReason reason, object? state);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// 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.
// This file is auto-generated and any changes to it will be lost.
// ------------------------------------------------------------------------------

namespace Microsoft.Extensions.Caching.Distributed
Expand All @@ -27,24 +28,24 @@ public partial class MemoryCache : Microsoft.Extensions.Caching.Memory.IMemoryCa
public MemoryCache(Microsoft.Extensions.Options.IOptions<Microsoft.Extensions.Caching.Memory.MemoryCacheOptions> optionsAccessor) { }
public MemoryCache(Microsoft.Extensions.Options.IOptions<Microsoft.Extensions.Caching.Memory.MemoryCacheOptions> optionsAccessor, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) { }
public int Count { get { throw null; } }
public void Clear() { }
public void Compact(double percentage) { }
public Microsoft.Extensions.Caching.Memory.ICacheEntry CreateEntry(object key) { throw null; }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
~MemoryCache() { }
public void Remove(object key) { }
public bool TryGetValue(object key, out object? result) { throw null; }
public void Clear() { }
}
public partial class MemoryCacheOptions : Microsoft.Extensions.Options.IOptions<Microsoft.Extensions.Caching.Memory.MemoryCacheOptions>
{
public MemoryCacheOptions() { }
public Microsoft.Extensions.Internal.ISystemClock? Clock { get { throw null; } set { } }
public Microsoft.Extensions.Internal.ISystemClock? Clock { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public double CompactionPercentage { get { throw null; } set { } }
public System.TimeSpan ExpirationScanFrequency { get { throw null; } set { } }
public System.TimeSpan ExpirationScanFrequency { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
Microsoft.Extensions.Caching.Memory.MemoryCacheOptions Microsoft.Extensions.Options.IOptions<Microsoft.Extensions.Caching.Memory.MemoryCacheOptions>.Value { get { throw null; } }
public long? SizeLimit { get { throw null; } set { } }
public bool TrackLinkedCacheEntries { get { throw null; } set { } }
public bool TrackLinkedCacheEntries { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public partial class MemoryDistributedCacheOptions : Microsoft.Extensions.Caching.Memory.MemoryCacheOptions
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,50 @@
// 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.
// This file is auto-generated and any changes to it will be lost.
// ------------------------------------------------------------------------------

namespace Microsoft.Extensions.Configuration
{
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct ConfigurationDebugViewContext
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public ConfigurationDebugViewContext(string path, string key, string? value, Microsoft.Extensions.Configuration.IConfigurationProvider configurationProvider) { throw null; }
public Microsoft.Extensions.Configuration.IConfigurationProvider ConfigurationProvider { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public string Key { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public string? Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
public static partial class ConfigurationExtensions
{
public static Microsoft.Extensions.Configuration.IConfigurationBuilder Add<TSource>(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, System.Action<TSource>? configureSource) where TSource : Microsoft.Extensions.Configuration.IConfigurationSource, new() { throw null; }
public static System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string?>> AsEnumerable(this Microsoft.Extensions.Configuration.IConfiguration configuration) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string?>> AsEnumerable(this Microsoft.Extensions.Configuration.IConfiguration configuration, bool makePathsRelative) { throw null; }
public static bool Exists([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] this Microsoft.Extensions.Configuration.IConfigurationSection? section) { throw null; }
public static bool Exists([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] this Microsoft.Extensions.Configuration.IConfigurationSection? section) { throw null; }
public static string? GetConnectionString(this Microsoft.Extensions.Configuration.IConfiguration configuration, string name) { throw null; }
public static Microsoft.Extensions.Configuration.IConfigurationSection GetRequiredSection(this Microsoft.Extensions.Configuration.IConfiguration configuration, string key) { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Property)]
public sealed partial class ConfigurationKeyNameAttribute : System.Attribute
{
public ConfigurationKeyNameAttribute(string name) { }
public string Name { get { throw null; } }
public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
public static partial class ConfigurationPath
{
public static readonly string KeyDelimiter;
public static string Combine(System.Collections.Generic.IEnumerable<string> pathSegments) { throw null; }
public static string Combine(params string[] pathSegments) { throw null; }
public static string? GetParentPath(string? path) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")]
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("path")]
public static string? GetSectionKey(string? path) { throw null; }
}
public static partial class ConfigurationRootExtensions
{
public static string GetDebugView(this Microsoft.Extensions.Configuration.IConfigurationRoot root) { throw null; }
public static string GetDebugView(this IConfigurationRoot root, System.Func<ConfigurationDebugViewContext, string>? processValue) { throw null; }
}
public readonly partial struct ConfigurationDebugViewContext
{
public ConfigurationDebugViewContext(string path, string key, string? value, IConfigurationProvider configurationProvider) { throw null; }
public string Path { get; }
public string Key { get; }
public string? Value { get; }
public IConfigurationProvider ConfigurationProvider { get; }
public static string GetDebugView(this Microsoft.Extensions.Configuration.IConfigurationRoot root, System.Func<Microsoft.Extensions.Configuration.ConfigurationDebugViewContext, string>? processValue) { throw null; }
}
public partial interface IConfiguration
{
Expand Down
Loading

0 comments on commit d79344f

Please sign in to comment.