diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-10-09 12:44:48 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-10-09 12:44:48 -0400 |
commit | c456a0f56ed0fba55042c167afa83c9922a5db33 (patch) | |
tree | 52ec30f7412ad79b512627aaa8d726fbcdb5580f | |
parent | dad0d67022be32c6b228f771099cc2379850bf87 (diff) | |
download | SMAPI-c456a0f56ed0fba55042c167afa83c9922a5db33.tar.gz SMAPI-c456a0f56ed0fba55042c167afa83c9922a5db33.tar.bz2 SMAPI-c456a0f56ed0fba55042c167afa83c9922a5db33.zip |
don't include Json.NET in mod deploy or release zip since it's loaded by SMAPI
-rw-r--r-- | docs/mod-build-config.md | 1 | ||||
-rw-r--r-- | src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs | 20 | ||||
-rw-r--r-- | src/SMAPI.ModBuildConfig/package.nuspec | 3 |
3 files changed, 19 insertions, 5 deletions
diff --git a/docs/mod-build-config.md b/docs/mod-build-config.md index f02981b9..ca750c86 100644 --- a/docs/mod-build-config.md +++ b/docs/mod-build-config.md @@ -130,6 +130,7 @@ _[Game path](#game-path)_ above. ### 2.0 * 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. 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<string, object> data = (IDictionary<string, object>)new JavaScriptSerializer().DeserializeObject(json); 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); + } } } 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 @@ <package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> <metadata> <id>Pathoschild.Stardew.ModBuildConfig</id> - <version>2.0-alpha</version> + <version>2.0-beta</version> <title>Build package for SMAPI mods</title> <authors>Pathoschild</authors> <owners>Pathoschild</owners> @@ -14,6 +14,7 @@ <releaseNotes> - 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. |