Skip to content

Commit

Permalink
Remove NS1.x assets from build and packaging
Browse files Browse the repository at this point in the history
These ten projects still built for netstandard1.x. This PR
trims out these assets from both the build which also results
in them not being packaged anymore as there is no harvesting
mechanism in the repository anymore.

Suppressing the package warnings for the intentionally dropped
assets and cleaning up conditions in the project file as well.

For more details please see the reasoning in the linked issue.

Contributes to dotnet#53282
  • Loading branch information
ViktorHofer committed May 26, 2021
1 parent 5f7ba2b commit cb24239
Show file tree
Hide file tree
Showing 85 changed files with 152 additions and 2,026 deletions.
8 changes: 0 additions & 8 deletions src/libraries/Common/src/System/CodeDom/CodeObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,9 @@
using System.Collections;
using System.Collections.Specialized;

#if !FEATURE_SERIALIZATION
namespace System.CodeDom
#else
namespace System.Runtime.Serialization
#endif
{
#if !FEATURE_SERIALIZATION
public class CodeObject
#else
internal class CodeObject
#endif
{
private IDictionary? _userData;

Expand Down
20 changes: 0 additions & 20 deletions src/libraries/Common/src/System/CodeDom/CodeTypeReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,16 @@
using System.Diagnostics;
using System.Globalization;

#if !FEATURE_SERIALIZATION
namespace System.CodeDom
#else
namespace System.Runtime.Serialization
#endif
{
[Flags]
#if !FEATURE_SERIALIZATION
public enum CodeTypeReferenceOptions
#else
internal enum CodeTypeReferenceOptions
#endif
{
GlobalReference = 0x00000001,
GenericTypeParameter = 0x00000002
}

#if !FEATURE_SERIALIZATION
public class CodeTypeReference : CodeObject
#else
internal sealed class CodeTypeReference : CodeObject
#endif
{
private string? _baseType;
private readonly bool _isInterface;
Expand Down Expand Up @@ -281,14 +269,6 @@ public CodeTypeReference(string typeName, params CodeTypeReference[] typeArgumen
}
}

#if !FEATURE_SERIALIZATION
public CodeTypeReference(CodeTypeParameter typeParameter) :
this(typeParameter?.Name)
{
Options = CodeTypeReferenceOptions.GenericTypeParameter;
}
#endif

public CodeTypeReference(string baseType, int rank)
{
_baseType = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,9 @@

using System.Collections;

#if !FEATURE_SERIALIZATION
namespace System.CodeDom
#else
namespace System.Runtime.Serialization
#endif
{
#if !FEATURE_SERIALIZATION
public class CodeTypeReferenceCollection : CollectionBase
#else
internal sealed class CodeTypeReferenceCollection : CollectionBase
#endif
{
public CodeTypeReferenceCollection() { }

Expand Down
2 changes: 1 addition & 1 deletion src/libraries/Common/src/System/HexConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Cas
#endif
public static unsafe string ToString(ReadOnlySpan<byte> bytes, Casing casing = Casing.Upper)
{
#if NETFRAMEWORK || NETSTANDARD1_0 || NETSTANDARD1_3 || NETSTANDARD2_0
#if NETFRAMEWORK || NETSTANDARD2_0
Span<char> result = stackalloc char[0];
if (bytes.Length > 16)
{
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/Common/src/System/SR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace System
{
internal static partial class SR
{
#if (!NETSTANDARD1_0 && !NETSTANDARD1_1 && !NET45) // AppContext is not supported on < NetStandard1.3 or < .NET Framework 4.5
#if !NET45 // AppContext is not supported on < .NET Framework 4.5
private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out bool usingResourceKeys) ? usingResourceKeys : false;
#endif

Expand All @@ -17,7 +17,7 @@ internal static partial class SR
// Native code generators can replace the value this returns based on user input at the time of native code generation.
// The Linker is also capable of replacing the value of this method when the application is being trimmed.
private static bool UsingResourceKeys() =>
#if (!NETSTANDARD1_0 && !NETSTANDARD1_1 && !NET45) // AppContext is not supported on < NetStandard1.3 or < .NET Framework 4.5
#if !NET45 // AppContext is not supported on < .NET Framework 4.5
s_usingResourceKeys;
#else
false;
Expand Down
12 changes: 4 additions & 8 deletions src/libraries/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,10 @@
</ItemGroup>
</Target>

<!-- Adds Nullable annotation attributes to netstandard <= 2.0 builds -->
<Choose>
<When Condition="'$(Nullable)' != '' and ($(TargetFramework.StartsWith('netstandard1')) or '$(TargetFramework)' == 'netstandard2.0' or $(TargetFramework.StartsWith('netcoreapp2')) or '$(TargetFrameworkIdentifier)' == '.NETFramework')">
<ItemGroup>
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\NullableAttributes.cs" Link="System\Diagnostics\CodeAnalysis\NullableAttributes.cs" />
</ItemGroup>
</When>
</Choose>
<!-- Adds Nullable annotation attributes to < .NET 5 builds. -->
<ItemGroup Condition="'$(Nullable)' != '' and !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net5.0'))">
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\NullableAttributes.cs" Link="System\Diagnostics\CodeAnalysis\NullableAttributes.cs" />
</ItemGroup>

<PropertyGroup>
<ExcludeFromPackage Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', '$(NetCoreAppCurrent)')) and '$(ExcludeCurrentNetCoreAppFromPackage)' == 'true'">true</ExcludeFromPackage>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<Project Sdk="Microsoft.Build.NoTargets">
<!-- Even though this project doesn't compile, we keep the csproj extension so that the source
package infra globs for .cs files. -->
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<!-- The project doesn't compile anything therefore create the package during build. -->
<GeneratePackageOnBuild Condition="'$(BuildingAnOfficialBuildLeg)' != 'true'">true</GeneratePackageOnBuild>
<IsShipping>false</IsShipping>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<!-- This is a source package which includes all .cs files by default. -->
<IsSourcePackage>true</IsSourcePackage>
<!-- This is non-shipping package. -->
<EnablePackageBaselineValidation>false</EnablePackageBaselineValidation>
<PackageDescription>Internal package for sharing Microsoft.Extensions.Hosting.HostFactoryResolver type.</PackageDescription>
</PropertyGroup>

<ItemGroup>
<Content Include="*.cs" PackagePath="contentFiles/cs/netstandard1.0/%(FileName)%(Extension)" BuildAction="Compile" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" />
<ItemGroup>
<ProjectReference Include="..\src\System.Collections.Immutable.csproj">
<SupportedFramework>net45;netcore45;netcoreapp1.0;wp8;wpa81;$(AllXamarinFrameworks)</SupportedFramework>
<SupportedFramework>net461;netcoreapp2.0;uap10.0.16299;$(AllXamarinFrameworks)</SupportedFramework>
</ProjectReference>

<!-- Since UAP and .NETCoreApp are package based we still want to enable
Expand All @@ -13,6 +13,9 @@
<ValidatePackageSuppression Include="TreatAsOutOfBox">
<Value>.NETCoreApp;UAP</Value>
</ValidatePackageSuppression>

<!-- Exclude TFMs that aren't supported by the package anymore from validation. -->
<ExcludeHarvestedSupportedFramework Include="netcoreapp1.0;netcoreapp1.1;netcore45;netcore451;netcore50;uap10.0;net45;net451;net46;wp8;wpa81" />
</ItemGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,8 @@ public static partial class ImmutableArray
public System.Collections.Immutable.ImmutableArray<T> Add(T item) { throw null; }
public System.Collections.Immutable.ImmutableArray<T> AddRange(System.Collections.Generic.IEnumerable<T> items) { throw null; }
public System.Collections.Immutable.ImmutableArray<T> AddRange(System.Collections.Immutable.ImmutableArray<T> items) { throw null; }
#if !NETSTANDARD1_0
public System.ReadOnlyMemory<T> AsMemory() { throw null; }
public System.ReadOnlySpan<T> AsSpan() { throw null; }
#endif
public System.Collections.Immutable.ImmutableArray<
#nullable disable
TOther
Expand Down Expand Up @@ -154,9 +152,7 @@ public void CopyTo(T[] destination, int destinationIndex) { }
public System.Collections.Immutable.ImmutableArray<T> Insert(int index, T item) { throw null; }
public System.Collections.Immutable.ImmutableArray<T> InsertRange(int index, System.Collections.Generic.IEnumerable<T> items) { throw null; }
public System.Collections.Immutable.ImmutableArray<T> InsertRange(int index, System.Collections.Immutable.ImmutableArray<T> items) { throw null; }
#if !NETSTANDARD1_0
public ref readonly T ItemRef(int index) { throw null; }
#endif
public int LastIndexOf(T item) { throw null; }
public int LastIndexOf(T item, int startIndex) { throw null; }
public int LastIndexOf(T item, int startIndex, int count) { throw null; }
Expand Down Expand Up @@ -239,9 +235,7 @@ public void CopyTo(T[] array, int index) { }
public int IndexOf(T item, int startIndex, int count) { throw null; }
public int IndexOf(T item, int startIndex, int count, System.Collections.Generic.IEqualityComparer<T>? equalityComparer) { throw null; }
public void Insert(int index, T item) { }
#if !NETSTANDARD1_0
public ref readonly T ItemRef(int index) { throw null; }
#endif
public int LastIndexOf(T item) { throw null; }
public int LastIndexOf(T item, int startIndex) { throw null; }
public int LastIndexOf(T item, int startIndex, int count) { throw null; }
Expand Down Expand Up @@ -423,7 +417,7 @@ public static partial class ImmutableHashSet
public static System.Collections.Immutable.ImmutableHashSet<TSource> ToImmutableHashSet<TSource>(this System.Collections.Immutable.ImmutableHashSet<TSource>.Builder builder) { throw null; }
}

#if !NETSTANDARD1_0 && !NETSTANDARD1_3 && !NETSTANDARD2_0 && !NETFRAMEWORK
#if !NETSTANDARD2_0 && !NETFRAMEWORK
public sealed partial class ImmutableHashSet<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.ISet<T>, System.Collections.Generic.IReadOnlySet<T>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.Immutable.IImmutableSet<T>
#else
public sealed partial class ImmutableHashSet<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.ISet<T>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.Immutable.IImmutableSet<T>
Expand Down Expand Up @@ -598,9 +592,7 @@ public void ForEach(System.Action<T> action) { }
public int IndexOf(T item, int index, int count, System.Collections.Generic.IEqualityComparer<T>? equalityComparer) { throw null; }
public System.Collections.Immutable.ImmutableList<T> Insert(int index, T item) { throw null; }
public System.Collections.Immutable.ImmutableList<T> InsertRange(int index, System.Collections.Generic.IEnumerable<T> items) { throw null; }
#if !NETSTANDARD1_0
public ref readonly T ItemRef(int index) { throw null; }
#endif
public int LastIndexOf(T item, int index, int count, System.Collections.Generic.IEqualityComparer<T>? equalityComparer) { throw null; }
public System.Collections.Immutable.ImmutableList<T> Remove(T value) { throw null; }
public System.Collections.Immutable.ImmutableList<T> Remove(T value, System.Collections.Generic.IEqualityComparer<T>? equalityComparer) { throw null; }
Expand Down Expand Up @@ -688,9 +680,7 @@ public void ForEach(System.Action<T> action) { }
public int IndexOf(T item, int index, int count, System.Collections.Generic.IEqualityComparer<T>? equalityComparer) { throw null; }
public void Insert(int index, T item) { }
public void InsertRange(int index, System.Collections.Generic.IEnumerable<T> items) { }
#if !NETSTANDARD1_0
public ref readonly T ItemRef(int index) { throw null; }
#endif
public int LastIndexOf(T item) { throw null; }
public int LastIndexOf(T item, int startIndex) { throw null; }
public int LastIndexOf(T item, int startIndex, int count) { throw null; }
Expand Down Expand Up @@ -747,9 +737,7 @@ internal ImmutableQueue() { }
public System.Collections.Immutable.ImmutableQueue<T> Enqueue(T value) { throw null; }
public System.Collections.Immutable.ImmutableQueue<T>.Enumerator GetEnumerator() { throw null; }
public T Peek() { throw null; }
#if !NETSTANDARD1_0
public ref readonly T PeekRef() { throw null; }
#endif
System.Collections.Generic.IEnumerator<T> System.Collections.Generic.IEnumerable<T>.GetEnumerator() { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
System.Collections.Immutable.IImmutableQueue<T> System.Collections.Immutable.IImmutableQueue<T>.Clear() { throw null; }
Expand Down Expand Up @@ -840,9 +828,7 @@ void System.Collections.IDictionary.Remove(object key) { }
public System.Collections.Immutable.ImmutableSortedDictionary<TKey, TValue>.Builder ToBuilder() { throw null; }
public bool TryGetKey(TKey equalKey, out TKey actualKey) { throw null; }
public bool TryGetValue(TKey key, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue value) { throw null; }
#if !NETSTANDARD1_0
public ref readonly TValue ValueRef(TKey key) { throw null; }
#endif
public System.Collections.Immutable.ImmutableSortedDictionary<TKey, TValue> WithComparers(System.Collections.Generic.IComparer<TKey>? keyComparer) { throw null; }
public System.Collections.Immutable.ImmutableSortedDictionary<TKey, TValue> WithComparers(System.Collections.Generic.IComparer<TKey>? keyComparer, System.Collections.Generic.IEqualityComparer<TValue>? valueComparer) { throw null; }
public sealed partial class Builder : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IDictionary<TKey, TValue>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>, System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable
Expand Down Expand Up @@ -888,9 +874,7 @@ void System.Collections.IDictionary.Remove(object key) { }
public System.Collections.Immutable.ImmutableSortedDictionary<TKey, TValue> ToImmutable() { throw null; }
public bool TryGetKey(TKey equalKey, out TKey actualKey) { throw null; }
public bool TryGetValue(TKey key, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue value) { throw null; }
#if !NETSTANDARD1_0
public ref readonly TValue ValueRef(TKey key) { throw null; }
#endif
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
public partial struct Enumerator : System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.IEnumerator, System.IDisposable
Expand Down Expand Up @@ -921,11 +905,11 @@ public static partial class ImmutableSortedSet
public static System.Collections.Immutable.ImmutableSortedSet<TSource> ToImmutableSortedSet<TSource>(this System.Collections.Immutable.ImmutableSortedSet<TSource>.Builder builder) { throw null; }
}

#if !NETSTANDARD1_0 && !NETSTANDARD1_3 && !NETSTANDARD2_0 && !NETFRAMEWORK
#if !NETSTANDARD2_0 && !NETFRAMEWORK
public sealed partial class ImmutableSortedSet<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T>, System.Collections.Generic.ISet<T>, System.Collections.Generic.IReadOnlySet<T>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.Collections.Immutable.IImmutableSet<T>
#else
#else
public sealed partial class ImmutableSortedSet<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T>, System.Collections.Generic.ISet<T>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.Collections.Immutable.IImmutableSet<T>
#endif
#endif
{
internal ImmutableSortedSet() { }
public static readonly System.Collections.Immutable.ImmutableSortedSet<T> Empty;
Expand Down Expand Up @@ -953,9 +937,7 @@ internal ImmutableSortedSet() { }
public bool IsProperSupersetOf(System.Collections.Generic.IEnumerable<T> other) { throw null; }
public bool IsSubsetOf(System.Collections.Generic.IEnumerable<T> other) { throw null; }
public bool IsSupersetOf(System.Collections.Generic.IEnumerable<T> other) { throw null; }
#if !NETSTANDARD1_0
public ref readonly T ItemRef(int index) { throw null; }
#endif
public bool Overlaps(System.Collections.Generic.IEnumerable<T> other) { throw null; }
public System.Collections.Immutable.ImmutableSortedSet<T> Remove(T value) { throw null; }
public System.Collections.Generic.IEnumerable<T> Reverse() { throw null; }
Expand Down Expand Up @@ -1014,9 +996,7 @@ public void IntersectWith(System.Collections.Generic.IEnumerable<T> other) { }
public bool IsProperSupersetOf(System.Collections.Generic.IEnumerable<T> other) { throw null; }
public bool IsSubsetOf(System.Collections.Generic.IEnumerable<T> other) { throw null; }
public bool IsSupersetOf(System.Collections.Generic.IEnumerable<T> other) { throw null; }
#if !NETSTANDARD1_0
public ref readonly T ItemRef(int index) { throw null; }
#endif
public bool Overlaps(System.Collections.Generic.IEnumerable<T> other) { throw null; }
public bool Remove(T item) { throw null; }
public System.Collections.Generic.IEnumerable<T> Reverse() { throw null; }
Expand Down Expand Up @@ -1059,9 +1039,7 @@ internal ImmutableStack() { }
public System.Collections.Immutable.ImmutableStack<T> Clear() { throw null; }
public System.Collections.Immutable.ImmutableStack<T>.Enumerator GetEnumerator() { throw null; }
public T Peek() { throw null; }
#if !NETSTANDARD1_0
public ref readonly T PeekRef() { throw null; }
#endif
public System.Collections.Immutable.ImmutableStack<T> Pop() { throw null; }
public System.Collections.Immutable.ImmutableStack<T> Pop(out T value) { throw null; }
public System.Collections.Immutable.ImmutableStack<T> Push(T value) { throw null; }
Expand Down
Loading

0 comments on commit cb24239

Please sign in to comment.