diff options
| author | Leitwolf11 | 2026-11-01 16:09:24 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-11-01 16:09:24 +0300 |
| commit | 02662c79c1f2bcda974da9e1b0ed8c5ac92ee127 (patch) | |
| tree | 4ee85eac098e19e0fbeda39353d9401e7888a5ba | |
| parent | 1d99f81ec96e05337e474dc84555def3a1bcf954 (diff) | |
| download | progmaweb-feature/four-part-versions.tar.gz | |
Accept plugin versions of four numbersfeature/four-part-versions
Progmasoft's releases move to four numbers, and the plugins publish here.
| -rw-r--r-- | apps/api-tests/ViGetTests.cs | 5 | ||||
| -rw-r--r-- | apps/api/ViGet/TazelPluginDescriptor.cs | 10 |
2 files changed, 9 insertions, 6 deletions
diff --git a/apps/api-tests/ViGetTests.cs b/apps/api-tests/ViGetTests.cs index 603ef2f..0eb94b8 100644 --- a/apps/api-tests/ViGetTests.cs +++ b/apps/api-tests/ViGetTests.cs @@ -59,8 +59,11 @@ 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 semantic version.", + Assert.Equal("The descriptor needs an exact version of three or four 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.True(TazelPluginDescriptor.IsVersion("0.1.1.1")); 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 7495e46..cc04b41 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 semantic version.</param> +/// <param name="Version">An exact version of three or four 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 semantic version, as Tazel requires of a plugin version.</summary> + /// <summary>Whether a text is an exact version of three or four 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 semantic version."; + return "The descriptor needs an exact version of three or four 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 semantic version without leading zeros or build metadata, as Tazel accepts it.</summary> + /// <summary>An exact version of three or four numbers without leading zeros or build metadata, as Tazel accepts it.</summary> /// <returns>The compiled expression.</returns> - [GeneratedRegex(@"^(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[0-9A-Za-z.-]+)?$")] + [GeneratedRegex(@"^(?:0|[1-9][0-9]*)(?:\.(?:0|[1-9][0-9]*)){2,3}(?:-[0-9A-Za-z.-]+)?$")] private static partial Regex VersionPattern(); } |