WIP packaging Build as NuGet package

This commit is contained in:
Caelan Sayler
2024-03-10 23:15:07 +00:00
parent 0dfeffddda
commit dd94b60be3
6 changed files with 41 additions and 27 deletions

View File

@@ -30,6 +30,7 @@
<ItemGroup Condition=" '$(MSBuildProjectExtension)'=='.csproj' ">
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.*" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
<PackageReference Include="NuGetizer" Version="1.2.1" PrivateAssets="all" Condition=" '$(NoNuGetizer)'=='' " />
</ItemGroup>
<PropertyGroup Condition=" '$(MSBuildProjectExtension)'=='.vcxproj' ">

View File

@@ -16,9 +16,6 @@ public class PackTask : MSBuildAsyncTask
[Required]
public string PackVersion { get; set; } = "";
[Required]
public string Runtimes { get; set; } = "";
[Required]
public string PackId { get; set; } = "";
@@ -28,6 +25,8 @@ public class PackTask : MSBuildAsyncTask
[Required]
public string ReleaseDir { get; set; } = null!;
public string Runtimes { get; set; } = "";
public string? PackAuthors { get; set; }
public string? PackTitle { get; set; }
@@ -38,7 +37,7 @@ public class PackTask : MSBuildAsyncTask
public string? ReleaseNotes { get; set; }
public DeltaMode DeltaMode { get; set; } = DeltaMode.BestSpeed;
public string? DeltaMode { get; set; } = "BestSpeed";
public string? Channel { get; set; }

View File

@@ -1,5 +1,7 @@
using System.IO;
using System;
using System.IO;
using Riok.Mapperly.Abstractions;
using Velopack.Packaging;
using Velopack.Packaging.Unix.Commands;
using Velopack.Packaging.Windows.Commands;
@@ -22,4 +24,6 @@ public static partial class TaskOptionsMapper
}
private static RID StringToRID(string t) => RID.Parse(t);
private static DeltaMode StringToDeltaMode(string t) => (DeltaMode) Enum.Parse(typeof(DeltaMode), t);
}

View File

@@ -9,6 +9,9 @@
https://learn.microsoft.com/dotnet/core/project-sdk/msbuild-props?WT.mc_id=DT-MVP-5003472#copylocallockfileassemblies
-->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PackDependencies>true</PackDependencies>
<PackTransitive>true</PackTransitive>
</PropertyGroup>
<PropertyGroup>
@@ -24,41 +27,45 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Velopack.Packaging.Unix\Velopack.Packaging.Unix.csproj" />
<ProjectReference Include="..\Velopack.Packaging.Windows\Velopack.Packaging.Windows.csproj" />
<ProjectReference Include="..\Velopack\Velopack.csproj" />
<PackInference Include="Compile" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.9.5" />
<PackageReference Include="Riok.Mapperly" Version="3.3.0" />
<ProjectReference Include="..\Velopack.Packaging.Unix\Velopack.Packaging.Unix.csproj" PrivateAssets="all" PackInclude="all" />
<ProjectReference Include="..\Velopack.Packaging.Windows\Velopack.Packaging.Windows.csproj" PrivateAssets="all" PackInclude="all" />
<ProjectReference Include="..\Velopack\Velopack.csproj" PrivateAssets="all" PackInclude="all" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\artwork\Velopack_200.png" Pack="true" PackagePath="\" />
<None Include="..\..\README_NUGET.md" Pack="true" PackagePath="\" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.9.5" PrivateAssets="all" />
<PackageReference Include="Riok.Mapperly" Version="3.3.0" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\artwork\Velopack_200.png" Pack="true" PackagePath="/" />
<None Include="..\..\README_NUGET.md" Pack="true" PackagePath="/" />
<None Include="Velopack.Build.targets" Pack="true" PackagePath="build\Velopack.Build.targets" />
</ItemGroup>
<ItemGroup Condition=" $([System.OperatingSystem]::IsWindows()) or '$(PackRustAssets)' == 'true' ">
<None Include="..\Rust\target\release\update.exe" Pack="true" PackagePath="vendor" />
<None Include="..\Rust\target\release\setup.exe" Pack="true" PackagePath="vendor" />
<None Include="..\Rust\target\release\stub.exe" Pack="true" PackagePath="vendor" />
<None Include="..\..\vendor\rcedit.exe" Pack="true" PackagePath="vendor" />
<None Include="..\..\vendor\zstd.exe" Pack="true" PackagePath="vendor" />
<None Include="..\..\vendor\signtool.exe" Pack="true" PackagePath="vendor" />
<None Include="..\Rust\target\release\update.exe" Pack="true" PackagePath="vendor/" />
<None Include="..\Rust\target\release\setup.exe" Pack="true" PackagePath="vendor/" />
<None Include="..\Rust\target\release\stub.exe" Pack="true" PackagePath="vendor/" />
<None Include="..\..\vendor\rcedit.exe" Pack="true" PackagePath="vendor/" />
<None Include="..\..\vendor\zstd.exe" Pack="true" PackagePath="vendor/" />
<None Include="..\..\vendor\signtool.exe" Pack="true" PackagePath="vendor/" />
</ItemGroup>
<ItemGroup Condition=" $([System.OperatingSystem]::IsMacOS()) or '$(PackRustAssets)' == 'true' ">
<None Include="..\Rust\target\release\UpdateMac" Pack="true" PackagePath="vendor" />
<None Include="..\..\Velopack.entitlements" Pack="true" PackagePath="vendor" />
<None Include="..\..\artwork\DefaultApp.icns" Pack="true" PackagePath="vendor" />
<None Include="..\Rust\target\release\UpdateMac" Pack="true" PackagePath="vendor/" />
<None Include="..\..\Velopack.entitlements" Pack="true" PackagePath="vendor/" />
<None Include="..\..\artwork\DefaultApp.icns" Pack="true" PackagePath="vendor/" />
</ItemGroup>
<ItemGroup Condition=" $([System.OperatingSystem]::IsLinux()) or '$(PackRustAssets)' == 'true' ">
<None Include="..\Rust\target\release\UpdateNix" Pack="true" PackagePath="vendor" />
<None Include="..\..\vendor\appimagetool-x86_64.AppImage" Pack="true" PackagePath="vendor" />
<None Include="..\..\artwork\DefaultApp_64.png" Pack="true" PackagePath="vendor" />
<None Include="..\Rust\target\release\UpdateNix" Pack="true" PackagePath="vendor/" />
<None Include="..\..\vendor\appimagetool-x86_64.AppImage" Pack="true" PackagePath="vendor/" />
<None Include="..\..\artwork\DefaultApp_64.png" Pack="true" PackagePath="vendor/" />
</ItemGroup>
<!--<PropertyGroup>

