mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Added a script to build a single file distribution
This commit is contained in:
		| @@ -82,7 +82,7 @@ root.printTo(Serial); | |||||||
| Documentation | Documentation | ||||||
| ------------- | ------------- | ||||||
|  |  | ||||||
| The documentation is available online in the [ArduinoJson wiki](https://github.com/bblanchon/ArduinoJson/wiki). | The documentation is available online in the [ArduinoJson Website](https://github.com/bblanchon/ArduinoJson/). | ||||||
|  |  | ||||||
| The [ArduinoJson Assistant](https://bblanchon.github.io/ArduinoJson/assistant/) helps you get started with the library. | The [ArduinoJson Assistant](https://bblanchon.github.io/ArduinoJson/assistant/) helps you get started with the library. | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,5 +5,8 @@ | |||||||
| // https://github.com/bblanchon/ArduinoJson | // https://github.com/bblanchon/ArduinoJson | ||||||
| // If you like this project, please add a star! | // If you like this project, please add a star! | ||||||
|  |  | ||||||
|  | #pragma once | ||||||
|  |  | ||||||
| #include "ArduinoJson.hpp" | #include "ArduinoJson.hpp" | ||||||
|  |  | ||||||
| using namespace ArduinoJson; | using namespace ArduinoJson; | ||||||
|   | |||||||
| @@ -19,5 +19,3 @@ | |||||||
| #include "ArduinoJson/JsonObjectImpl.hpp" | #include "ArduinoJson/JsonObjectImpl.hpp" | ||||||
| #include "ArduinoJson/JsonVariantImpl.hpp" | #include "ArduinoJson/JsonVariantImpl.hpp" | ||||||
| #include "ArduinoJson/Serialization/JsonSerializerImpl.hpp" | #include "ArduinoJson/Serialization/JsonSerializerImpl.hpp" | ||||||
|  |  | ||||||
| using namespace ArduinoJson; |  | ||||||
|   | |||||||
| @@ -7,6 +7,8 @@ | |||||||
|  |  | ||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
|  | #if ARDUINOJSON_ENABLE_ARDUINO_STREAM | ||||||
|  |  | ||||||
| #include <Stream.h> | #include <Stream.h> | ||||||
|  |  | ||||||
| #include "../TypeTraits/EnableIf.hpp" | #include "../TypeTraits/EnableIf.hpp" | ||||||
| @@ -59,3 +61,5 @@ struct StringTraits<TStream, | |||||||
|     : ArduinoStreamTraits {}; |     : ArduinoStreamTraits {}; | ||||||
| } | } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | #endif | ||||||
|   | |||||||
| @@ -7,6 +7,8 @@ | |||||||
|  |  | ||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
|  | #if ARDUINOJSON_ENABLE_PROGMEM | ||||||
|  |  | ||||||
| namespace ArduinoJson { | namespace ArduinoJson { | ||||||
| namespace Internals { | namespace Internals { | ||||||
| template <> | template <> | ||||||
| @@ -50,3 +52,5 @@ struct StringTraits<const __FlashStringHelper*, void> { | |||||||
| }; | }; | ||||||
| } | } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | #endif | ||||||
|   | |||||||
| @@ -7,6 +7,8 @@ | |||||||
|  |  | ||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
|  | #if ARDUINOJSON_ENABLE_STD_STREAM | ||||||
|  |  | ||||||
| #include <istream> | #include <istream> | ||||||
| #include "../TypeTraits/EnableIf.hpp" | #include "../TypeTraits/EnableIf.hpp" | ||||||
| #include "../TypeTraits/IsBaseOf.hpp" | #include "../TypeTraits/IsBaseOf.hpp" | ||||||
| @@ -57,3 +59,5 @@ struct StringTraits<TStream, | |||||||
|     : StdStreamTraits {}; |     : StdStreamTraits {}; | ||||||
| } | } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | #endif | ||||||
|   | |||||||
| @@ -7,6 +7,8 @@ | |||||||
|  |  | ||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
|  | #if ARDUINOJSON_ENABLE_STD_STRING || ARDUINOJSON_ENABLE_ARDUINO_STRING | ||||||
|  |  | ||||||
| #if ARDUINOJSON_ENABLE_ARDUINO_STRING | #if ARDUINOJSON_ENABLE_ARDUINO_STRING | ||||||
| #include <WString.h> | #include <WString.h> | ||||||
| #endif | #endif | ||||||
| @@ -60,3 +62,5 @@ struct StringTraits<std::string, void> : StdStringTraits<std::string> {}; | |||||||
| #endif | #endif | ||||||
| } | } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | #endif | ||||||
|   | |||||||
| @@ -23,23 +23,11 @@ struct StringTraits<TString&, void> : StringTraits<TString> {}; | |||||||
| } | } | ||||||
| } | } | ||||||
|  |  | ||||||
| #include "CharPointer.hpp" |  | ||||||
|  |  | ||||||
| #if ARDUINOJSON_ENABLE_STD_STRING || ARDUINOJSON_ENABLE_ARDUINO_STRING |  | ||||||
| #include "StdString.hpp" |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #if ARDUINOJSON_ENABLE_STD_STREAM |  | ||||||
| #include "StdStream.hpp" |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #if ARDUINOJSON_ENABLE_ARDUINO_STREAM |  | ||||||
| #include "ArduinoStream.hpp" | #include "ArduinoStream.hpp" | ||||||
| #endif | #include "CharPointer.hpp" | ||||||
|  |  | ||||||
| #if ARDUINOJSON_ENABLE_PROGMEM |  | ||||||
| #include "FlashString.hpp" | #include "FlashString.hpp" | ||||||
| #endif | #include "StdStream.hpp" | ||||||
|  | #include "StdString.hpp" | ||||||
|  |  | ||||||
| namespace ArduinoJson { | namespace ArduinoJson { | ||||||
| namespace TypeTraits { | namespace TypeTraits { | ||||||
|   | |||||||
							
								
								
									
										44
									
								
								scripts/build-single-header.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								scripts/build-single-header.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,44 @@ | |||||||
|  | #!/bin/bash | ||||||
|  |  | ||||||
|  | TAG=$(git describe) | ||||||
|  | RE_INCLUDE='^#include[[:space:]]*["<](.*)[">]' | ||||||
|  | RE_EMPTY='^(#pragma[[:space:]]+once)?[[:space:]]*(//.*)?$' | ||||||
|  |  | ||||||
|  | declare -A INCLUDED | ||||||
|  |  | ||||||
|  | process() | ||||||
|  | { | ||||||
|  | 	local PARENT=$1 | ||||||
|  | 	local FOLDER=$(dirname $1) | ||||||
|  | 	local SHOW_COMMENT=$2 | ||||||
|  | 	while IFS= read -r LINE; do | ||||||
|  | 		if [[ $LINE =~ $RE_INCLUDE ]]; then | ||||||
|  | 			local CHILD=${BASH_REMATCH[1]} | ||||||
|  | 			pushd "$FOLDER" > /dev/null | ||||||
|  | 			if [[ -e $CHILD ]]; then | ||||||
|  | 				local CHILD_PATH=$(realpath $CHILD) | ||||||
|  | 				if [[ ! ${INCLUDED[$CHILD_PATH]} ]]; then | ||||||
|  | 					#echo "// $PARENT -> $CHILD" | ||||||
|  | 					INCLUDED[$CHILD_PATH]=true | ||||||
|  | 					process "$CHILD" false | ||||||
|  | 				fi | ||||||
|  | 			else | ||||||
|  | 				if [[ ! ${INCLUDED[$CHILD]} ]]; then | ||||||
|  | 					echo "$LINE" | ||||||
|  | 					INCLUDED[$CHILD]=true | ||||||
|  | 				fi | ||||||
|  | 			fi | ||||||
|  | 			popd > /dev/null | ||||||
|  | 		elif [[ "${SHOW_COMMENT}" = "true" ]] ; then | ||||||
|  | 			echo "$LINE" | ||||||
|  | 		elif [[ ! $LINE =~ $RE_EMPTY ]]; then | ||||||
|  | 			echo "$LINE" | ||||||
|  | 		fi | ||||||
|  | 	done < $PARENT | ||||||
|  | } | ||||||
|  |  | ||||||
|  | cd $(dirname $0)/../ | ||||||
|  | INCLUDED=() | ||||||
|  | process include/ArduinoJson.h true > ../ArduinoJson-$TAG.h | ||||||
|  | INCLUDED=() | ||||||
|  | process include/ArduinoJson.hpp true > ../ArduinoJson-$TAG.hpp | ||||||
		Reference in New Issue
	
	Block a user