Skip to content

Commit d0fa4e1

Browse files
committed
bump version into 2024.2.0
1 parent a1e99c5 commit d0fa4e1

11 files changed

Lines changed: 165592 additions & 131400 deletions

File tree

generator/Sdcb.OpenVINO.AutoGen/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
IServiceProvider services = ConfigureServices();
1313
//ExtractedInfo info = (await services.GetRequiredService<HeadersDownloader>().DownloadAsync());
1414
AppSettings appSettings = services.GetRequiredService<AppSettings>();
15-
string url = "https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.3/windows/w_openvino_toolkit_windows_2023.3.0.13775.ceeafaf64f3_x86_64.zip";
15+
string url = "https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.2/windows/w_openvino_toolkit_windows_2024.2.0.15519.5c0f38f83f6_x86_64.zip";
1616
ExtractedInfo info = await HeadersDownloader.DirectDownloadAsync(url, services.GetRequiredService<ArtifactDownloader>(), appSettings.DownloadFolder);
1717
ParsedInfo parsed = HeadersParser.Parse(info);
1818
GeneratedAll all = GeneratedAll.Generate(parsed);

generator/Sdcb.OpenVINO.NuGetBuilder/ArtifactSources/StorageNodeRoot.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ public IEnumerable<VersionFolder> VersionFolders
3232
get
3333
{
3434
return EnumerateDirectories(VersionFolder.Prefix)
35-
.Where(x => x.Name != "nightly")
36-
.GroupBy(x => x.Name == "master")
37-
.SelectMany(x => x.Key switch
35+
.Where(x => x.Name != "master")
36+
.SelectMany(x => x.Name.StartsWith("202") switch
3837
{
39-
true => x.First().EnumerateDirectories("").Select(x => VersionFolder.FromFolder(x)),
40-
false => x.Select(x => VersionFolder.FromFolder(x))
38+
true => [VersionFolder.FromFolder(x)],
39+
false => x.EnumerateDirectories("").Select(x => VersionFolder.FromFolder(x)),
4140
});
4241
}
4342
}
Lines changed: 65 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using NuGet.Versioning;
2-
using System.Text.RegularExpressions;
32

43
namespace Sdcb.OpenVINO.NuGetBuilders.ArtifactSources;
54

@@ -16,37 +15,85 @@ public static VersionFolder FromFolder(StorageNode Folder)
1615
return new VersionFolder(path, Folder, ver);
1716
}
1817

19-
static SemanticVersion ParseOpenVINOVersion(string versionString)
18+
/// <summary>
19+
/// Supported formats:
20+
/// <list type="bullet">
21+
/// <item>2024.3.0-15549-ae01c973d53</item>
22+
/// <item>2022.1</item>
23+
/// <item>2022.3.1</item>
24+
/// <item>2024.2.0rc1</item>
25+
/// </list>
26+
/// </summary>
27+
/// <exception cref="ArgumentException"></exception>
28+
public static SemanticVersion ParseOpenVINOVersion(string versionString)
2029
{
21-
string[] versionParts = versionString.Split('.');
30+
// Split into major, minor, patch and optional additional label parts
31+
string[] parts = versionString.Split('.');
2232

23-
// If the version string is in the format 'major.minor', e.g., '2014.7'
24-
if (versionParts.Length == 2)
33+
if (parts.Length < 2)
2534
{
26-
// Append '.0' to convert it into a valid Semantic Version format (major.minor.patch)
27-
versionString += ".0";
35+
throw new ArgumentException("Invalid version string");
2836
}
2937

30-
// If the version string is in the format 'major.minor.0.0.dev+time', e.g., '2022.7.0.0.dev20220714'
31-
else if (versionParts.Length == 4 && versionParts[3].StartsWith("dev"))
38+
// Parse the major and minor versions
39+
int major = int.Parse(parts[0]);
40+
int minor = int.Parse(parts[1]);
41+
42+
// Initialize patch and label
43+
int patch = 0;
44+
string? releaseLabel = null;
45+
46+
if (parts.Length > 2)
3247
{
33-
// Remove 'dev' part and convert the last part (time) into a valid build metadata part
34-
versionString = OpenVINODevVersionRegex().Replace(versionString, "$1-$2.$3");
48+
// Possible formats can be "patch", "patch-...", "patchrc..."
49+
// Split third part further by '-' to separate patch and prerelease label if exists
50+
string[] subParts = parts[2].Split(['-'], 2);
51+
52+
// Parse patch version which is always the first part
53+
// Handle cases where the patch part might have a release candidate or similar suffix directly attached
54+
string patchPart = subParts[0];
55+
int releaseLabelIndex = FindFirstNonNumericIndex(patchPart);
56+
57+
if (releaseLabelIndex != -1)
58+
{
59+
// Separate the numeric patch from the non-numeric release label
60+
patch = int.Parse(patchPart[..releaseLabelIndex]);
61+
releaseLabel = patchPart[releaseLabelIndex..];
62+
}
63+
else
64+
{
65+
patch = int.Parse(patchPart);
66+
}
67+
68+
// If there is any further information after a '-', it is part of the release label
69+
if (subParts.Length > 1)
70+
{
71+
releaseLabel = (releaseLabel != null ? releaseLabel + "-" : "") + subParts[1];
72+
}
3573
}
3674

37-
// Try to parse the version string into a SemanticVersion object
38-
if (SemanticVersion.TryParse(versionString, out SemanticVersion? semVersion))
75+
// Create the SemanticVersion based on extracted information
76+
if (releaseLabel != null)
3977
{
40-
return semVersion;
78+
return new SemanticVersion(major, minor, patch, releaseLabel);
4179
}
4280
else
4381
{
44-
throw new FormatException($"{versionString} is not a known OpenVINO Version");
82+
return new SemanticVersion(major, minor, patch);
4583
}
46-
}
4784

