Skip to content

Commit

Permalink
Version 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kuiperzone committed Apr 23, 2023
1 parent d74755c commit b64747f
Show file tree
Hide file tree
Showing 20 changed files with 467 additions and 127 deletions.
1 change: 1 addition & 0 deletions AvantGarde.Test/AvantGarde.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<IsPublishable>false</IsPublishable>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
Expand Down
6 changes: 1 addition & 5 deletions AvantGarde.Test/Internal/TestUtilBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@
// with Avant Garde. If not, see <https://www.gnu.org/licenses/>.
// -----------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading;
using Xunit.Abstractions;

namespace AvantGarde.Test.Internal
Expand Down Expand Up @@ -285,7 +281,7 @@ protected virtual void Dispose(bool _)
{
try
{
Directory.Delete(_scratch, true);
Directory.Delete(_scratch, true);
}
catch
{
Expand Down
67 changes: 64 additions & 3 deletions AvantGarde.Test/Projects/DotnetProjectTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
// with Avant Garde. If not, see <https://www.gnu.org/licenses/>.
// -----------------------------------------------------------------------------

using System;
using System.IO;
using AvantGarde.Test.Internal;
using Xunit;
using Xunit.Abstractions;
Expand Down Expand Up @@ -90,7 +88,7 @@ public void Refresh_Updates()
// Change framework
path = CreateFileContent("Name.Test.csproj", ProjectNet6);

// Not exist
// Assembly not exist because we switch to .NET6
code = item.GetHashCode();
Assert.True(item.Refresh());
Assert.NotEqual(code, item.GetHashCode());
Expand Down Expand Up @@ -129,5 +127,68 @@ public void Refresh_Updates()
Assert.Equal("net6.0", item.TargetFramework);
Assert.True(item.AssemblyPath?.Exists == true);
}

[Fact]
public void Refresh_Artifacts()
{
var solDir = Path.Combine(Scratch, "Solution");
var projDir = Path.Combine(solDir, "Name.Test");
Directory.CreateDirectory(projDir);

var path = CreateFileContent(Path.Combine(projDir, "Name.Test.csproj"), ProjectNet6);
var item = new DotnetProject(path);

Assert.True(item.Refresh());
Assert.Equal("net6.0", item.TargetFramework);
Assert.False(item.AssemblyPath?.Exists == true);

// Now put in dummy solution ABOVE project (where artifacts live)
CreateFileContent(Path.Combine(solDir, "Name.Test.sln"), "Dummy");

item.Refresh();
Assert.Equal("net6.0", item.TargetFramework);
Assert.False(item.AssemblyPath?.Exists == true);

// Create assembly under artifacts
// debug_net8.0/projectName.dll
// .artifacts/bin/debug/projectName.dll
// .artifacts/bin/[projectName]/debug_net8.0/projectName.dll
var artDir = Path.Combine(solDir, ".artifacts", "bin", "debug");
Directory.CreateDirectory(artDir);
path = CreateFileContent(Path.Combine(artDir, "Name.Test.dll"), "Dummy");

// Exists now
item.Refresh();
Assert.True(item.AssemblyPath?.Exists == true);

// New location
Directory.Delete(artDir, true);
artDir = Path.Combine(solDir, ".artifacts", "bin", "debug_net6.0");

Directory.CreateDirectory(artDir);
path = CreateFileContent(Path.Combine(artDir, "Name.Test.dll"), "Dummy");

item.Refresh();
Assert.True(item.AssemblyPath?.Exists == true);

// New location
Directory.Delete(artDir, true);
artDir = Path.Combine(solDir, ".artifacts", "bin", "Name.Test", "debug_net6.0");
Directory.CreateDirectory(artDir);
path = CreateFileContent(Path.Combine(artDir, "Name.Test.dll"), "Dummy");

item.Refresh();
Assert.True(item.AssemblyPath?.Exists == true);

// New location
Directory.Delete(artDir, true);
artDir = Path.Combine(solDir, ".artifacts/bin/Name.Test/debug/net6.0");
Directory.CreateDirectory(artDir);
path = CreateFileContent(Path.Combine(artDir, "Name.Test.dll"), "Dummy");

item.Refresh();
Assert.True(item.AssemblyPath?.Exists == true);
}

}
}
41 changes: 27 additions & 14 deletions AvantGarde.Test/Projects/NodeItemTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
// with Avant Garde. If not, see <https://www.gnu.org/licenses/>.
// -----------------------------------------------------------------------------

using System;
using System.IO;
using AvantGarde.Test.Internal;
using Xunit;
using Xunit.Abstractions;
Expand Down Expand Up @@ -193,24 +191,39 @@ public void FilePattern_FiltersOnPattern()
}

