Skip to content

Commit

Permalink
[WIP] Port GenFacades, Microsft.Cci.Extensions to Arcade (#477)
Browse files Browse the repository at this point in the history
* Port GenFacade to Arcade

* Convert jsons into csprojs

* Move files to correct directories, fix errors

* Fix naming

* Microsoft.Cci.Extensions -> Microsoft.DotNet.Cci.Extensions

* Change csproj name

* use Microsoft.Cci where needed & add to SignToolData

* Microsoft.DotNet.Cci.Extensions -> Microsoft.Cci.Extensions

* Add netstandard2.0 to cci.extensions

* Spacing

* Fix mismatched property tag

* Add notsupported.targets & remove NoWarn from .csproj

* Remove dnxcore50, add NoWarn back

* Remove net461 & Disable Implicit AssetTargetFallback

* Bump System.Diag.Contracts to 4.3.0

* Don't port GenFacades.exe, fix overflow

* Add overflow fix to FileVersion as well

* Resolve conflicts

* Address feedback
  • Loading branch information
wtgodbe committed Sep 12, 2018
1 parent 37570bb commit 04f4b34
Show file tree
Hide file tree
Showing 117 changed files with 13,107 additions and 64 deletions.
28 changes: 28 additions & 0 deletions Arcade.sln
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.SignTool.T
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.ApiPagination", "src\Maestro\Microsoft.AspNetCore.ApiPagination\Microsoft.AspNetCore.ApiPagination.csproj", "{01C47D1E-5EBD-484A-B317-B8FC86707E6E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.GenFacades", "src\Microsoft.DotNet.GenFacades\Microsoft.DotNet.GenFacades.csproj", "{B6778A84-3330-4F2E-9D26-316C78A4BCC2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Cci.Extensions", "src\Microsoft.Cci.Extensions\Microsoft.Cci.Extensions.csproj", "{BCBFB7E1-B202-4C88-AB9F-290B13F309FD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -438,6 +442,30 @@ Global
{01C47D1E-5EBD-484A-B317-B8FC86707E6E}.Release|x64.Build.0 = Release|Any CPU
{01C47D1E-5EBD-484A-B317-B8FC86707E6E}.Release|x86.ActiveCfg = Release|Any CPU
{01C47D1E-5EBD-484A-B317-B8FC86707E6E}.Release|x86.Build.0 = Release|Any CPU
{B6778A84-3330-4F2E-9D26-316C78A4BCC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B6778A84-3330-4F2E-9D26-316C78A4BCC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B6778A84-3330-4F2E-9D26-316C78A4BCC2}.Debug|x64.ActiveCfg = Debug|Any CPU
{B6778A84-3330-4F2E-9D26-316C78A4BCC2}.Debug|x64.Build.0 = Debug|Any CPU
{B6778A84-3330-4F2E-9D26-316C78A4BCC2}.Debug|x86.ActiveCfg = Debug|Any CPU
{B6778A84-3330-4F2E-9D26-316C78A4BCC2}.Debug|x86.Build.0 = Debug|Any CPU
{B6778A84-3330-4F2E-9D26-316C78A4BCC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B6778A84-3330-4F2E-9D26-316C78A4BCC2}.Release|Any CPU.Build.0 = Release|Any CPU
{B6778A84-3330-4F2E-9D26-316C78A4BCC2}.Release|x64.ActiveCfg = Release|Any CPU
{B6778A84-3330-4F2E-9D26-316C78A4BCC2}.Release|x64.Build.0 = Release|Any CPU
{B6778A84-3330-4F2E-9D26-316C78A4BCC2}.Release|x86.ActiveCfg = Release|Any CPU
{B6778A84-3330-4F2E-9D26-316C78A4BCC2}.Release|x86.Build.0 = Release|Any CPU
{BCBFB7E1-B202-4C88-AB9F-290B13F309FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BCBFB7E1-B202-4C88-AB9F-290B13F309FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCBFB7E1-B202-4C88-AB9F-290B13F309FD}.Debug|x64.ActiveCfg = Debug|Any CPU
{BCBFB7E1-B202-4C88-AB9F-290B13F309FD}.Debug|x64.Build.0 = Debug|Any CPU
{BCBFB7E1-B202-4C88-AB9F-290B13F309FD}.Debug|x86.ActiveCfg = Debug|Any CPU
{BCBFB7E1-B202-4C88-AB9F-290B13F309FD}.Debug|x86.Build.0 = Debug|Any CPU
{BCBFB7E1-B202-4C88-AB9F-290B13F309FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BCBFB7E1-B202-4C88-AB9F-290B13F309FD}.Release|Any CPU.Build.0 = Release|Any CPU
{BCBFB7E1-B202-4C88-AB9F-290B13F309FD}.Release|x64.ActiveCfg = Release|Any CPU
{BCBFB7E1-B202-4C88-AB9F-290B13F309FD}.Release|x64.Build.0 = Release|Any CPU
{BCBFB7E1-B202-4C88-AB9F-290B13F309FD}.Release|x86.ActiveCfg = Release|Any CPU
{BCBFB7E1-B202-4C88-AB9F-290B13F309FD}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
117 changes: 60 additions & 57 deletions eng/Versions.props
Original file line number Diff line number Diff line change
@@ -1,59 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<!-- This repo version -->
<VersionPrefix>1.0.0</VersionPrefix>
<PreReleaseVersionLabel>beta</PreReleaseVersionLabel>
<!-- Opt-out repo features -->
<UsingToolXliff>false</UsingToolXliff>
<UsingToolNetFrameworkReferenceAssemblies>true</UsingToolNetFrameworkReferenceAssemblies>
<MicrosoftNetFrameworkReferenceAssembliesVersion>1.0.0-alpha-004</MicrosoftNetFrameworkReferenceAssembliesVersion>
<!-- Libs -->
<CommandLineParserVersion>2.2.1</CommandLineParserVersion>
<CredentialManagementVersion>1.0.2</CredentialManagementVersion>
<LibGit2SharpVersion>0.25.2</LibGit2SharpVersion>
<log4netVersion>2.0.8</log4netVersion>
<SystemNetHttpVersion>4.3.3</SystemNetHttpVersion>
<MicrosoftBuildVersion>15.7.179</MicrosoftBuildVersion>
<MicrosoftBuildFrameworkVersion>15.7.179</MicrosoftBuildFrameworkVersion>
<MicrosoftBuildTasksCoreVersion>15.7.179</MicrosoftBuildTasksCoreVersion>
<MicrosoftBuildUtilitiesCoreVersion>15.7.179</MicrosoftBuildUtilitiesCoreVersion>
<MicrosoftDotNetVersionToolsVersion>2.2.0-preview1-02815-01</MicrosoftDotNetVersionToolsVersion>
<MicrosoftIdentityModelClientsActiveDirectoryVersion>3.19.8</MicrosoftIdentityModelClientsActiveDirectoryVersion>
<MicrosoftRestClientRuntimeVersion>3.0.3</MicrosoftRestClientRuntimeVersion>
<MicrosoftExtensionsFileSystemGlobbingVersion>2.0.0</MicrosoftExtensionsFileSystemGlobbingVersion>
<MicrosoftNetTestSdkVersion>15.7.2</MicrosoftNetTestSdkVersion>
<MoqVersion>4.8.3</MoqVersion>
<NewtonsoftJsonVersion>9.0.1</NewtonsoftJsonVersion>
<NuGetVersioningVersion>4.4.0</NuGetVersioningVersion>
<OctokitVersion>0.30.0</OctokitVersion>
<DotNetSleetLibVersion>2.2.73</DotNetSleetLibVersion>
<SystemCollectionsImmutableVersion>1.3.1</SystemCollectionsImmutableVersion>
<SystemIOCompressionVersion>4.3.0</SystemIOCompressionVersion>
<SystemIOPackagingVersion>4.5.0</SystemIOPackagingVersion>
<SystemIOFileSystemPrimitivesVersion>4.3.0</SystemIOFileSystemPrimitivesVersion>
<SystemReflectionMetadataVersion>1.4.2</SystemReflectionMetadataVersion>
<SystemValueTupleVersion>4.4.0</SystemValueTupleVersion>
<WindowsAzureStorageVersion>8.5.0</WindowsAzureStorageVersion>
<XUnitVersion>2.4.1-pre.build.4059</XUnitVersion>
<XUnitVSRunnerVersion>2.4.1-pre.build.4059</XUnitVSRunnerVersion>
<!-- 3rd Part Packages Public Keys -->
<DynamicProxyGenAsm2Key>0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7</DynamicProxyGenAsm2Key>
</PropertyGroup>
<PropertyGroup>
<MicrosoftAzureDocumentDBVersion>1.22.0</MicrosoftAzureDocumentDBVersion>
<MicrosoftAzureCosmosDBTableVersion>1.1.2</MicrosoftAzureCosmosDBTableVersion>
</PropertyGroup>
<PropertyGroup>
<MicrosoftAspNetCoreAllVersion>2.0.0</MicrosoftAspNetCoreAllVersion>
<MicrosoftDotNetGitHubIssueLabelerAssetsVersion>1.2.0</MicrosoftDotNetGitHubIssueLabelerAssetsVersion>
<MicrosoftMLVersion>0.4.0</MicrosoftMLVersion>
<MicrosoftVisualStudioWebCodeGenerationDesignVersion>2.0.4</MicrosoftVisualStudioWebCodeGenerationDesignVersion>
</PropertyGroup>
<PropertyGroup>
<RestoreSources>
$(RestoreSources);
https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
</RestoreSources>
</PropertyGroup>
<Project>
<PropertyGroup>
<!-- This repo version -->
<VersionPrefix>1.0.0</VersionPrefix>
<PreReleaseVersionLabel>beta</PreReleaseVersionLabel>
<!-- Opt-out repo features -->
<UsingToolXliff>false</UsingToolXliff>
<UsingToolNetFrameworkReferenceAssemblies>true</UsingToolNetFrameworkReferenceAssemblies>
<MicrosoftNetFrameworkReferenceAssembliesVersion>1.0.0-alpha-004</MicrosoftNetFrameworkReferenceAssembliesVersion>
<!-- Libs -->
<CommandLineParserVersion>2.2.1</CommandLineParserVersion>
<CredentialManagementVersion>1.0.2</CredentialManagementVersion>
<LibGit2SharpVersion>0.25.2</LibGit2SharpVersion>
<log4netVersion>2.0.8</log4netVersion>
<SystemNetHttpVersion>4.3.3</SystemNetHttpVersion>
<MicrosoftBuildVersion>15.7.179</MicrosoftBuildVersion>
<MicrosoftBuildFrameworkVersion>15.7.179</MicrosoftBuildFrameworkVersion>
<MicrosoftBuildTasksCoreVersion>15.7.179</MicrosoftBuildTasksCoreVersion>
<MicrosoftBuildUtilitiesCoreVersion>15.7.179</MicrosoftBuildUtilitiesCoreVersion>
<MicrosoftDotNetVersionToolsVersion>2.2.0-preview1-02815-01</MicrosoftDotNetVersionToolsVersion>
<MicrosoftIdentityModelClientsActiveDirectoryVersion>3.19.8</MicrosoftIdentityModelClientsActiveDirectoryVersion>
<MicrosoftRestClientRuntimeVersion>3.0.3</MicrosoftRestClientRuntimeVersion>
<MicrosoftExtensionsFileSystemGlobbingVersion>2.0.0</MicrosoftExtensionsFileSystemGlobbingVersion>
<MicrosoftNetTestSdkVersion>15.7.2</MicrosoftNetTestSdkVersion>
<MoqVersion>4.8.3</MoqVersion>
<NewtonsoftJsonVersion>9.0.1</NewtonsoftJsonVersion>
<NuGetVersioningVersion>4.4.0</NuGetVersioningVersion>
<OctokitVersion>0.30.0</OctokitVersion>
<DotNetSleetLibVersion>2.2.73</DotNetSleetLibVersion>
<SystemCollectionsImmutableVersion>1.3.1</SystemCollectionsImmutableVersion>
<SystemIOCompressionVersion>4.3.0</SystemIOCompressionVersion>
<SystemIOPackagingVersion>4.5.0</SystemIOPackagingVersion>
<SystemIOFileSystemPrimitivesVersion>4.3.0</SystemIOFileSystemPrimitivesVersion>
<SystemReflectionMetadataVersion>1.4.2</SystemReflectionMetadataVersion>
<SystemValueTupleVersion>4.4.0</SystemValueTupleVersion>
<WindowsAzureStorageVersion>8.5.0</WindowsAzureStorageVersion>
<XUnitVersion>2.4.1-pre.build.4059</XUnitVersion>
<XUnitVSRunnerVersion>2.4.1-pre.build.4059</XUnitVSRunnerVersion>
<!-- 3rd Part Packages Public Keys -->
<DynamicProxyGenAsm2Key>0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7</DynamicProxyGenAsm2Key>
</PropertyGroup>
<PropertyGroup>
<MicrosoftAzureDocumentDBVersion>1.22.0</MicrosoftAzureDocumentDBVersion>
<MicrosoftAzureCosmosDBTableVersion>1.1.2</MicrosoftAzureCosmosDBTableVersion>
</PropertyGroup>
<PropertyGroup>
<MicrosoftAspNetCoreAllVersion>2.0.0</MicrosoftAspNetCoreAllVersion>
<MicrosoftDotNetGitHubIssueLabelerAssetsVersion>1.2.0</MicrosoftDotNetGitHubIssueLabelerAssetsVersion>
<MicrosoftMLVersion>0.4.0</MicrosoftMLVersion>
<MicrosoftVisualStudioWebCodeGenerationDesignVersion>2.0.4</MicrosoftVisualStudioWebCodeGenerationDesignVersion>
<MicrosoftDiaSymReaderConverterVersion>1.1.0-beta1-62810-01</MicrosoftDiaSymReaderConverterVersion>
</PropertyGroup>
<PropertyGroup>
<RestoreSources>
$(RestoreSources);
https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
https://dotnet.myget.org/F/symreader-converter/api/v3/index.json;
https:%2F%2Fdotnet.myget.org/F/symreader/api/v3/index.json
</RestoreSources>
</PropertyGroup>
</Project>
14 changes: 7 additions & 7 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"tools": {
"dotnet": "2.1.400-preview-009088"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18461.2"
}
{
"tools": {
"dotnet": "2.1.400-preview-009088"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18461.2"
}
}
159 changes: 159 additions & 0 deletions src/Microsoft.Cci.Extensions/Comparers/ApiComparer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
// 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.

using System;
using System.Collections.Generic;

using Microsoft.Cci.Extensions;

namespace Microsoft.Cci.Comparers
{
public sealed class ApiComparer<T> : IComparer<T>
{
private readonly Func<T, ApiKind> _kindProvider;
private readonly Func<T, string> _nameProvider;

public ApiComparer(Func<T, ApiKind> kindProvider, Func<T, string> nameProvider)
{
_kindProvider = kindProvider;
_nameProvider = nameProvider;
}

public int Compare(T x, T y)
{
var kindX = _kindProvider(x);
var kindY = _kindProvider(y);
var kindComparison = CompareKind(kindX, kindY);
if (kindComparison != 0)
return kindComparison;

var nameX = _nameProvider(x);
var nameY = _nameProvider(y);
if (kindX == ApiKind.Namespace && kindY == ApiKind.Namespace)
return CompareQualifiedNamespaceNames(nameX, nameY);

return CompareNames(nameX, nameY);
}

private static int CompareKind(ApiKind x, ApiKind y)
{
var xKindOrder = GetKindOrder(x);
var yKindOrder = GetKindOrder(y);
return xKindOrder.CompareTo(yKindOrder);
}

private static int CompareNames(string x, string y)
{
var xNonGenericName = GetNonGenericName(x);
var yNonGenericName = GetNonGenericName(y);

var nameComparison = StringComparer.OrdinalIgnoreCase.Compare(xNonGenericName, yNonGenericName);
if (nameComparison != 0)
return nameComparison;

return x.Length.CompareTo(y.Length);
}

private static int CompareQualifiedNamespaceNames(string nameX, string nameY)
{
string beforeFirstDotX;
string afterFirstDotX;
SplitAtFirstDot(nameX, out beforeFirstDotX, out afterFirstDotX);

string beforeFirstDotY;
string afterFirstDotY;
SplitAtFirstDot(nameY, out beforeFirstDotY, out afterFirstDotY);

var firstComparison = CompareNamespaceNames(beforeFirstDotX, beforeFirstDotY);
if (firstComparison != 0)
return firstComparison;

return StringComparer.OrdinalIgnoreCase.Compare(nameX, nameY);
}

private static int CompareNamespaceNames(string nameX, string nameY)
{
var orderX = GetNamspaceOrder(nameX);
var orderY = GetNamspaceOrder(nameY);

var comparison = orderX.CompareTo(orderY);
if (comparison != 0)
return comparison;

return StringComparer.OrdinalIgnoreCase.Compare(nameX, nameY);
}

private static int GetKindOrder(ApiKind kind)
{
switch (kind)
{
// Namespace -- no order
case ApiKind.Namespace:
return 0;

// Types -- no order between types
case ApiKind.Interface:
case ApiKind.Delegate:
case ApiKind.Enum:
case ApiKind.Struct:
case ApiKind.Class:
return 1;

// Members
case ApiKind.EnumField:
case ApiKind.Field:
return 2;
case ApiKind.Constructor:
return 3;
case ApiKind.Property:
return 4;
case ApiKind.Method:
case ApiKind.PropertyAccessor:
case ApiKind.EventAccessor:
case ApiKind.DelegateMember:
return 5;
case ApiKind.Event:
return 6;
default:
throw new ArgumentOutOfRangeException("kind");
}
}

private static int GetNamspaceOrder(string name)
{
switch (name)
{
case "System":
return 0;
case "Microsoft":
return 1;
case "Windows":
return 2;
default:
return 3;
}
}

private static string GetNonGenericName(string name)
{
var i = name.IndexOf("<", StringComparison.OrdinalIgnoreCase);
return i > -1 ? name.Substring(0, i) : name;
}

private static void SplitAtFirstDot(string qualifiedName, out string beforeFirstDot, out string afterFirstDot)
{
var firstDot = qualifiedName.IndexOf('.');
if (firstDot < 0)
{
beforeFirstDot = qualifiedName;
afterFirstDot = string.Empty;
}
else
{
beforeFirstDot = qualifiedName.Substring(0, firstDot);
afterFirstDot = qualifiedName.Substring(firstDot + 1);
}
}
}
}
31 changes: 31 additions & 0 deletions src/Microsoft.Cci.Extensions/Comparers/AttributeComparer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// 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.

using System;
using Microsoft.Cci.Extensions;
using Microsoft.Cci.Filters;
using Microsoft.Cci.Writers.CSharp;

namespace Microsoft.Cci.Comparers
{
public class AttributeComparer : StringKeyComparer<ICustomAttribute>
{
private readonly CSDeclarationHelper _helper;

public AttributeComparer()
: this(new IncludeAllFilter(), false)
{
}

public AttributeComparer(ICciFilter filter, bool forCompilation)
{
_helper = new CSDeclarationHelper(filter, forCompilation);
}

public override string GetKey(ICustomAttribute c)
{
return _helper.GetString(c);
}
}
}
Loading

0 comments on commit 04f4b34

Please sign in to comment.