Skip to content

Commit 8f1954f

Browse files
authored
Fixes #3790. Can't build v2_develop RELEASE - "The local source 'C:\Users\Tig\s\gui-cs\Terminal.Gui\local_packages' doesn't exist." (#3794)
1 parent d6a652b commit 8f1954f

File tree

9 files changed

+66
-45
lines changed

9 files changed

+66
-45
lines changed

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ _ReSharper.**
3434
~$*
3535
*~
3636

37-
# NuGet Stuff
38-
*.nupkg
39-
*.snupkg
4037
# Exclude everything in packages directory except the packages/build directory
4138
**/[Pp]ackages/*
4239
!**/[Pp]ackages/build/
@@ -61,4 +58,3 @@ demo.*
6158
*.tui/
6259

6360
*.dotCover
64-
/local_packages/

NativeAot/PackTerminalGui.ps1

Lines changed: 0 additions & 9 deletions
This file was deleted.

NativeAot/PackTerminalGui.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

SelfContained/PackTerminalGui.ps1

Lines changed: 0 additions & 9 deletions
This file was deleted.

SelfContained/PackTerminalGui.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

Terminal.Gui/Terminal.Gui.csproj

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<!-- =================================================================== -->
33
<!-- Version numbers -->
44
<!-- Automatically updated by gitversion (run `dotnet-gitversion /updateprojectfiles`) -->
@@ -142,4 +142,36 @@
142142
<Authors>Miguel de Icaza, Tig Kindel (@tig), @BDisp</Authors>
143143
</PropertyGroup>
144144
<ProjectExtensions><VisualStudio><UserProperties resources_4config_1json__JsonSchema="../../docfx/schemas/tui-config-schema.json" /></VisualStudio></ProjectExtensions>
145+
146+
<Target Name="CopyNuGetPackagesToLocalPackagesFolder"
147+
AfterTargets="Pack"
148+
Condition="'$(Configuration)' == 'Release'">
149+
<PropertyGroup>
150+
<!-- Define the path for local_packages relative to the project directory -->
151+
<LocalPackagesPath>$(MSBuildThisFileDirectory)..\local_packages\</LocalPackagesPath>
152+
<!-- Output path without framework-specific folders -->
153+
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\$(Configuration)\</PackageOutputPath>
154+
</PropertyGroup>
155+
156+
<!-- Ensure the local_packages folder exists -->
157+
<Message Text="Checking if $(LocalPackagesPath) exists, creating if necessary." Importance="high" />
158+
<MakeDir Directories="$(LocalPackagesPath)" />
159+
160+
<!-- Collect .nupkg and .snupkg files into an item group -->
161+
<ItemGroup>
162+
<NuGetPackages Include="$(PackageOutputPath)*.nupkg;$(PackageOutputPath)*.snupkg" />
163+
</ItemGroup>
164+
165+
<!-- Check if any packages were found -->
166+
<Message Text="Found packages: @(NuGetPackages)" Importance="high" />
167+
168+
<!-- Copy files only if found -->
169+
<Copy SourceFiles="@(NuGetPackages)"
170+
DestinationFolder="$(LocalPackagesPath)"
171+
SkipUnchangedFiles="false"
172+
Condition="@(NuGetPackages) != ''" />
173+
174+
<!-- Log success -->
175+
<Message Text="Copy completed successfully." Importance="high" />
176+
</Target>
145177
</Project>

UnitTests/LocalPackagesTests.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
namespace Terminal.Gui;
2+
3+
public class LocalPackagesTests
4+
{
5+
private readonly string _localPackagesPath;
6+
7+
public LocalPackagesTests ()
8+
{
9+
// Define the local_packages path relative to the solution directory
10+
_localPackagesPath = Path.Combine (Directory.GetCurrentDirectory (), "..", "..", "..", "..", "local_packages");
11+
}
12+
13+
[Fact]
14+
public void LocalPackagesFolderExists ()
15+
{
16+
Assert.True (Directory.Exists (_localPackagesPath),
17+
$"The local_packages folder does not exist: {_localPackagesPath}");
18+
}
19+
20+
[Fact]
21+
public void NupkgFilesExist ()
22+
{
23+
var nupkgFiles = Directory.GetFiles (_localPackagesPath, "*.nupkg");
24+
Assert.NotEmpty (nupkgFiles);
25+
}
26+
27+
[Fact]
28+
public void SnupkgFilesExist ()
29+
{
30+
var snupkgFiles = Directory.GetFiles (_localPackagesPath, "*.snupkg");
31+
Assert.NotEmpty (snupkgFiles);
32+
}
33+
}
724 KB
Binary file not shown.
200 KB
Binary file not shown.

0 commit comments

Comments
 (0)