48-
[GeneratedRegex("(.+)\\.(dev)(\\d{8})")]
49-
private static partial Regex OpenVINODevVersionRegex();
85+
static int FindFirstNonNumericIndex(string str)
86+
{
87+
for (int i = 0; i < str.Length; i++)
88+
{
89+
if (!char.IsDigit(str[i]))
90+
{
91+
return i;
92+
}
93+
}
94+
return -1;
95+
}
96+
}
5097

5198
public IEnumerable<ArtifactInfo> Artifacts => ArtifactInfo.FromFolder(this);
5299
}

generator/Sdcb.OpenVINO.NuGetBuilder/Extractors/ArchiveExtractor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static ExtractedInfo Extract(Stream stream, string destinationFolder, ILi
2828
Console.WriteLine($"Extracting artifacts into {destinationFolder}...");
2929
foreach (ZipEntrySlim entry in dynamicLibs)
3030
{
31-
string destFile = Path.Combine(destinationFolder, flatten ? Path.GetFileName(entry.Key) : entry.Key.Replace(reader.RootFolderName, ""));
31+
string destFile = Path.Combine(destinationFolder, flatten ? Path.GetFileName(entry.Key) : entry.Key);
3232
Directory.CreateDirectory(Path.GetDirectoryName(destFile)!);
3333

3434
if (entry.Data.Length > 0)

generator/Sdcb.OpenVINO.NuGetBuilder/PackageBuilders/NuGetPackageInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public static NuGetPackageInfo FromArtifact(ArtifactInfo info)
1616
"ubuntu18" => "ubuntu.18.04",
1717
"ubuntu20" => "ubuntu.20.04",
1818
"ubuntu22" => "ubuntu.22.04",
19+
"ubuntu24" => "ubuntu.24.04",
1920
"macos_10_15" => "osx.10.15",
2021
"macos_11_0" => "osx.11.0",
2122
"windows" => "win",
@@ -29,6 +30,7 @@ public static NuGetPackageInfo FromArtifact(ArtifactInfo info)
2930
"ubuntu18" => "linux",
3031
"ubuntu20" => "linux",
3132
"ubuntu22" => "linux",
33+
"ubuntu24" => "linux",
3234
"macos_10_15" => "osx",
3335
"macos_11_0" => "osx",
3436
"windows" => "win",

generator/Sdcb.OpenVINO.NuGetBuilder/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ static async Task Main(string[] args)
1616
IServiceProvider sp = ConfigureServices();
1717
ArtifactDownloader w = sp.GetRequiredService<ArtifactDownloader>();
1818
StorageNodeRoot root = sp.GetRequiredService<StorageNodeRoot>();
19-
string purpose = args.Length > 0 ? args[0] : "win64";
19+
string purpose = args.Length > 0 ? args[0] : "linux";
2020
string? versionSuffix = "preview.1"; // null or "preview.1", can't be ""
2121
string dir = Path.Combine(DirectoryUtils.SearchFileInCurrentAndParentDirectories(new DirectoryInfo("."), "OpenVINO.NET.sln").DirectoryName!,
2222
"build", "nupkgs");

0 commit comments

Comments
 (0)