mhallin / graphql_ppx

GraphQL PPX rewriter for Bucklescript/ReasonML
BSD 3-Clause "New" or "Revised" License
320 stars 42 forks source link

Support (Free)BSD #62

Open nlfiedler opened 5 years ago

nlfiedler commented 5 years ago

BTW, how does one build graphql_ppx from source? The README doesn't say, it just suggests filing an issue.

nlfiedler commented 5 years ago

On a related note, the developing file says to use 4.02.3, but when I try to build, it fails because ppxlib is missing. When trying to install that, it complains that I need ocaml 4.04.1. This is FreeBSD 11, which has 4.02.3, and seemingly does not know about opam switch; bear in mind I'm coming from ReasonML and know next to nothing about Ocaml, so I'm probably just doing something wrong. But I'm up for trying to get this working, so any suggestions are welcome.

nlfiedler commented 5 years ago

BTW, which version of node is needed for running the tests? I've got 10.11 and npm install fails when attempting to build nan (an indirect dependency) because of a native API change. Anyway, I got it compiled but I have no idea if it's right or not.

mhallin commented 5 years ago

Hello!

I've been preparing support for native code generation, and the source instructions have become a bit outdated. I suggest you start working from the most recent release (https://github.com/mhallin/graphql_ppx/tree/0.2.8) instead.

As for FreeBSD support, do you know if we can use Travis or some other CI service to either emulate BSD directly, or cross-compile the binaries from Linux? A solution that would let us run the test suite would be the ideal scenario.

nlfiedler commented 5 years ago

I changed two things, rather unscientifically, using opam switch create ocaml-system.4.02.3 instead of opam switch 4.02.3 which simply gave an error, and using the 0.2.8 tag as you suggested. That worked a lot better, and npm install also succeeds, except for the postinstall hook. However, running the tests fails in a different way (using gmake):

$ gmake test
dune build @graphql_ppx
cp _build/default/src/graphql_ppx.exe .
cp tests/graphql_schema.json tests_apollo/graphql_schema.json
(cd tests && ../node_modules/.bin/bsb -clean-world && ../node_modules/.bin/bsb -make-world)
[4/4] Building src/jest.mlast.d
[2/2] Building src/jest.cmj
[6/92] Building __tests__/union.mlast
[dirty_checker][update ok]
Marshaled file is broken. Doing recovery build...
[7/92] Building __tests__/record.mlast
[dirty_checker][update ok]
Marshaled file is broken. Doing recovery build...
End_of_file

  We've found a bug for you!
  /usr/home/nfiedler/graphql_ppx/tests/__tests__/record.re

  There's been an error running a preprocessor before the compilation of a file.
  This was the command:

  /usr/home/nfiedler/graphql_ppx/tests/../graphql_ppx.exe '/tmp/camlppx923d62' '/tmp/camlppxceb316'

[9/92] Building __tests__/lists.mlast
[dirty_checker][update ok]
Marshaled file is broken. Doing recovery build...
[12/92] Building __tests__/nested.mlast
[dirty_checker][update ok]
[13/92] Building __tests__/comment.mlast
[dirty_checker][update ok]
[16/92] Building __tests__/union.mlast.d
ninja: error: rebuilding 'build.ninja': subcommand failed
gmake: *** [Makefile:12: only-test] Error 2

As for CI, yeah, there is a dearth of options, but I did find this: https://cipier.net -- although I cannot set up your repo, I will see how far I can get with one of my own and follow up.

nlfiedler commented 5 years ago

Looks like cipier is for CI of ports of packages to FreeBSD, not just a general purpose CI that runs on FreeBSD. For now I can build graphql_ppx as needed, and until a CI that runs FreeBSD becomes available, there's no good way to resolve this.

mhallin commented 5 years ago

One option could be to run qemu (http://erouault.blogspot.com/2016/09/running-freebsd-in-travis-ci.html), which could be helpful for https://github.com/mhallin/graphql_ppx/issues/53 as well.

nlfiedler commented 5 years ago

I saw that, too, but that looked challenging. Maybe it's gotten better since then.