-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
156 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,78 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using CSharpFunctionalExtensions; | ||
using DotnetPackaging.Common; | ||
using Nuke.Common.IO; | ||
using Nuke.Common.ProjectModel; | ||
using Nuke.Common.Tooling; | ||
using Nuke.Common.Tools.DotNet; | ||
using Serilog; | ||
|
||
class DebPackages | ||
{ | ||
public static async Task Create(Solution solution, | ||
Configuration configuration, | ||
AbsolutePath publishDirectory, | ||
AbsolutePath outputDirectory, | ||
string version) | ||
{ | ||
var desktopProject = solution.AllProjects.First(project => project.Name.EndsWith("Desktop")); | ||
var runtimes = new[] { "linux-x64", "linux-arm64" }; | ||
|
||
DotNetTasks.DotNetPublish(settings => settings | ||
.SetConfiguration(configuration) | ||
.SetProject(desktopProject) | ||
.CombineWith(runtimes, (c, runtime) => | ||
c.SetRuntime(runtime) | ||
.SetOutput(publishDirectory / runtime))); | ||
|
||
var results = new List<Result>(); | ||
|
||
foreach (var runtime in runtimes) | ||
{ | ||
string projectName = solution.Name; | ||
string architecture = runtime.Split("-")[1]; | ||
|
||
string packageName = $"{projectName!.Replace(" ", "").ToLower()}_{version}_{architecture}.deb"; | ||
|
||
var fromFile = await new FileInfo(solution.Directory / "metadata.deb.json").ToPackageDefinition(); | ||
var packageDefinition = fromFile with | ||
{ | ||
Metadata = fromFile.Metadata with | ||
{ | ||
Version = version, | ||
Architecture = GetArchitecture(architecture) | ||
} | ||
}; | ||
|
||
Log.Information("Creating {Package}", packageName); | ||
var result = await DotnetPackaging.Create.Deb(packageDefinition, publishDirectory / runtime, outputDirectory / packageName); | ||
result | ||
.Finally(r => | ||
{ | ||
Log.Information("{Package} {Result}", packageName, r.Match(() => $"{packageName} created successfully!", error => $"{packageName} creation failed: {error}")); | ||
return r; | ||
}); | ||
|
||
results.Add(result); | ||
} | ||
|
||
if (results.Combine().IsFailure) | ||
{ | ||
throw new Exception(".deb creation failed"); | ||
} | ||
} | ||
|
||
static string GetArchitecture(string architecture) | ||
{ | ||
return architecture switch | ||
{ | ||
"x64" => "amd64", | ||
"arm64" => "arm64", | ||
_ => throw new NotSupportedException($"Invalid architecture {architecture}"), | ||
}; | ||
} | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using CSharpFunctionalExtensions; | ||
using DotnetPackaging.Deb.Archives; | ||
using Nuke.Common.IO; | ||
using Nuke.Common.ProjectModel; | ||
using Nuke.Common.Tooling; | ||
using Nuke.Common.Tools.DotNet; | ||
using Serilog; | ||
|
||
class DebPackages | ||
{ | ||
public static async Task Create(Solution solution, | ||
Configuration configuration, | ||
AbsolutePath publishDirectory, | ||
AbsolutePath outputDirectory, | ||
string version) | ||
{ | ||
var desktopProject = solution.AllProjects.First(project => project.Name.EndsWith("Desktop")); | ||
var runtimes = new[] { "linux-x64", "linux-arm64" }; | ||
|
||
DotNetTasks.DotNetPublish(settings => settings | ||
.SetConfiguration(configuration) | ||
.SetProject(desktopProject) | ||
.CombineWith(runtimes, (c, runtime) => | ||
c.SetRuntime(runtime) | ||
.SetOutput(publishDirectory / runtime))); | ||
|
||
var results = new List<Result>(); | ||
|
||
foreach (var runtime in runtimes) | ||
{ | ||
string projectName = solution.Name; | ||
string architecture = runtime.Split("-")[1]; | ||
|
||
string packageName = $"{projectName!.Replace(" ", "").ToLower()}_{version}_{architecture}.deb"; | ||
|
||
var fromFile = await new FileInfo(solution.Directory / "metadata.deb.json").ToPackageDefinition(); | ||
var packageDefinition = fromFile with | ||
{ | ||
Metadata = fromFile.Metadata with | ||
{ | ||
Version = version, | ||
Architecture = GetArchitecture(architecture) | ||
} | ||
}; | ||
|
||
Log.Information("Creating {Package}", packageName); | ||
var result = await DotnetPackaging.Deb.Create.Deb(packageDefinition, publishDirectory / runtime, outputDirectory / packageName); | ||
result | ||
.Finally(r => | ||
{ | ||
Log.Information("{Package} {Result}", packageName, r.Match(() => $"{packageName} created successfully!", error => $"{packageName} creation failed: {error}")); | ||
return r; | ||
}); | ||
|
||
results.Add(result); | ||
} | ||
|
||
if (results.Combine().IsFailure) | ||
{ | ||
throw new Exception(".deb creation failed"); | ||
} | ||
} | ||
|
||
static string GetArchitecture(string architecture) | ||
{ | ||
return architecture switch | ||
{ | ||
"x64" => "amd64", | ||
"arm64" => "arm64", | ||
_ => throw new NotSupportedException($"Invalid architecture {architecture}"), | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<RootNamespace /> | ||
<NoWarn>CS0649;CS0169</NoWarn> | ||
<NukeRootDirectory>..</NukeRootDirectory> | ||
<NukeScriptDirectory>..</NukeScriptDirectory> | ||
<NukeTelemetryVersion>1</NukeTelemetryVersion> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="DotnetPackaging" Version="1.0.17" /> | ||
<PackageReference Include="Nuke.Common" Version="7.0.2" /> | ||
<PackageReference Include="Nuke.GitHub" Version="5.0.0" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageDownload Include="GitVersion.Tool" Version="[5.12.0]" /> | ||
</ItemGroup> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace /> | ||
<NoWarn>CS0649;CS0169</NoWarn> | ||
<NukeRootDirectory>..</NukeRootDirectory> | ||
<NukeScriptDirectory>..</NukeScriptDirectory> | ||
<NukeTelemetryVersion>1</NukeTelemetryVersion> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="DotnetPackaging.Deb" Version="1.0.22" /> | ||
<PackageReference Include="Nuke.Common" Version="8.0.0" /> | ||
<PackageReference Include="Nuke.GitHub" Version="5.0.1" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageDownload Include="GitVersion.Tool" Version="[5.12.0]" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0-android</TargetFramework> | ||
<SupportedOSPlatformVersion>30</SupportedOSPlatformVersion> | ||
<Nullable>enable</Nullable> | ||
<ApplicationId>com.SuperJMN.AvaloniaSyncer</ApplicationId> | ||
<AndroidPackageFormat>apk</AndroidPackageFormat> | ||
<AndroidEnableProfiledAot>False</AndroidEnableProfiledAot> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<AndroidResource Include="Icon.png"> | ||
<Link>Resources\drawable\Icon.png</Link> | ||
</AndroidResource> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Avalonia.Android" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.5" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\AvaloniaSyncer\AvaloniaSyncer.csproj" /> | ||
</ItemGroup> | ||
</Project> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0-android</TargetFramework> | ||
<SupportedOSPlatformVersion>30</SupportedOSPlatformVersion> | ||
<Nullable>enable</Nullable> | ||
<ApplicationId>com.SuperJMN.AvaloniaSyncer</ApplicationId> | ||
<AndroidPackageFormat>apk</AndroidPackageFormat> | ||
<AndroidEnableProfiledAot>False</AndroidEnableProfiledAot> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<AndroidResource Include="Icon.png"> | ||
<Link>Resources\drawable\Icon.png</Link> | ||
</AndroidResource> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Avalonia.Android" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.6" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\AvaloniaSyncer\AvaloniaSyncer.csproj" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<LangVersion>latest</LangVersion> | ||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<AvaloniaResource Include="Assets\**" /> | ||
<AvaloniaResource Include="**\*.png" /> | ||
</ItemGroup> | ||
<ItemGroup Condition="'$(Configuration)' == 'Debug'"> | ||
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.0" /> | ||
<PackageReference Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="HttpClient.Extensions.LoggingHttpMessageHandler" Version="1.0.3" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="Avalonia.Controls.DataGrid" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="Avalonia.Fonts.Inter" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="Avalonia.ReactiveUI" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="ByteSize" Version="2.1.1" /> | ||
<PackageReference Include="Deadpikle.AvaloniaProgressRing" Version="0.10.6" /> | ||
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" /> | ||
<PackageReference Include="ReactiveUI.Validation" Version="3.1.7" /> | ||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" /> | ||
<PackageReference Include="Zafiro.Avalonia" Version="3.0.81" /> | ||
<PackageReference Include="Zafiro.Avalonia.Dialogs" Version="3.0.81" /> | ||
<PackageReference Include="Zafiro.Avalonia.FileExplorer" Version="1.0.44" /> | ||
<PackageReference Include="Zafiro.FileSystem.Local" Version="5.0.11" /> | ||
<PackageReference Include="Zafiro.FileSystem.SeaweedFS" Version="5.0.11" /> | ||
<PackageReference Include="Zafiro.FileSystem.Sftp" Version="5.0.11" /> | ||
<PackageReference Include="Zafiro.UI" Version="4.0.29" /> | ||
</ItemGroup> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<LangVersion>latest</LangVersion> | ||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<AvaloniaResource Include="Assets\**" /> | ||
<AvaloniaResource Include="**\*.png" /> | ||
</ItemGroup> | ||
<ItemGroup Condition="'$(Configuration)' == 'Debug'"> | ||
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" /> | ||
<PackageReference Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="HttpClient.Extensions.LoggingHttpMessageHandler" Version="1.0.3" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="Avalonia.Controls.DataGrid" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="Avalonia.Fonts.Inter" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="Avalonia.ReactiveUI" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="ByteSize" Version="2.1.2" /> | ||
<PackageReference Include="Deadpikle.AvaloniaProgressRing" Version="0.10.6" /> | ||
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" /> | ||
<PackageReference Include="ReactiveUI.Validation" Version="3.1.7" /> | ||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" /> | ||
<PackageReference Include="Zafiro.Avalonia" Version="3.0.81" /> | ||
<PackageReference Include="Zafiro.Avalonia.Dialogs" Version="3.0.81" /> | ||
<PackageReference Include="Zafiro.Avalonia.FileExplorer" Version="1.0.44" /> | ||
<PackageReference Include="Zafiro.FileSystem.Local" Version="5.1.0" /> | ||
<PackageReference Include="Zafiro.FileSystem.SeaweedFS" Version="5.1.0" /> | ||
<PackageReference Include="Zafiro.FileSystem.Sftp" Version="5.1.0" /> | ||
<PackageReference Include="Zafiro.UI" Version="4.0.29" /> | ||
</ItemGroup> | ||
</Project> |