Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UnitTests forcing SDK NuGet package to be broken #185

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using SharpGen.Doc;
using SharpGenTools.Sdk.Internal;

namespace SharpGenTools.Sdk.Documentation
namespace SharpGen.Platform.Documentation
{
internal static class DocConverterUtilities
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
using System.Collections.Specialized;
using System.Linq;
using SharpGen.Doc;
using SharpGenTools.Sdk.Internal;

namespace SharpGenTools.Sdk.Documentation
namespace SharpGen.Platform.Documentation
{
public sealed class DocItem : IDocItem
internal sealed class DocItem : IDocItem
{
private readonly ObservableCollection<IDocSubItem> items = new();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
using System.Linq;
using System.Text.Json;
using SharpGen.Doc;
using SharpGenTools.Sdk.Internal;

namespace SharpGenTools.Sdk.Documentation
namespace SharpGen.Platform.Documentation
{
internal class DocItemCache
public sealed class DocItemCache
{
private readonly object syncObject = new();

Expand Down Expand Up @@ -41,8 +40,6 @@ public IDocItem Find(string name)

public static DocItemCache Read(string file)
{
Utilities.RequireAbsolutePath(file, nameof(file));

return JsonSerializer.Deserialize<DocItemCache>(File.ReadAllBytes(file), JsonSerializerOptions);
}

Expand All @@ -52,8 +49,6 @@ public static DocItemCache Read(string file)
/// <param name="file">The file.</param>
public void Write(string file)
{
Utilities.RequireAbsolutePath(file, nameof(file));

using var output = File.Create(file);
using var writer = new Utf8JsonWriter(output);

Expand All @@ -69,8 +64,6 @@ public void Write(string file)
/// <param name="file">The file.</param>
public void WriteIfDirty(string file)
{
Utilities.RequireAbsolutePath(file, nameof(file));

if (File.Exists(file))
{
bool touch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using SharpGen.Doc;
using static SharpGenTools.Sdk.Documentation.DocConverterUtilities;
using static SharpGen.Platform.Documentation.DocConverterUtilities;

namespace SharpGenTools.Sdk.Documentation
namespace SharpGen.Platform.Documentation
{
internal sealed class DocItemConverter : JsonConverter<IDocItem>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
using System.Collections.Generic;
using System.Collections.Specialized;
using SharpGen.Doc;
using SharpGenTools.Sdk.Internal;

namespace SharpGenTools.Sdk.Documentation
namespace SharpGen.Platform.Documentation
{
/// <inheritdoc />
public sealed class DocSubItem : IDocSubItem
internal sealed class DocSubItem : IDocSubItem
{
private readonly ObservableSet<string> attributes =
new(StringComparer.InvariantCultureIgnoreCase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using SharpGen.Doc;
using static SharpGenTools.Sdk.Documentation.DocConverterUtilities;
using static SharpGen.Platform.Documentation.DocConverterUtilities;

namespace SharpGenTools.Sdk.Documentation
namespace SharpGen.Platform.Documentation
{
internal sealed class DocSubItemConverter : JsonConverter<IDocSubItem>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace SharpGenTools.Sdk.Internal
namespace SharpGen.Platform
{
public sealed class ObservableSet<T> : ObservableCollection<T>
{
Expand Down
28 changes: 28 additions & 0 deletions SharpGen.Platform/SharpGen.Platform.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,44 @@
<ItemGroup>
<PackageReference Include="Microsoft.Win32.Registry" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="System.Diagnostics.Process" Condition="'$(TargetFramework)' != 'net472'" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1>SharpGen.UnitTests</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1>SharpGenTools.Sdk</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SharpGen\SharpGen.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="Documentation\DocConverterUtilities.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Documentation\DocItemCache.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Documentation\DocItem.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Documentation\DocItemConverter.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Documentation\DocSubItemConverter.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Documentation\DocSubItem.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="ObservableSet.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion SharpGen.UnitTests/Sdk/DocItemConverterTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Linq;
using System.Text.Json;
using SharpGenTools.Sdk.Documentation;
using SharpGen.Platform.Documentation;
using Xunit;
using Xunit.Abstractions;

Expand Down
1 change: 0 additions & 1 deletion SharpGen.UnitTests/SharpGen.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<ItemGroup>
<ProjectReference Include="..\SharpGen.Platform\SharpGen.Platform.csproj" />
<ProjectReference Include="..\SharpGen.Runtime\SharpGen.Runtime.csproj" />
<ProjectReference Include="..\SharpGenTools.Sdk\SharpGenTools.Sdk.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions SharpGenTools.Sdk/Documentation/DocProviderExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Polly.Contrib.WaitAndRetry;
using SharpGen.CppModel;
using SharpGen.Doc;
using SharpGen.Platform.Documentation;

namespace SharpGenTools.Sdk.Documentation
{
Expand Down
2 changes: 2 additions & 0 deletions SharpGenTools.Sdk/Documentation/DocumentationContext.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using SharpGen.Doc;
using SharpGen.Logging;
using SharpGen.Platform;
using SharpGen.Platform.Documentation;
using SharpGenTools.Sdk.Internal;

#nullable enable
Expand Down
1 change: 1 addition & 0 deletions SharpGenTools.Sdk/Extensibility/ExtensibilityDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using SharpGen.CppModel;
using SharpGen.Doc;
using SharpGen.Logging;
using SharpGen.Platform.Documentation;
using SharpGenTools.Sdk.Documentation;
using SharpGenTools.Sdk.Internal;
using SharpGenTools.Sdk.Internal.Roslyn;
Expand Down
1 change: 0 additions & 1 deletion SharpGenTools.Sdk/SharpGenTools.Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.Build.Utilities.Core" />
<PackageReference Include="Microsoft.Bcl.HashCode" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
<PackageReference Include="Polly.Contrib.WaitAndRetry" />
<PackageReference Include="Nullable" />
Expand Down
1 change: 1 addition & 0 deletions SharpGenTools.Sdk/Tasks/SharpGenTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using SharpGen.Model;
using SharpGen.Parser;
using SharpGen.Platform;
using SharpGen.Platform.Documentation;
using SharpGen.Transform;
using SharpGenTools.Sdk.Documentation;
using SharpGenTools.Sdk.Extensibility;
Expand Down