Skip to content

Commit 84bb59a

Browse files
PublicApiGenerator script and current report
1 parent 8e0b232 commit 84bb59a

File tree

270 files changed

+18140
-3106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

270 files changed

+18140
-3106
lines changed

src/NuGet.Config renamed to NuGet.Config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
<configuration>
33
<packageSources>
44
<add key="Nuget" value="https://api.nuget.org/v3/index.json" />
5+
<add key="UiPath-Internal" value="https://uipath.pkgs.visualstudio.com/Public.Feeds/_packaging/UiPath-Internal/nuget/v3/index.json" />
56
</packageSources>
67
</configuration>

src/CI/azp-dotnet-dist.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ steps:
1616

1717
- task: DotNetCoreCLI@2
1818
displayName: 'dotnet push to UiPath-Internal'
19-
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
19+
condition: succeeded()
2020
inputs:
2121
command: push
2222
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
2323
publishVstsFeed: 'Public.Feeds/UiPath-Internal'
2424

2525
- task: PublishSymbols@2
2626
displayName: 'Publish Symbols to UiPath Azure Artifacts Symbol Server'
27-
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
27+
condition: succeeded()
2828
inputs:
2929
symbolsFolder: $(Build.SourcesDirectory)
3030
searchPattern: '**/UiPath.CoreIpc/bin/**/UiPath.CoreIpc.pdb'

src/CI/azp-dotnet.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
steps:
2+
- task: DotNetCoreCLI@2
3+
displayName: '$(Label_DotNet) Restore, build and pack'
4+
inputs:
5+
projects: '$(DotNet_SessionSolution)'
6+
arguments: '--configuration $(DotNet_BuildConfiguration) -p:Version="$(FullVersion)" -p:DefineConstantsEx="CI"'
7+
28
- task: DotNetCoreCLI@2
39
displayName: '$(Label_DotNet) Run unit tests'
410
inputs:

src/CI/azp-initialization.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
steps:
2+
# Runtime version should match with SDK version.
3+
# The runtime should be the one that is contained in SDK.
4+
# https://dotnet.microsoft.com/en-us/download/dotnet/6.0
5+
- powershell: |
6+
Write-Host "##vso[task.setvariable variable=DotnetRuntimeVersion;]8.0.8"
7+
Write-Host "##vso[task.setvariable variable=DOTNET_NOLOGO;]true"
8+
displayName: 'Use .NET Runtime 8.0.8'
9+
10+
- task: UseDotNet@2
11+
displayName: 'Use .NET SDK 6.0.317'
12+
inputs:
13+
packageType: 'sdk'
14+
version: '6.0.317'
15+
16+
- task: UseDotNet@2
17+
displayName: 'Use .NET SDK 8.0.400'
18+
inputs:
19+
packageType: 'sdk'
20+
version: 8.0.400
221

322
# Read $(Version) from the UiPath.CoreIpc.csproj file
423
- powershell: |

src/CI/azp-nodejs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
inputs:
4949
workingDirectory: $(NodeJS_ProjectPath)
5050
script: 'npm test'
51-
51+
5252
- task: PublishTestResults@2
5353
displayName: 'Publish Web Test Results'
5454
condition: succeededOrFailed()

src/CI/azp-start.yaml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ variables:
1010
DotNet_MainProjectName: 'UiPath.CoreIpc'
1111
DotNet_MainProjectPath: './src/UiPath.CoreIpc/UiPath.CoreIpc.csproj'
1212
DotNet_ArtifactName: 'NuGet package'
13-
13+
1414
NodeJS_DotNet_BuildConfiguration: 'Debug'
1515
NodeJS_ProjectPath: './src/Clients/js'
1616
NodeJS_ArchivePath: './src/Clients/js/dist/pack/nodejs.zip'
@@ -23,32 +23,32 @@ stages:
2323
- stage: Build
2424
displayName: '🏭 Build'
2525
jobs:
26-
# The following 3 jobs will run in parallel:
27-
- job:
28-
displayName: '.NET on Windows'
29-
pool:
26+
# The following 3 jobs will run in parallel:
27+
- job:
28+
displayName: '.NET on Windows'
29+
pool:
3030
vmImage: 'windows-2022'
31-
steps:
32-
- template: azp-initialization.yaml
33-
- template: azp-dotnet.yaml
34-
- template: azp-dotnet-dist.yaml
35-
36-
- job:
37-
displayName: 'node.js on Windows'
38-
pool:
31+
steps:
32+
- template: azp-initialization.yaml
33+
- template: azp-dotnet.yaml
34+
- template: azp-dotnet-dist.yaml
35+
36+
- job:
37+
displayName: 'node.js on Windows'
38+
pool:
3939
vmImage: 'windows-2022'
40-
steps:
41-
- template: azp-initialization.yaml
42-
- template: azp-nodejs.yaml
43-
- template: azp-nodejs-dist.yaml
44-
45-
- job:
46-
displayName: 'node.js on Ubuntu'
47-
pool:
48-
vmImage: 'ubuntu-20.04'
49-
steps:
50-
- template: azp-initialization.yaml
51-
- template: azp-nodejs.yaml
40+
steps:
41+
- template: azp-initialization.yaml
42+
- template: azp-nodejs.yaml
43+
- template: azp-nodejs-dist.yaml
44+
45+
- job:
46+
displayName: 'node.js on Ubuntu'
47+
pool:
48+
vmImage: 'ubuntu-20.04'
49+
steps:
50+
- template: azp-initialization.yaml
51+
- template: azp-nodejs.yaml
5252

