add prerelease tag to zip name & normalise version format

This commit is contained in:
Jesse Plamondon-Willard 2017-10-08 02:13:08 -04:00
parent e2e7e096b7
commit ca58da37cd
5 changed files with 10 additions and 11 deletions

View File

@ -1,5 +1,3 @@
using Newtonsoft.Json;
namespace StardewModdingAPI.Common.Models
{
/// <summary>Generic metadata about a mod.</summary>
@ -9,16 +7,16 @@ namespace StardewModdingAPI.Common.Models
** Accessors
*********/
/// <summary>The mod name.</summary>
public string Name { get; }
public string Name { get; set; }
/// <summary>The mod's semantic version number.</summary>
public string Version { get; }
public string Version { get; set; }
/// <summary>The mod's web URL.</summary>
public string Url { get; }
public string Url { get; set; }
/// <summary>The error message indicating why the mod is invalid (if applicable).</summary>
public string Error { get; }
public string Error { get; set; }
/*********
@ -29,7 +27,6 @@ namespace StardewModdingAPI.Common.Models
/// <param name="version">The mod's semantic version number.</param>
/// <param name="url">The mod's web URL.</param>
/// <param name="error">The error message indicating why the mod is invalid (if applicable).</param>
[JsonConstructor]
public ModInfoModel(string name, string version, string url, string error = null)
{
this.Name = name;

View File

@ -1,6 +1,5 @@
using System;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
namespace StardewModdingAPI.Common
{
@ -41,7 +40,6 @@ namespace StardewModdingAPI.Common
/// <param name="minor">The minor version incremented for backwards-compatible changes.</param>
/// <param name="patch">The patch version for backwards-compatible bug fixes.</param>
/// <param name="tag">An optional prerelease tag.</param>
[JsonConstructor]
public SemanticVersionImpl(int major, int minor, int patch, string tag = null)
{
this.Major = major;

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
@ -55,5 +55,6 @@
<ItemGroup>
<Content Include="assets\nuget-icon.png" />
</ItemGroup>
<Import Project="..\SMAPI.Common\StardewModdingAPI.Common.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -6,6 +6,7 @@ using System.Linq;
using System.Web.Script.Serialization;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using StardewModdingAPI.Common;
namespace StardewModdingAPI.ModBuildConfig.Tasks
{
@ -115,8 +116,9 @@ namespace StardewModdingAPI.ModBuildConfig.Tasks
int major = versionFields.ContainsKey("MajorVersion") ? (int)versionFields["MajorVersion"] : 0;
int minor = versionFields.ContainsKey("MinorVersion") ? (int)versionFields["MinorVersion"] : 0;
int patch = versionFields.ContainsKey("PatchVersion") ? (int)versionFields["PatchVersion"] : 0;
string tag = versionFields.ContainsKey("Build") ? (string)versionFields["Build"] : null;
return $"{major}.{minor}.{patch}";
return new SemanticVersionImpl(major, minor, patch, tag).ToString();
}
/// <summary>Get a case-insensitive dictionary matching the given JSON.</summary>

View File

@ -50,6 +50,7 @@ EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
SMAPI.Common\StardewModdingAPI.Common.projitems*{2aa02fb6-ff03-41cf-a215-2ee60ab4f5dc}*SharedItemsImports = 13
SMAPI.Common\StardewModdingAPI.Common.projitems*{ea4f1e80-743f-4a1d-9757-ae66904a196a}*SharedItemsImports = 4
SMAPI.Common\StardewModdingAPI.Common.projitems*{f1a573b0-f436-472c-ae29-0b91ea6b9f8f}*SharedItemsImports = 4
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution