public void Package(string outputRoot) { var artifactsFolder = Path.Combine(outputRoot, "artifacts"); Directory.CreateDirectory(artifactsFolder); var tempRoot = Path.Combine(outputRoot, "temp"); // Router PackageRouter(outputRoot, artifactsFolder); // Function entrypoints using (var serviceEntryFolder = RunPublish(tempRoot, Path.Combine(_options.Root, "Toxon.Micro.RabbitBlog.Serverless.ServiceEntry", "Toxon.Micro.RabbitBlog.Serverless.ServiceEntry.csproj"), "serviceEntry", true)) using (var httpEntryFolder = RunPublish(tempRoot, Path.Combine(_options.Root, "Toxon.Micro.RabbitBlog.Serverless.HttpEntry", "Toxon.Micro.RabbitBlog.Serverless.HttpEntry.csproj"), "httpEntry", true)) { var serviceEntryAssembly = Path.Combine(serviceEntryFolder.Path, "Toxon.Micro.RabbitBlog.Serverless.ServiceEntry.dll"); var httpEntryAssembly = Path.Combine(httpEntryFolder.Path, "Toxon.Micro.RabbitBlog.Serverless.HttpEntry.dll"); // Services var services = ServiceDiscoverer.Discover(_serviceDiscoveryOptions); var pluginLoaders = Bootstrapper.LoadPlugins(services.Select(x => x.AssemblyPath)); foreach (var service in services) { var assembly = pluginLoaders.Assemblies.Single(x => x.GetName().Name == service.Name); PackageService(service, assembly, tempRoot, serviceEntryAssembly, httpEntryAssembly, artifactsFolder); } } }
private void AddServices(YamlMappingNode functions, YamlMappingNode resources) { var services = ServiceDiscoverer.Discover(_serviceDiscoveryOptions); var pluginLoaders = Bootstrapper.LoadPlugins(services.Select(x => x.AssemblyPath)); foreach (var service in services) { var assembly = pluginLoaders.Assemblies.Single(x => x.GetName().Name == service.Name); var plugins = PluginDiscoverer.Discover(assembly); foreach (var plugin in plugins) { AddService(functions, resources, service, plugin); } } }
public RouterConfig Build() { var services = ServiceDiscoverer.Discover(_serviceDiscoveryOptions); var pluginLoaders = Bootstrapper.LoadPlugins(services.Select(x => x.AssemblyPath)); var routes = new List <RouterEntry>(); foreach (var assembly in pluginLoaders.Assemblies) { var assemblyRoutes = PluginDiscoverer.Discover(assembly) .SelectMany(plugin => RouteDiscoverer.Discover(plugin).Select(route => ToRouterEntry(plugin, route))); routes.AddRange(assemblyRoutes); } return(new RouterConfig(routes)); }