Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Thomas Adam
committed
Sep 19, 2015
0 parents
commit f9bb5d8
Showing
78 changed files
with
10,404 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
internal/Ast.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
internal/GraphQLParser.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
internal/JsonVisitor.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# c-graphqlparser | ||
|
||
This is a go-gettable version of the [libgraphqlparser](https://github.com/graphql/libgraphqlparser) C library for use in Go code that needs to link against the libgraphqlparser C library but wants to integrate with `go get` and `go build`. | ||
|
||
To use in your project you need to import the package and set appropriate cgo flag directives: | ||
|
||
``` | ||
import _ "github.com/tecbot/c-graphqlparser" | ||
// #cgo CXXFLAGS: -std=c++11 | ||
// #cgo CPPFLAGS: -I <relative-path>/c-graphqlparser/internal | ||
// #cgo darwin LDFLAGS: -Wl,-undefined -Wl,dynamic_lookup | ||
// #cgo !darwin LDFLAGS: -Wl,-unresolved-symbols=ignore-all | ||
import "C" | ||
``` | ||
|
||
To update the upstream version of libgraphqlparser you'll want to run `./import.sh`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
internal/c/GraphQLAst.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
internal/c/GraphQLAstNode.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
internal/c/GraphQLAstToJSON.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
internal/c/GraphQLAstVisitor.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
internal/c/GraphQLParser.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Package graphqlparser uses the cgo compilation facilities to build the | ||
// GraphQL C++ parser. | ||
package graphqlparser | ||
|
||
// #cgo CPPFLAGS: -Iinternal | ||
// #cgo CXXFLAGS: -std=c++11 -fPIC -fno-omit-frame-pointer -momit-leaf-frame-pointer | ||
// #cgo CXXFLAGS: -W -Wextra -Wno-deprecated-register -Wno-unused-parameter -Wno-sign-compare | ||
import "C" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM alpine:latest | ||
|
||
# Install base requirements | ||
RUN apk add --update alpine-sdk flex bison cmake python | ||
|
||
COPY build.sh /data/build.sh | ||
|
||
CMD ["/data/build.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
URL=${LIBGRAPHQLPARSER_URL:-"https://github.com/graphql/libgraphqlparser/archive/master.tar.gz"} | ||
|
||
# Build libgraphqlparser | ||
mkdir -p /data/libgraphqlparser | ||
curl -sSL ${URL} \ | ||
| tar -v -C /data/libgraphqlparser -xz --strip-components=1 \ | ||
&& cd /data/libgraphqlparser \ | ||
&& cmake . \ | ||
&& make \ | ||
&& make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
diff --git 1/internal/.gitignore 2/internal/.gitignore | ||
index 0173588..7036933 100644 | ||
--- 1/internal/.gitignore | ||
+++ 2/internal/.gitignore | ||
@@ -3,9 +3,6 @@ bison.tab.hpp | ||
*.o | ||
parser.output | ||
dump_json_ast | ||
-Ast.h | ||
-Ast.cpp | ||
-AstVisitor.h | ||
*.dSYM | ||
CMakeCache.txt | ||
CMakeFiles | ||
|
||
diff --git 1/internal/c/.gitignore 2/internal/c/.gitignore | ||
deleted file mode 100644 | ||
index 02f06d2..e69de29 100644 | ||
--- 1/internal/c/.gitignore | ||
+++ /dev/null | ||
@@ -1,3 +0,0 @@ | ||
-GraphQLAst.h | ||
-GraphQLAst.cpp | ||
-GraphQLAstForEachConcreteType.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -eu | ||
|
||
URL="https://github.com/graphql/libgraphqlparser/archive/master.tar.gz" | ||
|
||
rm -rf *.cpp internal/* | ||
docker run --rm \ | ||
-v $PWD/internal:/data/libgraphqlparser \ | ||
-e LIBGRAPHQLPARSER_URL=$URL \ | ||
tecbot/libgraphqlparser | ||
|
||
# apply patches | ||
patch -p1 < includes.patch | ||
patch -p1 < gitignore.patch | ||
|
||
# stuff we need to compile. | ||
SOURCES=' | ||
Ast.cpp | ||
GraphQLParser.cpp | ||
JsonVisitor.cpp | ||
lexer.cpp | ||
parser.tab.cpp | ||
' | ||
|
||
# symlink so cgo compiles them | ||
for file in $SOURCES; do | ||
ln -sf internal/$file . | ||
done | ||
|
||
# stuff we need to compile. | ||
SOURCES=' | ||
GraphQLAst.cpp | ||
GraphQLAstNode.cpp | ||
GraphQLAstToJSON.cpp | ||
GraphQLAstVisitor.cpp | ||
GraphQLParser.cpp | ||
' | ||
|
||
# symlink so cgo compiles them | ||
for file in $SOURCES; do | ||
ln -sf internal/c/$file ./c_$file | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
diff --git 1/internal/c/GraphQLAst.cpp 2/internal/c/GraphQLAst.cpp | ||
index 3996c9a..cf39d4b 100644 | ||
--- 1/internal/c/GraphQLAst.cpp | ||
+++ 2/internal/c/GraphQLAst.cpp | ||
@@ -8,8 +8,8 @@ | ||
*/ | ||
/** @generated */ | ||
|
||
-#include "GraphQLAst.h" | ||
-#include "../Ast.h" | ||
+#include "c/GraphQLAst.h" | ||
+#include "Ast.h" | ||
|
||
using namespace facebook::graphql::ast; | ||
|
||
diff --git a/internal/c/GraphQLAstNode.cpp b/internal/c/GraphQLAstNode.cpp | ||
index a7947b3..9eb2f17 100644 | ||
--- a/internal/c/GraphQLAstNode.cpp | ||
+++ b/internal/c/GraphQLAstNode.cpp | ||
@@ -7,8 +7,8 @@ | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
-#include "GraphQLAstNode.h" | ||
-#include "../AstNode.h" | ||
+#include "c/GraphQLAstNode.h" | ||
+#include "AstNode.h" | ||
|
||
using facebook::graphql::ast::Node; | ||
|
||
diff --git a/internal/c/GraphQLParser.cpp b/internal/c/GraphQLParser.cpp | ||
index 871a5f9..5f8aa5a 100644 | ||
--- a/internal/c/GraphQLParser.cpp | ||
+++ b/internal/c/GraphQLParser.cpp | ||
@@ -7,9 +7,9 @@ | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
+#include "c/GraphQLParser.h" | ||
#include "GraphQLParser.h" | ||
-#include "../GraphQLParser.h" | ||
-#include "../AstNode.h" | ||
+#include "AstNode.h" | ||
|
||
#include <cstdlib> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
bison.tab.cpp | ||
bison.tab.hpp | ||
*.o | ||
parser.output | ||
dump_json_ast | ||
*.dSYM | ||
CMakeCache.txt | ||
CMakeFiles | ||
CMakeScripts | ||
Makefile | ||
cmake_install.cmake | ||
*.a | ||
*.dylib | ||
*.so | ||
GraphQLParser.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
language: cpp | ||
|
||
compiler: | ||
- clang | ||
- gcc | ||
|
||
before_install: | ||
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test | ||
- sudo apt-get update -qq | ||
# bison and flex are not installed in CI because | ||
# 1) the versions in Travis are too old, and | ||
# 2) up-to-date bison and flex output should be checked in. | ||
# Versions of g++ prior to 4.8 don't have very good C++11 support. | ||
- sudo apt-get install -y g++-4.8 | ||
&& sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90 | ||
- wget https://googletest.googlecode.com/files/gtest-1.7.0.zip | ||
&& cd test | ||
&& unzip ../gtest-1.7.0.zip | ||
&& cd .. | ||
&& rm gtest-1.7.0.zip | ||
|
||
script: mkdir build && cd build && cmake .. -Dtest=ON && make && test/runTests |
Oops, something went wrong.