Skip to content

Commit

Permalink
Refactor: Snapx dependencies will now be copied from the Snapx dotnet…
Browse files Browse the repository at this point in the history
… tools directory instead of the Snapx.core nuget package.
  • Loading branch information
peters committed Apr 13, 2023
1 parent caeab40 commit 3aa2f10
Show file tree
Hide file tree
Showing 24 changed files with 429 additions and 593 deletions.
11 changes: 0 additions & 11 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ $WorkingDir = Split-Path -parent $MyInvocation.MyCommand.Definition

$SrcDirectory = Join-Path $WorkingDir src
$NupkgsDir = Join-Path $WorkingDir nupkgs
$SnapSrcDir = Join-Path $SrcDirectory Snap
$SnapxSrcDir = Join-Path $SrcDirectory Snapx

$SnapCsProjPath = Join-Path $SnapSrcDir Snap.csproj
$SnapxCsProjPath = Join-Path $SnapxSrcDir Snapx.csproj

# Environment variables
Expand Down Expand Up @@ -134,15 +132,6 @@ function Invoke-Install-Snapx
"snapx"
) -IgnoreExitCode

Invoke-Command-Colored dotnet @(
"build"
"/p:Version=$Version"
"/p:SnapRid=pack"
"/p:GeneratePackageOnBuild=true"
"--configuration $Configuration"
$SnapCsProjPath
)

Invoke-Command-Colored dotnet @(
"nuget add source $NupkgsDir --name snapx-local"
) -IgnoreExitCode
Expand Down
8 changes: 4 additions & 4 deletions src/Snap.Installer.Tests/ProgramTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public async Task TestInstall_Offline_Using_Local_PackageSource()

genesisSnapReleaseBuilder
.AddNuspecItem(mainAssemblyDefinition)
.AddSnapDlls();
.AddSnapDll();

using var genesisPackageContext = await _baseFixturePackaging.BuildPackageAsync(genesisSnapReleaseBuilder, cts.Token);

Expand Down Expand Up @@ -181,22 +181,22 @@ public async Task TestInstall_Web_Using_Local_PackageSource()
.AddNuspecItem(mainExecutable)
.AddNuspecItem(mainExecutable.BuildRuntimeConfigFilename(_snapFilesystem), mainExecutable.BuildRuntimeConfig())
.AddNuspecItem(_baseFixture.BuildLibrary("test1"))
.AddSnapDlls();
.AddSnapDll();

update1SnapReleaseBuilder
.AddNuspecItem(genesisSnapReleaseBuilder, 0)
.AddNuspecItem(genesisSnapReleaseBuilder, 1)
.AddNuspecItem(genesisSnapReleaseBuilder, 2)
.AddNuspecItem(_baseFixture.BuildLibrary("test2"))
.AddSnapDlls();
.AddSnapDll();

update2SnapReleaseBuilder
.AddNuspecItem(update1SnapReleaseBuilder, 0)
.AddNuspecItem(update1SnapReleaseBuilder, 1)
.AddNuspecItem(update1SnapReleaseBuilder, 2)
.AddNuspecItem(update1SnapReleaseBuilder, 3)
.AddNuspecItem(_baseFixture.BuildLibrary("test3"))
.AddSnapDlls();
.AddSnapDll();

using var genesisPackageContext = await _baseFixturePackaging.BuildPackageAsync(genesisSnapReleaseBuilder, cts.Token);
using var update1PackageContext = await _baseFixturePackaging.BuildPackageAsync(update1SnapReleaseBuilder, cts.Token);
Expand Down
7 changes: 1 addition & 6 deletions src/Snap.Shared.Tests/BaseFixturePackaging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,10 @@ public SnapReleaseBuilder AddNuspecItem([NotNull] AssemblyDefinition assemblyDef
return this;
}

