Merge branch 'features/nuget_autobuild' into develop
This commit is contained in:
		
						commit
						0ce199e5ee
					
				
							
								
								
									
										0
									
								
								build/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								build/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										2
									
								
								build/buildProjects.bat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								build/buildProjects.bat
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | |||||||
|  | dotnet build ../src/Connected/Connected.csproj | ||||||
|  | dotnet build ../src/Connected.Client/Connected.Client.csproj | ||||||
							
								
								
									
										15
									
								
								nuget.config
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								nuget.config
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | |||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <configuration> | ||||||
|  |     <config> | ||||||
|  |         <add key="repositoryPath" value="%PACKAGEHOME%/External" /> | ||||||
|  |     </config> | ||||||
|  | 
 | ||||||
|  |     <packageRestore> | ||||||
|  |         <add key="enabled" value="True" /> | ||||||
|  |         <add key="automatic" value="True" /> | ||||||
|  |     </packageRestore> | ||||||
|  |     <packageSources> | ||||||
|  |         <add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" /> | ||||||
|  |     </packageSources> | ||||||
|  |     <disabledPackageSources /> | ||||||
|  | </configuration> | ||||||
| @ -1,4 +1,5 @@ | |||||||
| using Connected.Configuration; | using System.Text.Json; | ||||||
|  | using Connected.Configuration; | ||||||
| using Connected.Events; | using Connected.Events; | ||||||
| using Connected.Net; | using Connected.Net; | ||||||
| using Connected.Startup; | using Connected.Startup; | ||||||
| @ -20,6 +21,8 @@ public class ClientStartup : IStartup | |||||||
| 		if (events is null) | 		if (events is null) | ||||||
| 			throw new NullReferenceException(nameof(EventConnection)); | 			throw new NullReferenceException(nameof(EventConnection)); | ||||||
| 
 | 
 | ||||||
|  | 		Console.WriteLine(JsonSerializer.Serialize(host.Configuration)); | ||||||
|  | 
 | ||||||
| 		await events.Initialize(); | 		await events.Initialize(); | ||||||
| 		await events.Connect(); | 		await events.Connect(); | ||||||
| 
 | 
 | ||||||
