Skip to content

Commit

Permalink
add bazel build files
Browse files Browse the repository at this point in the history
  • Loading branch information
ValKmjolnir committed Jun 25, 2024
1 parent af37800 commit 5c5ff4d
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# for godel-script build
build --action_env=HOME
10 changes: 9 additions & 1 deletion .github/workflows/godel_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -47,4 +51,8 @@ jobs:
mkdir build
cd build
cmake ..
make -j4
make -j4
./godel --version
./godel -h --color-off
- name: Check
run: pwd
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@ build/
### VS Code ###
.vscode/
.cloudide

### Bazel ###
bazel-bin
bazel-CodeFuse-Query
bazel-out
bazel-testlogs
Empty file added BUILD
Empty file.
1 change: 1 addition & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
3 changes: 3 additions & 0 deletions godel-script/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# build directory
build
cmake-build
41 changes: 41 additions & 0 deletions godel-script/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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"]
)
39 changes: 29 additions & 10 deletions godel-script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:

Expand Down
4 changes: 3 additions & 1 deletion godel-script/docs/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,6 @@ Usage: [Initializer List](./language-reference/functions.md#initializer-list)
```ebnf
initializer = "{" [initializer_pair ","] "}";
initializer_pair = identifier ":" or_expr;
```
```

Back to [README.md](../README.md#documents)

0 comments on commit 5c5ff4d

Please sign in to comment.