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)

This commit is contained in:
BDisp
2024-10-17 19:15:06 +01:00
committed by GitHub
parent d6a652b159
commit 8f1954f16c
9 changed files with 66 additions and 45 deletions

4
.gitignore vendored
View File

@@ -34,9 +34,6 @@ _ReSharper.**
~$*
*~
# NuGet Stuff
*.nupkg
*.snupkg
# Exclude everything in packages directory except the packages/build directory
**/[Pp]ackages/*
!**/[Pp]ackages/build/
@@ -61,4 +58,3 @@ demo.*
*.tui/
*.dotCover
/local_packages/

View File

@@ -1,9 +0,0 @@
# Step 1: Build and pack Terminal.Gui
dotnet build ../Terminal.Gui/Terminal.Gui.csproj --configuration Release
dotnet pack ../Terminal.Gui/Terminal.Gui.csproj --configuration Release --output ../local_packages
# Step 2: Restore NativeAot with the new package
dotnet restore ./NativeAot.csproj --source ./local_packages
# Step 3: Build NativeAot
dotnet build ./NativeAot.csproj --configuration Release

View File

@@ -1,11 +0,0 @@
#!/bin/bash
# Step 1: Build and pack Terminal.Gui
dotnet build ../Terminal.Gui/Terminal.Gui.csproj --configuration Release
dotnet pack ../Terminal.Gui/Terminal.Gui.csproj --configuration Release --output ../local_packages
# Step 2: Restore NativeAot with the new package
dotnet restore ./NativeAot.csproj --source ./local_packages
# Step 3: Build NativeAot
dotnet build ./NativeAot.csproj --configuration Release

View File

@@ -1,9 +0,0 @@
# Step 1: Build and pack Terminal.Gui
dotnet build ../Terminal.Gui/Terminal.Gui.csproj --configuration Release
dotnet pack ../Terminal.Gui/Terminal.Gui.csproj --configuration Release --output ../local_packages
# Step 2: Restore SelfContained with the new package
dotnet restore ./SelfContained.csproj --source ./local_packages
# Step 3: Build SelfContained
dotnet build ./SelfContained.csproj --configuration Release

View File

@@ -1,11 +0,0 @@
#!/bin/bash
# Step 1: Build and pack Terminal.Gui
dotnet build ../Terminal.Gui/Terminal.Gui.csproj --configuration Release
dotnet pack ../Terminal.Gui/Terminal.Gui.csproj --configuration Release --output ../local_packages
# Step 2: Restore SelfContained with the new package
dotnet restore ./SelfContained.csproj --source ./local_packages
# Step 3: Build SelfContained
dotnet build ./SelfContained.csproj --configuration Release

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<!-- =================================================================== -->
<!-- Version numbers -->
<!-- Automatically updated by gitversion (run `dotnet-gitversion /updateprojectfiles`) -->
@@ -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>

View File

@@ -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 not shown.

Binary file not shown.