5353
- stage: Publish
5454
displayName: 🚚 Publish

src/Clients/js/dotnet/UiPath.CoreIpc.NodeInterop.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.30320.27
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.10.35027.167
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UiPath.CoreIpc.NodeInterop", "UiPath.CoreIpc.NodeInterop\UiPath.CoreIpc.NodeInterop.csproj", "{B514D2A2-B8ED-4A2A-BDE7-42F74A316FBE}"
77
EndProject

src/Clients/js/dotnet/UiPath.CoreIpc.NodeInterop/Contracts.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Threading;
33
using System.Threading.Tasks;
44

5-
namespace UiPath.CoreIpc.NodeInterop;
5+
namespace UiPath.Ipc.NodeInterop;
66

77
internal static class Contracts
88
{

src/Clients/js/dotnet/UiPath.CoreIpc.NodeInterop/Program.cs

Lines changed: 88 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
using System.Net.WebSockets;
88
using System.Threading;
99
using System.Threading.Tasks;
10-
using UiPath.CoreIpc.NamedPipe;
11-
using UiPath.CoreIpc.WebSockets;
10+
using UiPath.Ipc.Transport.NamedPipe;
11+
using UiPath.Ipc.Transport.WebSocket;
1212

13-
namespace UiPath.CoreIpc.NodeInterop;
13+
namespace UiPath.Ipc.NodeInterop;
1414

1515
using static Contracts;
1616
using static ServiceImpls;
1717
using static Signalling;
18+
using static UiPath.Ipc.NodeInterop.Extensions;
1819

1920
class Program
2021
{
@@ -61,6 +62,11 @@ static async Task<int> Main(
6162

6263
static async Task MainCore(string? pipeName, string? webSocketUrl, int? maybeSecondsPowerOnDelay)
6364
{
65+
if (pipeName is null && webSocketUrl is null)
66+
{
67+
throw new ArgumentException($"At least one of {nameof(pipeName)} or {nameof(webSocketUrl)} must be specified.");
68+
}
69+
6470
if (maybeSecondsPowerOnDelay is { } secondsPowerOnDelay)
6571
{
6672
await Task.Delay(TimeSpan.FromSeconds(secondsPowerOnDelay));
@@ -71,34 +77,41 @@ static async Task MainCore(string? pipeName, string? webSocketUrl, int? maybeSec
7177

7278
var sp = services
7379
.AddLogging()
74-
.AddIpc()
7580
.AddSingleton<IAlgebra, Algebra>()
7681
.AddSingleton<ICalculus, Calculus>()
7782
.AddSingleton<IBrittleService, BrittleService>()
7883
.AddSingleton<IEnvironmentVariableGetter, EnvironmentVariableGetter>()
7984
.AddSingleton<IDtoService, DtoService>()
8085
.BuildServiceProvider();
8186

82-
var serviceHost = new ServiceHostBuilder(sp)
83-
.UseNamedPipesAndOrWebSockets(pipeName, webSocketUrl)
84-
.AddEndpoint<IAlgebra, IArithmetic>()
85-
.AddEndpoint<ICalculus>()
86-
.AddEndpoint<IBrittleService>()
87-
.AddEndpoint<IEnvironmentVariableGetter>()
88-
.AddEndpoint<IDtoService>()
89-
.Build();
90-
9187
var thread = new AsyncContextThread();
9288
thread.Context.SynchronizationContext.Send(_ => Thread.CurrentThread.Name = "GuiThread", null);
93-
var sched = thread.Context.Scheduler;
89+
var scheduler = thread.Context.Scheduler;
90+
91+
var ipcServer = new IpcServer()
92+
{
93+
Endpoints = new()
94+
{
95+
typeof(IAlgebra),
96+
typeof(ICalculus),
97+
typeof(IBrittleService),
98+
typeof(IEnvironmentVariableGetter),
99+
typeof(IDtoService)
100+
},
101+
Listeners = [
102+
..EnumerateListeners(pipeName, webSocketUrl)
103+
],
104+
ServiceProvider = sp,
105+
Scheduler = scheduler
106+
};
107+
ipcServer.Start();
94108

95109
_ = Task.Run(async () =>
96110
{
97111
try
98112
{
99113
await using var sp = new ServiceCollection()
100114
.AddLogging()
101-
.AddIpc()
102115
.BuildServiceProvider();
103116

104117
var callback = new Arithmetic();
@@ -107,25 +120,51 @@ IEnumerable<Task> EnumeratePings()
107120
{
108121
if (webSocketUrl is not null)
109122
{
110-
yield return new WebSocketClientBuilder<IAlgebra, IArithmetic>(uri: new(webSocketUrl), sp)
111-
.RequestTimeout(TimeSpan.FromHours(5))
112-
.CallbackInstance(callback)
113-
.Build()
114-
.Ping();
123+
yield return new IpcClient
124+
{
125+
Config = new()
126+
{
127+
ServiceProvider = sp,
128+
RequestTimeout = TimeSpan.FromHours(5),
129+
Callbacks = new()
130+
{
131+
{ typeof(IArithmetic), callback }
132+
},
133+
},
134+
Transport = new WebSocketTransport
135+
{
136+
Uri = new(webSocketUrl),
137+
}
138+
}
139+
.GetProxy<IAlgebra>()
140+
.Ping();
115141
}
116142

117143
if (pipeName is not null)
118144
{
119-
yield return new NamedPipeClientBuilder<IAlgebra, IArithmetic>(pipeName, sp)
120-
.RequestTimeout(TimeSpan.FromHours(5))
121-
.CallbackInstance(callback)
122-
.Build()
123-
.Ping();
145+
yield return new IpcClient
146+
{
147+
Config = new()
148+
{
149+
ServiceProvider = sp,
150+
RequestTimeout = TimeSpan.FromHours(5),
151+
Callbacks = new()
152+
{
153+
{ typeof(IArithmetic), callback }
154+
}
155+
},
156+
Transport = new NamedPipeTransport()
157+
{
158+
PipeName = pipeName,
159+
}
160+
}
161+
.GetProxy<IAlgebra>()
162+
.Ping();
124163
}
125164
}
126165

127166
await Task.WhenAll(EnumeratePings());
128-
167+
129168
Send(SignalKind.ReadyToConnect);
130169
}
131170
catch (Exception ex)
@@ -135,7 +174,29 @@ IEnumerable<Task> EnumeratePings()
135174
}
136175
});
137176

138-
await serviceHost.RunAsync(sched);
177+
await ipcServer.WaitForStop();
178+
179+
IEnumerable<ListenerConfig> EnumerateListeners(string? pipeName, string? webSocketUrl)
180+
{
181+
if (pipeName is not null)
182+
{
183+
yield return new NamedPipeListener() { PipeName = pipeName };
184+
}
185+
186+
if (webSocketUrl is not null)
187+
{
188+
string url = CurateWebSocketUrl(webSocketUrl);
189+
var accept = new HttpSysWebSocketsListener(url).Accept;
190+
yield return new WebSocketListener() { Accept = accept };
191+
}
192+
193+
static string CurateWebSocketUrl(string raw)
194+
{
195+
var builder = new UriBuilder(raw);
196+
builder.Scheme = "http";
197+
return builder.ToString();
198+
}
199+
}
139200
}
140201

141202
private class Arithmetic : IArithmetic
@@ -148,37 +209,6 @@ private class Arithmetic : IArithmetic
148209

149210
internal static class Extensions
150211
{
151-
public static ServiceHostBuilder UseNamedPipesAndOrWebSockets(this ServiceHostBuilder builder, string? pipeName, string? webSocketUrl)
152-
{
153-
if (pipeName is null && webSocketUrl is null)
154-
{
155-
throw new ArgumentOutOfRangeException();
156-
}
157-
158-
if (pipeName is not null)
159-
{
160-
builder = builder.UseNamedPipes(new NamedPipeSettings(pipeName));
161-
}
162-
163-
if (webSocketUrl is not null)
164-
{
165-
string url = CurateWebSocketUrl(webSocketUrl);
166-
var accept = new HttpSysWebSocketsListener(url).Accept;
167-
WebSocketSettings settings = new(accept);
168-
169-
builder = builder.UseWebSockets(settings);
170-
}
171-
172-
return builder;
173-
}
174-
175-
private static string CurateWebSocketUrl(string raw)
176-
{
177-
var builder = new UriBuilder(raw);
178-
builder.Scheme = "http";
179-
return builder.ToString();
180-
}
181-
182212
public class HttpSysWebSocketsListener : IDisposable
183213
{
184214
HttpListener _httpListener = new();

src/Clients/js/dotnet/UiPath.CoreIpc.NodeInterop/ServiceImpls.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Threading;
44
using System.Threading.Tasks;
55

6-
namespace UiPath.CoreIpc.NodeInterop;
6+
namespace UiPath.Ipc.NodeInterop;
77

88
using static Contracts;
99

0 commit comments

Comments
 (0)