[Fact]
public void FindFirst_FindsName()
public void FindDirectory_FindsName()
{
var temp = CreateNewScratch();
var sub = Directory.CreateDirectory(temp + "sub") + "/";
var temp = CreateNewScratch() + "sub";
var sub = Directory.CreateDirectory(temp) + "/";
CreateFileContent(sub + "Text1.txt", "Hello World");

var item = new NodeItem(Scratch, PathKind.Directory);
item.Refresh();

Assert.Null(item.FindFirst("NotExist", true));
Assert.Null(item.FindFirst("Text1.txt", false));
Assert.Null(item.FindDirectory("NotExist"));
Assert.Null(item.FindDirectory("Text1.txt"));

Assert.Equal(temp, item.FindDirectory(temp)?.FullName);
Assert.Equal(temp, item.FindDirectory(temp.ToUpperInvariant(), StringComparison.InvariantCultureIgnoreCase)?.FullName);
}

[Fact]
public void FindFile_FindsName()
{
var temp = CreateNewScratch() + "sub";
var sub = Directory.CreateDirectory(temp) + "/";
CreateFileContent(sub + "Text1.txt", "Hello World");

var item = new NodeItem(Scratch, PathKind.Directory);
item.Refresh();

Assert.Equal("Text1.txt", item.FindFirst("Text1.txt", true)?.Name);
Assert.Equal("Text1.txt", item.FindFirst("TEXT1.txt", true, StringComparison.OrdinalIgnoreCase)?.Name);
Assert.Null(item.FindFile("NotExist"));
Assert.Equal("Text1.txt", item.FindFile("Text1.txt")?.Name);
Assert.Equal("Text1.txt", item.FindFile("TEXT1.txt", StringComparison.OrdinalIgnoreCase)?.Name);
}

[Fact]
public void FindExact_FindsPath()
public void FindNode_FindsPath()
{
var temp = CreateNewScratch();
var sub = Directory.CreateDirectory(temp + "sub") + "/";
Expand All @@ -219,11 +232,11 @@ public void FindExact_FindsPath()
var item = new NodeItem(Scratch, PathKind.Directory);
item.Refresh();

Assert.Null(item.FindExact("NotExist"));
Assert.Null(item.FindExact(""));
Assert.Null(item.FindNode("NotExist"));
Assert.Null(item.FindNode(""));

Assert.Equal("Text1.txt", item.FindExact(path)?.Name);
Assert.Equal("Text1.txt", item.FindExact(path.ToUpperInvariant(), StringComparison.OrdinalIgnoreCase)?.Name);
Assert.Equal("Text1.txt", item.FindNode(path)?.Name);
Assert.Equal("Text1.txt", item.FindNode(path.ToUpperInvariant(), StringComparison.OrdinalIgnoreCase)?.Name);
}

}
Expand Down
31 changes: 28 additions & 3 deletions AvantGarde.pupnet.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# PUPNET DEPLOY 1.0.1
# PUPNET DEPLOY: 1.3.0

# APP PREAMBLE
AppBaseName = AvantGarde
AppFriendlyName = Avant Garde
AppId = zone.kuiper.AvantGarde
AppVersionRelease = 1.1.0[1]
AppVersionRelease = 1.2.0[1]
AppShortSummary = A cross-platform XAML Previewer for the Avalonia .NET Framework
AppLicenseId = GPL-3.0-or-later
AppLicenseFile = LICENSE
Expand All @@ -22,7 +22,7 @@ DesktopTerminal = false
DesktopFile = Deploy/AvantGarde.desktop
StartCommand =
PrimeCategory = Development
MetaFile = Deploy/AvantGarde.metainfo.xml
MetaFile = Deploy/AvantGarde.metainfo.xml
IconFiles = """
Deploy/AvantGarde.ico
Deploy/AvantGarde.svg
Expand Down Expand Up @@ -62,8 +62,33 @@ FlatpakFinishArgs = """
"""
FlatpakBuilderArgs =

# RPM OPTIONS
RpmAutoReq = false
RpmAutoProv = true
RpmRequires = """
krb5-libs
libicu
openssl-libs
zlib
"""

# DEBIAN OPTIONS
DebianRecommends = """
libc6
libgcc1
libgcc-s1
libgssapi-krb5-2
libicu
libssl
libstdc++6
libunwind
zlib1g
"""

# WINDOWS SETUP OPTIONS
SetupAdminInstall = false
SetupCommandPrompt =
SetupMinWindowsVersion = 10
SetupSignTool =
SetupSuffixOutput =
SetupVersionOutput = false
2 changes: 1 addition & 1 deletion AvantGarde/Loading/RemoteLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public static PathItem FindDesignerHost(string? version)
node.Properties.FilePatterns = DotnetHostName;
node.Refresh();

return node.FindFirst(DotnetHostName, true, StringComparison.OrdinalIgnoreCase) ??
return node.FindFile(DotnetHostName, StringComparison.OrdinalIgnoreCase) ??
throw new FileNotFoundException($"Unable to locate {DotnetHostName} for version {version}");
}

Expand Down
Loading

0 comments on commit b64747f

Please sign in to comment.