View File

@@ -8,10 +8,11 @@
-->
<VelopackStronglyTyped_TFM Condition=" '$(MSBuildRuntimeType)' != 'Core' ">net472</VelopackStronglyTyped_TFM>
<VelopackStronglyTyped_TFM Condition=" '$(MSBuildRuntimeType)' == 'Core' ">net6.0</VelopackStronglyTyped_TFM>
<VelopackBuildDll>$(MSBuildThisFileDirectory)..\lib\$(VelopackStronglyTyped_TFM)\Velopack.Build.dll</VelopackBuildDll>
</PropertyGroup>
<UsingTask TaskName="Velopack.Build.PackTask" AssemblyFile="..\..\build\$(Configuration)\$(VelopackStronglyTyped_TFM)\Velopack.Build.dll"/>
<UsingTask TaskName="Velopack.Build.PublishTask" AssemblyFile="..\..\build\$(Configuration)\$(VelopackStronglyTyped_TFM)\Velopack.Build.dll"/>
<UsingTask TaskName="Velopack.Build.PackTask" AssemblyFile="$(VelopackBuildDll)"/>
<UsingTask TaskName="Velopack.Build.PublishTask" AssemblyFile="$(VelopackBuildDll)"/>
<Target Name="_VelopackResolveProperties" AfterTargets="Publish" BeforeTargets="VelopackBuildRelease">
<PropertyGroup>
@@ -22,10 +23,11 @@
<VelopackReleaseDirectory Condition="'$(VelopackReleaseDirectory)' == ''">Releases</VelopackReleaseDirectory>
<VelopackPackTitle Condition="'$(VelopackPackTitle)' == ''">$(Product)</VelopackPackTitle>
<VelopackPackAuthors Condition="'$(VelopackPackAuthors)' == ''">$(Authors)</VelopackPackAuthors>
<VelopackTargetRuntime Condition="'$(VelopackTargetRuntime)' == ''">$(RuntimeIdentifier)</VelopackTargetRuntime>
<!--
TODO: the required runtimes can be automatically set (windows only)
We need to know the TargetFramework and the RID that's being published.
We need to know the TargetFramework, RID, and SelfContained properties.
Probably we should pass these both into the C# Task and let it figure out the runtimes.
<VelopackRuntimes Condition="'$(VelopackRuntimes)' == ''">net8-x64-desktop</VelopackRuntimes>
-->

View File

@@ -16,6 +16,7 @@
<PackageIcon>Velopack_200.png</PackageIcon>
<LangVersion>latest</LangVersion>
<NoWarn>$(NoWarn);CA2007;CS8002</NoWarn>
<NoNuGetizer>true</NoNuGetizer>
</PropertyGroup>
<ItemGroup>