diff options
| author | Leitwolf11 | 2026-11-01 20:16:35 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-11-01 20:16:35 +0300 |
| commit | e85e2b2359518f83354c09f9f4a101b7779e6e9c (patch) | |
| tree | 866f72ee121f11b3abde3891e0605c1b327dcc12 | |
| parent | 8323e428c021642aaf898bfdefe3b3f4f8f1824b (diff) | |
| download | progmaweb-feature/five-part-versions.tar.gz | |
Accept plugin versions of up to five numbersfeature/five-part-versions
Tazel takes A.B.C, then .D, .E and -METADATA if needed, so the descriptor
check follows it.
| -rw-r--r-- | apps/api-tests/ViGetTests.cs | 8 | ||||
| -rw-r--r-- | apps/api/ViGet/TazelPluginDescriptor.cs | 10 |
2 files changed, 10 insertions, 8 deletions
diff --git a/apps/api-tests/ViGetTests.cs b/apps/api-tests/ViGetTests.cs index 0eb94b8..bcffd4e 100644 --- a/apps/api-tests/ViGetTests.cs +++ b/apps/api-tests/ViGetTests.cs @@ -59,11 +59,13 @@ public sealed class ViGetTests : IDisposable Assert.Equal("The JAR has no META-INF/services/com.progmasoft.api.tazel.dsl.plugin.ProjectPlugin.", TazelPluginDescriptor.TryRead(Jar(service: false), out _)); - Assert.Equal("The descriptor needs an exact version of three or four numbers.", + Assert.Equal("The descriptor needs an exact version of three to five numbers.", TazelPluginDescriptor.TryRead(Jar(version: "1.0"), out _)); - Assert.Equal("The descriptor needs an exact version of three or four numbers.", - TazelPluginDescriptor.TryRead(Jar(version: "1.2.3.4.5"), out _)); + Assert.Equal("The descriptor needs an exact version of three to five numbers.", + TazelPluginDescriptor.TryRead(Jar(version: "1.2.3.4.5.6"), out _)); Assert.True(TazelPluginDescriptor.IsVersion("0.1.1.1")); + Assert.True(TazelPluginDescriptor.IsVersion("0.1.1.1.1")); + Assert.True(TazelPluginDescriptor.IsVersion("0.1.1.1.1-build.2")); Assert.Equal("The descriptor needs a name that is one identifier.", TazelPluginDescriptor.TryRead(Jar(name: "c-make"), out _)); Assert.Equal("The homepage of the descriptor is not an https address.", diff --git a/apps/api/ViGet/TazelPluginDescriptor.cs b/apps/api/ViGet/TazelPluginDescriptor.cs index cc04b41..2433cc7 100644 --- a/apps/api/ViGet/TazelPluginDescriptor.cs +++ b/apps/api/ViGet/TazelPluginDescriptor.cs @@ -13,7 +13,7 @@ namespace Progmasoft.Progmaweb.Api.ViGet; /// </summary> /// <param name="Publisher">The Progmasoft Account the plugin is published under.</param> /// <param name="Name">The name of the plugin; one identifier.</param> -/// <param name="Version">An exact version of three or four numbers.</param> +/// <param name="Version">An exact version of three to five numbers.</param> /// <param name="ApiVersion">The plugin API of Tazel it was built for.</param> /// <param name="Description">What the plugin does.</param> /// <param name="Authors">The authors, in the order of the descriptor.</param> @@ -40,7 +40,7 @@ internal sealed partial record TazelPluginDescriptor( /// <summary>Whether a text is one identifier, as Tazel requires of a publisher and a plugin name.</summary> public static bool IsIdentifier(string value) => IdentifierPattern().IsMatch(value); - /// <summary>Whether a text is an exact version of three or four numbers, as Tazel requires of a plugin version.</summary> + /// <summary>Whether a text is an exact version of three to five numbers, as Tazel requires of a plugin version.</summary> public static bool IsVersion(string value) => VersionPattern().IsMatch(value); /// <summary>Reads and checks the descriptor of a plugin JAR.</summary> @@ -96,7 +96,7 @@ internal sealed partial record TazelPluginDescriptor( if (version is null || !IsVersion(version)) { - return "The descriptor needs an exact version of three or four numbers."; + return "The descriptor needs an exact version of three to five numbers."; } if (!int.TryParse(Text("apiVersion"), out int apiVersion) || apiVersion < 1) @@ -131,8 +131,8 @@ internal sealed partial record TazelPluginDescriptor( [GeneratedRegex("^[A-Za-z_][A-Za-z0-9_]*$")] private static partial Regex IdentifierPattern(); - /// <summary>An exact version of three or four numbers without leading zeros or build metadata, as Tazel accepts it.</summary> + /// <summary>An exact version of three to five numbers without leading zeros, as Tazel accepts it.</summary> /// <returns>The compiled expression.</returns> - [GeneratedRegex(@"^(?:0|[1-9][0-9]*)(?:\.(?:0|[1-9][0-9]*)){2,3}(?:-[0-9A-Za-z.-]+)?$")] + [GeneratedRegex(@"^(?:0|[1-9][0-9]*)(?:\.(?:0|[1-9][0-9]*)){2,4}(?:-[0-9A-Za-z.-]+)?$")] private static partial Regex VersionPattern(); } |