Skip to content

Commit

Permalink
added cleaner to docker (not called yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
vbar committed May 6, 2022
1 parent 7b80c45 commit b1a6580
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "wasi-sdk"]
path = wasi-sdk
url = https://github.com/eqlabs/wasi-sdk.git
[submodule "hook-cleaner-c"]
path = hook-cleaner-c
url = https://github.com/RichardAH/hook-cleaner-c
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ checkout:
git submodule update --init --recursive c2wasm-api
git submodule update --init --recursive llvm-project
git submodule update --init --recursive wasi-sdk
git submodule update --init --recursive hook-cleaner-c

bin:
mkdir $@
Expand All @@ -20,6 +21,7 @@ doc:
build: bin
$(MAKE) -C clang-build
$(MAKE) -C clangd-build
$(MAKE) -C cleaner-build
$(MAKE) -C docker

doc-build: doc
Expand All @@ -34,5 +36,6 @@ doc.zip: doc
clean:
$(MAKE) -C clang-build clean
$(MAKE) -C clangd-build clean
$(MAKE) -C cleaner-build clean
$(MAKE) -C docker clean
-rm -rf bin doc
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ even work on computers with less than 8GB of memory (16GB is better),
so the LLVM binaries are maintained in releases of
[xrpl-hooks-compiler](https://github.com/eqlabs/xrpl-hooks-compiler/).
These binaries can be extracted from the file bin.zip in the top-level
directory, providing the results of running `make` in clang-build and
clangd-build directories, so that running the top-level make `build`
target can be replaced by running just the (default) make `build`
target in the docker directory. This also allows skipping the checkout
of the `llvm-project` and `wasi-sdk` submodules; the other submodules
are still needed, so running the `checkout` target should be replaced
by running
directory, providing the results of running `make` in clang-build,
clangd-build and cleaner-build directories, so that running the
top-level make `build` target can be replaced by running just the
(default) make `build` target in the docker directory. This also
allows skipping the checkout of the `llvm-project`, `wasi-sdk` and
`hook-cleaner-c` submodules; the API submodule is still needed, so
running the `checkout` target should be replaced by running

```bash
git submodule update --init c2wasm-api
Expand Down
5 changes: 5 additions & 0 deletions cleaner-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM --platform=linux/amd64 node:17-alpine
MAINTAINER Vaclav Barta "[email protected]"
RUN apk --no-cache add --update bash build-base
ADD build.sh .
CMD ./build.sh
17 changes: 17 additions & 0 deletions cleaner-build/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# must be run as root

CLEANER_BUILD_CONTAINER_TAG?=cleaner-build

all: build1 build2 install

build1:
docker build -t $(CLEANER_BUILD_CONTAINER_TAG) .

build2:
docker run -v $(realpath ../hook-cleaner-c):/mnt/hook-cleaner $(CLEANER_BUILD_CONTAINER_TAG):latest

install:
cp ../hook-cleaner-c/cleaner ../bin

clean:
-rm ../hook-cleaner-c/cleaner
7 changes: 7 additions & 0 deletions cleaner-build/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

echo running build.sh...
set -e

cd /mnt/hook-cleaner
make
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ COPY c2wasm-api/yarn.lock .
COPY c2wasm-api/tsconfig.json .
COPY c2wasm-api/src ./src
COPY wasi-sdk ./clang/wasi-sdk
COPY cleaner /usr/bin
COPY run.sh .
ADD compile_flags.txt /etc/clangd/compile_flags.txt
ADD .clang-tidy /work/.clang-tidy
Expand Down
5 changes: 4 additions & 1 deletion docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

MAIN_CONTAINER_TAG?=xrpl-hooks-compiler

build: wasi-sdk c2wasm-api clangd
build: wasi-sdk c2wasm-api clangd cleaner
docker build -t $(MAIN_CONTAINER_TAG) .

run:
Expand All @@ -21,6 +21,9 @@ wasi-sdk: ../wasi-sdk.ts
clangd: ../bin/clangd
cp $< .

cleaner: ../bin/cleaner
cp $< .

c2wasm-api: ../c2wasm-api
cp -LR $< .
rm -rf c2wasm-api/.git
Expand Down
1 change: 1 addition & 0 deletions hook-cleaner-c
Submodule hook-cleaner-c added at a43e98

0 comments on commit b1a6580

Please sign in to comment.