Skip to content

Commit

Permalink
Setup build/pkg on Microsoft.Extensions.Primitives
Browse files Browse the repository at this point in the history
- Fix ref/src build on supported frameworks
- Use GenerateReferenceSource to properly set ref APIs
- Enable tests
- Add packaging setup
  • Loading branch information
maryamariyan committed Mar 2, 2020
1 parent e631031 commit 2220437
Show file tree
Hide file tree
Showing 15 changed files with 121 additions and 265 deletions.
7 changes: 6 additions & 1 deletion src/libraries/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@
<Import Project="..\..\Directory.Build.props" />

<ItemGroup>
<PortedExtensionsProject Include="$(MSBuildThisFileDirectory)Microsoft.Extensions.Primitives\ref\**\*csproj" />
<PortedExtensionsProject Include="$(MSBuildThisFileDirectory)Microsoft.Extensions.Primitives\src\**\*csproj" />
<PortedExtensionsProject Include="$(MSBuildThisFileDirectory)Microsoft.Extensions.Primitives\tests\**\*csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)*\ref\**\Microsoft.Extensions.*proj" Exclude="@(PortedExtensionsProject)" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)*\src\**\Microsoft.Extensions.*proj" Exclude="@(PortedExtensionsProject)" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)*\tests\**\Microsoft.Extensions.*.Tests.csproj" Exclude="@(PortedExtensionsProject)" />
</ItemGroup>

<PropertyGroup Condition="$(MSBuildProjectName.StartsWith('Microsoft.Extensions.')) and !$(MSBuildProjectName.EndsWith('.Tests'))">
<PropertyGroup Condition="$(MSBuildProjectName.StartsWith('Microsoft.Extensions.'))">
<StrongNameKeyId>MicrosoftAspNetCore</StrongNameKeyId>
<IsAspNetCoreApp>true</IsAspNetCoreApp>
<!-- Temporarily ignore nit warning/errors (e.g. extra whitespace) from Extensions projects -->
<NoWarn Condition="!$(MSBuildProjectName.EndsWith('.Tests'))">$(NoWarn);SA1129;SA1028;SA1027;SA1121;CA1200</NoWarn>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project DefaultTargets="Build">
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" />
<ItemGroup>
<ProjectReference Include="..\src\Microsoft.Extensions.Primitives.csproj">
<SupportedFramework>net461;netcoreapp2.0;uap10.0.16299;$(AllXamarinFrameworks)</SupportedFramework>
</ProjectReference>
</ItemGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// ------------------------------------------------------------------------------
// Changes to this file must follow the https://aka.ms/api-review process.
// ------------------------------------------------------------------------------