public SnapReleaseBuilder AddSnapDlls()
public SnapReleaseBuilder AddSnapDll()
{
var assemblyDefinition = AssemblyDefinition.ReadAssembly(typeof(SnapPack).Assembly.Location);
_nuspec.Add(assemblyDefinition.BuildRelativeFilename(), assemblyDefinition);
var libPalFilename = SnapApp.GetLibPalFilename();
var libBsdiffFilename = SnapApp.GetLibBsdiffFilename();
var targetRid = SnapApp.Target.Rid;
_nuspec.Add(GetLibPalRelativePath(), File.OpenRead(Path.Combine(AppContext.BaseDirectory, "runtimes", targetRid, "native", libPalFilename)));
_nuspec.Add(GetLibBsdiffRelativePath(), File.OpenRead(Path.Combine(AppContext.BaseDirectory, "runtimes", targetRid, "native", libBsdiffFilename)));
return this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Snap.Tests/Core/SnapCryptoProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public async Task TestSha256_PackageArchiveReader_Central_Directory_Corrupt()
using var genesisSnapReleaseBuilder = _baseFixture
.WithSnapReleaseBuilder(testDirectory, snapAppsReleases, genesisSnapApp, _snapReleaseBuilderContext)
.AddNuspecItem(_baseFixture.BuildSnapExecutable(genesisSnapApp))
.AddSnapDlls();
.AddSnapDll();
using var genesisPackageContext = await _baseFixture.BuildPackageAsync(genesisSnapReleaseBuilder);
Checksum(genesisPackageContext.FullPackageSnapRelease);
Checksum(genesisPackageContext.FullPackageSnapRelease);
Expand Down
10 changes: 5 additions & 5 deletions src/Snap.Tests/Core/SnapInstallerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public async Task TestInstallAsync()
.AddNuspecItem(mainAssemblyDefinition)
.AddNuspecItem(mainAssemblyDefinition.BuildRuntimeConfigFilename(_snapFilesystem), mainAssemblyDefinition.BuildRuntimeConfig())
.AddNuspecItem(_baseFixture.BuildLibrary("test1"))
.AddSnapDlls();
.AddSnapDll();

using var genesisPackageContext = await _baseFixture.BuildPackageAsync(genesisSnapReleaseBuilder);

Expand Down Expand Up @@ -172,7 +172,7 @@ public async Task TestInstallAsync_Different_Channel()
var mainAssemblyDefinition = _baseFixture.BuildSnapExecutable(genesisSnapApp);
genesisSnapReleaseBuilder
.AddNuspecItem(mainAssemblyDefinition)
.AddSnapDlls();
.AddSnapDll();

using var genesisPackageContext = await _baseFixture.BuildPackageAsync(genesisSnapReleaseBuilder);
var loggerMock = new Mock<ILog>();
Expand Down Expand Up @@ -245,22 +245,22 @@ public async Task TestUpdateAsync()
.AddNuspecItem(mainExecutable)
.AddNuspecItem(mainExecutable.BuildRuntimeConfigFilename(_snapFilesystem), mainExecutable.BuildRuntimeConfig())
.AddNuspecItem(_baseFixture.BuildLibrary("test1"))
.AddSnapDlls();
.AddSnapDll();

update1SnapReleaseBuilder
.AddNuspecItem(genesisSnapReleaseBuilder, 0)
.AddNuspecItem(genesisSnapReleaseBuilder, 1)
.AddNuspecItem(genesisSnapReleaseBuilder, 2)
.AddNuspecItem(_baseFixture.BuildLibrary("test2"))
.AddSnapDlls();
.AddSnapDll();

update2SnapReleaseBuilder
.AddNuspecItem(update1SnapReleaseBuilder, 0)
.AddNuspecItem(update1SnapReleaseBuilder, 1)
.AddNuspecItem(update1SnapReleaseBuilder, 2)
.AddNuspecItem(update1SnapReleaseBuilder, 3)
.AddNuspecItem(_baseFixture.BuildLibrary("test3"))
.AddSnapDlls();
.AddSnapDll();

using var genesisPackageContext = await _baseFixture.BuildPackageAsync(genesisSnapReleaseBuilder);
using (await _baseFixture.BuildPackageAsync(update1SnapReleaseBuilder))
Expand Down
Loading

0 comments on commit 3aa2f10

Please sign in to comment.