diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 00000000..d80625b3 --- /dev/null +++ b/.bazelrc @@ -0,0 +1,3 @@ + +# for godel-script build +build --action_env=HOME diff --git a/.github/workflows/godel_build.yml b/.github/workflows/godel_build.yml index 40d43dc4..2675fbd6 100644 --- a/.github/workflows/godel_build.yml +++ b/.github/workflows/godel_build.yml @@ -27,6 +27,10 @@ jobs: cd build cmake .. make -j4 + ./godel --version + ./godel -h --color-off + - name: Check + run: pwd linux-x86_64-build: runs-on: ubuntu-latest @@ -47,4 +51,8 @@ jobs: mkdir build cd build cmake .. - make -j4 \ No newline at end of file + make -j4 + ./godel --version + ./godel -h --color-off + - name: Check + run: pwd \ No newline at end of file diff --git a/.gitignore b/.gitignore index 35885f72..81174ae3 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,9 @@ build/ ### VS Code ### .vscode/ .cloudide + +### Bazel ### +bazel-bin +bazel-CodeFuse-Query +bazel-out +bazel-testlogs diff --git a/BUILD b/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 00000000..1aa92835 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") diff --git a/godel-script/.gitignore b/godel-script/.gitignore new file mode 100644 index 00000000..38202cac --- /dev/null +++ b/godel-script/.gitignore @@ -0,0 +1,3 @@ +# build directory +build +cmake-build \ No newline at end of file diff --git a/godel-script/BUILD.bazel b/godel-script/BUILD.bazel new file mode 100644 index 00000000..45730816 --- /dev/null +++ b/godel-script/BUILD.bazel @@ -0,0 +1,41 @@ + +package( + default_visibility = ["//visibility:public"] +) + +filegroup( + name = "godel-cmake-lists", + srcs = [ + "CMakeLists.txt" + ] +) + +filegroup( + name = "godel-frontend", + srcs = glob(["godel-frontend/src/**/*"]), + visibility = ["//visibility:public"] +) + +filegroup( + name = "godel-backend", + srcs = glob(["godel-backend/**/*"]), + visibility = ["//visibility:public"] +) + +genrule( + name = "godel-script-build", + srcs = [ + ":godel-frontend", + ":godel-backend", + ":godel-cmake-lists" + ], + outs = [ + "godel" + ], + cmd = """ + cmake $(location //godel-script:godel-cmake-lists) + make -j + cp godel $(location godel) + """, + visibility = ["//visibility:public"] +) diff --git a/godel-script/README.md b/godel-script/README.md index 16935f07..1087a50a 100644 --- a/godel-script/README.md +++ b/godel-script/README.md @@ -34,7 +34,7 @@ pub fn hello() -> string { * GödelScript [Query](./docs/language-reference/queries.md) * GödelScript [Statement](./docs/language-reference/functions.md#statement) * GödelScript [Expression](./docs/language-reference/functions.md#expression) -* GödelScript [Query Example](./example) +* GödelScript [Query Example](../example) * GödelScript [Syntax Definition](./docs/syntax.md) ## Compilation @@ -43,19 +43,38 @@ Structure of this project: ``` . -|-- dockerFile -|-- docs godel-script documents -|-- godel-backend godel-script backend -| |-- extension godel-script souffle extension -| |-- souffle souffle source code -| +-- tools souffle build tools -+-- godel-frontend godel-script frontend - +-- src godel-frontend source code +|-- docs godel-script documents +|-- godel-backend godel-script backend +| |-- extension godel-script souffle extension +| |-- souffle souffle source code +| +-- tools souffle build tools ++-- godel-frontend godel-script frontend + +-- src godel-frontend source code ``` Need C++ standard at least `-std=c++17`. -### Build Godel Script +### Apply Patch On Soufflé Submodule + +GödelScript uses a self-modified soufflé from a much older branch of public soufflé, +now we use patch to make sure it could be built successfully. + +Use this command to apply patch: + +```bash +cd souffle +git am ../../0001-init-self-used-souffle-from-public-souffle.patch +``` + +Use these commands to revert: + +```bash +cd souffle +git apply -R ../0001-init-self-used-souffle-from-public-souffle.patch +git reset HEAD~ +``` + +### Build GödelScript Use command below: diff --git a/godel-script/docs/syntax.md b/godel-script/docs/syntax.md index 349399a5..0073ee53 100644 --- a/godel-script/docs/syntax.md +++ b/godel-script/docs/syntax.md @@ -245,4 +245,6 @@ Usage: [Initializer List](./language-reference/functions.md#initializer-list) ```ebnf initializer = "{" [initializer_pair ","] "}"; initializer_pair = identifier ":" or_expr; -``` \ No newline at end of file +``` + +Back to [README.md](../README.md#documents)