Skip to content

Commit 5c5ff4d

Browse files
committed
add bazel build files
1 parent af37800 commit 5c5ff4d

File tree

9 files changed

+95
-12
lines changed

9 files changed

+95
-12
lines changed

.bazelrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
# for godel-script build
3+
build --action_env=HOME

.github/workflows/godel_build.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ jobs:
2727
cd build
2828
cmake ..
2929
make -j4
30+
./godel --version
31+
./godel -h --color-off
32+
- name: Check
33+
run: pwd
3034

3135
linux-x86_64-build:
3236
runs-on: ubuntu-latest
@@ -47,4 +51,8 @@ jobs:
4751
mkdir build
4852
cd build
4953
cmake ..
50-
make -j4
54+
make -j4
55+
./godel --version
56+
./godel -h --color-off
57+
- name: Check
58+
run: pwd

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,9 @@ build/
3434
### VS Code ###
3535
.vscode/
3636
.cloudide
37+
38+
### Bazel ###
39+
bazel-bin
40+
bazel-CodeFuse-Query
41+
bazel-out
42+
bazel-testlogs

BUILD

Whitespace-only changes.

WORKSPACE

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

godel-script/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# build directory
2+
build
3+
cmake-build

godel-script/BUILD.bazel

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
package(
3+
default_visibility = ["//visibility:public"]
4+
)
5+
6+
filegroup(
7+
name = "godel-cmake-lists",
8+
srcs = [
9+
"CMakeLists.txt"
10+
]
11+
)
12+
13+
filegroup(
14+
name = "godel-frontend",
15+
srcs = glob(["godel-frontend/src/**/*"]),
16+
visibility = ["//visibility:public"]
17+
)
18+
19+
filegroup(
20+
name = "godel-backend",
21+
srcs = glob(["godel-backend/**/*"]),
22+
visibility = ["//visibility:public"]
23+
)
24+
25+
genrule(
26+
name = "godel-script-build",
27+
srcs = [
28+
":godel-frontend",
29+
":godel-backend",
30+
":godel-cmake-lists"
31+
],
32+
outs = [
33+
"godel"
34+
],
35+
cmd = """
36+
cmake $(location //godel-script:godel-cmake-lists)
37+
make -j
38+
cp godel $(location godel)
39+
""",
40+
visibility = ["//visibility:public"]
41+
)

godel-script/README.md

+29-10
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub fn hello() -> string {
3434
* GödelScript [Query](./docs/language-reference/queries.md)
3535
* GödelScript [Statement](./docs/language-reference/functions.md#statement)
3636
* GödelScript [Expression](./docs/language-reference/functions.md#expression)
37-
* GödelScript [Query Example](./example)
37+
* GödelScript [Query Example](../example)
3838
* GödelScript [Syntax Definition](./docs/syntax.md)
3939

4040
## Compilation
@@ -43,19 +43,38 @@ Structure of this project:
4343

4444
```
4545
.
46-
|-- dockerFile
47-
|-- docs godel-script documents
48-
|-- godel-backend godel-script backend
49-
| |-- extension godel-script souffle extension
50-
| |-- souffle souffle source code
51-
| +-- tools souffle build tools
52-
+-- godel-frontend godel-script frontend
53-
+-- src godel-frontend source code
46+
|-- docs godel-script documents
47+
|-- godel-backend godel-script backend
48+
| |-- extension godel-script souffle extension
49+
| |-- souffle souffle source code
50+
| +-- tools souffle build tools
51+
+-- godel-frontend godel-script frontend
52+
+-- src godel-frontend source code
5453
```
5554

5655
Need C++ standard at least `-std=c++17`.
5756

58-
### Build Godel Script
57+
### Apply Patch On Soufflé Submodule
58+
59+
GödelScript uses a self-modified soufflé from a much older branch of public soufflé,
60+
now we use patch to make sure it could be built successfully.
61+
62+
Use this command to apply patch:
63+
64+
```bash
65+
cd souffle
66+
git am ../../0001-init-self-used-souffle-from-public-souffle.patch
67+
```
68+
69+
Use these commands to revert:
70+
71+
```bash
72+
cd souffle
73+
git apply -R ../0001-init-self-used-souffle-from-public-souffle.patch
74+
git reset HEAD~
75+
```
76+
77+
### Build GödelScript
5978

6079
Use command below:
6180

godel-script/docs/syntax.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,6 @@ Usage: [Initializer List](./language-reference/functions.md#initializer-list)
245245
```ebnf
246246
initializer = "{" [initializer_pair ","] "}";
247247
initializer_pair = identifier ":" or_expr;
248-
```
248+
```
249+
250+
Back to [README.md](../README.md#documents)

0 commit comments

Comments
 (0)