From ac7ffc413e1ff0fd09082278878e9d63e3bdfeb8 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Thu, 7 Apr 2022 15:44:37 +0800 Subject: [PATCH 1/2] 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 From 390e99ca9552c01685dc91cd81b4151285c30b44 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Fri, 8 Apr 2022 08:51:07 +0100 Subject: [PATCH 2/2] rename cabal flag --- simplexmq.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simplexmq.cabal b/simplexmq.cabal index f635cefc1..9bc4b79e3 100644 --- a/simplexmq.cabal +++ b/simplexmq.cabal @@ -27,7 +27,7 @@ extra-source-files: README.md CHANGELOG.md -flag swiftJSON +flag swift Description: Enable swift JSON format Default: False Manual: True @@ -74,7 +74,7 @@ library src ghc-options: -Wall -Wcompat -Werror=incomplete-patterns -Wredundant-constraints -Wincomplete-record-updates -Wincomplete-uni-patterns -Wunused-type-patterns - if flag(swiftJSON) + if flag(swift) ghc-options: "-DswiftJSON" build-depends: