Skip to content

Commit a489de6

Browse files
committed
Replace use of third_party/closure-library submodule
... 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`
1 parent a56e721 commit a489de6

File tree

12 files changed

+33
-37
lines changed

12 files changed

+33
-37
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[submodule "third_party/closure-library"]
2-
path = third_party/closure-library
3-
url = https://github.com/google/closure-library.git
41
[submodule "third_party/protobuf"]
52
path = third_party/protobuf
63
url = https://github.com/protocolbuffers/protobuf.git

Makefile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ plugin:
88
install-plugin:
99
cd "$(ROOT_DIR)"/javascript/net/grpc/web && make install
1010

11-
client:
12-
cd "$(ROOT_DIR)"/net/grpc/gateway/examples/echo && make client
13-
14-
install-example:
15-
cd "$(ROOT_DIR)"/net/grpc/gateway/examples/echo && make install
16-
1711
clean:
18-
cd "$(ROOT_DIR)"/net/grpc/gateway/examples/echo && make clean
1912
cd "$(ROOT_DIR)"/javascript/net/grpc/web && make clean
2013
cd "$(ROOT_DIR)"

net/grpc/gateway/docker/closure_client/Dockerfile

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,11 @@
1414

1515
FROM grpcweb/prereqs
1616

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

20-
WORKDIR /github/grpc-web
19+
RUN npm install
2120

22-
RUN curl -sS https://dl.google.com/closure-compiler/compiler-20190909.zip \
23-
-o compiler-latest.zip
24-
25-
RUN rm -f closure-compiler.jar && \
26-
unzip -p -qq -o compiler-latest.zip *.jar > closure-compiler.jar
27-
28-
RUN make client && make install-example
21+
RUN make client && make install
2922

3023
WORKDIR /var/www/html
3124

net/grpc/gateway/docker/prereqs/Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ WORKDIR /github/grpc-web
2626
COPY ./scripts ./scripts
2727
RUN ./scripts/init_submodules.sh
2828

29+
COPY ./packages ./packages
30+
RUN cd ./packages/grpc-web && \
31+
npm install && \
32+
npm run build && \
33+
npm link
34+
2935
COPY ./Makefile ./Makefile
3036
COPY ./WORKSPACE ./WORKSPACE
3137
COPY ./bazel ./bazel
3238
COPY ./javascript ./javascript
3339
COPY ./net ./net
34-
COPY ./packages ./packages
3540
COPY ./src ./src
3641
COPY ./test ./test
3742

38-
RUN cd ./packages/grpc-web && \
39-
npm install && \
40-
npm run build && \
41-
npm link
42-
4343
RUN wget -nv -O buildifier \
4444
https://github.com/bazelbuild/buildtools/releases/download/$BUILDIFIER_VERSION/buildifier && \
4545
chmod +x ./buildifier && \
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/package-lock.json
2+
/node_modules

net/grpc/gateway/examples/echo/Makefile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
# limitations under the License.
1414

1515
ROOT_DIR = ../../../../..
16+
NPM_DIR = ./node_modules
1617
PROTOC = protoc
1718
PROTOS_PATH = ../..
18-
EXAMPLES_PATH = net/grpc/gateway/examples/echo
1919
HTML_DIR = /var/www/html
2020
JS_IMPORT_STYLE = import_style=closure,binary
2121
JS_PATH = javascript/net/grpc/web
@@ -36,12 +36,12 @@ compiled-js:
3636
rm $(ROOT_DIR)/$(PROTOBUF_PATH)/js/compatibility_tests/v3.0.0/commonjs/*_test.js || true
3737
rm $(ROOT_DIR)/$(PROTOBUF_PATH)/js/compatibility_tests/v3.1.0/*_test.js || true
3838
rm $(ROOT_DIR)/$(PROTOBUF_PATH)/js/compatibility_tests/v3.1.0/binary/*_test.js || true
39-
java \
40-
-jar $(ROOT_DIR)/closure-compiler.jar \
41-
--js $(ROOT_DIR)/javascript \
42-
--js $(ROOT_DIR)/net \
43-
--js $(ROOT_DIR)/third_party/closure-library \
44-
--js $(ROOT_DIR)/$(PROTOBUF_PATH)/js \
39+
./node_modules/.bin/google-closure-compiler \
40+
--js=*.js \
41+
--js=$(OUT_DIR)/*.js \
42+
--js=$(ROOT_DIR)/javascript \
43+
--js=$(ROOT_DIR)/$(PROTOBUF_PATH)/js \
44+
--js=$(NPM_DIR)/google-closure-library \
4545
--entry_point=goog:proto.grpc.gateway.testing.EchoServiceClient \
4646
--dependency_mode=PRUNE \
4747
--js_output_file compiled.js
@@ -64,4 +64,5 @@ install:
6464

6565
clean:
6666
rm -f compiled.js
67+
rm -f *_pb.js
6768
rm -rf $(OUT_DIR)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "echo-closure-example",
3+
"version": "0.1.0",
4+
"description": "gRPC-Web Closure JS client example",
5+
"license": "Apache-2.0",
6+
"dependencies": {},
7+
"devDependencies": {
8+
"google-closure-compiler": "~20200224.0.0",
9+
"google-closure-library": "~20201102.0.1"
10+
}
11+
}

packages/grpc-web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@types/google-protobuf": "~3.7.0",
2727
"command-exists": "~1.2.8",
2828
"google-closure-compiler": "~20200224.0.0",
29+
"google-closure-library": "~20201102.0.1",
2930
"google-protobuf": "~3.14.0",
3031
"gulp": "~4.0.2",
3132
"gulp-eval": "~1.0.0",

packages/grpc-web/scripts/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const indexPath = path.relative(cwd, path.resolve(__dirname, "../index.js"));
2727
const jsPaths = [
2828
"../exports.js",
2929
"../../../javascript",
30-
"../../../third_party/closure-library",
30+
"../node_modules/google-closure-library",
3131
].map(jsPath => path.relative(cwd, path.resolve(__dirname, jsPath)));
3232

3333
const closureArgs = [].concat(

packages/grpc-web/test/generated_code_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ describe('grpc-web generated code (closure+grpcwebtext)', function() {
472472
const jsPaths = [
473473
".",
474474
"../../../javascript",
475-
"../../../third_party/closure-library",
475+
"../node_modules/google-closure-library",
476476
"../../../third_party/protobuf/js",
477477
].map(jsPath => path.relative(cwd, path.resolve(__dirname, jsPath)));
478478
const closureArgs = [].concat(

scripts/init_submodules.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@ set -ex
1616

1717
cd "$(dirname "$0")"/..
1818
git submodule --quiet update --init --recursive
19-
(cd third_party/closure-library && git checkout tags/v20201102)
2019
(cd third_party/protobuf && git checkout tags/v3.15.6)

third_party/closure-library

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)