namespace Microsoft.Extensions.Primitives
{
public partial class CancellationChangeToken : Microsoft.Extensions.Primitives.IChangeToken
{
public CancellationChangeToken(System.Threading.CancellationToken cancellationToken) { }
public bool ActiveChangeCallbacks { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public bool ActiveChangeCallbacks { get { throw null; } }
public bool HasChanged { get { throw null; } }
public System.IDisposable RegisterChangeCallback(System.Action<object> callback, object state) { throw null; }
}
Expand All @@ -19,8 +22,8 @@ public static partial class ChangeToken
public partial class CompositeChangeToken : Microsoft.Extensions.Primitives.IChangeToken
{
public CompositeChangeToken(System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.Primitives.IChangeToken> changeTokens) { }
public bool ActiveChangeCallbacks { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.Primitives.IChangeToken> ChangeTokens { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public bool ActiveChangeCallbacks { get { throw null; } }
public System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.Primitives.IChangeToken> ChangeTokens { get { throw null; } }
public bool HasChanged { get { throw null; } }
public System.IDisposable RegisterChangeCallback(System.Action<object> callback, object state) { throw null; }
}
Expand All @@ -34,52 +37,48 @@ public partial interface IChangeToken
bool HasChanged { get; }
System.IDisposable RegisterChangeCallback(System.Action<object> callback, object state);
}
[System.Diagnostics.DebuggerDisplayAttribute("Value = {_value}")]
[System.ObsoleteAttribute("This type is obsolete and will be removed in a future version.")]
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct InplaceStringBuilder
{
private object _dummy;
private int _dummyPrimitive;
public InplaceStringBuilder(int capacity) { throw null; }
public int Capacity { get { throw null; } set { } }
public void Append(Microsoft.Extensions.Primitives.StringSegment segment) { }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void Append(char c) { }
public void Append(char c) { }
public void Append(string value) { }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void Append(string value, int offset, int count) { }
public void Append(string value, int offset, int count) { }
public override string ToString() { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct StringSegment : System.IEquatable<Microsoft.Extensions.Primitives.StringSegment>, System.IEquatable<string>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public static readonly Microsoft.Extensions.Primitives.StringSegment Empty;
public StringSegment(string buffer) { throw null; }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public StringSegment(string buffer, int offset, int length) { throw null; }
public string Buffer { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public StringSegment(string buffer, int offset, int length) { throw null; }
public string Buffer { get { throw null; } }
public bool HasValue { get { throw null; } }
public char this[int index] { get { throw null; } }
public int Length { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public int Offset { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public int Length { get { throw null; } }
public int Offset { get { throw null; } }
public string Value { get { throw null; } }
public System.ReadOnlyMemory<char> AsMemory() { throw null; }
public System.ReadOnlySpan<char> AsSpan() { throw null; }
public static int Compare(Microsoft.Extensions.Primitives.StringSegment a, Microsoft.Extensions.Primitives.StringSegment b, System.StringComparison comparisonType) { throw null; }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool EndsWith(string text, System.StringComparison comparisonType) { throw null; }
public bool EndsWith(string text, System.StringComparison comparisonType) { throw null; }
public bool Equals(Microsoft.Extensions.Primitives.StringSegment other) { throw null; }
public static bool Equals(Microsoft.Extensions.Primitives.StringSegment a, Microsoft.Extensions.Primitives.StringSegment b, System.StringComparison comparisonType) { throw null; }
public bool Equals(Microsoft.Extensions.Primitives.StringSegment other, System.StringComparison comparisonType) { throw null; }
public override bool Equals(object obj) { throw null; }
public bool Equals(string text) { throw null; }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool Equals(string text, System.StringComparison comparisonType) { throw null; }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public override int GetHashCode() { throw null; }
public bool Equals(string text, System.StringComparison comparisonType) { throw null; }
public override int GetHashCode() { throw null; }
public int IndexOf(char c) { throw null; }
public int IndexOf(char c, int start) { throw null; }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public int IndexOf(char c, int start, int count) { throw null; }
public int IndexOf(char c, int start, int count) { throw null; }
public int IndexOfAny(char[] anyOf) { throw null; }
public int IndexOfAny(char[] anyOf, int startIndex) { throw null; }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public int IndexOfAny(char[] anyOf, int startIndex, int count) { throw null; }
public int IndexOfAny(char[] anyOf, int startIndex, int count) { throw null; }
public static bool IsNullOrEmpty(Microsoft.Extensions.Primitives.StringSegment value) { throw null; }
public int LastIndexOf(char value) { throw null; }
public static bool operator ==(Microsoft.Extensions.Primitives.StringSegment left, Microsoft.Extensions.Primitives.StringSegment right) { throw null; }
Expand All @@ -88,11 +87,11 @@ public void Append(string value) { }
public static implicit operator Microsoft.Extensions.Primitives.StringSegment (string value) { throw null; }
public static bool operator !=(Microsoft.Extensions.Primitives.StringSegment left, Microsoft.Extensions.Primitives.StringSegment right) { throw null; }
public Microsoft.Extensions.Primitives.StringTokenizer Split(char[] chars) { throw null; }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool StartsWith(string text, System.StringComparison comparisonType) { throw null; }
public bool StartsWith(string text, System.StringComparison comparisonType) { throw null; }
public Microsoft.Extensions.Primitives.StringSegment Subsegment(int offset) { throw null; }
public Microsoft.Extensions.Primitives.StringSegment Subsegment(int offset, int length) { throw null; }
public string Substring(int offset) { throw null; }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public string Substring(int offset, int length) { throw null; }
public string Substring(int offset, int length) { throw null; }
public override string ToString() { throw null; }
public Microsoft.Extensions.Primitives.StringSegment Trim() { throw null; }
public Microsoft.Extensions.Primitives.StringSegment TrimEnd() { throw null; }
Expand All @@ -101,13 +100,12 @@ public void Append(string value) { }
public partial class StringSegmentComparer : System.Collections.Generic.IComparer<Microsoft.Extensions.Primitives.StringSegment>, System.Collections.Generic.IEqualityComparer<Microsoft.Extensions.Primitives.StringSegment>
{
internal StringSegmentComparer() { }
public static Microsoft.Extensions.Primitives.StringSegmentComparer Ordinal { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public static Microsoft.Extensions.Primitives.StringSegmentComparer OrdinalIgnoreCase { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public static Microsoft.Extensions.Primitives.StringSegmentComparer Ordinal { get { throw null; } }
public static Microsoft.Extensions.Primitives.StringSegmentComparer OrdinalIgnoreCase { get { throw null; } }
public int Compare(Microsoft.Extensions.Primitives.StringSegment x, Microsoft.Extensions.Primitives.StringSegment y) { throw null; }
public bool Equals(Microsoft.Extensions.Primitives.StringSegment x, Microsoft.Extensions.Primitives.StringSegment y) { throw null; }
public int GetHashCode(Microsoft.Extensions.Primitives.StringSegment obj) { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct StringTokenizer : System.Collections.Generic.IEnumerable<Microsoft.Extensions.Primitives.StringSegment>, System.Collections.IEnumerable
{
private readonly object _dummy;
Expand All @@ -117,29 +115,27 @@ internal StringSegmentComparer() { }
public Microsoft.Extensions.Primitives.StringTokenizer.Enumerator GetEnumerator() { throw null; }
System.Collections.Generic.IEnumerator<Microsoft.Extensions.Primitives.StringSegment> System.Collections.Generic.IEnumerable<Microsoft.Extensions.Primitives.StringSegment>.GetEnumerator() { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct Enumerator : System.Collections.Generic.IEnumerator<Microsoft.Extensions.Primitives.StringSegment>, System.Collections.IEnumerator, System.IDisposable
{
private object _dummy;
private int _dummyPrimitive;
public Enumerator(ref Microsoft.Extensions.Primitives.StringTokenizer tokenizer) { throw null; }
public Microsoft.Extensions.Primitives.StringSegment Current { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public readonly Microsoft.Extensions.Primitives.StringSegment Current { get { throw null; } }
object System.Collections.IEnumerator.Current { get { throw null; } }
public void Dispose() { }
public bool MoveNext() { throw null; }
public void Reset() { }
}
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct StringValues : System.Collections.Generic.ICollection<string>, System.Collections.Generic.IEnumerable<string>, System.Collections.Generic.IList<string>, System.Collections.Generic.IReadOnlyCollection<string>, System.Collections.Generic.IReadOnlyList<string>, System.Collections.IEnumerable, System.IEquatable<Microsoft.Extensions.Primitives.StringValues>, System.IEquatable<string>, System.IEquatable<string[]>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public static readonly Microsoft.Extensions.Primitives.StringValues Empty;
public StringValues(string value) { throw null; }
public StringValues(string[] values) { throw null; }
public int Count { [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]get { throw null; } }
public string this[int index] { [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]get { throw null; } }
public int Count { get { throw null; } }
public string this[int index] { get { throw null; } }
bool System.Collections.Generic.ICollection<System.String>.IsReadOnly { get { throw null; } }
string System.Collections.Generic.IList<System.String>.this[int index] { get { throw null; } set { } }
public static Microsoft.Extensions.Primitives.StringValues Concat(Microsoft.Extensions.Primitives.StringValues values1, Microsoft.Extensions.Primitives.StringValues values2) { throw null; }
Expand Down Expand Up @@ -187,7 +183,6 @@ public void Reset() { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
public string[] ToArray() { throw null; }
public override string ToString() { throw null; }
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct Enumerator : System.Collections.Generic.IEnumerator<string>, System.Collections.IEnumerator, System.IDisposable
{
private object _dummy;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
<!-- This file is automatically generated. -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;$(DefaultNetCoreTargetFramework)</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<Compile Include="Microsoft.Extensions.Primitives.netstandard2.0.cs" />
<Reference Include="System.Memory" />
<Reference Include="System.Runtime.CompilerServices.Unsafe" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)'">
<Compile Include="Microsoft.Extensions.Primitives.netcoreapp.cs" />

<ItemGroup>
<Compile Include="Microsoft.Extensions.Primitives.cs" />
</ItemGroup>
</Project>
Loading

0 comments on commit 2220437

Please sign in to comment.