| @ -30,8 +33,8 @@ public class ClientStartup : IStartup | |||||||
| 	{ | 	{ | ||||||
| 		services.AddSingleton<EventConnection>(); | 		services.AddSingleton<EventConnection>(); | ||||||
| 		services.AddSingleton(typeof(IEventService), typeof(EventService)); | 		services.AddSingleton(typeof(IEventService), typeof(EventService)); | ||||||
| 		services.AddSingleton(typeof(IConfigurationService), typeof(ConfigurationService)); |  | ||||||
| 		services.AddSingleton(typeof(IRemoteProviderService), typeof(RemoteProviderService)); | 		services.AddSingleton(typeof(IRemoteProviderService), typeof(RemoteProviderService)); | ||||||
|  | 		services.AddSingleton(typeof(IConfigurationService), typeof(ConfigurationService)); | ||||||
| 
 | 
 | ||||||
| 		await Task.CompletedTask; | 		await Task.CompletedTask; | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -1,10 +1,12 @@ | |||||||
| namespace Connected.Configuration; | using Microsoft.Extensions.Configuration; | ||||||
|  | 
 | ||||||
|  | namespace Connected.Configuration; | ||||||
| 
 | 
 | ||||||
| internal class ConfigurationService : IConfigurationService | internal class ConfigurationService : IConfigurationService | ||||||
| { | { | ||||||
| 	public ConfigurationService() | 	public ConfigurationService(IConfiguration configuration) | ||||||
| 	{ | 	{ | ||||||
| 		Remote = new RemoteConfiguration(); | 		Remote = new RemoteConfiguration(configuration.GetSection("remote")); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public IRemoteConfiguration Remote { get; } | 	public IRemoteConfiguration Remote { get; } | ||||||
|  | |||||||
| @ -1,6 +1,10 @@ | |||||||
| namespace Connected.Configuration; | using System.Collections.Immutable; | ||||||
|  | 
 | ||||||
|  | namespace Connected.Configuration; | ||||||
| 
 | 
 | ||||||
| public interface IRemoteConfiguration | public interface IRemoteConfiguration | ||||||
| { | { | ||||||
| 	List<string> Servers { get; } | 	ImmutableList<IRemoteServerConfiguration> Servers { get; } | ||||||
|  | 
 | ||||||
|  | 	public ImmutableList<IRemoteServerConfiguration> Query(string id); | ||||||
| } | } | ||||||
|  | |||||||
| @ -0,0 +1,12 @@ | |||||||
|  | using System; | ||||||
|  | using System.Collections.Generic; | ||||||
|  | using System.Linq; | ||||||
|  | using System.Text; | ||||||
|  | using System.Threading.Tasks; | ||||||
|  | 
 | ||||||
|  | namespace Connected.Configuration; | ||||||
|  | public interface IRemoteServerConfiguration | ||||||
|  | { | ||||||
|  | 	public string? Id { get; } | ||||||
|  | 	public string? Address { get; } | ||||||
|  | } | ||||||
| @ -1,13 +1,23 @@ | |||||||
| namespace Connected.Configuration; | using System.Collections.Immutable; | ||||||
|  | using Connected.Remote; | ||||||
|  | using Microsoft.Extensions.Configuration; | ||||||
|  | 
 | ||||||
|  | namespace Connected.Configuration; | ||||||
| 
 | 
 | ||||||
| internal class RemoteConfiguration : IRemoteConfiguration | internal class RemoteConfiguration : IRemoteConfiguration | ||||||
| { | { | ||||||
| 	public RemoteConfiguration() | 	private readonly List<RemoteServerConfiguration> _servers; | ||||||
|  | 
 | ||||||
|  | 	public RemoteConfiguration(IConfiguration configuration) | ||||||
| 	{ | 	{ | ||||||
| 		Servers = new() | 		_servers = new(); | ||||||
| 		{ | 		configuration.Bind("servers", _servers); | ||||||
| 			"http://localhost:5063" | 	} | ||||||
| 		}; | 
 | ||||||
|  | 	public ImmutableList<IRemoteServerConfiguration> Servers => _servers.Cast<IRemoteServerConfiguration>().ToImmutableList(); | ||||||
|  | 
 | ||||||
|  | 	public ImmutableList<IRemoteServerConfiguration> Query(string id) | ||||||
|  | 	{ | ||||||
|  | 		return _servers.Where(e => e.Id == id).Cast<IRemoteServerConfiguration>().ToImmutableList(); | ||||||
| 	} | 	} | ||||||
| 	public List<string> Servers { get; } |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -0,0 +1,13 @@ | |||||||
|  | using System; | ||||||
|  | using System.Collections.Generic; | ||||||
|  | using System.Linq; | ||||||
|  | using System.Text; | ||||||
|  | using System.Threading.Tasks; | ||||||
|  | 
 | ||||||
|  | namespace Connected.Configuration; | ||||||
|  | internal class RemoteServerConfiguration : IRemoteServerConfiguration | ||||||
|  | { | ||||||
|  | 	public string? Id { get; init; } | ||||||
|  | 
 | ||||||
|  | 	public string? Address { get; init; } | ||||||
|  | } | ||||||
| @ -1,21 +1,42 @@ | |||||||
| <Project Sdk="Microsoft.NET.Sdk"> | <Project Sdk="Microsoft.NET.Sdk"> | ||||||
| 
 | 
 | ||||||
|   <PropertyGroup> |   <PropertyGroup> | ||||||
|     <TargetFramework>net7.0</TargetFramework> | 		<RootNamespace>Connected</RootNamespace> | ||||||
|     <ImplicitUsings>enable</ImplicitUsings> | 		<TargetFramework>net7.0</TargetFramework> | ||||||
|     <Nullable>enable</Nullable> | 		<ImplicitUsings>enable</ImplicitUsings> | ||||||
|     <RootNamespace>Connected</RootNamespace> | 		<Nullable>enable</Nullable> | ||||||
|   </PropertyGroup> | 		<GeneratePackageOnBuild>True</GeneratePackageOnBuild> | ||||||
|  | 		<Title>$(AssemblyName)</Title> | ||||||
|  | 		<Authors>Tom PIT ltd</Authors> | ||||||
|  | 		<Copyright>2022 Tom PIT ltd</Copyright> | ||||||
|  | 		<PackageProjectUrl>https://git.tompit.com/Connected/Info</PackageProjectUrl> | ||||||
|  | 		<PackageReadmeFile>README.md</PackageReadmeFile> | ||||||
|  | 		<PackageTags>connected;platform;</PackageTags> | ||||||
|  | 		<IncludeSymbols>True</IncludeSymbols> | ||||||
|  | 		<SymbolPackageFormat>snupkg</SymbolPackageFormat> | ||||||
|  | 		<PackageLicenseFile>LICENSE</PackageLicenseFile> | ||||||
|  | 		<PackageOutputPath>$(OutputPath)</PackageOutputPath> | ||||||
|  | 	</PropertyGroup> | ||||||
| 
 | 
 | ||||||
|   <ItemGroup> | 	<ItemGroup> | ||||||
|     <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.*-*" /> | 		<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.*-*" /> | ||||||
| 	  <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.*-*" /> | 		<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.*-*" /> | ||||||
| 	  <PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="7.0.*-*" /> | 		<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="7.0.*-*" /> | ||||||
| 	  <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.*-*" /> | 	 	<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.*-*" /> | ||||||
|   </ItemGroup> | 	</ItemGroup> | ||||||
| 
 | 
 | ||||||
|   <ItemGroup> | 	<ItemGroup> | ||||||
|     <ProjectReference Include="..\Connected\Connected.csproj" /> | 		<ProjectReference Include="..\Connected\Connected.csproj" /> | ||||||
|   </ItemGroup> | 	</ItemGroup> | ||||||
| 
 | 
 | ||||||
|  | 	<ItemGroup> | ||||||
|  | 		<None Include="..\..\LICENSE"> | ||||||
|  | 			<Pack>True</Pack> | ||||||
|  | 			<PackagePath>\</PackagePath> | ||||||
|  | 		</None> | ||||||
|  | 		<None Include="..\..\README.md"> | ||||||
|  | 			<Pack>True</Pack> | ||||||
|  | 			<PackagePath>\</PackagePath> | ||||||
|  | 		</None> | ||||||
|  | 	</ItemGroup> | ||||||
| </Project> | </Project> | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| using Connected.Net; | using Connected.Configuration; | ||||||
|  | using Connected.Net; | ||||||
| using Connected.Startup; | using Connected.Startup; | ||||||
| using Microsoft.AspNetCore.Components.WebAssembly.Hosting; | using Microsoft.AspNetCore.Components.WebAssembly.Hosting; | ||||||
| using Microsoft.Extensions.DependencyInjection; | using Microsoft.Extensions.DependencyInjection; | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| using Connected.Configuration; | using Connected.Configuration; | ||||||
|  | using Microsoft.Extensions.Configuration; | ||||||
| 
 | 
 | ||||||
| namespace Connected.Net; | namespace Connected.Net; | ||||||
| 
 | 
 | ||||||
| @ -7,7 +8,7 @@ namespace Connected.Net; | |||||||
| /// </summary> | /// </summary> | ||||||
| internal class RemoteProviderService : IRemoteProviderService | internal class RemoteProviderService : IRemoteProviderService | ||||||
| { | { | ||||||
| 	public RemoteProviderService(IConfigurationService configuration) | 	public RemoteProviderService(IConfiguration configuration) | ||||||
| 	{ | 	{ | ||||||
| 		Configuration = configuration; | 		Configuration = configuration; | ||||||
| 		Balancer = new(); | 		Balancer = new(); | ||||||
| @ -16,7 +17,7 @@ internal class RemoteProviderService : IRemoteProviderService | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	private RoundRobin Balancer { get; } | 	private RoundRobin Balancer { get; } | ||||||
| 	private IConfigurationService Configuration { get; } | 	private IConfiguration Configuration { get; } | ||||||
| 
 | 
 | ||||||
| 	public string ProvideBaseUrl() | 	public string ProvideBaseUrl() | ||||||
| 	{ | 	{ | ||||||
| @ -30,7 +31,10 @@ internal class RemoteProviderService : IRemoteProviderService | |||||||
| 
 | 
 | ||||||
| 	private void Initialize() | 	private void Initialize() | ||||||
| 	{ | 	{ | ||||||
| 		foreach (var s in Configuration.Remote.Servers) | 		var remoteConfiguration = new RemoteConfiguration(Configuration.GetSection("remote")); | ||||||
| 			Balancer.Register(new RemoteDescriptor(s)); | 
 | ||||||
|  | 		foreach (var s in remoteConfiguration.Servers) | ||||||
|  | 			if (!string.IsNullOrWhiteSpace(s.Address)) | ||||||
|  | 				Balancer.Register(new RemoteDescriptor(s.Address)); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | |||||||
| @ -12,14 +12,16 @@ | |||||||
|     <Copyright>Tom PIT</Copyright> |     <Copyright>Tom PIT</Copyright> | ||||||
|     <PackageProjectUrl>https://git.tompit.com/Connected/connected</PackageProjectUrl> |     <PackageProjectUrl>https://git.tompit.com/Connected/connected</PackageProjectUrl> | ||||||
|     <PackageReadmeFile>README.md</PackageReadmeFile> |     <PackageReadmeFile>README.md</PackageReadmeFile> | ||||||
|     <RepositoryUrl>https://git.tompit.com/Connected/connected</RepositoryUrl> | 		<RepositoryUrl>https://git.tompit.com/Connected/Connected</RepositoryUrl> | ||||||
|     <PackageTags>connected;platform;</PackageTags> |     <PackageTags>connected;platform;</PackageTags> | ||||||
|     <PackageReleaseNotes>First beta release</PackageReleaseNotes> | 		<PackageReleaseNotes></PackageReleaseNotes> | ||||||
|     <IncludeSymbols>True</IncludeSymbols> |     <IncludeSymbols>True</IncludeSymbols> | ||||||
|     <SymbolPackageFormat>snupkg</SymbolPackageFormat> |     <SymbolPackageFormat>snupkg</SymbolPackageFormat> | ||||||
|     <PackageLicenseFile>LICENSE</PackageLicenseFile> |     <PackageLicenseFile>LICENSE</PackageLicenseFile> | ||||||
|     <GenerateDocumentationFile>True</GenerateDocumentationFile> |     <GenerateDocumentationFile>True</GenerateDocumentationFile> | ||||||
|     <DocumentationFile>..\..\docs\api\connected.xml</DocumentationFile> |     <DocumentationFile>..\..\docs\api\connected.xml</DocumentationFile> | ||||||
|  | 		<PackageOutputPath>$(OutputPath)</PackageOutputPath> | ||||||
|  | 		<Version>$(VersionPrefix)$(VersionSuffix)</Version> | ||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
| 
 | 
 | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
| @ -57,5 +59,4 @@ | |||||||
|       <PackagePath>\</PackagePath> |       <PackagePath>\</PackagePath> | ||||||
|     </None> |     </None> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
| 
 |  | ||||||
| </Project> | </Project> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Matija Koželj
						Matija Koželj