From c98875112f1b0289de739569590021ec3e23f034 Mon Sep 17 00:00:00 2001 From: Mattias Karlsson Date: Sun, 7 Jan 2018 21:17:31 +0100 Subject: [PATCH 1/3] (GH-69) Add .NET 3.5 and .NET 4.0 targets * Added .NET 3.5 target * Added .NET 4.0 target * Added source link * Added source to symbols package * Added NuGet package description * Added CLRF fix for AppVeyor * Fixes #69 --- appveyor.yml | 5 ++++- build.cake | 27 ++++++++++++++++++++------- src/LitJson/JsonWriter.cs | 2 +- src/LitJson/LitJSON.csproj | 22 +++++++++++++++++++++- 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 83cfb66..9a0220c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,4 +6,7 @@ build_script: - ps: .\build.ps1 --target="AppVeyor" --verbosity=Verbose # Tests -test: off \ No newline at end of file +test: off + +init: + - git config --global core.autocrlf true \ No newline at end of file diff --git a/build.cake b/build.cake index 5a1c0ad..8177dff 100644 --- a/build.cake +++ b/build.cake @@ -83,7 +83,7 @@ Task("Clean") "./test/bin", "./src/obj", "./test/obj", - "./artifacts/nuget" + "./artifacts/nuget" } ); }); @@ -102,7 +102,8 @@ Task("Build") DotNetCoreBuild("./LitJSON.sln", new DotNetCoreBuildSettings { Configuration = configuration, - MSBuildSettings = msBuildSettings + MSBuildSettings = msBuildSettings, + ArgumentCustomization = args => args.Append("--no-restore") } ); }); @@ -114,7 +115,8 @@ Task("Test") new DotNetCoreTestSettings { Configuration = configuration, Framework = "netcoreapp2.0", - NoBuild = true + NoBuild = true, + ArgumentCustomization = args => args.Append("--no-restore") } ); @@ -123,8 +125,19 @@ Task("Test") }); }); +Task("Test-SourceLink") + .IsDependentOn("Build") + .WithCriteria(IsRunningOnWindows()) + .Does(() => { + foreach(var asssembly in GetFiles("./src/LitJSON/bin/" + configuration + "/**/*.dll")) + { + DotNetCoreTool("./src/LitJSON/LitJSON.csproj", "sourcelink", $"test {asssembly}"); + } +}); + Task("Package") .IsDependentOn("Test") + .IsDependentOn("Test-SourceLink") .Does(() => { DotNetCorePack("./src/LitJSON/LitJSON.csproj", new DotNetCorePackSettings { @@ -132,7 +145,8 @@ Task("Package") NoBuild = true, IncludeSymbols = true, OutputDirectory = "./artifacts/nuget", - MSBuildSettings = msBuildSettings + MSBuildSettings = msBuildSettings, + ArgumentCustomization = args => args.Append("--no-restore") } ); }); @@ -141,7 +155,6 @@ Task("Upload-AppVeyor-Artifacts") .IsDependentOn("Package") .WithCriteria(AppVeyor.IsRunningOnAppVeyor) .Does(() => { - foreach(var artifact in GetFiles("./artifacts/**/*.*")) { AppVeyor.UploadArtifact(artifact); @@ -165,7 +178,7 @@ Task("Publish-MyGet") if(string.IsNullOrEmpty(apiUrl)) { throw new InvalidOperationException("Could not resolve MyGet API url."); } - + foreach(var package in (GetFiles("./artifacts/nuget/*.nupkg") - GetFiles("./artifacts/nuget/*.symbols.nupkg"))) { DotNetCoreNuGetPush(package.FullPath, @@ -194,7 +207,7 @@ Task("Publish-NuGet") if(string.IsNullOrEmpty(apiUrl)) { throw new InvalidOperationException("Could not resolve MyGet API url."); } - + foreach(var package in (GetFiles("./artifacts/nuget/*.nupkg") - GetFiles("./artifacts/nuget/*.symbols.nupkg"))) { DotNetCoreNuGetPush(package.FullPath, diff --git a/src/LitJson/JsonWriter.cs b/src/LitJson/JsonWriter.cs index eec4a86..7a410b3 100644 --- a/src/LitJson/JsonWriter.cs +++ b/src/LitJson/JsonWriter.cs @@ -223,7 +223,7 @@ private void PutNewline (bool add_comma) writer.Write (','); if (pretty_print && ! context.ExpectingValue) - writer.Write ('\n'); + writer.Write (Environment.NewLine); } private void PutString (string str) diff --git a/src/LitJson/LitJSON.csproj b/src/LitJson/LitJSON.csproj index 7be874e..d935384 100644 --- a/src/LitJson/LitJSON.csproj +++ b/src/LitJson/LitJSON.csproj @@ -1,15 +1,25 @@ - netstandard2.0;net45;netstandard1.5 + netstandard2.0;net45;netstandard1.5;net40;net35 false + embedded + true + + + + + + LitJson + A .Net library to handle conversions from and to JSON (JavaScript Object Notation) strings. Written in C#, and it’s intended to be small, fast and easy to use. +It's quick and lean, without external dependencies. The authors disclaim copyright to this source code. Leonardo Boshell, Mattias Karlsson and contributors Leonardo Boshell, Mattias Karlsson and contributors @@ -18,6 +28,16 @@ https://github.com/LitJSON/litjson git JSON;Serializer + true + + + + $(DefineConstants);LEGACY + C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client + + + + $(DefineConstants);LEGACY From 39fa8acc0c3a8f49d514828453ed7788086310fe Mon Sep 17 00:00:00 2001 From: Mattias Karlsson Date: Mon, 8 Jan 2018 09:09:39 +0100 Subject: [PATCH 2/3] Removed make in favor of just supporting Cake build script --- build/make/Makefile | 82 --------------------------------------------- build/version | 1 - 2 files changed, 83 deletions(-) delete mode 100644 build/make/Makefile delete mode 100644 build/version diff --git a/build/make/Makefile b/build/make/Makefile deleted file mode 100644 index 9ea8154..0000000 --- a/build/make/Makefile +++ /dev/null @@ -1,82 +0,0 @@ -topdir = $(CURDIR)/../.. -srcdir = $(topdir)/src/LitJson -testdir = $(topdir)/test -builddir = $(CURDIR) - - -CLEAN_FILES = -CSC = gmcs -CSC_FLAGS = -DATA_VERSION = $(topdir)/build/version -NUNIT = nunit-console2 -PKG_CONFIG = pkg-config - - -ifdef ENABLE_DEBUG - CSC_FLAGS += -debug -endif - - -## -## Main library -## -LITJSON_ASSEMBLY = $(topdir)/bin/LitJson.dll -LITJSON_MDB_FILE = $(LITJSON_ASSEMBLY).mdb - -LITJSON_VERSION = $(shell cat $(DATA_VERSION)) - -GEN_FILES = $(srcdir)/AssemblyInfo.cs -SRC_FILES = \ - $(srcdir)/IJsonWrapper.cs \ - $(srcdir)/JsonMockWrapper.cs \ - $(srcdir)/JsonData.cs \ - $(srcdir)/JsonException.cs \ - $(srcdir)/JsonMapper.cs \ - $(srcdir)/JsonReader.cs \ - $(srcdir)/JsonWriter.cs \ - $(srcdir)/Lexer.cs \ - $(srcdir)/ParserToken.cs - -CLEAN_FILES += $(LITJSON_ASSEMBLY) $(GEN_FILES) $(LITJSON_MDB_FILE) - - -## -## Tests -## -TEST_ASSEMBLY = $(topdir)/bin/LitJson.Tests.dll - -TEST_MONO_NUNIT = $(shell "$(PKG_CONFIG)" --libs mono-nunit) - -TEST_RES_FILES = $(testdir)/json-example.txt -TEST_SRC_FILES = \ - $(testdir)/JsonDataTest.cs \ - $(testdir)/JsonMapperTest.cs \ - $(testdir)/JsonReaderTest.cs \ - $(testdir)/JsonWriterTest.cs - -CLEAN_FILES += $(TEST_ASSEMBLY) $(builddir)/TestResult.xml - - -## -## Rules -## -.PHONY: all clean library test - -all: library - -library: $(LITJSON_ASSEMBLY) - -test: $(TEST_ASSEMBLY) - $(NUNIT) -nologo $(TEST_ASSEMBLY) - -$(srcdir)/AssemblyInfo.cs: $(srcdir)/AssemblyInfo.cs.in $(DATA_VERSION) - sed -e 's#@ASSEMBLY_VERSION@#$(LITJSON_VERSION)#' $< > $@ - -$(LITJSON_ASSEMBLY): $(SRC_FILES) $(GEN_FILES) - $(CSC) $(CSC_FLAGS) -target:library -out:$@ $^ - -$(TEST_ASSEMBLY): $(TEST_SRC_FILES) $(TEST_RES_FILES) $(LITJSON_ASSEMBLY) - $(CSC) $(CSC_FLAGS) -target:library -out:$@ $(TEST_MONO_NUNIT) -r:$(LITJSON_ASSEMBLY) $(TEST_RES_FILES:%=-resource:%) $(TEST_SRC_FILES) - -clean: - rm -rf $(CLEAN_FILES) diff --git a/build/version b/build/version deleted file mode 100644 index ac39a10..0000000 --- a/build/version +++ /dev/null @@ -1 +0,0 @@ -0.9.0 From 468866b8cfa5449abcd86457629c166c3929c7d3 Mon Sep 17 00:00:00 2001 From: Mattias Karlsson Date: Mon, 8 Jan 2018 09:16:01 +0100 Subject: [PATCH 3/3] Release notes migrated to litjson.net --- NEWS | 200 +---------------------------------------------------------- 1 file changed, 1 insertion(+), 199 deletions(-) diff --git a/NEWS b/NEWS index 8aa92ab..8f05c0d 100644 --- a/NEWS +++ b/NEWS @@ -1,199 +1 @@ -LitJSON 0.9.0 -============= - -2014-09-08 - -## Additions - -* Added `JsonData.Keys` property, with type `ICollection`. - -## Bug fixes - -* Handle nullable types (Issue #3) -* Parse UInt64 numbers correctly - -## Other changes - -* Allow specifying a custom PKG_CONFIG in build/make. - -## Contributors for this release - -- Michael Bartnett (@michaelbartnett) -- @MickeyKim - - -- - - - - -LitJSON 0.7.0 -============= - -2013-04-26 - -General changes and improvements: - -* Simplified the building mechanism. Dropped the entire autotools - infrastructure, and instead added a single Makefile to compile the project - and run the tests with *GNU make*. - -* Added `SkipNonMembers` property to `JsonReader`. When active, it allows to - parse JSON data using `JsonMapper.ToObject` and ignore any properties - not available in the type `T`. Its default value is `true`. - -* Started moving the documentation into Markdown format. - -* Added a new section to the QuickStart Guide, regarding customisation of - the library's behaviour. - -Bug fixes: - -* Convert `null` properties properly in `JsonData.ToJson`. - -* Read nested arrays in `JsonMapper.ToObject` and `JsonMapper.ToObject` - correctly. - -Contributors for this release: - - - whoo24 - - Christopher Dummy - - -LitJSON 0.5.0 -============= - -2007-10-04 - -New features and improvements: - -* The JsonRader class now has two properties to control the reading of data - from an input stream: EndOfInput and EndOfJson. The latter becomes - true whenever a complete piece of JSON text has been read, while the - former is a flag that becomes true when the stream itself reaches the end. - This way, reading multiple JSON texts from the same input stream is - straightforward. - -* Added new base importers in JsonMapper for reading numeric values - correctly into float and double members. - -* Now Enum's can be imported/exported as numeric values. - -* JsonData implements the IEquatable interface now. - - -API changes: - - The following types are new: - enum JsonType - - The following methods are new: - IJsonWrapper.GetJsonType() - IJsonWrapper.SetJsonType() - - The following properties are new: - JsonReader.EndOfInput - - -Bug fixes: - -* Correctly import/export properties that are read-only or write-only. - -* Correctly convert null values when adding them as array elements or - properties to a JsonData instance. - -* Fixed conversion of empty JSON objects and arrays. - - -Thanks to all the contributors that reported problems and suggested fixes -for this release: - Colin Alworth - Ralf Callenberg - andi - - -LitJSON 0.3.0 -============= - -2007-08-15 - -New features and improvements: - -* Exporters and importers. - Custom conversions using the JsonMapper class can be made through - importers and exporters. These are delegates that tell the library how to - perform conversions between non-basic types (i.e. not string, int, long, - double or boolean) and JSON. There are base and custom - exporters/importers. The base exporters and importers are built-in - delegates that currently handle simple conversions between JSON and the - following value types: - - byte - char - DateTime - decimal - sbyte - short - ushort - uint - ulong - - Custom exporters and importers can be defined through - JsonMapper.RegisterExporter and JsonMapper.RegisterImporter, and they - override the built-in conversions. - -* Improved performance of JsonMapper.ToJson() - A static JsonWriter is re-used to reduce the activity in the heap, - improving performance for multiple conversions. - -* Allowing extended grammar - The lexer can now accept single-quoted strings, and comments in the - following forms: - - // Single-line comment - - /* - * Multi-line comment - */ - - This way, certain forms of input coming from JavaScript that don't - necessarily conform to the strict JSON grammar are allowed and succesfully - parsed. - - A JsonReader can be configured to accept only the strict grammar or the - extended one. These extensions are allowed by default. - -* API cleanups and additions. - The following members are new: - - JsonData.Count - JsonMapper.RegisterExporter() - JsonMapper.RegisterImporter() - JsonMapper.UnregisterExporters() - JsonMapper.UnregisterImporters() - JsonReader.AllowComments - JsonReader.AllowSingleQuotedStrings - JsonWriter.Reset() - - The following overloads have been added: - - JsonMapper.ToJson(object obj, JsonWriter writer) - JsonMapper.ToObject(JsonReader reader) - - The following members have been renamed: - - JsonReader.HasReachedEnd is now JsonReader.EndOfJson - - -Bugs fixed: - -* JsonMapper.ToJson() avoids entering an infinite recursion by defining a - max nesting depth. -* The JsonData int indexer now behaves correctly both when it acts as an - array and as an object. - - -LitJSON 0.1.0 -============= - -2007-08-09 - -First release. +News has moved to https://litjson.net/blog/