diff --git a/.github/workflows/dotnet-cd.yml b/.github/workflows/dotnet-cd.yml
index c1a6fb3..68379b8 100644
--- a/.github/workflows/dotnet-cd.yml
+++ b/.github/workflows/dotnet-cd.yml
@@ -10,7 +10,7 @@ permissions:
jobs:
build:
- runs-on: windows-latest
+ runs-on: self-hosted
steps:
- uses: actions/checkout@v4
@@ -29,31 +29,14 @@ jobs:
- name: dotnet publish
run: dotnet publish "rubberduckvba.Server\rubberduckvba.Server.csproj" --configuration Release --output ${{env.DOTNET_ROOT}}\pub
- - name: Upload artifact for deployment job
- uses: actions/upload-artifact@v4
- with:
- name: webapi
- path: ${{env.DOTNET_ROOT}}/pub
-
deploy:
- environment:
- name: AZ-Test
- url: https://test.rubberduckvba.com
- permissions:
- contents: none
- runs-on: windows-latest
+ runs-on: self-hosted
needs: build
steps:
- - name: Download artifact from build job
- uses: actions/download-artifact@v4
- with:
- name: webapi
- name: Deploy to IIS
- id: deploy-to-iis
- uses: ChristopheLav/iis-deploy@v1
- with:
- website-name: 'api'
- msdeploy-service-url: ${{ secrets.MSDEPLOY_URL }}
- msdeploy-username: ${{ secrets.MSDEPLOY_USERNAME }}
- msdeploy-password: ${{ secrets.MSDEPLOY_PASSWORD }}
- source-path: ${{ github.workspace }}\website\publish
+ run: |
+ stop-webapppool rubberduckvba
+ stop-iissite -Name api -Confirm: $false
+ Copy-Item ${{env.DOTNET_ROOT}}\pub\* C:/inetpub/wwwroot -Recurse -Force
+ start-webapppool rubberduckvba
+ start-iissite api
diff --git a/.gitignore b/.gitignore
index 1a4c036..933f381 100644
--- a/.gitignore
+++ b/.gitignore
@@ -361,4 +361,5 @@ MigrationBackup/
.ionide/
# Fody - auto-generated XML schema
-FodyWeavers.xsd
\ No newline at end of file
+FodyWeavers.xsd
+/rubberduckvba.Server/appsettings.json
diff --git a/README.md b/README.md
index 7c80217..8d2c9e3 100644
--- a/README.md
+++ b/README.md
@@ -51,7 +51,7 @@ The task can be launched manually from the back-end API with an authenticated PO
## Update XmlDoc content
Similarly, this job creates a TPL DataFlow pipeline that can be documented as follows:
-![diagram](https://github.com/user-attachments/assets/519e1d61-514f-4186-a694-4db69d7e8da9)
+![diagram](https://github.com/user-attachments/assets/dac3020c-9335-4573-b1ef-f4984cdf56b4)
This pipeline hits GitHub to download the code inspections' default configuration from the **rubberduck-vba/Rubberduck** repository, fetches the current-latest tags from the database to compare against the current-latest tags from GitHub, then downloads the .xml assets and parses them into "feature items" and proceeds to merge the contents:
- Items that exist in **next** but not **main** are considered/marked as NEW
diff --git a/RubberduckServices/SyntaxHighlighterService.cs b/RubberduckServices/SyntaxHighlighterService.cs
index 7f6a9e8..d49d454 100644
--- a/RubberduckServices/SyntaxHighlighterService.cs
+++ b/RubberduckServices/SyntaxHighlighterService.cs
@@ -18,7 +18,7 @@ public interface ISyntaxHighlighterService
///
/// A fragment of VBA code that can be parsed by Rubberduck.
/// The provided code, syntax-formatted.
- Task FormatAsync(string code);
+ string Format(string code);
}
public class SyntaxHighlighterService : ISyntaxHighlighterService
@@ -52,7 +52,7 @@ public SyntaxHighlighterService(
_attributeValueClass = cssAttributeValues;
}
- public async Task FormatAsync(string code)
+ public string Format(string code)
{
var indenter = new SimpleIndenter();
@@ -96,10 +96,10 @@ public async Task FormatAsync(string code)
var lines = builder.ToString().Split("\n").ToArray();
var indent = lines.LastOrDefault()?.TakeWhile(char.IsWhiteSpace)?.Count() ?? 0;
var formattedLines = from line in lines
- let trimmed = line.Substring(indent)
+ let trimmed = line[indent..]
select FormatIndents(trimmed);
- return await Task.FromResult(string.Join("
", formattedLines));
+ return string.Join("
", formattedLines);
}
private void FormatTokens(StringBuilder builder, ITokenStream tokens, IntervalListener[] listeners)
@@ -119,13 +119,13 @@ private void FormatTokens(StringBuilder builder, ITokenStream tokens, IntervalLi
builder.Append($"{tokens.GetText(listener.Interval)}");
i = listener.Interval.b;
}
- else if (listener is NewLineListener)
- {
- if (token.Type == VBAParser.NEWLINE)
- {
- builder.Append(Environment.NewLine);
- }
- }
+ //else if (listener is NewLineListener)
+ //{
+ // if (token.Type == VBAParser.NEWLINE)
+ // {
+ // builder.Append(Environment.NewLine);
+ // }
+ //}
else
{
if (TokenKinds.StringLiterals.Contains(token.Type))
@@ -148,7 +148,7 @@ private void FormatTokens(StringBuilder builder, ITokenStream tokens, IntervalLi
}
}
- private static ITokenStream Tokenize(string code)
+ private static CommonTokenStream Tokenize(string code)
{
AntlrInputStream input;
using (var reader = new StringReader(code))
@@ -165,7 +165,7 @@ private static string FormatIndents(string line)
var indent = line.TakeWhile(char.IsWhiteSpace).Count();
if (indent > 0)
{
- formatted = line.Substring(0, indent).Replace(" ", " ") + line.Substring(indent);
+ formatted = string.Concat(line[..indent].Replace(" ", " "), line.AsSpan(indent));
}
return formatted;
}
diff --git a/rubberduckvba.Server/Api/Admin/AdminController.cs b/rubberduckvba.Server/Api/Admin/AdminController.cs
index 9e768f2..1c56ba9 100644
--- a/rubberduckvba.Server/Api/Admin/AdminController.cs
+++ b/rubberduckvba.Server/Api/Admin/AdminController.cs
@@ -2,13 +2,14 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
-using rubberduckvba.com.Server.ContentSynchronization;
-using rubberduckvba.com.Server.Hangfire;
+using rubberduckvba.Server;
+using rubberduckvba.Server.ContentSynchronization;
+using rubberduckvba.Server.Hangfire;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.Api.Admin;
+namespace rubberduckvba.Server.Api.Admin;
-[Authorize("github")]
[ApiController]
public class AdminController(ConfigurationOptions options, IBackgroundJobClient backgroundJob, ILogger logger) : ControllerBase
{
@@ -20,7 +21,7 @@ public class AdminController(ConfigurationOptions options, IBackgroundJobClient
[HttpPost("admin/update/xmldoc")]
public async ValueTask UpdateXmldocContent()
{
- var parameters = new XmldocSyncRequestParameters { RepositoryId = Services.RepositoryId.Rubberduck, RequestId = Guid.NewGuid() };
+ var parameters = new XmldocSyncRequestParameters { RepositoryId = RepositoryId.Rubberduck, RequestId = Guid.NewGuid() };
var jobId = backgroundJob.Enqueue(HangfireConstants.ManualQueueName, () => QueuedUpdateOrchestrator.UpdateXmldocContent(parameters, null!));
logger.LogInformation("JobId {jobId} was enqueued (queue: {queueName}) for xmldoc sync request {requestId}", jobId, HangfireConstants.ManualQueueName, parameters.RequestId);
@@ -35,14 +36,13 @@ public async ValueTask UpdateXmldocContent()
[HttpPost("admin/update/tags")]
public async ValueTask UpdateTagMetadata()
{
- var parameters = new TagSyncRequestParameters { RepositoryId = Services.RepositoryId.Rubberduck, RequestId = Guid.NewGuid() };
+ var parameters = new TagSyncRequestParameters { RepositoryId = RepositoryId.Rubberduck, RequestId = Guid.NewGuid() };
var jobId = backgroundJob.Enqueue(HangfireConstants.ManualQueueName, () => QueuedUpdateOrchestrator.UpdateInstallerDownloadStats(parameters, null!));
logger.LogInformation("JobId {jobId} was enqueued (queue: {queueName}) for tag sync request {requestId}", jobId, HangfireConstants.ManualQueueName, parameters.RequestId);
return await ValueTask.FromResult(Ok(jobId));
}
- [Authorize("github")]
[HttpGet("admin/config/current")]
public async ValueTask Config()
{
@@ -52,6 +52,7 @@ public async ValueTask Config()
public record class ConfigurationOptions(
IOptions ConnectionOptions,
+ IOptions GitHubOptions,
IOptions HangfireOptions)
{
diff --git a/rubberduckvba.Server/Api/Auth/AuthController.cs b/rubberduckvba.Server/Api/Auth/AuthController.cs
index 92ef276..10c8c3d 100644
--- a/rubberduckvba.Server/Api/Auth/AuthController.cs
+++ b/rubberduckvba.Server/Api/Auth/AuthController.cs
@@ -6,7 +6,7 @@
using System.Security.Claims;
using System.Text;
-namespace rubberduckvba.com.Server.Api.Auth;
+namespace rubberduckvba.Server.Api.Auth;
public record class UserViewModel
{
diff --git a/rubberduckvba.Server/Api/Auth/ClaimsPrincipalExtensions.cs b/rubberduckvba.Server/Api/Auth/ClaimsPrincipalExtensions.cs
index 42d63d9..076c126 100644
--- a/rubberduckvba.Server/Api/Auth/ClaimsPrincipalExtensions.cs
+++ b/rubberduckvba.Server/Api/Auth/ClaimsPrincipalExtensions.cs
@@ -3,14 +3,14 @@
using System.Security.Claims;
using System.Text;
-namespace rubberduckvba.com.Server.Api.Auth;
+namespace rubberduckvba.Server.Api.Auth;
public static class ClaimsPrincipalExtensions
{
public static string AsJWT(this ClaimsPrincipal principal, string secret, string issuer, string audience)
{
var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(secret));
- var token = new JwtSecurityToken(issuer, audience,
+ var token = new JwtSecurityToken(issuer, audience,
claims: principal?.Claims,
notBefore: new DateTimeOffset(DateTime.UtcNow).UtcDateTime,
expires: new DateTimeOffset(DateTime.UtcNow.AddMinutes(60)).UtcDateTime,
diff --git a/rubberduckvba.Server/Api/Downloads/AvailableDownload.cs b/rubberduckvba.Server/Api/Downloads/AvailableDownload.cs
index 5b4b5b5..abe2cc9 100644
--- a/rubberduckvba.Server/Api/Downloads/AvailableDownload.cs
+++ b/rubberduckvba.Server/Api/Downloads/AvailableDownload.cs
@@ -1,6 +1,6 @@
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.Model;
-namespace rubberduckvba.com.Server.Api.Downloads;
+namespace rubberduckvba.Server.Api.Downloads;
public record class AvailableDownload
{
diff --git a/rubberduckvba.Server/Api/Downloads/DownloadsController.cs b/rubberduckvba.Server/Api/Downloads/DownloadsController.cs
index 0976f59..3a69fc1 100644
--- a/rubberduckvba.Server/Api/Downloads/DownloadsController.cs
+++ b/rubberduckvba.Server/Api/Downloads/DownloadsController.cs
@@ -1,9 +1,9 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.Services;
using System.Collections.Immutable;
-namespace rubberduckvba.com.Server.Api.Downloads;
+namespace rubberduckvba.Server.Api.Downloads;
[ApiController]
diff --git a/rubberduckvba.Server/Api/Features/FeatureEditViewModel.cs b/rubberduckvba.Server/Api/Features/FeatureEditViewModel.cs
index c6b0173..38707d5 100644
--- a/rubberduckvba.Server/Api/Features/FeatureEditViewModel.cs
+++ b/rubberduckvba.Server/Api/Features/FeatureEditViewModel.cs
@@ -1,7 +1,7 @@
-using rubberduckvba.com.Server.Data;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.Model;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.Api.Features;
+namespace rubberduckvba.Server.Api.Features;
public class FeatureEditViewModel
{
@@ -30,7 +30,7 @@ public Feature ToFeature()
{
Id = Id ?? default,
ParentId = ParentId,
- RepositoryId = (int)RepositoryId,
+ RepositoryId = RepositoryId,
Name = Name,
Title = Title,
ShortDescription = ShortDescription,
@@ -44,8 +44,8 @@ public FeatureEditViewModel(Feature model, FeatureOptionViewModel[] features, Re
{
Id = model.Id;
ParentId = model.ParentId;
- RepositoryId = (RepositoryId)model.RepositoryId;
-
+ RepositoryId = model.RepositoryId;
+
Name = model.Name;
Title = model.Title;
ShortDescription = model.ShortDescription;
diff --git a/rubberduckvba.Server/Api/Features/FeatureOptionViewModel.cs b/rubberduckvba.Server/Api/Features/FeatureOptionViewModel.cs
index 968ef86..99ebc75 100644
--- a/rubberduckvba.Server/Api/Features/FeatureOptionViewModel.cs
+++ b/rubberduckvba.Server/Api/Features/FeatureOptionViewModel.cs
@@ -1,4 +1,4 @@
-namespace rubberduckvba.com.Server.Api.Features;
+namespace rubberduckvba.Server.Api.Features;
public class FeatureOptionViewModel
{
diff --git a/rubberduckvba.Server/Api/Features/FeatureViewModel.cs b/rubberduckvba.Server/Api/Features/FeatureViewModel.cs
index 8a51a6c..12b9220 100644
--- a/rubberduckvba.Server/Api/Features/FeatureViewModel.cs
+++ b/rubberduckvba.Server/Api/Features/FeatureViewModel.cs
@@ -1,7 +1,6 @@
-using rubberduckvba.com.Server.Data;
-using System.Text.Json;
+using rubberduckvba.Server.Model;
-namespace rubberduckvba.com.Server.Api.Features;
+namespace rubberduckvba.Server.Api.Features;
public class FeatureViewModel
{
@@ -21,13 +20,8 @@ public FeatureViewModel(Feature model)
if (model is FeatureGraph graph)
{
- FeatureId = graph.ParentId;
- FeatureName = graph.ParentName;
- FeatureTitle = graph.ParentTitle;
-
- Features = graph.Features.Select(e => new FeatureViewModel(e)).ToArray();
- Items = graph.Items.Select(e => e with { FeatureId = graph.ParentId!.Value, FeatureName = graph.ParentName, FeatureTitle = graph.ParentTitle }).ToArray();
- Inspections = graph.Items.Select(e => JsonSerializer.Deserialize(e.Serialized)!).ToArray();
+ Features = graph.Features.Select(e => new FeatureViewModel(e) { FeatureId = e.ParentId, FeatureName = graph.Name, FeatureTitle = graph.Title }).ToArray();
+ Inspections = graph.Inspections.ToArray();
}
}
@@ -36,8 +30,8 @@ public FeatureViewModel(Feature model)
public DateTime? DateUpdated { get; init; }
public int? FeatureId { get; init; }
- public string FeatureName { get; init; }
- public string FeatureTitle { get; init; }
+ public string? FeatureName { get; init; }
+ public string? FeatureTitle { get; init; }
public string Name { get; init; }
public string Title { get; init; }
@@ -48,8 +42,7 @@ public FeatureViewModel(Feature model)
public bool HasImage { get; init; }
public FeatureViewModel[] Features { get; init; } = [];
- public FeatureXmlDoc[] Items { get; init; } = [];
- public XmlDocInspectionInfo[] Inspections { get; init; } = [];
+ public Inspection[] Inspections { get; init; } = []; // InspectionViewModel[]
}
public class FeatureXmlDocViewModel
diff --git a/rubberduckvba.Server/Api/Features/FeaturesController.cs b/rubberduckvba.Server/Api/Features/FeaturesController.cs
index de60313..43f60c1 100644
--- a/rubberduckvba.Server/Api/Features/FeaturesController.cs
+++ b/rubberduckvba.Server/Api/Features/FeaturesController.cs
@@ -1,13 +1,12 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-using rubberduckvba.com.Server.ContentSynchronization.XmlDoc;
-using rubberduckvba.com.Server.Data;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.Model;
+using rubberduckvba.Server.Services;
+using rubberduckvba.Server.Services.rubberduckdb;
using System.ComponentModel;
using System.Reflection;
-using System.Text.Json;
-namespace rubberduckvba.com.Server.Api.Features;
+namespace rubberduckvba.Server.Api.Features;
public record class MarkdownFormattingRequestViewModel
{
@@ -18,7 +17,7 @@ public record class MarkdownFormattingRequestViewModel
[ApiController]
[AllowAnonymous]
-public class FeaturesController(IRubberduckDbService db, IMarkdownFormattingService md, ICacheService cache) : ControllerBase
+public class FeaturesController(IRubberduckDbService db, FeatureServices features, IMarkdownFormattingService md, ICacheService cache) : ControllerBase
{
private static RepositoryOptionViewModel[] RepositoryOptions { get; } =
Enum.GetValues().Select(e => new RepositoryOptionViewModel { Id = e, Name = e.ToString() }).ToArray();
@@ -48,6 +47,9 @@ public async Task>> Index()
return Ok(model);
}
+ private static readonly IDictionary _moduleTypeNames = typeof(ExampleModuleType).GetMembers().Where(e => e.GetCustomAttribute() != null)
+ .ToDictionary(member => member.Name, member => member.GetCustomAttribute()?.Description ?? member.Name);
+
[HttpGet("features/{name}")]
[AllowAnonymous]
public async Task> Info([FromRoute] string name)
@@ -57,64 +59,13 @@ public async Task> Info([FromRoute] string name)
// return cached;
//}
- var feature = await db.ResolveFeature(RepositoryId.Rubberduck, name);
+ var feature = features.Get(name);
if (feature is null)
{
return NotFound();
}
- var moduleTypeNames = typeof(ExampleModuleType).GetMembers().Where(e => e.GetCustomAttribute() != null).ToDictionary(member => member.Name, member => member.GetCustomAttribute()?.Description ?? member.Name);
-
- var model = new FeatureViewModel(feature with
- {
- Description = await md.FormatMarkdownDocument(feature.Description, true),
- ShortDescription = feature.ShortDescription,
-
- ParentId = feature.Id,
- ParentName = feature.Name,
- ParentTitle = feature.Title,
-
- Features = feature.Features.Select(subFeature => subFeature with
- {
- Description = subFeature.Description,
- ShortDescription = subFeature.ShortDescription
- }).ToArray(),
-
- Inspections = feature.Items.Select(item =>
- {
- var info = JsonSerializer.Deserialize(item.Serialized)!;
- return new XmlDocInspectionInfo
- {
- Id = item.Id,
- DateTimeInserted = item.DateTimeInserted,
- DateTimeUpdated = item.DateTimeUpdated,
- IsDiscontinued = item.IsDiscontinued,
- IsHidden = item.IsHidden,
- IsNew = item.IsNew,
- Name = item.Name,
- Title = item.Title,
- SourceUrl = item.SourceUrl,
-
- FeatureId = feature.Id,
- FeatureName = feature.Name,
- FeatureTitle = feature.Title,
-
- Summary = info.Summary,
- Reasoning = info.Reasoning,
- Remarks = info.Remarks,
- HostApp = info.HostApp,
- References = info.References,
- InspectionType = info.InspectionType,
- DefaultSeverity = info.DefaultSeverity,
- QuickFixes = info.QuickFixes,
- Serialized = item.Serialized,
- Examples = info.Examples ?? []
- };
- }).ToArray(),
-
- Items = feature.Items
- });
-
+ var model = new FeatureViewModel(feature);
//cache.Write(HttpContext.Request.Path, model);
return Ok(model);
}
@@ -124,12 +75,12 @@ public async Task> Info([FromRoute] string name)
public async Task Resolve([FromQuery] RepositoryId repository, [FromQuery] string name)
{
var graph = await db.ResolveFeature(repository, name);
- var markdown = await md.FormatMarkdownDocument(graph.Description, withSyntaxHighlighting: true);
+ var markdown = md.FormatMarkdownDocument(graph.Description, withSyntaxHighlighting: true);
return Ok(graph with { Description = markdown });
}
[HttpGet("features/create")]
- //[Authorize("github")]
+ [Authorize("github")]
public async Task> Create([FromQuery] RepositoryId repository = RepositoryId.Rubberduck, [FromQuery] int? parentId = default)
{
var features = await GetFeatureOptions(repository);
@@ -140,7 +91,7 @@ public async Task> Create([FromQuery] Reposit
}
[HttpPost("create")]
- //[Authorize("github")]
+ [Authorize("github")]
public async Task> Create([FromBody] FeatureEditViewModel model)
{
if (model.Id.HasValue || string.IsNullOrWhiteSpace(model.Name) || model.Name.Trim().Length < 3)
@@ -162,7 +113,7 @@ public async Task> Create([FromBody] FeatureE
}
[HttpPost("features/update")]
- //[Authorize("github")]
+ [Authorize("github")]
public async Task> Update([FromBody] FeatureEditViewModel model)
{
if (model.Id.GetValueOrDefault() == default)
@@ -183,8 +134,8 @@ public async Task> Update([FromBody] FeatureE
}
[HttpPost("features/markdown")]
- public async Task FormatMarkdown([FromBody] MarkdownFormattingRequestViewModel model)
+ public IActionResult FormatMarkdown([FromBody] MarkdownFormattingRequestViewModel model)
{
- return Ok(await md.FormatMarkdownDocument(model.MarkdownContent, model.WithVbeCodeBlocks));
+ return Ok(md.FormatMarkdownDocument(model.MarkdownContent, model.WithVbeCodeBlocks));
}
}
diff --git a/rubberduckvba.Server/Api/Features/RepositoryOptionViewModel.cs b/rubberduckvba.Server/Api/Features/RepositoryOptionViewModel.cs
index 016fd97..906c185 100644
--- a/rubberduckvba.Server/Api/Features/RepositoryOptionViewModel.cs
+++ b/rubberduckvba.Server/Api/Features/RepositoryOptionViewModel.cs
@@ -1,6 +1,6 @@
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.Api.Features;
+namespace rubberduckvba.Server.Api.Features;
public class RepositoryOptionViewModel
{
diff --git a/rubberduckvba.Server/Api/Tags/LatestTagsViewModel.cs b/rubberduckvba.Server/Api/Tags/LatestTagsViewModel.cs
index 98cbe59..1438d04 100644
--- a/rubberduckvba.Server/Api/Tags/LatestTagsViewModel.cs
+++ b/rubberduckvba.Server/Api/Tags/LatestTagsViewModel.cs
@@ -1,6 +1,6 @@
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.Model;
-namespace rubberduckvba.com.Server.Api.Tags;
+namespace rubberduckvba.Server.Api.Tags;
public record struct LatestTagsViewModel
{
diff --git a/rubberduckvba.Server/Api/Tags/TagViewModel.cs b/rubberduckvba.Server/Api/Tags/TagViewModel.cs
index 01591b5..30794c9 100644
--- a/rubberduckvba.Server/Api/Tags/TagViewModel.cs
+++ b/rubberduckvba.Server/Api/Tags/TagViewModel.cs
@@ -1,6 +1,6 @@
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.Model;
-namespace rubberduckvba.com.Server.Api.Tags;
+namespace rubberduckvba.Server.Api.Tags;
public record struct TagViewModel
{
diff --git a/rubberduckvba.Server/Api/Tags/TagsController.cs b/rubberduckvba.Server/Api/Tags/TagsController.cs
index 37922eb..2302514 100644
--- a/rubberduckvba.Server/Api/Tags/TagsController.cs
+++ b/rubberduckvba.Server/Api/Tags/TagsController.cs
@@ -1,8 +1,8 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.Api.Tags;
+namespace rubberduckvba.Server.Api.Tags;
[ApiController]
diff --git a/rubberduckvba.Server/ContentSynchronization/InspectionDefaultConfig.cs b/rubberduckvba.Server/ContentSynchronization/InspectionDefaultConfig.cs
index 4517d4b..27a21a1 100644
--- a/rubberduckvba.Server/ContentSynchronization/InspectionDefaultConfig.cs
+++ b/rubberduckvba.Server/ContentSynchronization/InspectionDefaultConfig.cs
@@ -1,4 +1,4 @@
-namespace rubberduckvba.com.Server.ContentSynchronization;
+namespace rubberduckvba.Server.ContentSynchronization;
///
/// Encapsulates the inspection type and default severity setting override for an inspection.
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/ActionBlockBase.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/ActionBlockBase.cs
index e383a87..1409176 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/ActionBlockBase.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/ActionBlockBase.cs
@@ -1,6 +1,7 @@
-using System.Threading.Tasks.Dataflow;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using System.Threading.Tasks.Dataflow;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
public abstract class ActionBlockBase : ExecutionDataflowBlockBase, TInput, TContext>
where TContext : IPipelineContext
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/BroadcastBlockBase.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/BroadcastBlockBase.cs
index 06f0e26..463368b 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/BroadcastBlockBase.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/BroadcastBlockBase.cs
@@ -1,6 +1,7 @@
-using System.Threading.Tasks.Dataflow;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using System.Threading.Tasks.Dataflow;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
public abstract class BroadcastBlockBase : ExecutionDataflowBlockBase, TInput, TContext>
where TContext : IPipelineContext
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/BufferBlockBase.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/BufferBlockBase.cs
index 40e9dbf..31bd8ea 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/BufferBlockBase.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/BufferBlockBase.cs
@@ -1,6 +1,7 @@
-using System.Threading.Tasks.Dataflow;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using System.Threading.Tasks.Dataflow;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
public abstract class BufferBlockBase : ExecutionDataflowBlockBase, TInput, TContext>
where TContext : IPipelineContext
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/DataflowBlockBase.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/DataflowBlockBase.cs
index 4a90b50..55f6f68 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/DataflowBlockBase.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/DataflowBlockBase.cs
@@ -1,6 +1,7 @@
-using System.Threading.Tasks.Dataflow;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using System.Threading.Tasks.Dataflow;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
public interface ISectionBlock
where TContext : IPipelineContext
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/DataflowJoinBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/DataflowJoinBlock.cs
index 020b859..3a57c47 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/DataflowJoinBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/DataflowJoinBlock.cs
@@ -1,12 +1,13 @@
-using System.Threading.Tasks.Dataflow;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using System.Threading.Tasks.Dataflow;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
-public class DataflowJoinBlock : DataflowBlockBase, SyncContext>, IDisposable
+public class DataflowJoinBlock : DataflowBlockBase, SyncContext>, IDisposable
{
private readonly ICollection _links = [];
- public DataflowJoinBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger, string name)
+ public DataflowJoinBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger, string name)
: base(parent, tokenSource, logger)
{
Name = name;
@@ -42,6 +43,7 @@ public JoinBlock CreateBlock(GroupingDataflowBlockOptions options, ISour
Block = new JoinBlock(options);
LinkSources(source1, source2);
+ Parent.TraceBlockCompletion(Block, Name);
return Block;
}
@@ -50,12 +52,11 @@ public JoinBlock CreateBlock(GroupingDataflowBlockOptions opti
{
Block = new JoinBlock(options);
- var sourceBlock1 = source1.TryGetBlock() as ISourceBlock;
- var sourceBlock2 = source2.TryGetBlock() as ISourceBlock;
- if (sourceBlock1 != null && sourceBlock2 != null)
- {
- LinkSources(sourceBlock1, sourceBlock2);
- }
+ var sourceBlock1 = source1.TryGetBlock() as ISourceBlock ?? throw new ArgumentNullException(nameof(source1));
+ var sourceBlock2 = source2.TryGetBlock() as ISourceBlock ?? throw new ArgumentNullException(nameof(source2));
+
+ LinkSources(sourceBlock1, sourceBlock2);
+ Parent.TraceBlockCompletion(Block, Name);
return Block;
}
@@ -120,6 +121,7 @@ public JoinBlock CreateBlock(GroupingDataflowBlockOptions options, I
Block = new JoinBlock(options);
LinkSources(source1, source2, source3);
+ Parent.TraceBlockCompletion(Block, Name);
return Block;
}
@@ -128,13 +130,12 @@ public JoinBlock CreateBlock(GroupingDataflowBlockOptions
{
Block = new JoinBlock(options);
- var sourceBlock1 = source1.TryGetBlock() as ISourceBlock;
- var sourceBlock2 = source2.TryGetBlock() as ISourceBlock;
- var sourceBlock3 = source3.TryGetBlock() as ISourceBlock;
- if (sourceBlock1 != null && sourceBlock2 != null && sourceBlock3 != null)
- {
- LinkSources(sourceBlock1, sourceBlock2, sourceBlock3);
- }
+ var sourceBlock1 = source1.TryGetBlock() as ISourceBlock ?? throw new ArgumentNullException(nameof(source1));
+ var sourceBlock2 = source2.TryGetBlock() as ISourceBlock ?? throw new ArgumentNullException(nameof(source2));
+ var sourceBlock3 = source3.TryGetBlock() as ISourceBlock ?? throw new ArgumentNullException(nameof(source3));
+
+ LinkSources(sourceBlock1, sourceBlock2, sourceBlock3);
+ Parent.TraceBlockCompletion(Block, Name);
return Block;
}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/ExecutionDataflowBlockBase.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/ExecutionDataflowBlockBase.cs
index 6e8bc81..0fc2885 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/ExecutionDataflowBlockBase.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/ExecutionDataflowBlockBase.cs
@@ -1,7 +1,8 @@
-using System.Diagnostics;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using System.Diagnostics;
using System.Threading.Tasks.Dataflow;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
public abstract class ExecutionDataflowBlockBase : DataflowBlockBase, IDisposable
where TBlock : class, IDataflowBlock, ITargetBlock
@@ -123,7 +124,7 @@ protected void LinkToSources(params ISourceBlock[] sources)
if (sources != null && sources.Length > 0)
{
var propagate = sources.Count() == 1;
-
+
foreach (var source in sources)
{
var propagateSourceCompletion = propagate
@@ -164,9 +165,9 @@ protected void LinkToSources(params ISectionBlock[] sources)
}
else if (srcBlock != null)
{
- // could be e.g. ActionBlock, which can't directly source another block.
- completionTasks.Add(srcBlock.Completion);
- Logger.LogDebug(Context.Parameters, $"{Name} | ⚠️ Source block ({srcBlock.GetType().Name}) is not ISourceBlock<{typeof(TInput).Name}>. If this is accidental, pipeline may not complete.");
+ //completionTasks.Add(srcBlock.Completion);
+ Logger.LogWarning(Context.Parameters, $"{Name} | ⚠️ Source block ({srcBlock.GetType().Name}) is not ISourceBlock<{typeof(TInput).Name}>. Pipeline may not complete.");
+ throw new InvalidOperationException($"Source block ({srcBlock.GetType().Name}) is not ISourceBlock<{typeof(TInput).Name}>");
}
else
{
@@ -193,6 +194,7 @@ protected void WaitAllTasks(params Task[] completionTasks)
sw.Stop();
Block.Complete();
Logger.LogInformation(Context.Parameters, $"{Name} | ☑️ Block completed | ⏱️ {sw.Elapsed}");
+ Parent.LogBlockCompletionDetails();
}));
}
}
@@ -202,6 +204,7 @@ protected void LinkFromSource(Func blockOutput, params Task[] waitForTas
if (waitForTasks?.Any() ?? false)
{
Logger.LogTrace(Context.Parameters, $"{Name} | 🕑 Awaiting the completion of {waitForTasks.Length} source block task{(waitForTasks.Length > 1 ? "s" : string.Empty)}");
+
_whenAllTasks.Add(Task.WhenAll(waitForTasks).ContinueWith(t =>
{
try
@@ -215,18 +218,14 @@ protected void LinkFromSource(Func blockOutput, params Task[] waitForTas
}
Logger.LogTrace(Context.Parameters, $"{Name} | 🚀 Block accepted input ({typeof(TInput).Name})");
+ Block.Complete();
}
catch (Exception exception)
{
Logger.LogException(Context.Parameters, exception);
throw;
}
- finally
- {
- Block.Complete();
- Logger.LogTrace(Context.Parameters, $"{Name} | ☑️ Block completed");
- }
- }, Token, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.Current));
+ }, Token, TaskContinuationOptions.NotOnCanceled, TaskScheduler.Current));
}
}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/IPipeline.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/IPipeline.cs
index 693e844..b753f5c 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/IPipeline.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/IPipeline.cs
@@ -1,6 +1,6 @@
using System.Threading.Tasks.Dataflow;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
public interface IPipeline
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/ISynchronizationPipeline.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/ISynchronizationPipeline.cs
index fa5cb16..7bc8c94 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/ISynchronizationPipeline.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/ISynchronizationPipeline.cs
@@ -1,4 +1,4 @@
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
public interface ISynchronizationPipeline : IPipeline
where TContext : class
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/ISynchronizationPipelineFactory.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/ISynchronizationPipelineFactory.cs
index d89ed05..f115f4d 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/ISynchronizationPipelineFactory.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/ISynchronizationPipelineFactory.cs
@@ -1,4 +1,4 @@
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
public interface ISynchronizationPipelineFactory
where TContext : class
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/PipelineBase.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/PipelineBase.cs
index 85830c2..ba3ccc4 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/PipelineBase.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/PipelineBase.cs
@@ -1,6 +1,7 @@
-using System.Threading.Tasks.Dataflow;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using System.Threading.Tasks.Dataflow;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
public abstract class PipelineBase : IDisposable, IPipeline
where TContext : IPipelineContext
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/PipelineResult.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/PipelineResult.cs
index 5084ad3..361f339 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/PipelineResult.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/PipelineResult.cs
@@ -1,6 +1,6 @@
using System.Collections.Concurrent;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
public class PipelineResult : IPipelineResult
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/PipelineSection.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/PipelineSection.cs
index 13b0b31..a81f83e 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/PipelineSection.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/PipelineSection.cs
@@ -1,6 +1,7 @@
-using System.Threading.Tasks.Dataflow;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using System.Threading.Tasks.Dataflow;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
public interface IPipelineResult
{
@@ -26,6 +27,7 @@ protected PipelineSection(IPipeline parent, CancellationTokenSou
private readonly List _tracedCompletionTasks = [];
public void TraceBlockCompletion(IDataflowBlock block, string name)
{
+ Logger.LogTrace(Context.Parameters, $"{GetType().Name} | ☑️ Tracing block completion for {name}.");
_tracedCompletionTasks.Add(block.Completion.ContinueWith(t =>
{
string status;
@@ -41,22 +43,26 @@ public void TraceBlockCompletion(IDataflowBlock block, string name)
status = "task ran to completion.";
break;
default:
- status = $"task is in unexpected state {t.Status}.";
+ status = $"task is in unexpected state '{t.Status}'.";
break;
}
Logger.LogTrace(Context.Parameters, $"{GetType().Name} | ✅ Dataflow block completion task completed | {name} ({block.GetType().Name}) | {status}");
- }).ContinueWith(t =>
- {
- var details = Blocks.Select(
- block => $"{(
- block.Value.Completion.IsCompletedSuccessfully ? "✔️"
- : block.Value.Completion.IsFaulted ? "✖️"
- : block.Value.Completion.IsCanceled ? "⛔"
- : "🕑")} {block.Key} : {block.Value.Completion.Status}");
- Logger.LogTrace(Context.Parameters, "Pipeline block completion status details" + Environment.NewLine + string.Join(Environment.NewLine, details));
+ LogBlockCompletionDetails();
}));
}
+ public void LogBlockCompletionDetails()
+ {
+ var details = Blocks.Select(
+ block => $"{(
+ block.Value.Completion.IsCompletedSuccessfully ? "✔️"
+ : block.Value.Completion.IsFaulted ? "✖️"
+ : block.Value.Completion.IsCanceled ? "⛔"
+ : "🕑")} {block.Key} : {block.Value.Completion.Status}");
+
+ Logger.LogTrace(Context.Parameters, "Pipeline block completion status details" + Environment.NewLine + string.Join(Environment.NewLine, details));
+ }
+
public void FaultPipelineBlock(IDataflowBlock block, Exception exception)
{
block.Fault(exception);
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/SynchronizationPipelineFactory.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/SynchronizationPipelineFactory.cs
index 01ae599..ca01999 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/SynchronizationPipelineFactory.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/SynchronizationPipelineFactory.cs
@@ -1,8 +1,12 @@
using Hangfire;
-using rubberduckvba.com.Server.ContentSynchronization.XmlDoc.Abstract;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.ContentSynchronization.XmlDoc;
+using rubberduckvba.Server.ContentSynchronization.XmlDoc.Abstract;
+using rubberduckvba.Server.Data;
+using rubberduckvba.Server.Model.Entity;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
public class SynchronizationPipelineFactory : ISynchronizationPipelineFactory
{
@@ -12,8 +16,17 @@ public class SynchronizationPipelineFactory : ISynchronizationPipelineFactory _inspections;
+ private readonly IRepository _quickfixes;
+ private readonly IRepository _annotations;
- public SynchronizationPipelineFactory(ILogger logger, IRubberduckDbService content, IGitHubClientService github, IXmlDocMerge merge, IStagingServices staging, IMarkdownFormattingService markdown)
+ private readonly XmlDocAnnotationParser _annotationParser;
+ private readonly XmlDocQuickFixParser _quickFixParser;
+ private readonly XmlDocInspectionParser _inspectionParser;
+
+ public SynchronizationPipelineFactory(ILogger logger, IRubberduckDbService content, IGitHubClientService github, IXmlDocMerge merge, IStagingServices staging, IMarkdownFormattingService markdown,
+ IRepository inspections, IRepository quickfixes, IRepository annotations,
+ XmlDocAnnotationParser xmlAnnotationParser, XmlDocQuickFixParser xmlQuickFixParser, XmlDocInspectionParser xmlInspectionParser)
{
_logger = logger;
_content = content;
@@ -21,20 +34,26 @@ public SynchronizationPipelineFactory(ILogger logger, IRubberduc
_merge = merge;
_staging = staging;
_markdown = markdown;
+ _inspections = inspections;
+ _quickfixes = quickfixes;
+ _annotations = annotations;
+
+ _annotationParser = xmlAnnotationParser;
+ _quickFixParser = xmlQuickFixParser;
+ _inspectionParser = xmlInspectionParser;
}
public ISynchronizationPipeline Create(TParameters parameters, CancellationTokenSource tokenSource) where TParameters : IRequestParameters
{
return parameters switch
{
- XmldocSyncRequestParameters => new SynchronizeXmlPipeline(parameters, _logger, _content, _github, _merge, _staging, _markdown, tokenSource),
+ XmldocSyncRequestParameters => new SynchronizeXmlPipeline(parameters, _logger, _content, _github, _merge, _staging, _markdown, tokenSource, _inspections, _quickfixes, _annotations, _annotationParser, _quickFixParser, _inspectionParser),
TagSyncRequestParameters => new SynchronizeTagsPipeline(parameters, _logger, _content, _github, _merge, _staging, tokenSource),
_ => throw new NotSupportedException(),
};
}
}
-
public class HangfireTokenSource(IJobCancellationToken token) : CancellationTokenSource
{
public void ThrowIfCancellationRequested() => token.ThrowIfCancellationRequested();
-}
\ No newline at end of file
+}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/TransformBlockBase.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/TransformBlockBase.cs
index b41f590..0e44521 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/TransformBlockBase.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/TransformBlockBase.cs
@@ -1,6 +1,7 @@
-using System.Threading.Tasks.Dataflow;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using System.Threading.Tasks.Dataflow;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
public abstract class TransformBlockBase : ExecutionDataflowBlockBase, TInput, TContext>
where TContext : IPipelineContext
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/TransformManyBlockBase.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/TransformManyBlockBase.cs
index af9e971..512cba0 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/TransformManyBlockBase.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Abstract/TransformManyBlockBase.cs
@@ -1,12 +1,13 @@
-using System.Threading.Tasks.Dataflow;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using System.Threading.Tasks.Dataflow;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
public abstract class TransformManyBlockBase : ExecutionDataflowBlockBase, TInput, TContext>
where TContext : IPipelineContext
{
protected TransformManyBlockBase(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
- : base(parent, tokenSource, logger)
+ : base(parent, tokenSource, logger)
{
}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/PipelineLogger.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/PipelineLogger.cs
index f94a8db..6ed7f74 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/PipelineLogger.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/PipelineLogger.cs
@@ -1,3 +1,3 @@
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline;
public class PipelineLogger { }
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/Context/InitializeContextSection.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/Context/InitializeContextSection.cs
index d49d1a8..d494ac6 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/Context/InitializeContextSection.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/Context/InitializeContextSection.cs
@@ -1,12 +1,12 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
using System.Threading.Tasks.Dataflow;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
public class InitializeContextSection : PipelineSection
{
- public InitializeContextSection(IPipeline parent, CancellationTokenSource tokenSource, ILogger logger)
+ public InitializeContextSection(IPipeline parent, CancellationTokenSource tokenSource, ILogger logger)
: base(parent, tokenSource, logger)
{
ReceiveRequest = new ReceiveRequestBlock(this, tokenSource, logger);
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/Context/StagingContext.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/Context/StagingContext.cs
index 56f913c..3cae870 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/Context/StagingContext.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/Context/StagingContext.cs
@@ -1,7 +1,7 @@
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.Model;
using System.Collections.Concurrent;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
public class StagingContext
{
@@ -12,11 +12,9 @@ public StagingContext(SyncRequestParameters parameters)
Parameters = parameters;
}
- public ConcurrentBag ProcessedTags { get; } = [];
- public ICollection NewTags { get; set; } = [];
- public ICollection UpdatedTags { get; set; } = [];
+ public ConcurrentBag Tags { get; } = [];
- public ConcurrentBag ProcessedFeatureItems { get; } = [];
- public ICollection NewFeatureItems { get; set; } = [];
- public ICollection UpdatedFeatureItems { get; set; } = [];
+ public ConcurrentBag Inspections { get; set; } = [];
+ public ConcurrentBag QuickFixes { get; set; } = [];
+ public ConcurrentBag Annotations { get; set; } = [];
}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/Context/SyncContext.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/Context/SyncContext.cs
index 18925e3..cdafb1f 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/Context/SyncContext.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/Context/SyncContext.cs
@@ -1,7 +1,7 @@
-using System.Collections.Immutable;
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.Model;
+using System.Collections.Immutable;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
public interface IPipelineContext
{
@@ -17,11 +17,10 @@ public SyncContext(IRequestParameters parameters)
private IRequestParameters? _parameters;
public IRequestParameters Parameters => ContextNotInitializedException.ThrowIfNull(_parameters);
- IRequestParameters IPipelineContext.Parameters => Parameters;
+ IRequestParameters IPipelineContext.Parameters => Parameters;
public void LoadParameters(SyncRequestParameters parameters)
{
InvalidContextParameterException.ThrowIfNull(nameof(parameters), parameters);
- //ContextAlreadyInitializedException.ThrowIfNotNull(_parameters);
_parameters = parameters;
_staging = new StagingContext(parameters);
}
@@ -30,8 +29,9 @@ public void LoadParameters(SyncRequestParameters parameters)
public StagingContext StagingContext => ContextNotInitializedException.ThrowIfNull(_staging);
+ private Dictionary _latestTagsByAssetId = [];
private TagGraph? _main;
- public TagGraph RubberduckDbMain
+ public TagGraph RubberduckDbMain
=> ContextNotInitializedException.ThrowIfNull(_main);
public void LoadRubberduckDbMain(TagGraph main)
@@ -39,10 +39,14 @@ public void LoadRubberduckDbMain(TagGraph main)
InvalidContextParameterException.ThrowIfNull(nameof(main), main);
ContextAlreadyInitializedException.ThrowIfNotNull(_main);
_main ??= main;
+ foreach (var asset in _main.Assets)
+ {
+ _latestTagsByAssetId[asset.Id] = _main;
+ }
}
private TagGraph? _next;
- public TagGraph RubberduckDbNext
+ public TagGraph RubberduckDbNext
=> ContextNotInitializedException.ThrowIfNull(_next);
public void LoadRubberduckDbNext(TagGraph next)
@@ -50,6 +54,17 @@ public void LoadRubberduckDbNext(TagGraph next)
InvalidContextParameterException.ThrowIfNull(nameof(next), next);
ContextAlreadyInitializedException.ThrowIfNotNull(_next);
_next ??= next;
+ foreach (var asset in _next.Assets)
+ {
+ _latestTagsByAssetId[asset.Id] = _next;
+ }
+ }
+
+
+ public bool TryGetTagByAssetId(int assetId, out TagGraph tag)
+ {
+ var tags = ContextNotInitializedException.ThrowIfNull(_latestTagsByAssetId);
+ return tags.TryGetValue(assetId, out tag!);
}
private ImmutableDictionary? _tagsById;
@@ -66,8 +81,9 @@ public void LoadDbTags(IEnumerable tags)
_tagsById = tags.ToImmutableDictionary(tag => tag.Id);
}
+
private ImmutableDictionary? _inspectionConfig;
- public ImmutableDictionary InspectionDefaultConfig
+ public ImmutableDictionary InspectionDefaultConfig
=> ContextNotInitializedException.ThrowIfNull(_inspectionConfig);
public void LoadInspectionDefaultConfig(IEnumerable config)
{
@@ -76,21 +92,42 @@ public void LoadInspectionDefaultConfig(IEnumerable con
_inspectionConfig = config.ToImmutableDictionary(e => e.InspectionName);
}
- private ImmutableHashSet? _featureItems;
- public ImmutableHashSet FeatureItems
- => ContextNotInitializedException.ThrowIfNull(_featureItems);
+ private ImmutableHashSet? _inspections;
+ public ImmutableHashSet Inspections
+ => ContextNotInitializedException.ThrowIfNull(_inspections);
+
+ private ImmutableHashSet? _quickfixes;
+ public ImmutableHashSet QuickFixes
+ => ContextNotInitializedException.ThrowIfNull(_quickfixes);
+
+ private ImmutableHashSet? _annotations;
+ public ImmutableHashSet Annotations
+ => ContextNotInitializedException.ThrowIfNull(_annotations);
+
+
+ public void LoadInspections(IEnumerable inspections)
+ {
+ ContextAlreadyInitializedException.ThrowIfNotNull(_inspections);
+ _inspections = inspections.ToImmutableHashSet();
+ }
+
+ public void LoadQuickFixes(IEnumerable quickfixes)
+ {
+ ContextAlreadyInitializedException.ThrowIfNotNull(_quickfixes);
+ _quickfixes = quickfixes.ToImmutableHashSet();
+ }
- public void LoadFeatureItems(IEnumerable items)
+ public void LoadAnnotations(IEnumerable annotations)
{
- ContextAlreadyInitializedException.ThrowIfNotNull(_featureItems);
- _featureItems = items.ToImmutableHashSet();
+ ContextAlreadyInitializedException.ThrowIfNotNull(_annotations);
+ _annotations = annotations.ToImmutableHashSet();
}
private TagGraph? _githubMain;
private TagGraph? _githubNext;
private ImmutableHashSet? _githubOthers;
- public TagGraph GitHubMain
+ public TagGraph GitHubMain
=> ContextNotInitializedException.ThrowIfNull(_githubMain);
public TagGraph GitHubNext
=> ContextNotInitializedException.ThrowIfNull(_githubNext);
@@ -142,12 +179,12 @@ public static void ThrowIfNullOrEmpty(string paramName, IEnumerable values
}
}
- private InvalidContextParameterException(string paramName, string message)
- : base(paramName, message)
+ private InvalidContextParameterException(string paramName, string message)
+ : base(paramName, message)
{ }
}
-public class ContextNotInitializedException : InvalidOperationException
+public class ContextNotInitializedException : InvalidOperationException
{
public static T ThrowIfNull(T? value)
=> value ?? throw new ContextNotInitializedException();
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/AccumulateProcessedTagsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/AccumulateProcessedTagsBlock.cs
index 528c951..5bd4a50 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/AccumulateProcessedTagsBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/AccumulateProcessedTagsBlock.cs
@@ -1,8 +1,9 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public class AccumulateProcessedTagsBlock : TransformBlockBase
{
@@ -13,7 +14,7 @@ public AccumulateProcessedTagsBlock(PipelineSection parent, Cancell
public override SyncContext Transform(TagGraph input)
{
- Context.StagingContext.ProcessedTags.Add(input);
+ Context.StagingContext.Tags.Add(input);
return Context;
}
}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/AcquireDbMainTagGraphBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/AcquireDbMainTagGraphBlock.cs
index d4b5cdf..ad7fe23 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/AcquireDbMainTagGraphBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/AcquireDbMainTagGraphBlock.cs
@@ -1,8 +1,9 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public class AcquireDbMainTagGraphBlock : TransformBlockBase
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/AcquireDbNextTagGraphBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/AcquireDbNextTagGraphBlock.cs
index 97989fd..e492f47 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/AcquireDbNextTagGraphBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/AcquireDbNextTagGraphBlock.cs
@@ -1,8 +1,9 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public class AcquireDbNextTagGraphBlock : TransformBlockBase
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/BroadcastParametersBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/BroadcastParametersBlock.cs
index 4ac09ea..838f15d 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/BroadcastParametersBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/BroadcastParametersBlock.cs
@@ -1,6 +1,7 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public class BroadcastParametersBlock : BroadcastBlockBase
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/BroadcastTagsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/BroadcastTagsBlock.cs
index b09fada..4793a84 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/BroadcastTagsBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/BroadcastTagsBlock.cs
@@ -1,6 +1,7 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public class BroadcastTagsBlock : BroadcastBlockBase, SyncContext>
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/GetTagAssetsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/GetTagAssetsBlock.cs
index 25871e0..b6a5f8b 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/GetTagAssetsBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/GetTagAssetsBlock.cs
@@ -1,8 +1,9 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public class GetTagAssetsBlock : TransformBlockBase
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadDbFeatureItemsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadDbFeatureItemsBlock.cs
index 3bb489f..1d6eaeb 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadDbFeatureItemsBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadDbFeatureItemsBlock.cs
@@ -1,21 +1,34 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Data;
+using rubberduckvba.Server.Model;
+using rubberduckvba.Server.Model.Entity;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public class LoadDbFeatureItemsBlock : ActionBlockBase
{
private IRubberduckDbService _db;
+ private readonly IRepository _inspections;
+ private readonly IRepository _quickfixes;
+ private readonly IRepository _annotations;
- public LoadDbFeatureItemsBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger, IRubberduckDbService db)
+ public LoadDbFeatureItemsBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger,
+ IRepository inspections, IRepository quickfixes, IRepository annotations)
: base(parent, tokenSource, logger)
{
- _db = db;
+ _inspections = inspections;
+ _quickfixes = quickfixes;
+ _annotations = annotations;
}
protected override async Task ActionAsync(SyncRequestParameters input)
{
- var items = await _db.GetXmlDocFeaturesAsync(input.RepositoryId);
- Context.LoadFeatureItems(items);
+ await Task.WhenAll([
+ Task.Run(() => _inspections.GetAll()).ContinueWith(t => Context.LoadInspections(t.Result.Select(e => new Inspection(e)))),
+ Task.Run(() => _quickfixes.GetAll()).ContinueWith(t => Context.LoadQuickFixes(t.Result.Select(e => new QuickFix(e)))),
+ Task.Run(() => _annotations.GetAll()).ContinueWith(t => Context.LoadAnnotations(t.Result.Select(e => new Annotation(e))))
+ ]);
}
}
\ No newline at end of file
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadDbLatestTagsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadDbLatestTagsBlock.cs
index 2e3fc39..ef5a082 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadDbLatestTagsBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadDbLatestTagsBlock.cs
@@ -1,11 +1,12 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public class LoadDbLatestTagsBlock : TransformBlockBase, SyncContext, SyncContext>
{
- public LoadDbLatestTagsBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
+ public LoadDbLatestTagsBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
: base(parent, tokenSource, logger)
{
}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadFeaturesBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadFeaturesBlock.cs
index afde93c..796bd47 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadFeaturesBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadFeaturesBlock.cs
@@ -1,7 +1,8 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public class LoadFeaturesBlock : ActionBlockBase
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadGitHubTagsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadGitHubTagsBlock.cs
index b1fc654..d9dfc63 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadGitHubTagsBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadGitHubTagsBlock.cs
@@ -1,7 +1,8 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public class LoadGitHubTagsBlock : TransformBlockBase
{
@@ -17,7 +18,7 @@ public override async Task TransformAsync(SyncRequestParameters inp
{
var githubTags = await _github.GetAllTagsAsync(); // does not get the assets
var (gitHubMain, gitHubNext, gitHubOthers) = githubTags.GetLatestTags();
-
+
Context.LoadGitHubTags(gitHubMain, gitHubNext, gitHubOthers);
return Context;
}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadInspectionDefaultConfigBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadInspectionDefaultConfigBlock.cs
index 6109009..14aac87 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadInspectionDefaultConfigBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/LoadInspectionDefaultConfigBlock.cs
@@ -1,7 +1,8 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public class LoadInspectionDefaultConfigBlock : ActionBlockBase
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/ReceiveRequestBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/ReceiveRequestBlock.cs
index 9840085..7077e58 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/ReceiveRequestBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/ReceiveRequestBlock.cs
@@ -1,6 +1,7 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public class ReceiveRequestBlock : TransformBlockBase
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/StreamGitHubOtherTagsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/StreamGitHubOtherTagsBlock.cs
index 057f3e1..fffac39 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/StreamGitHubOtherTagsBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/StreamGitHubOtherTagsBlock.cs
@@ -1,7 +1,8 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public class StreamGitHubOtherTagsBlock : TransformManyBlockBase, TagGraph, SyncContext>
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/StreamGitHubTagsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/StreamGitHubTagsBlock.cs
index ec9d6ff..4f4ebfb 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/StreamGitHubTagsBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/StreamGitHubTagsBlock.cs
@@ -1,7 +1,8 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public class StreamGitHubTagsBlock : TransformManyBlockBase, TagGraph, SyncContext>
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/SyncTagsSection.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/SyncTagsSection.cs
index cdc603a..143576b 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/SyncTagsSection.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/SyncTagsSection.cs
@@ -1,9 +1,10 @@
-using System.Threading.Tasks.Dataflow;
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
+using rubberduckvba.Server.Services;
+using System.Threading.Tasks.Dataflow;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public class SyncTagsSection : PipelineSection
{
@@ -43,7 +44,7 @@ public SyncTagsSection(IPipeline parent, CancellationTokenSou
private BulkSaveStagingBlock SaveTags { get; }
public ITargetBlock InputBlock => ReceiveRequest.Block;
- public Task OutputTask => AccumulateProcessedTags.Block.Completion;
+ public Task OutputTask => SaveTags.Block.Completion;
protected override IReadOnlyDictionary Blocks => new Dictionary
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/TagBufferBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/TagBufferBlock.cs
index 1562a9b..b35964b 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/TagBufferBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/TagBufferBlock.cs
@@ -1,7 +1,8 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public class TagBufferBlock : BufferBlockBase
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/TagExtensions.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/TagExtensions.cs
index 22ebf9f..61a3da0 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/TagExtensions.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncTags/TagExtensions.cs
@@ -1,6 +1,6 @@
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.Model;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncTags;
public static class TagExtensions
{
@@ -9,9 +9,9 @@ public static (TagGraph main, TagGraph next, IEnumerable others) GetLa
var sortedTags = tags.OrderByDescending(tag => tag.DateCreated)
.GroupBy(tag => tag.IsPreRelease)
.ToDictionary(grouping => grouping.Key, grouping => grouping.AsEnumerable());
-
+
return (
- sortedTags[false].First(),
+ sortedTags[false].First(),
sortedTags[true].First(),
sortedTags[false].Skip(1).Concat(sortedTags[true].Skip(1).ToArray())
);
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/AccumulateFeatureItemsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/AccumulateFeatureItemsBlock.cs
deleted file mode 100644
index 200a4fe..0000000
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/AccumulateFeatureItemsBlock.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
-
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
-
-public class AccumulateFeatureItemsBlock : ActionBlockBase
-{
- public AccumulateFeatureItemsBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
- : base(parent, tokenSource, logger)
- {
- }
-
- protected override void Action(FeatureXmlDoc input)
- {
- if (input != null)
- {
- Context.StagingContext.ProcessedFeatureItems.Add(input);
- }
- }
-}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/AccumulateProcessedFeatureItemsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/AccumulateProcessedFeatureItemsBlock.cs
deleted file mode 100644
index fbe291b..0000000
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/AccumulateProcessedFeatureItemsBlock.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
-
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
-
-public class AccumulateProcessedFeatureItemsBlock : ActionBlockBase
-{
- public AccumulateProcessedFeatureItemsBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
- : base(parent, tokenSource, logger)
- {
- }
-
- protected override void Action(FeatureXmlDoc input)
- {
- if (input != null)
- {
- foreach (var featureItem in input.Examples.GroupBy(e => e.FeatureItemId))
- {
- var exampleNumber = 1;
- foreach (var example in featureItem)
- {
- example.SortOrder = exampleNumber;
- exampleNumber++;
- }
- }
-
- Context.StagingContext.ProcessedFeatureItems.Add(input);
- }
- }
-}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/AccumulateProcessedInspectionsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/AccumulateProcessedInspectionsBlock.cs
new file mode 100644
index 0000000..b7365aa
--- /dev/null
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/AccumulateProcessedInspectionsBlock.cs
@@ -0,0 +1,59 @@
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
+
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+
+public class AccumulateProcessedInspectionsBlock : ActionBlockBase
+{
+ public AccumulateProcessedInspectionsBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
+ : base(parent, tokenSource, logger)
+ {
+ }
+
+ protected override void Action(Inspection input)
+ {
+ if (input is null)
+ {
+ return;
+ }
+
+ Context.StagingContext.Inspections.Add(input);
+ }
+}
+
+public class AccumulateProcessedQuickFixesBlock : ActionBlockBase
+{
+ public AccumulateProcessedQuickFixesBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
+ : base(parent, tokenSource, logger)
+ {
+ }
+
+ protected override void Action(QuickFix input)
+ {
+ if (input is null)
+ {
+ return;
+ }
+
+ Context.StagingContext.QuickFixes.Add(input);
+ }
+}
+
+public class AccumulateProcessedAnnotationsBlock : ActionBlockBase
+{
+ public AccumulateProcessedAnnotationsBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
+ : base(parent, tokenSource, logger)
+ {
+ }
+
+ protected override void Action(Annotation input)
+ {
+ if (input is null)
+ {
+ return;
+ }
+
+ Context.StagingContext.Annotations.Add(input);
+ }
+}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BroadcastLatestTagsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BroadcastLatestTagsBlock.cs
deleted file mode 100644
index c1f5fed..0000000
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BroadcastLatestTagsBlock.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
-
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
-
-public class BroadcastLatestTagsBlock : TransformManyBlockBase, TagGraph, SyncContext>
-{
- public BroadcastLatestTagsBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
- : base(parent, tokenSource, logger)
- {
- }
-
- public override IEnumerable Transform(Tuple input) => [Context.RubberduckDbMain, Context.RubberduckDbNext];
-}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BroadcastQuickFixesBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BroadcastQuickFixesBlock.cs
new file mode 100644
index 0000000..e3225f2
--- /dev/null
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BroadcastQuickFixesBlock.cs
@@ -0,0 +1,29 @@
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
+
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+
+public class BroadcastQuickFixesBlock : BroadcastBlockBase, SyncContext>
+{
+ public BroadcastQuickFixesBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
+ : base(parent, tokenSource, logger)
+ {
+ }
+}
+
+public class BroadcastAnnotationsBlock : BroadcastBlockBase, SyncContext>
+{
+ public BroadcastAnnotationsBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
+ : base(parent, tokenSource, logger)
+ {
+ }
+}
+
+public class BroadcastInspectionsBlock : BroadcastBlockBase, SyncContext>
+{
+ public BroadcastInspectionsBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
+ : base(parent, tokenSource, logger)
+ {
+ }
+}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BroadcastTagAssetsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BroadcastTagAssetsBlock.cs
deleted file mode 100644
index c831c83..0000000
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BroadcastTagAssetsBlock.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
-
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
-
-public class BroadcastTagAssetsBlock : TransformManyBlockBase
-{
- public BroadcastTagAssetsBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
- : base(parent, tokenSource, logger)
- {
- }
-
- public override IEnumerable Transform(TagGraph input) => input.Assets;
-}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BroadcastXDocumentBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BroadcastXDocumentBlock.cs
index 0fc6f6c..0325955 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BroadcastXDocumentBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BroadcastXDocumentBlock.cs
@@ -1,8 +1,9 @@
-using System.Xml.Linq;
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
+using System.Xml.Linq;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
public class BroadcastXDocumentBlock : BroadcastBlockBase<(TagAsset, XDocument), SyncContext>
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BulkSaveStagingBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BulkSaveStagingBlock.cs
index f40d921..28eb80c 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BulkSaveStagingBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/BulkSaveStagingBlock.cs
@@ -1,10 +1,10 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
-public class BulkSaveStagingBlock : ActionBlockBase, SyncContext>
+public class BulkSaveStagingBlock : ActionBlockBase
{
private readonly IStagingServices _staging;
@@ -14,8 +14,8 @@ public BulkSaveStagingBlock(PipelineSection parent, CancellationTok
_staging = staging;
}
- protected override async Task ActionAsync(IEnumerable input)
+ protected override async Task ActionAsync(StagingContext input)
{
- await _staging.StageAsync(Context.StagingContext, Token);
+ await _staging.StageAsync(input, Token);
}
}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/DownloadXmlAssetBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/DownloadXmlTagAssetBlock.cs
similarity index 75%
rename from rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/DownloadXmlAssetBlock.cs
rename to rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/DownloadXmlTagAssetBlock.cs
index 6ff3d26..5cb6ab8 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/DownloadXmlAssetBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/DownloadXmlTagAssetBlock.cs
@@ -1,12 +1,13 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
using System.Xml.Linq;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
-public class DownloadXmlAssetBlock : TransformBlockBase
+public class DownloadXmlTagAssetBlock : TransformBlockBase
{
- public DownloadXmlAssetBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
+ public DownloadXmlTagAssetBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
: base(parent, tokenSource, logger)
{
}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/FeatureItemBufferBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/FeatureItemBufferBlock.cs
deleted file mode 100644
index 9e254ed..0000000
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/FeatureItemBufferBlock.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
-
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
-
-public class FeatureItemBufferBlock : BufferBlockBase
-{
- public FeatureItemBufferBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
- : base(parent, tokenSource, logger){ }
-}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/GetInspectionNodesBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/GetInspectionNodesBlock.cs
deleted file mode 100644
index 5288d43..0000000
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/GetInspectionNodesBlock.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
-using System.Xml.Linq;
-
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
-
-public class GetInspectionNodesBlock : GetXElementInfoBlock
-{
- public GetInspectionNodesBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
- : base(parent, tokenSource, logger)
- {
- }
-
- public override IEnumerable<(TagAsset, XElementInfo)> Transform((TagAsset asset, XDocument document) input)
- {
- if (input.asset is null)
- {
- return [];
- }
-
- var result = (from node in input.document.Descendants("member").AsParallel()
- let fullName = GetNameOrDefault(node, "Inspection")
- where !string.IsNullOrWhiteSpace(fullName)
- let typeName = fullName.Substring(fullName.LastIndexOf(".", StringComparison.Ordinal) + 1)
- select (input.asset, new XElementInfo(typeName, node)))
- .ToList();
-
- Logger.LogInformation(Context.Parameters, $"{Name} | Extracted {result.Count} inspection nodes from tag asset {input.asset.Name}");
- return result;
- }
-}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/GetTagAssetBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/GetTagAssetBlock.cs
index 1b98643..766e92c 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/GetTagAssetBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/GetTagAssetBlock.cs
@@ -1,7 +1,8 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
public class GetTagAssetBlock : TransformBlockBase
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/GetXElementInfoBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/GetXElementInfoBlock.cs
index 5556dbe..6bd63ef 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/GetXElementInfoBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/GetXElementInfoBlock.cs
@@ -1,8 +1,9 @@
-using System.Xml.Linq;
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
+using System.Xml.Linq;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
public abstract class GetXElementInfoBlock : TransformManyBlockBase<(TagAsset asset, XDocument document), (TagAsset, XElementInfo), SyncContext>
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/LoadDbTagsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/LoadDbTagsBlock.cs
index 91609f2..c7c4759 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/LoadDbTagsBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/LoadDbTagsBlock.cs
@@ -1,15 +1,16 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
public class AcquireDbTagsBlock : TransformBlockBase, SyncContext>
{
private readonly IRubberduckDbService _service;
public AcquireDbTagsBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger,
- IRubberduckDbService service)
+ IRubberduckDbService service)
: base(parent, tokenSource, logger)
{
_service = service;
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/LoadFeaturesBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/LoadFeaturesBlock.cs
index 1fe9180..7424584 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/LoadFeaturesBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/LoadFeaturesBlock.cs
@@ -1,7 +1,8 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
public class LoadFeaturesBlock : TransformBlockBase
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/LoadInspectionDefaultConfigBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/LoadInspectionDefaultConfigBlock.cs
index b760e7a..a001930 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/LoadInspectionDefaultConfigBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/LoadInspectionDefaultConfigBlock.cs
@@ -1,7 +1,8 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Services;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
public class LoadInspectionDefaultConfigBlock : TransformBlockBase
{
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/MergeAnnotationsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/MergeAnnotationsBlock.cs
new file mode 100644
index 0000000..49e38f0
--- /dev/null
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/MergeAnnotationsBlock.cs
@@ -0,0 +1,46 @@
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.ContentSynchronization.XmlDoc.Abstract;
+using rubberduckvba.Server.Model;
+
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+
+public class MergeAnnotationsBlock : TransformBlockBase, IEnumerable, SyncContext>
+{
+ private readonly IXmlDocMerge _service;
+
+ public MergeAnnotationsBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger, IXmlDocMerge service)
+ : base(parent, tokenSource, logger)
+ {
+ _service = service;
+ }
+
+ public override IEnumerable Transform(IEnumerable input)
+ {
+ try
+ {
+ var main = Context.StagingContext.Annotations
+ .Where(annotation => Context.RubberduckDbMain.Assets.Any(asset => asset.Id == annotation.TagAssetId))
+ .ToList();
+
+ var next = Context.StagingContext.Annotations
+ .Where(annotation => Context.RubberduckDbNext.Assets.Any(asset => asset.Id == annotation.TagAssetId))
+ .ToList();
+
+ Logger.LogDebug(Context.Parameters, $"Merging annotations. Main x{main.Count} | Next x{next.Count}");
+ var dbItems = Context.Annotations.ToDictionary(e => e.Name);
+
+ var merged = _service.Merge(dbItems, main, next);
+ Logger.LogDebug(Context.Parameters, $"Merged x{merged.Count()}");
+
+ Context.StagingContext.Annotations = new(merged);
+
+ Logger.LogDebug(Context.Parameters, $"Updated: {Context.StagingContext.Annotations.Count(e => e.Id != default)} | New: {Context.StagingContext.Annotations.Count(e => e.Id == default)}");
+ return merged;
+ }
+ finally
+ {
+ Block.Complete();
+ }
+ }
+}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/MergeFeatureItemsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/MergeFeatureItemsBlock.cs
deleted file mode 100644
index 892e255..0000000
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/MergeFeatureItemsBlock.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.ContentSynchronization.XmlDoc.Abstract;
-using rubberduckvba.com.Server.Data;
-using System.Collections.Immutable;
-
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
-
-public class MergeFeatureItemsBlock : TransformBlockBase, IEnumerable, SyncContext>
-{
- private readonly IXmlDocMerge _service;
-
- public MergeFeatureItemsBlock(IXmlDocMerge merge, PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
- : base(parent, tokenSource, logger)
- {
- _service = merge;
- }
-
- public override IEnumerable Transform(IEnumerable input)
- {
- try
- {
- var main = input
- .Where(e => Context.RubberduckDbMain.Assets.Any(asset => asset.TagId == e.TagId && asset.Id == e.TagAssetId))
- .ToList();
-
- var next = input
- .Where(e => Context.RubberduckDbNext.Assets.Any(asset => asset.TagId == e.TagId && asset.Id == e.TagAssetId))
- .ToList();
-
- Logger.LogDebug(Context.Parameters, $"Merging feature items. Main x{main.Count} | Next x{next.Count}");
- var dbItems = Context.FeatureItems.ToDictionary(e => e.Name);
- var merged = _service.Merge(dbItems, main, next);
- Logger.LogDebug(Context.Parameters, $"Merged x{merged.Count()}");
-
- Context.StagingContext.UpdatedFeatureItems = merged.Where(e => e.Id != default && e.DateTimeUpdated.HasValue).ToImmutableArray();
- Context.StagingContext.NewFeatureItems = merged.Where(e => e.Id == default).ToImmutableArray();
-
- Logger.LogDebug(Context.Parameters, $"Updated: {Context.StagingContext.UpdatedFeatureItems.Count} | New: {Context.StagingContext.NewFeatureItems.Count}");
- return merged;
- }
- finally
- {
- Block.Complete();
- }
- }
-}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/MergeInspectionsBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/MergeInspectionsBlock.cs
new file mode 100644
index 0000000..c7f247f
--- /dev/null
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/MergeInspectionsBlock.cs
@@ -0,0 +1,45 @@
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.ContentSynchronization.XmlDoc.Abstract;
+using rubberduckvba.Server.Model;
+
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+
+public class MergeInspectionsBlock : TransformBlockBase, IEnumerable, SyncContext>
+{
+ private readonly IXmlDocMerge _service;
+
+ public MergeInspectionsBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger, IXmlDocMerge service)
+ : base(parent, tokenSource, logger)
+ {
+ _service = service;
+ }
+
+ public override IEnumerable Transform(IEnumerable input)
+ {
+ try
+ {
+ var main = Context.StagingContext.Inspections
+ .Where(inspection => Context.RubberduckDbMain.Assets.Any(asset => asset.Id == inspection.TagAssetId))
+ .ToList();
+
+ var next = Context.StagingContext.Inspections
+ .Where(inspection => Context.RubberduckDbNext.Assets.Any(asset => asset.Id == inspection.TagAssetId))
+ .ToList();
+
+ Logger.LogDebug(Context.Parameters, $"Merging inspections. Main x{main.Count} | Next x{next.Count}");
+ var dbItems = Context.Inspections.ToDictionary(e => e.Name);
+ var merged = _service.Merge(dbItems, main, next);
+ Logger.LogDebug(Context.Parameters, $"Merged x{merged.Count()}");
+
+ Context.StagingContext.Inspections = new(merged);
+
+ Logger.LogDebug(Context.Parameters, $"Updated: {Context.StagingContext.Inspections.Count(e => e.Id != default)} | New: {Context.StagingContext.Inspections.Count(e => e.Id == default)}");
+ return merged;
+ }
+ finally
+ {
+ Block.Complete();
+ }
+ }
+}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/MergeQuickFixesBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/MergeQuickFixesBlock.cs
new file mode 100644
index 0000000..b5e9b34
--- /dev/null
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/MergeQuickFixesBlock.cs
@@ -0,0 +1,45 @@
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.ContentSynchronization.XmlDoc.Abstract;
+using rubberduckvba.Server.Model;
+
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+
+public class MergeQuickFixesBlock : TransformBlockBase, IEnumerable, SyncContext>
+{
+ private readonly IXmlDocMerge _service;
+
+ public MergeQuickFixesBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger, IXmlDocMerge service)
+ : base(parent, tokenSource, logger)
+ {
+ _service = service;
+ }
+
+ public override IEnumerable Transform(IEnumerable input)
+ {
+ try
+ {
+ var main = Context.StagingContext.QuickFixes
+ .Where(quickfix => Context.RubberduckDbMain.Assets.Any(asset => asset.Id == quickfix.TagAssetId))
+ .ToList();
+
+ var next = Context.StagingContext.QuickFixes
+ .Where(e => Context.RubberduckDbNext.Assets.Any(asset => asset.Id == e.TagAssetId))
+ .ToList();
+
+ Logger.LogDebug(Context.Parameters, $"Merging quickfixes. Main x{main.Count} | Next x{next.Count}");
+ var dbItems = Context.QuickFixes.ToDictionary(e => e.Name);
+ var merged = _service.Merge(dbItems, main, next);
+ Logger.LogDebug(Context.Parameters, $"Merged x{merged.Count()}");
+
+ Context.StagingContext.QuickFixes = new(merged);
+
+ Logger.LogDebug(Context.Parameters, $"Updated: {Context.StagingContext.QuickFixes.Count(e => e.Id != default)} | New: {Context.StagingContext.QuickFixes.Count(e => e.Id == default)}");
+ return merged;
+ }
+ finally
+ {
+ Block.Complete();
+ }
+ }
+}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/ParseAnnotationXElementInfoBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/ParseAnnotationXElementInfoBlock.cs
index fce9d47..f729130 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/ParseAnnotationXElementInfoBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/ParseAnnotationXElementInfoBlock.cs
@@ -1,29 +1,27 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.ContentSynchronization.XmlDoc;
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.ContentSynchronization.XmlDoc;
+using rubberduckvba.Server.Model;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
-public class ParseAnnotationXElementInfoBlock : TransformBlockBase<(TagAsset asset, XElementInfo info), FeatureXmlDoc, SyncContext>
+public class ParseAnnotationXElementInfoBlock : TransformBlockBase<(TagAsset asset, XElementInfo info), Annotation, SyncContext>
{
- public ParseAnnotationXElementInfoBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
+ private readonly XmlDocAnnotationParser _parser;
+
+ public ParseAnnotationXElementInfoBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger, XmlDocAnnotationParser parser)
: base(parent, tokenSource, logger)
{
+ _parser = parser;
}
- public override FeatureXmlDoc Transform((TagAsset asset, XElementInfo info) input)
+ public override Annotation Transform((TagAsset asset, XElementInfo info) input)
{
- if (input.asset is null)
- {
- return null;
- }
-
var feature = Context.Features["Annotations"];
var isPreRelease = Context.RubberduckDbNext.Assets.Any(asset => asset.Id == input.asset.Id);
- var parser = new XmlDocAnnotation(input.info.Name, input.info.Element, isPreRelease);
- var result = parser.Parse(input.asset.Id, feature.Id);
+ var result = _parser.Parse(input.asset.Id, feature.Id, input.info.Name, input.info.Element, isPreRelease);
- return result;
+ return result ?? throw new InvalidOperationException("Failed to parse annotation xmldoc");
}
}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/ParseInspectionXElementInfoBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/ParseInspectionXElementInfoBlock.cs
index 812ed19..29f5cb2 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/ParseInspectionXElementInfoBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/ParseInspectionXElementInfoBlock.cs
@@ -1,22 +1,22 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.ContentSynchronization.XmlDoc;
-using rubberduckvba.com.Server.Data;
-using rubberduckvba.com.Server.Services;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.ContentSynchronization.XmlDoc;
+using rubberduckvba.Server.Model;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
-public class ParseInspectionXElementInfoBlock : TransformBlockBase<(TagAsset asset, XElementInfo info), FeatureXmlDoc, SyncContext>
+public class ParseInspectionXElementInfoBlock : TransformBlockBase<(TagAsset asset, XElementInfo info, IEnumerable quickfixes), Inspection, SyncContext>
{
- private readonly IMarkdownFormattingService _markdownService;
+ private readonly XmlDocInspectionParser _parser;
- public ParseInspectionXElementInfoBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger,
- IMarkdownFormattingService markdownService)
+ public ParseInspectionXElementInfoBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger,
+ XmlDocInspectionParser parser)
: base(parent, tokenSource, logger)
{
- _markdownService = markdownService;
+ _parser = parser;
}
- public override async Task TransformAsync((TagAsset asset, XElementInfo info) input)
+ public override async Task TransformAsync((TagAsset asset, XElementInfo info, IEnumerable quickfixes) input)
{
if (input.asset is null)
{
@@ -24,19 +24,13 @@ public override async Task TransformAsync((TagAsset asset, XEleme
}
var feature = Context.Features["Inspections"];
- var quickfixes = Context.Features["QuickFixes"].Items; // FIXME not loaded in initial run
+
var config = Context.InspectionDefaultConfig.TryGetValue(input.info.Name, out var value) ? value : null;
var isPreRelease = Context.RubberduckDbNext.Assets.Any(asset => asset.Id == input.asset.Id);
var name = input.info.Element.Attribute("name")!.Value;
- if (Context.TryGetTagById(input.asset.TagId, out var tag))
- {
- var parser = new XmlDocInspection(_markdownService);
- var result = await parser.ParseAsync(input.asset.Id, tag.Name, feature.Id, quickfixes, name, input.info.Element, config, isPreRelease);
-
- return result with { TagId = tag.Id };
- }
+ var result = await _parser.ParseAsync(input.asset.Id, feature.Id, input.quickfixes, name, input.info.Element, config, isPreRelease);
- throw new InvalidOperationException($"[Tag.Id]:{input.asset.TagId} was not loaded or does not exist.");
+ return result with { TagAssetId = input.asset.Id };
}
}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/ParseQuickFixXElementInfoBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/ParseQuickFixXElementInfoBlock.cs
index ee393f4..e2e8ba3 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/ParseQuickFixXElementInfoBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/ParseQuickFixXElementInfoBlock.cs
@@ -1,29 +1,32 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.ContentSynchronization.XmlDoc;
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.ContentSynchronization.XmlDoc;
+using rubberduckvba.Server.Model;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
-public class ParseQuickFixXElementInfoBlock : TransformBlockBase<(TagAsset asset, XElementInfo info), FeatureXmlDoc, SyncContext>
+public class ParseQuickFixXElementInfoBlock : TransformBlockBase<(TagAsset asset, XElementInfo info), QuickFix, SyncContext>
{
- public ParseQuickFixXElementInfoBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
+ private readonly XmlDocQuickFixParser _parser;
+
+ public ParseQuickFixXElementInfoBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger, XmlDocQuickFixParser parser)
: base(parent, tokenSource, logger)
{
+ _parser = parser;
}
- public override FeatureXmlDoc Transform((TagAsset asset, XElementInfo info) input)
+ public override QuickFix Transform((TagAsset asset, XElementInfo info) input)
{
if (input.asset is null)
{
- return null;
+ return null!;
}
var feature = Context.Features["QuickFixes"];
var isPreRelease = Context.RubberduckDbNext.Assets.Any(asset => asset.Id == input.asset.Id);
- var parser = new XmlDocQuickFix(input.info.Name, input.info.Element, isPreRelease);
- var result = parser.Parse(input.asset.Id, feature.Id) with { TagAssetId = input.asset.Id };
+ var result = _parser.Parse(input.info.Name, input.asset.Id, feature.Id, input.info.Element, isPreRelease) with { TagAssetId = input.asset.Id };
- return result;
+ return result ?? throw new InvalidOperationException("Failed to parse quickfix xmldoc");
}
}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/PrepareStagingBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/PrepareStagingBlock.cs
new file mode 100644
index 0000000..2090ecb
--- /dev/null
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/PrepareStagingBlock.cs
@@ -0,0 +1,26 @@
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
+
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+
+public class PrepareStagingBlock : TransformBlockBase, IEnumerable, IEnumerable>, StagingContext, SyncContext>
+{
+ public PrepareStagingBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
+ : base(parent, tokenSource, logger)
+ {
+ }
+
+ public override StagingContext Transform(Tuple, IEnumerable, IEnumerable> input)
+ {
+ var parameters = Context.StagingContext.Parameters;
+ var (annotations, quickfixes, inspections) = (input.Item1, input.Item2, input.Item3);
+
+ return new StagingContext(parameters)
+ {
+ Inspections = new(inspections),
+ QuickFixes = new(quickfixes),
+ Annotations = new(annotations)
+ };
+ }
+}
\ No newline at end of file
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/GetAnnotationNodesBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/StreamAnnotationNodesBlock.cs
similarity index 66%
rename from rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/GetAnnotationNodesBlock.cs
rename to rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/StreamAnnotationNodesBlock.cs
index dd3a64e..591f88f 100644
--- a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/GetAnnotationNodesBlock.cs
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/StreamAnnotationNodesBlock.cs
@@ -1,12 +1,13 @@
-using rubberduckvba.com.Server.ContentSynchronization.Pipeline.Abstract;
-using rubberduckvba.com.Server.Data;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
using System.Xml.Linq;
-namespace rubberduckvba.com.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
-public class GetAnnotationNodesBlock : GetXElementInfoBlock
+public class StreamAnnotationNodesBlock : GetXElementInfoBlock
{
- public GetAnnotationNodesBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
+ public StreamAnnotationNodesBlock(PipelineSection parent, CancellationTokenSource tokenSource, ILogger logger)
: base(parent, tokenSource, logger)
{
}
diff --git a/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/StreamInspectionNodesBlock.cs b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/StreamInspectionNodesBlock.cs
new file mode 100644
index 0000000..8f4e894
--- /dev/null
+++ b/rubberduckvba.Server/ContentSynchronization/Pipeline/Sections/SyncXmldoc/StreamInspectionNodesBlock.cs
@@ -0,0 +1,43 @@
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Abstract;
+using rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.Context;
+using rubberduckvba.Server.Model;
+using System.Xml.Linq;
+
+namespace rubberduckvba.Server.ContentSynchronization.Pipeline.Sections.SyncXmldoc;
+
+public class StreamInspectionNodesBlock : TransformManyBlockBase