From 15faf2bb50196b09e2d396b816bd2756aec1cd47 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Fri, 3 May 2019 18:10:02 -0500 Subject: [PATCH] Implement External Access APIs for Apex --- ...ronousOperationListenerProviderAccessor.cs | 27 +++++++++++++++++++ ...ronousOperationListenerProviderAccessor.cs | 12 +++++++++ ...ft.CodeAnalysis.ExternalAccess.Apex.csproj | 1 + .../Microsoft.CodeAnalysis.Workspaces.csproj | 1 + 4 files changed, 41 insertions(+) create mode 100644 src/Tools/ExternalAccess/Apex/ApexAsynchronousOperationListenerProviderAccessor.cs create mode 100644 src/Tools/ExternalAccess/Apex/IApexAsynchronousOperationListenerProviderAccessor.cs diff --git a/src/Tools/ExternalAccess/Apex/ApexAsynchronousOperationListenerProviderAccessor.cs b/src/Tools/ExternalAccess/Apex/ApexAsynchronousOperationListenerProviderAccessor.cs new file mode 100644 index 00000000000..7f34b78baf5 --- /dev/null +++ b/src/Tools/ExternalAccess/Apex/ApexAsynchronousOperationListenerProviderAccessor.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Composition; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Shared.TestHooks; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Apex +{ + [Export(typeof(IApexAsynchronousOperationListenerProviderAccessor))] + [Shared] + internal sealed class ApexAsynchronousOperationListenerProviderAccessor : IApexAsynchronousOperationListenerProviderAccessor + { + private readonly AsynchronousOperationListenerProvider _implementation; + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public ApexAsynchronousOperationListenerProviderAccessor(AsynchronousOperationListenerProvider implementation) + { + _implementation = implementation; + } + + public Task WaitAllAsync(string[] featureNames = null, Action eventProcessingAction = null) + => _implementation.WaitAllAsync(featureNames, eventProcessingAction); + } +} diff --git a/src/Tools/ExternalAccess/Apex/IApexAsynchronousOperationListenerProviderAccessor.cs b/src/Tools/ExternalAccess/Apex/IApexAsynchronousOperationListenerProviderAccessor.cs new file mode 100644 index 00000000000..f4b0196d6a7 --- /dev/null +++ b/src/Tools/ExternalAccess/Apex/IApexAsynchronousOperationListenerProviderAccessor.cs @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Threading.Tasks; + +namespace Microsoft.CodeAnalysis.ExternalAccess.Apex +{ + internal interface IApexAsynchronousOperationListenerProviderAccessor + { + Task WaitAllAsync(string[] featureNames = null, Action eventProcessingAction = null); + } +} diff --git a/src/Tools/ExternalAccess/Apex/Microsoft.CodeAnalysis.ExternalAccess.Apex.csproj b/src/Tools/ExternalAccess/Apex/Microsoft.CodeAnalysis.ExternalAccess.Apex.csproj index 7e026f514c6..fe376f49a34 100644 --- a/src/Tools/ExternalAccess/Apex/Microsoft.CodeAnalysis.ExternalAccess.Apex.csproj +++ b/src/Tools/ExternalAccess/Apex/Microsoft.CodeAnalysis.ExternalAccess.Apex.csproj @@ -24,6 +24,7 @@ + diff --git a/src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj b/src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj index 81014c875cd..04de51d5f96 100644 --- a/src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj +++ b/src/Workspaces/Core/Portable/Microsoft.CodeAnalysis.Workspaces.csproj @@ -232,6 +232,7 @@ + -- GitLab