Skip to content

Commit 6e3af85

Browse files
authored
Merge pull request #1216 from haskell-servant/servant-client-jsaddle
Add servant-jsaddle
2 parents 12e64fd + e14a14f commit 6e3af85

File tree

15 files changed

+700
-7
lines changed

15 files changed

+700
-7
lines changed

.travis.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# For more information, see https://github.com/haskell-CI/haskell-ci
66
#
7-
# version: 0.5.20180907
7+
# version: 0.5.20190908
88
#
99
language: c
1010
dist: xenial
@@ -14,6 +14,8 @@ git:
1414
branches:
1515
only:
1616
- master
17+
addons:
18+
google: stable
1719
cache:
1820
directories:
1921
- $HOME/.cabal/packages
@@ -115,19 +117,22 @@ install:
115117
echo " prefix: $CABALHOME" >> $CABALHOME/config
116118
echo "repository hackage.haskell.org" >> $CABALHOME/config
117119
echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
120+
- GHCJOBS=-j2
118121
- |
119-
echo "program-default-options" >> $CABALHOME/config
120-
echo " ghc-options: -j2" >> $CABALHOME/config
122+
echo "program-default-options" >> $CABALHOME/config
123+
echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config
121124
- cat $CABALHOME/config
122125
- rm -fv cabal.project cabal.project.local cabal.project.freeze
123126
- travis_retry ${CABAL} v2-update -v
127+
- if $GHCJS ; then (cd /tmp && ${CABAL} v2-install -w ghc-8.4.4 cabal-plan | color_cabal_output) ; fi
124128
- if $GHCJS ; then (cd /tmp && ${CABAL} v2-install -w ghc-8.4.4 hspec-discover | color_cabal_output) ; fi
125129
# Generate cabal.project
126130
- rm -rf cabal.project cabal.project.local cabal.project.freeze
127131
- touch cabal.project
128132
- |
129133
echo "packages: servant" >> cabal.project
130134
if ! $GHCJS ; then echo "packages: servant-client" >> cabal.project ; fi
135+
echo "packages: servant-jsaddle" >> cabal.project
131136
echo "packages: servant-client-core" >> cabal.project
132137
if ! $GHCJS ; then echo "packages: servant-http-streams" >> cabal.project ; fi
133138
if ! $GHCJS ; then echo "packages: servant-docs" >> cabal.project ; fi
@@ -165,11 +170,12 @@ install:
165170
echo "allow-newer: io-streams-1.5.1.0:network" >> cabal.project
166171
echo "allow-newer: openssl-streams-1.2.2.0:network" >> cabal.project
167172
echo "optimization: False" >> cabal.project
168-
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(cookbook-basic-auth|cookbook-basic-streaming|cookbook-curl-mock|cookbook-db-postgres-pool|cookbook-db-sqlite-simple|cookbook-file-upload|cookbook-generic|cookbook-https|cookbook-pagination|cookbook-structuring-apis|cookbook-testing|cookbook-using-custom-monad|cookbook-using-free-client|servant|servant-client|servant-client-core|servant-conduit|servant-docs|servant-foreign|servant-http-streams|servant-machines|servant-pipes|servant-server|tutorial)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
173+
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(cookbook-basic-auth|cookbook-basic-streaming|cookbook-curl-mock|cookbook-db-postgres-pool|cookbook-db-sqlite-simple|cookbook-file-upload|cookbook-generic|cookbook-https|cookbook-pagination|cookbook-structuring-apis|cookbook-testing|cookbook-using-custom-monad|cookbook-using-free-client|servant|servant-client|servant-client-core|servant-conduit|servant-docs|servant-foreign|servant-http-streams|servant-jsaddle|servant-machines|servant-pipes|servant-server|tutorial)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
169174
- cat cabal.project || true
170175
- cat cabal.project.local || true
171176
- if [ -f "servant/configure.ac" ]; then (cd "servant" && autoreconf -i); fi
172177
- if [ -f "servant-client/configure.ac" ]; then (cd "servant-client" && autoreconf -i); fi
178+
- if [ -f "servant-jsaddle/configure.ac" ]; then (cd "servant-jsaddle" && autoreconf -i); fi
173179
- if [ -f "servant-client-core/configure.ac" ]; then (cd "servant-client-core" && autoreconf -i); fi
174180
- if [ -f "servant-http-streams/configure.ac" ]; then (cd "servant-http-streams" && autoreconf -i); fi
175181
- if [ -f "servant-docs/configure.ac" ]; then (cd "servant-docs" && autoreconf -i); fi
@@ -209,6 +215,7 @@ script:
209215
- find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \;
210216
- PKGDIR_servant="$(find . -maxdepth 1 -type d -regex '.*/servant-[0-9.]*')"
211217
- PKGDIR_servant_client="$(find . -maxdepth 1 -type d -regex '.*/servant-client-[0-9.]*')"
218+
- PKGDIR_servant_jsaddle="$(find . -maxdepth 1 -type d -regex '.*/servant-jsaddle-[0-9.]*')"
212219
- PKGDIR_servant_client_core="$(find . -maxdepth 1 -type d -regex '.*/servant-client-core-[0-9.]*')"
213220
- PKGDIR_servant_http_streams="$(find . -maxdepth 1 -type d -regex '.*/servant-http-streams-[0-9.]*')"
214221
- PKGDIR_servant_docs="$(find . -maxdepth 1 -type d -regex '.*/servant-docs-[0-9.]*')"
@@ -237,6 +244,7 @@ script:
237244
- |
238245
echo "packages: ${PKGDIR_servant}" >> cabal.project
239246
if ! $GHCJS ; then echo "packages: ${PKGDIR_servant_client}" >> cabal.project ; fi
247+
echo "packages: ${PKGDIR_servant_jsaddle}" >> cabal.project
240248
echo "packages: ${PKGDIR_servant_client_core}" >> cabal.project
241249
if ! $GHCJS ; then echo "packages: ${PKGDIR_servant_http_streams}" >> cabal.project ; fi
242250
if ! $GHCJS ; then echo "packages: ${PKGDIR_servant_docs}" >> cabal.project ; fi
@@ -274,7 +282,7 @@ script:
274282
echo "allow-newer: io-streams-1.5.1.0:network" >> cabal.project
275283
echo "allow-newer: openssl-streams-1.2.2.0:network" >> cabal.project
276284
echo "optimization: False" >> cabal.project
277-
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(cookbook-basic-auth|cookbook-basic-streaming|cookbook-curl-mock|cookbook-db-postgres-pool|cookbook-db-sqlite-simple|cookbook-file-upload|cookbook-generic|cookbook-https|cookbook-pagination|cookbook-structuring-apis|cookbook-testing|cookbook-using-custom-monad|cookbook-using-free-client|servant|servant-client|servant-client-core|servant-conduit|servant-docs|servant-foreign|servant-http-streams|servant-machines|servant-pipes|servant-server|tutorial)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
285+
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(cookbook-basic-auth|cookbook-basic-streaming|cookbook-curl-mock|cookbook-db-postgres-pool|cookbook-db-sqlite-simple|cookbook-file-upload|cookbook-generic|cookbook-https|cookbook-pagination|cookbook-structuring-apis|cookbook-testing|cookbook-using-custom-monad|cookbook-using-free-client|servant|servant-client|servant-client-core|servant-conduit|servant-docs|servant-foreign|servant-http-streams|servant-jsaddle|servant-machines|servant-pipes|servant-server|tutorial)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
278286
- cat cabal.project || true
279287
- cat cabal.project.local || true
280288
- echo -en 'travis_fold:end:unpack\\r'
@@ -285,6 +293,7 @@ script:
285293
- echo -en 'travis_fold:end:build-everything\\r'
286294
# Testing...
287295
- if ! $GHCJS ; then ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output ; fi
296+
- if $GHCJS ; then for testexe in $(cabal-plan list-bins '*:test:*' | awk '{ print $2 }'); do echo $testexe; nodejs ${testexe}.jsexe/all.js; done ; fi
288297
# haddock...
289298
- echo 'haddock...' && echo -en 'travis_fold:start:haddock\\r'
290299
- if ! $GHCJS ; then ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all | color_cabal_output ; fi

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ really-all :
99
$(MAKE) build-ghc
1010
$(MAKE) build-ghc HC=ghc-8.0.2
1111
$(MAKE) build-ghc HC=ghc-8.2.2
12-
$(MAKE) build-ghc HC=ghc-8.6.3
12+
$(MAKE) build-ghc HC=ghc-8.6.5
1313
$(MAKE) build-ghcjs
1414

