Skip to content

Commit

Permalink
Replace use of third_party/closure-library submodule
Browse files Browse the repository at this point in the history
... in favor of `google-closure-library` npm package.

Removed the third_party/closure-library submodule following the instructions here:
https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial#Removal

Tested:
- Verified that `npm run build` inside `packages/grpc-web` generates
  exactly the same output as before.
- Test ran closure client: `docker-compose up --build node-server envoy closure-client`
  • Loading branch information
sampajano committed Sep 2, 2021
1 parent a56e721 commit a489de6
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 37 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "third_party/closure-library"]
path = third_party/closure-library
url = https://github.com/google/closure-library.git
[submodule "third_party/protobuf"]
path = third_party/protobuf
url = https://github.com/protocolbuffers/protobuf.git
7 changes: 0 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ plugin:
install-plugin:
cd "$(ROOT_DIR)"/javascript/net/grpc/web && make install

client:
cd "$(ROOT_DIR)"/net/grpc/gateway/examples/echo && make client

install-example:
cd "$(ROOT_DIR)"/net/grpc/gateway/examples/echo && make install

clean:
cd "$(ROOT_DIR)"/net/grpc/gateway/examples/echo && make clean
cd "$(ROOT_DIR)"/javascript/net/grpc/web && make clean
cd "$(ROOT_DIR)"
13 changes: 3 additions & 10 deletions net/grpc/gateway/docker/closure_client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,11 @@

FROM grpcweb/prereqs

RUN apt-get -qq update && apt-get -qq install -y \
default-jdk
WORKDIR /github/grpc-web/net/grpc/gateway/examples/echo

WORKDIR /github/grpc-web
RUN npm install

RUN curl -sS https://dl.google.com/closure-compiler/compiler-20190909.zip \
-o compiler-latest.zip

RUN rm -f closure-compiler.jar && \
unzip -p -qq -o compiler-latest.zip *.jar > closure-compiler.jar

RUN make client && make install-example
RUN make client && make install

WORKDIR /var/www/html

Expand Down
12 changes: 6 additions & 6 deletions net/grpc/gateway/docker/prereqs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ WORKDIR /github/grpc-web
COPY ./scripts ./scripts
RUN ./scripts/init_submodules.sh

COPY ./packages ./packages
RUN cd ./packages/grpc-web && \
npm install && \
npm run build && \
npm link

COPY ./Makefile ./Makefile
COPY ./WORKSPACE ./WORKSPACE
COPY ./bazel ./bazel
COPY ./javascript ./javascript
COPY ./net ./net
COPY ./packages ./packages
COPY ./src ./src
COPY ./test ./test

RUN cd ./packages/grpc-web && \
npm install && \
npm run build && \
npm link

RUN wget -nv -O buildifier \
https://github.com/bazelbuild/buildtools/releases/download/$BUILDIFIER_VERSION/buildifier && \
chmod +x ./buildifier && \
Expand Down
2 changes: 2 additions & 0 deletions net/grpc/gateway/examples/echo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/package-lock.json
/node_modules
15 changes: 8 additions & 7 deletions net/grpc/gateway/examples/echo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# limitations under the License.

ROOT_DIR = ../../../../..
NPM_DIR = ./node_modules
PROTOC = protoc
PROTOS_PATH = ../..
EXAMPLES_PATH = net/grpc/gateway/examples/echo
HTML_DIR = /var/www/html
JS_IMPORT_STYLE = import_style=closure,binary
JS_PATH = javascript/net/grpc/web
Expand All @@ -36,12 +36,12 @@ compiled-js:
rm $(ROOT_DIR)/$(PROTOBUF_PATH)/js/compatibility_tests/v3.0.0/commonjs/*_test.js || true
rm $(ROOT_DIR)/$(PROTOBUF_PATH)/js/compatibility_tests/v3.1.0/*_test.js || true
rm $(ROOT_DIR)/$(PROTOBUF_PATH)/js/compatibility_tests/v3.1.0/binary/*_test.js || true
java \
-jar $(ROOT_DIR)/closure-compiler.jar \
--js $(ROOT_DIR)/javascript \
--js $(ROOT_DIR)/net \
--js $(ROOT_DIR)/third_party/closure-library \
--js $(ROOT_DIR)/$(PROTOBUF_PATH)/js \
./node_modules/.bin/google-closure-compiler \
--js=*.js \
--js=$(OUT_DIR)/*.js \
--js=$(ROOT_DIR)/javascript \
--js=$(ROOT_DIR)/$(PROTOBUF_PATH)/js \
--js=$(NPM_DIR)/google-closure-library \
--entry_point=goog:proto.grpc.gateway.testing.EchoServiceClient \
--dependency_mode=PRUNE \
--js_output_file compiled.js
Expand All @@ -64,4 +64,5 @@ install:

clean:
rm -f compiled.js
rm -f *_pb.js
rm -rf $(OUT_DIR)
11 changes: 11 additions & 0 deletions net/grpc/gateway/examples/echo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "echo-closure-example",
"version": "0.1.0",
"description": "gRPC-Web Closure JS client example",
"license": "Apache-2.0",
"dependencies": {},
"devDependencies": {
"google-closure-compiler": "~20200224.0.0",
"google-closure-library": "~20201102.0.1"
}
}
1 change: 1 addition & 0 deletions packages/grpc-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@types/google-protobuf": "~3.7.0",
"command-exists": "~1.2.8",
"google-closure-compiler": "~20200224.0.0",
"google-closure-library": "~20201102.0.1",
"google-protobuf": "~3.14.0",
"gulp": "~4.0.2",
"gulp-eval": "~1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/grpc-web/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const indexPath = path.relative(cwd, path.resolve(__dirname, "../index.js"));
const jsPaths = [
"../exports.js",
"../../../javascript",
"../../../third_party/closure-library",
"../node_modules/google-closure-library",
].map(jsPath => path.relative(cwd, path.resolve(__dirname, jsPath)));

const closureArgs = [].concat(
Expand Down
2 changes: 1 addition & 1 deletion packages/grpc-web/test/generated_code_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ describe('grpc-web generated code (closure+grpcwebtext)', function() {
const jsPaths = [
".",
"../../../javascript",
"../../../third_party/closure-library",
"../node_modules/google-closure-library",
"../../../third_party/protobuf/js",
].map(jsPath => path.relative(cwd, path.resolve(__dirname, jsPath)));
const closureArgs = [].concat(
Expand Down
1 change: 0 additions & 1 deletion scripts/init_submodules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ set -ex

cd "$(dirname "$0")"/..
git submodule --quiet update --init --recursive
(cd third_party/closure-library && git checkout tags/v20201102)
(cd third_party/protobuf && git checkout tags/v3.15.6)
1 change: 0 additions & 1 deletion third_party/closure-library
Submodule closure-library deleted from be4ae2

0 comments on commit a489de6

Please sign in to comment.