Skip to content

Commit e6823c7

Browse files
committed
V2025.12.0
Fixes #9
1 parent 625de53 commit e6823c7

3 files changed

Lines changed: 21 additions & 9 deletions

File tree

Nickvision.FlatpakGenerator/FlatpakSourcesGenerator.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public static async Task<bool> CheckRuntimeAsync(string runtime, bool runAsUser)
6868
return false;
6969
}
7070

71-
public static async Task<List<NugetSource>> GenerateSourcesAsync(string input, int dotnetVersion, string? freedesktopVersion, string? temp, bool selfContained, bool runAsUser)
71+
public static async Task<List<NugetSource>> GenerateSourcesAsync(string input, int dotnetVersion, string? freedesktopVersion, string? temp, bool selfContained, bool runAsUser, string? destinationName)
7272
{
7373
input = input.Replace("~", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile));
7474
freedesktopVersion = freedesktopVersion ?? "25.08";
@@ -141,7 +141,7 @@ public static async Task<List<NugetSource>> GenerateSourcesAsync(string input, i
141141
{
142142
Url = $"https://api.nuget.org/v3-flatcontainer/{name}/{version}/{filename}",
143143
Sha512 = hash,
144-
Destination = "nuget-sources",
144+
Destination = destinationName ?? "nuget-sources",
145145
DestinationFileName = filename
146146
});
147147
}
@@ -158,7 +158,7 @@ public static async Task<List<NugetSource>> GenerateSourcesAsync(string input, i
158158
"microsoft.netcore.app.runtime.linux-x64"
159159
})
160160
{
161-
var extraSource = await GetExtraSourceAsync(extra);
161+
var extraSource = await GetExtraSourceAsync(extra, destinationName);
162162
if (extraSource is not null)
163163
{
164164
sources.Add(extraSource);
@@ -185,7 +185,7 @@ public static async Task WriteSourcesFileAsync(List<NugetSource> sources, string
185185
Console.WriteLine($"[Info] Sources file written to {Path.GetFullPath(output)}");
186186
}
187187

188-
private static async Task<NugetSource?> GetExtraSourceAsync(string name)
188+
private static async Task<NugetSource?> GetExtraSourceAsync(string name, string? destinationName)
189189
{
190190
name = name.ToLower();
191191
var catalog = await HttpClient.GetFromJsonAsync<NugetCatalog>($"https://api.nuget.org/v3/registration5-semver1/{name}/index.json", JsonSerializerOptions);
@@ -214,7 +214,7 @@ public static async Task WriteSourcesFileAsync(List<NugetSource> sources, string
214214
{
215215
Url = $"https://api.nuget.org/v3-flatcontainer/{name}/{latestEntry.Version}/{filename}",
216216
Sha512 = Convert.ToHexString(Convert.FromBase64String(latestEntry.PackageHash)).ToLower(),
217-
Destination = "nuget-sources",
217+
Destination = destinationName ?? "nuget-sources",
218218
DestinationFileName = filename
219219
};
220220
}

Nickvision.FlatpakGenerator/Nickvision.FlatpakGenerator.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ImplicitUsings>disable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<PackageId>Nickvision.FlatpakGenerator</PackageId>
9-
<Version>2025.11.3</Version>
9+
<Version>2025.12.0</Version>
1010
<Company>Nickvision</Company>
1111
<Authors>Nickvision</Authors>
1212
<Description>A tool to generate Flatpak sources file for .NET projects</Description>
@@ -22,7 +22,7 @@
2222
</PropertyGroup>
2323

2424
<ItemGroup>
25-
<PackageReference Include="System.CommandLine" Version="2.0.0" />
25+
<PackageReference Include="System.CommandLine" Version="2.0.1" />
2626
</ItemGroup>
2727

2828
<ItemGroup>

Nickvision.FlatpakGenerator/Program.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ public static async Task<int> Main(string[] args)
113113
{
114114
"-t"
115115
}
116+
},
117+
new Option<string>("--destination-name")
118+
{
119+
Description = "The name to use for the flatpak sources destination folder",
120+
Required = false,
121+
Aliases =
122+
{
123+
"-d"
124+
}
116125
}
117126
};
118127
checkCommand.SetAction(async x =>
@@ -142,8 +151,11 @@ public static async Task<int> Main(string[] args)
142151
Console.Error.WriteLine("[Error] Invalid FreeDesktop version for the specified .NET version.");
143152
return;
144153
}
145-
var sources = await FlatpakSourcesGenerator.GenerateSourcesAsync(x.GetRequiredValue<string>("--input"), x.GetRequiredValue<int>("--dotnet"), x.GetRequiredValue<string>("--freedesktop"), x.GetValue<string>("--temp"), x.GetValue<bool>("--self-contained"), x.GetValue<bool>("--run-as-user"));
146-
await FlatpakSourcesGenerator.WriteSourcesFileAsync(sources, x.GetValue<string>("--output"));
154+
var sources = await FlatpakSourcesGenerator.GenerateSourcesAsync(x.GetRequiredValue<string>("--input"), x.GetRequiredValue<int>("--dotnet"), x.GetRequiredValue<string>("--freedesktop"), x.GetValue<string>("--temp"), x.GetValue<bool>("--self-contained"), x.GetValue<bool>("--run-as-user"), x.GetValue<string>("--destination-name"));
155+
if(sources.Count > 0)
156+
{
157+
await FlatpakSourcesGenerator.WriteSourcesFileAsync(sources, x.GetValue<string>("--output"));
158+
}
147159
});
148160
rootCommand.Subcommands.Add(checkCommand);
149161
rootCommand.Subcommands.Add(generateCommand);

0 commit comments

Comments
 (0)