1515
build-ghc :

cabal.ghcjs.project

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
packages:
44
servant/
55
servant-client-core/
6-
servant-client-ghcjs/
6+
servant-jsaddle/
77

88
-- we need to tell cabal we are using GHCJS
99
compiler: ghcjs
10+
tests: True

cabal.haskell-ci

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
folds: all-but-test
22
branches: master
33
jobs-selection: any
4+
google-chrome: True
5+
ghcjs-tests: True
46

57
-- https://github.com/haskell/cabal/issues/6176
68
ghcjs-tools: hspec-discover

cabal.project

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
packages:
22
servant/
33
servant-client/
4+
servant-jsaddle/
45
servant-client-core/
56
servant-http-streams/
67
servant-docs/
@@ -32,6 +33,8 @@ packages:
3233
doc/cookbook/using-free-client
3334
-- doc/cookbook/open-id-connect
3435

36+
37+
3538
tests: True
3639
optimization: False
3740
-- reorder-goals: True

screenshot.png

3.17 KB
Loading

servant-jsaddle/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
X.Y
2+
----
3+
4+
Initial release

servant-jsaddle/LICENSE

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Copyright (c) 2014-2016, Zalora South East Asia Pte Ltd, Servant Contributors
2+
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above
12+
copyright notice, this list of conditions and the following
13+
disclaimer in the documentation and/or other materials provided
14+
with the distribution.
15+
16+
* Neither the name of Zalora South East Asia Pte Ltd nor the names of other
17+
contributors may be used to endorse or promote products derived
18+
from this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

servant-jsaddle/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# `servant-client-jsaddle`
2+
3+
This is a an implementation of the `servant-client-core` API on top of `jsaddle`, a framework that lets you write Haskell programs that compile to javascript to run in a browser or compile to native code that connects to a browser.
4+
5+
It is similar to `servant-client-ghcjs`, except it supports native compilation and native GHCi. It even reuses some of the logic from `servant-client-ghcjs`.
6+
7+
# Build
8+
9+
This package comes with a test suite that depends on `jsaddle-webkit2gtk`. You may want to skip that because of the heavy dependency footprint.
10+
11+
cabal new-build --allow-newer=aeson,http-types --disable-tests
12+
13+
# Usage
14+
15+
TBD. Similar to `servant-client` and `servant-client-ghcjs`.

servant-jsaddle/Setup.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Distribution.Simple
2+
main = defaultMain

0 commit comments

Comments
 (0)