Skip to content

Commit

Permalink
feat(resource-rules): add yacc
Browse files Browse the repository at this point in the history
  • Loading branch information
fantix committed Mar 21, 2019
1 parent ffa920b commit 353702c
Show file tree
Hide file tree
Showing 7 changed files with 831 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ _*

# Specific binaries arborist compiles.
bin/arborist

# goyacc
y.output

# GoLand
.idea/
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ RUN apk update && apk add --no-cache git ca-certificates gcc musl-dev
RUN mkdir -p /go/src/github.com/uc-cdis/arborist
WORKDIR /go/src/github.com/uc-cdis/arborist
ADD . .
RUN go get golang.org/x/tools/cmd/goyacc
RUN goyacc -o arborist/resource_rules.go arborist/resource_rules.y
RUN go build -ldflags "-linkmode external -extldflags -static" -o bin/arborist

# Set up small scratch image, and copy necessary things over
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
GOYACC ?= goyacc

_default: bin/arborist

test: bin/arborist db-test
go test -v ./.../

bin/arborist:
bin/arborist: arborist/*.go
go build -o bin/arborist

up: upgrade
Expand All @@ -17,3 +19,6 @@ downgrade:
db-test: $(which psql)
-@ psql -c "CREATE DATABASE arborist_test" 2>&1 || true
./migrations/latest

arborist/resource_rules.go: arborist/resource_rules.y
$(GOYACC) -o arborist/resource_rules.go arborist/resource_rules.y
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ We will start from the lowest-level definitions, and work upwards.

Build the go code with:
```bash
go build -o bin/arborist
go get golang.org/x/tools/cmd/goyacc
make
```

### Building and Running a Docker Image
Expand Down
Loading

0 comments on commit 353702c

Please sign in to comment.