From ac7ffc413e1ff0fd09082278878e9d63e3bdfeb8 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Thu, 7 Apr 2022 15:44:37 +0800 Subject: [PATCH] Add Flag (#349) * Update Parsers.hs * Update simplexmq.cabal --- simplexmq.cabal | 9 +++++++++ src/Simplex/Messaging/Parsers.hs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/simplexmq.cabal b/simplexmq.cabal index b863614d6..f635cefc1 100644 --- a/simplexmq.cabal +++ b/simplexmq.cabal @@ -27,6 +27,11 @@ extra-source-files: README.md CHANGELOG.md +flag swiftJSON + Description: Enable swift JSON format + Default: False + Manual: True + library exposed-modules: Simplex.Messaging.Agent @@ -68,6 +73,10 @@ library hs-source-dirs: src ghc-options: -Wall -Wcompat -Werror=incomplete-patterns -Wredundant-constraints -Wincomplete-record-updates -Wincomplete-uni-patterns -Wunused-type-patterns + + if flag(swiftJSON) + ghc-options: "-DswiftJSON" + build-depends: QuickCheck ==2.14.* , aeson ==2.0.* diff --git a/src/Simplex/Messaging/Parsers.hs b/src/Simplex/Messaging/Parsers.hs index ab4c1a4b5..8a86324be 100644 --- a/src/Simplex/Messaging/Parsers.hs +++ b/src/Simplex/Messaging/Parsers.hs @@ -98,7 +98,7 @@ enumJSON tagModifier = } sumTypeJSON :: (String -> String) -> J.Options -#if defined(darwin_HOST_OS) +#if defined(darwin_HOST_OS) && defined(swiftJSON) sumTypeJSON = singleFieldJSON #else sumTypeJSON = taggedObjectJSON