Skip to content

Commit

Permalink
Fixes #3790. Can't build v2_develop RELEASE - "The local source 'C:\U…
Browse files Browse the repository at this point in the history
…sers\Tig\s\gui-cs\Terminal.Gui\local_packages' doesn't exist." (#3794)
  • Loading branch information
BDisp authored Oct 17, 2024
1 parent d6a652b commit 8f1954f
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 45 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ _ReSharper.**
~$*
*~

# NuGet Stuff
*.nupkg
*.snupkg
# Exclude everything in packages directory except the packages/build directory
**/[Pp]ackages/*
!**/[Pp]ackages/build/
Expand All @@ -61,4 +58,3 @@ demo.*
*.tui/

*.dotCover
/local_packages/
9 changes: 0 additions & 9 deletions NativeAot/PackTerminalGui.ps1

This file was deleted.

11 changes: 0 additions & 11 deletions NativeAot/PackTerminalGui.sh

This file was deleted.

9 changes: 0 additions & 9 deletions SelfContained/PackTerminalGui.ps1

This file was deleted.

11 changes: 0 additions & 11 deletions SelfContained/PackTerminalGui.sh

This file was deleted.

34 changes: 33 additions & 1 deletion Terminal.Gui/Terminal.Gui.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<!-- =================================================================== -->
<!-- Version numbers -->
<!-- Automatically updated by gitversion (run `dotnet-gitversion /updateprojectfiles`) -->
Expand Down Expand Up @@ -142,4 +142,36 @@
<Authors>Miguel de Icaza, Tig Kindel (@tig), @BDisp</Authors>
</PropertyGroup>
<ProjectExtensions><VisualStudio><UserProperties resources_4config_1json__JsonSchema="../../docfx/schemas/tui-config-schema.json" /></VisualStudio></ProjectExtensions>

<Target Name="CopyNuGetPackagesToLocalPackagesFolder"
AfterTargets="Pack"
Condition="'$(Configuration)' == 'Release'">
<PropertyGroup>
<!-- Define the path for local_packages relative to the project directory -->
<LocalPackagesPath>$(MSBuildThisFileDirectory)..\local_packages\</LocalPackagesPath>
<!-- Output path without framework-specific folders -->
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\$(Configuration)\</PackageOutputPath>
</PropertyGroup>

<!-- Ensure the local_packages folder exists -->
<Message Text="Checking if $(LocalPackagesPath) exists, creating if necessary." Importance="high" />
<MakeDir Directories="$(LocalPackagesPath)" />

<!-- Collect .nupkg and .snupkg files into an item group -->
<ItemGroup>
<NuGetPackages Include="$(PackageOutputPath)*.nupkg;$(PackageOutputPath)*.snupkg" />
</ItemGroup>

<!-- Check if any packages were found -->
<Message Text="Found packages: @(NuGetPackages)" Importance="high" />

<!-- Copy files only if found -->
<Copy SourceFiles="@(NuGetPackages)"
DestinationFolder="$(LocalPackagesPath)"
SkipUnchangedFiles="false"
Condition="@(NuGetPackages) != ''" />

<!-- Log success -->
<Message Text="Copy completed successfully." Importance="high" />
</Target>
</Project>
33 changes: 33 additions & 0 deletions UnitTests/LocalPackagesTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
namespace Terminal.Gui;

public class LocalPackagesTests
{
private readonly string _localPackagesPath;

public LocalPackagesTests ()
{
// Define the local_packages path relative to the solution directory
_localPackagesPath = Path.Combine (Directory.GetCurrentDirectory (), "..", "..", "..", "..", "local_packages");
}

[Fact]
public void LocalPackagesFolderExists ()
{
Assert.True (Directory.Exists (_localPackagesPath),
$"The local_packages folder does not exist: {_localPackagesPath}");
}

[Fact]
public void NupkgFilesExist ()
{
var nupkgFiles = Directory.GetFiles (_localPackagesPath, "*.nupkg");
Assert.NotEmpty (nupkgFiles);
}

[Fact]
public void SnupkgFilesExist ()
{
var snupkgFiles = Directory.GetFiles (_localPackagesPath, "*.snupkg");
Assert.NotEmpty (snupkgFiles);
}
}
Binary file added local_packages/Terminal.Gui.2.0.0.nupkg
Binary file not shown.
Binary file added local_packages/Terminal.Gui.2.0.0.snupkg
Binary file not shown.

0 comments on commit 8f1954f

Please sign in to comment.