From c456a0f56ed0fba55042c167afa83c9922a5db33 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 9 Oct 2017 12:44:48 -0400 Subject: don't include Json.NET in mod deploy or release zip since it's loaded by SMAPI --- src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs | 20 ++++++++++++++++---- src/SMAPI.ModBuildConfig/package.nuspec | 3 ++- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs b/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs index 10c55d4c..64262dc2 100644 --- a/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs +++ b/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs @@ -67,15 +67,19 @@ namespace StardewModdingAPI.ModBuildConfig.Framework string relativeDirPath = file.Directory.FullName.Replace(buildFolder.FullName, ""); // prefer project manifest/i18n files - if (hasProjectManifest && relativePath.Equals(this.ManifestFileName, StringComparison.InvariantCultureIgnoreCase)) + if (hasProjectManifest && this.EqualsInvariant(relativePath, this.ManifestFileName)) continue; - if (hasProjectTranslations && relativeDirPath.Equals("i18n", StringComparison.InvariantCultureIgnoreCase)) + if (hasProjectTranslations && this.EqualsInvariant(relativeDirPath, "i18n")) continue; // ignore release zips - if (file.Extension.Equals(".zip", StringComparison.InvariantCultureIgnoreCase)) + if (this.EqualsInvariant(file.Extension, ".zip")) 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 this.Files[relativePath] = file; } @@ -158,5 +162,13 @@ namespace StardewModdingAPI.ModBuildConfig.Framework IDictionary data = (IDictionary)new JavaScriptSerializer().DeserializeObject(json); return MakeCaseInsensitive(data); } + + /// Get whether a string is equal to another case-insensitively. + /// The string value. + /// The string to compare with. + private bool EqualsInvariant(string str, string other) + { + return str.Equals(other, StringComparison.InvariantCultureIgnoreCase); + } } } diff --git a/src/SMAPI.ModBuildConfig/package.nuspec b/src/SMAPI.ModBuildConfig/package.nuspec index 4242489e..3ab5db8e 100644 --- a/src/SMAPI.ModBuildConfig/package.nuspec +++ b/src/SMAPI.ModBuildConfig/package.nuspec @@ -2,7 +2,7 @@ Pathoschild.Stardew.ModBuildConfig - 2.0-alpha + 2.0-beta Build package for SMAPI mods Pathoschild Pathoschild @@ -14,6 +14,7 @@ - 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: mod deploy and release zips now exclude Json.NET automatically, since it's provided by SMAPI. - Added mod's version to release zip filename. - Improved errors to simplify troubleshooting. - Fixed release zip not having a mod folder. -- cgit