don't include Json.NET in mod deploy or release zip since it's loaded by SMAPI

This commit is contained in:
Jesse Plamondon-Willard 2017-10-09 12:44:48 -04:00
parent dad0d67022
commit c456a0f56e
3 changed files with 19 additions and 5 deletions

View File

@ -130,6 +130,7 @@ _[Game path](#game-path)_ above.
### 2.0 ### 2.0
* Added: mods are now copied into the `Mods` folder automatically (configurable). * Added: mods are now copied into the `Mods` folder automatically (configurable).
* Added: release zips are now created automatically in your build output folder (configurable). * Added: release zips are now created automatically in your build output folder (configurable).
* Added: mod deploy and release zips now exclude Json.NET automatically, since it's provided by SMAPI.
* Added mod's version to release zip filename. * Added mod's version to release zip filename.
* Improved errors to simplify troubleshooting. * Improved errors to simplify troubleshooting.
* Fixed release zip not having a mod folder. * Fixed release zip not having a mod folder.

View File

@ -67,15 +67,19 @@ namespace StardewModdingAPI.ModBuildConfig.Framework
string relativeDirPath = file.Directory.FullName.Replace(buildFolder.FullName, ""); string relativeDirPath = file.Directory.FullName.Replace(buildFolder.FullName, "");
// prefer project manifest/i18n files // prefer project manifest/i18n files
if (hasProjectManifest && relativePath.Equals(this.ManifestFileName, StringComparison.InvariantCultureIgnoreCase)) if (hasProjectManifest && this.EqualsInvariant(relativePath, this.ManifestFileName))
continue; continue;
if (hasProjectTranslations && relativeDirPath.Equals("i18n", StringComparison.InvariantCultureIgnoreCase)) if (hasProjectTranslations && this.EqualsInvariant(relativeDirPath, "i18n"))
continue; continue;
// ignore release zips // ignore release zips
if (file.Extension.Equals(".zip", StringComparison.InvariantCultureIgnoreCase)) if (this.EqualsInvariant(file.Extension, ".zip"))
continue; continue;
// ignore Json.NET (bundled into SMAPI)
if (this.EqualsInvariant(file.Name, "Newtonsoft.Json.dll") || this.EqualsInvariant(file.Name, "Newtonsoft.Json.xml"))
continue;
// add file // add file
this.Files[relativePath] = file; this.Files[relativePath] = file;
} }
@ -158,5 +162,13 @@ namespace StardewModdingAPI.ModBuildConfig.Framework
IDictionary<string, object> data = (IDictionary<string, object>)new JavaScriptSerializer().DeserializeObject(json); IDictionary<string, object> data = (IDictionary<string, object>)new JavaScriptSerializer().DeserializeObject(json);
return MakeCaseInsensitive(data); return MakeCaseInsensitive(data);
} }
/// <summary>Get whether a string is equal to another case-insensitively.</summary>
/// <param name="str">The string value.</param>
/// <param name="other">The string to compare with.</param>
private bool EqualsInvariant(string str, string other)
{
return str.Equals(other, StringComparison.InvariantCultureIgnoreCase);
}
} }
} }

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata> <metadata>
<id>Pathoschild.Stardew.ModBuildConfig</id> <id>Pathoschild.Stardew.ModBuildConfig</id>
<version>2.0-alpha</version> <version>2.0-beta</version>
<title>Build package for SMAPI mods</title> <title>Build package for SMAPI mods</title>
<authors>Pathoschild</authors> <authors>Pathoschild</authors>
<owners>Pathoschild</owners> <owners>Pathoschild</owners>
@ -14,6 +14,7 @@
<releaseNotes> <releaseNotes>
- Added: mods are now copied into the `Mods` folder automatically (configurable). - Added: mods are now copied into the `Mods` folder automatically (configurable).
- Added: release zips are now created automatically in your build output folder (configurable). - Added: release zips are now created automatically in your build output folder (configurable).
- Added: mod deploy and release zips now exclude Json.NET automatically, since it's provided by SMAPI.
- Added mod's version to release zip filename. - Added mod's version to release zip filename.
- Improved errors to simplify troubleshooting. - Improved errors to simplify troubleshooting.
- Fixed release zip not having a mod folder. - Fixed release zip not having a mod folder.