diff --git a/Dockerfile b/Dockerfile index 82ee12e..23091c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,7 @@ RUN sudo mv /tmp/protoc-gen-grpc-web /usr/local/bin/ && sudo chmod u+x /usr/loca # deps for node.js RUN curl -fsSL https://deb.nodesource.com/setup_15.x | bash - RUN apt-get install -y nodejs -RUN npm install -g grpc-tools +RUN npm install -g protoc-gen-grpc # compile build tool and put it into path ADD . /root/cs3apis-build diff --git a/README.md b/README.md index 404590d..41336bc 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,22 @@ # cs3apis-build Docker image to build the CS3APIS + +## Development +See the [cs3apis local compiliation instructions](https://github.com/cs3org/cs3apis#local-compilation) and the +[cs3apis Makefile](https://github.com/cs3org/cs3apis/blob/main/Makefile) +for pointers on how to run and test the code in this repo on your local machine. + +So for instance: +```sh +git clone https://github.com/cs3org/cs3apis-build +cd cs3apis-build +// make your changes in how e.g. `cs3apis-build -build-js` works +docker build -t cs3apis-build . +cd .. +git clone https://github.com/cs3org/cs3apis +cd cs3apis +docker run -v `pwd`:/root/cs3apis cs3apis-build cs3apis-build -build-js +cd build/js-cs3apis +git status +// see the result +``` diff --git a/build.go b/build.go index 678bbac..c615862 100644 --- a/build.go +++ b/build.go @@ -439,21 +439,20 @@ func buildNode() { checkout(protoBranch, "build/node-cs3apis") } - nodeProtocPlugin, err := exec.LookPath("grpc_tools_node_protoc_plugin") - - if err != nil { - panic(fmt.Sprintf("grpc_tools_node_protoc_plugin binary not found in PATH: %v\n", err)) - } - // remove leftovers (existing defs) os.RemoveAll("build/node-cs3apis/cs3") files := findProtos() - args := []string{"--js_out=import_style=commonjs,binary:./build/node-cs3apis", "--grpc_out=./build/node-cs3apis/", "--plugin=protoc-gen-grpc=" + nodeProtocPlugin} - args = append(args, files...) - cmd := exec.Command("grpc_tools_node_protoc", args...) - run(cmd) + args1 := []string{"--ts_out=grpc_js:./build/node-cs3apis"} //, "--proto_path ."} + args1 = append(args1, files...) + cmd1 := exec.Command("protoc-gen-grpc-ts", args1...) + run(cmd1) + + args2 := []string{"--js_out=import_style=commonjs,binary:./build/node-cs3apis", "--grpc_out=grpc_js:./build/node-cs3apis/"} //, "--proto_path ."} + args2 = append(args2, files...) + cmd2 := exec.Command("protoc-gen-grpc", args2...) + run(cmd2) // get proto repo commit id hash := getCommitID(".")