Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
chore: update protocol generation (#571)
Browse files Browse the repository at this point in the history
* update protocol generation

* fix scene number

* fix tests

* linter

* use fixed protocol version

* use fixed pixel ratio
  • Loading branch information
menduz authored Oct 6, 2022
1 parent f8996b4 commit 0feec21
Show file tree
Hide file tree
Showing 68 changed files with 391 additions and 29,524 deletions.
83 changes: 49 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@
NODE = node
COMPILER = $(NODE) --max-old-space-size=4096 node_modules/.bin/decentraland-compiler
CONCURRENTLY = node_modules/.bin/concurrently
BFF_PROTO_FILES := $(wildcard packages/shared/comms/v3/proto/bff/*.proto)
COMMS_PROTO_FILES := $(wildcard packages/shared/comms/v3/proto/*.proto)

SCENE_PROTO_FILES := $(wildcard node_modules/@dcl/protocol/kernel/apis/*.proto)
RENDERER_PROTO_FILES := $(wildcard node_modules/@dcl/protocol/renderer-protocol/*.proto)
PBS_TS = $(SCENE_PROTO_FILES:node_modules/@dcl/protocol/kernel/apis/%.proto=packages/shared/apis/proto/%.gen.ts)
PBRENDERER_TS = $(RENDERER_PROTO_FILES:node_modules/@dcl/protocol/renderer-protocol/%.proto=packages/renderer-protocol/proto/%.gen.ts)
BFF_TS = $(BFF_PROTO_FILES:packages/shared/comms/v3/proto/bff/%.proto=packages/shared/comms/v3/proto/bff/%.gen.ts)
COMMS_TS = $(COMMS_PROTO_FILES:packages/shared/comms/v3/proto/%.proto=packages/shared/comms/v3/proto/%.gen.ts)
RENDERER_PROTO_FILES := $(wildcard node_modules/@dcl/protocol/renderer-protocol/*.proto)
BFF_PROTO_FILES := $(wildcard node_modules/@dcl/protocol/bff/*.proto)
SCENE_PROTO_FILES := $(wildcard node_modules/@dcl/protocol/kernel/apis/*.proto)
COMMSRFC4_PROTO_FILES := $(wildcard node_modules/@dcl/protocol/kernel/comms/*.proto)
COMMS_PROTO_FILES := $(wildcard node_modules/@dcl/protocol/kernel/comms/v3/*.proto)
COMMS_PROTO_FILES2 := $(wildcard packages/shared/comms/v3/proto/*.proto)

BFF_TS = packages/shared/protocol/bff-services.gen.ts
PBS_TS = packages/shared/protocol/kernel/sdk-apis.gen.ts
PBRENDERER_TS = $(RENDERER_PROTO_FILES:node_modules/@dcl/protocol/renderer-protocol/%.proto=packages/shared/protocol/renderer-protocol/%.gen.ts)
COMMSRFC4_TS = $(COMMSRFC4_PROTO_FILES:node_modules/@dcl/protocol/kernel/comms/%.proto=packages/shared/protocol/kernel/comms/%.gen.ts)
COMMS_TS = $(COMMS_PROTO_FILES:node_modules/@dcl/protocol/kernel/comms/v3/%.proto=packages/shared/protocol/kernel/comms/v3/%.gen.ts)
COMMS_TS2 = $(COMMS_PROTO_FILES2:packages/shared/comms/v3/proto/%.proto=packages/shared/comms/v3/proto/%.gen.ts)

CWD = $(shell pwd)
PROTOC = node_modules/.bin/protoc

PROTOC_ARGS = --plugin=./node_modules/.bin/protoc-gen-ts_proto \
--ts_proto_opt=esModuleInterop=true,returnObservable=false,outputServices=generic-definitions,fileSuffix=.gen \
--ts_proto_out="$(PWD)/packages/shared/protocol" \
-I="$(PWD)/node_modules/@dcl/protocol"
# Remove default Makefile rules

.SUFFIXES:
Expand Down Expand Up @@ -61,7 +68,7 @@ empty-parcels:
cp $(EMPTY_SCENES)/mappings.json static/loader/empty-scenes/mappings.json
cp -R $(EMPTY_SCENES)/contents static/loader/empty-scenes/contents

build-essentials: ${BFF_TS} ${COMMS_TS} ${PBRENDERER_TS} ${PBS_TS} $(COMPILED_SUPPORT_JS_FILES) $(SCENE_SYSTEM) $(INTERNAL_SCENES) $(DECENTRALAND_LOADER) $(GIF_PROCESSOR) $(VOICE_CHAT_CODEC_WORKER) empty-parcels
build-essentials: ${BFF_TS} ${COMMS_TS} ${COMMS_TS2} ${COMMSRFC4_TS} ${PBRENDERER_TS} ${PBS_TS} $(COMPILED_SUPPORT_JS_FILES) $(SCENE_SYSTEM) $(INTERNAL_SCENES) $(DECENTRALAND_LOADER) $(GIF_PROCESSOR) $(VOICE_CHAT_CODEC_WORKER) empty-parcels packages/shared/protocol/bff-services.gen.ts

# Entry points
static/%.js: build-essentials packages/entryPoints/%.ts
Expand Down Expand Up @@ -175,42 +182,50 @@ help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
@echo "\nYou probably want to run 'make watch' to build all the test scenes and run the local comms server."

packages/shared/apis/proto/%.gen.ts: node_modules/@dcl/protocol/kernel/apis/%.proto
${PROTOC} \
--plugin=./node_modules/.bin/protoc-gen-ts_proto \
--ts_proto_opt=esModuleInterop=true,returnObservable=false,outputServices=generic-definitions \
--ts_proto_opt=fileSuffix=.gen \
--ts_proto_out="$(PWD)/packages/shared/apis/proto" \
-I="$(PWD)/packages/shared/apis/proto" \
-I="$(PWD)/node_modules/@dcl/protocol/kernel/apis" \
"$(PWD)/node_modules/@dcl/protocol/kernel/apis/$*.proto";
packages/shared/protocol/kernel/sdk-apis.gen.ts: node_modules/@dcl/protocol/sdk-apis.proto
${PROTOC} ${PROTOC_ARGS} \
"$(PWD)/node_modules/@dcl/protocol/sdk-apis.proto";

packages/renderer-protocol/proto/%.gen.ts: node_modules/@dcl/protocol/renderer-protocol/%.proto
packages/shared/protocol/renderer-protocol/%.gen.ts: node_modules/@dcl/protocol/renderer-protocol/%.proto
mkdir -p "$(PWD)/packages/shared/protocol/renderer-protocol"
${PROTOC} ${PROTOC_ARGS} \
"$(PWD)/node_modules/@dcl/protocol/renderer-protocol/$*.proto";

packages/shared/protocol/bff-services.gen.ts: node_modules/@dcl/protocol/bff-services.proto
mkdir -p "$(PWD)/packages/shared/protocol/bff"
${PROTOC} ${PROTOC_ARGS} \
-I="$(PWD)/node_modules/protobufjs" \
"$(PWD)/node_modules/@dcl/protocol/bff-services.proto"

packages/shared/protocol/kernel/comms/%.gen.ts: node_modules/@dcl/protocol/kernel/comms/%.proto
mkdir -p "$(PWD)/packages/shared/protocol/kernel/comms"
${PROTOC} \
--plugin=./node_modules/.bin/protoc-gen-ts_proto \
--ts_proto_opt=esModuleInterop=true,returnObservable=false,outputServices=generic-definitions \
--ts_proto_opt=esModuleInterop=true,returnObservable=false,outputServices=generic-definitions,oneof=unions \
--ts_proto_opt=fileSuffix=.gen \
--ts_proto_out="$(PWD)/packages/renderer-protocol/proto" \
-I="$(PWD)/packages/renderer-protocol/proto" \
-I="$(PWD)/node_modules/@dcl/protocol/renderer-protocol/" \
"$(PWD)/node_modules/@dcl/protocol/renderer-protocol/$*.proto";

packages/shared/comms/v3/proto/bff/%.gen.ts: packages/shared/comms/v3/proto/bff/%.proto
--ts_proto_out="$(PWD)/packages/shared/protocol/kernel/comms" \
-I="$(PWD)/node_modules/@dcl/protocol/bff" \
-I="$(PWD)/node_modules/protobufjs" \
-I="$(PWD)/node_modules/@dcl/protocol/kernel/comms" \
"$(PWD)/node_modules/@dcl/protocol/kernel/comms/$*.proto"

packages/shared/protocol/kernel/comms/v3/%.gen.ts: node_modules/@dcl/protocol/kernel/comms/v3/%.proto
mkdir -p "$(PWD)/packages/shared/protocol/kernel/comms/v3"
${PROTOC} \
--plugin=./node_modules/.bin/protoc-gen-ts_proto \
--ts_proto_opt=esModuleInterop=true,returnObservable=false,outputServices=generic-definitions \
--ts_proto_opt=fileSuffix=.gen \
--ts_proto_out="$(PWD)/packages/shared/comms/v3/proto/bff" -I="$(PWD)/packages/shared/comms/v3/proto/bff" \
"$(PWD)/packages/shared/comms/v3/proto/bff/$*.proto"
--ts_proto_opt=esModuleInterop=true,oneof=unions,fileSuffix=.gen \
--ts_proto_out="$(PWD)/packages/shared/protocol/kernel/comms/v3" \
-I="$(PWD)/node_modules/@dcl/protocol/kernel/comms/v3" \
"$(PWD)/node_modules/@dcl/protocol/kernel/comms/v3/$*.proto"

packages/shared/comms/v3/proto/%.gen.ts: packages/shared/comms/v3/proto/%.proto
${PROTOC} \
--plugin=./node_modules/.bin/protoc-gen-ts_proto \
--ts_proto_opt=esModuleInterop=true,oneof=unions\
--ts_proto_opt=fileSuffix=.gen \
--ts_proto_out="$(PWD)/packages/shared/comms/v3/proto" -I="$(PWD)/packages/shared/comms/v3/proto" \
"$(PWD)/packages/shared/comms/v3/proto/$*.proto"
"$(PWD)/packages/shared/comms/v3/proto/$*.proto"

compile_apis: ${BFF_TS} ${COMMS_TS} ${PBS_TS}
compile_apis: ${BFF_TS} ${COMMS_TS} ${COMMS_TS2} ${PBS_TS} ${packages/shared/protocol/bff-services.gen.ts}

compile_renderer_protocol: ${PBRENDERER_TS}
20 changes: 0 additions & 20 deletions docs/how-to-add-or-update-protobuf-compiled-components.md

This file was deleted.

104 changes: 71 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
"devDependencies": {
"@dcl/eslint-config": "^1.0.5-20220608210046.commit-d51d9ec",
"@dcl/posix": "^1.0.3",
"@dcl/unity-renderer": "^1.0.49884-20220818143841.commit-421e39d",
"@dcl/unity-renderer": "^1.0.56455-20221006153048.commit-dedb6d1",
"@microsoft/api-documenter": "^7.2.2",
"@microsoft/api-extractor": "^7.1.7",
"@protobuf-ts/protoc": "^2.8.1",
"@tweenjs/tween.js": "^17.2.0",
"@types/chai": "^4.1.3",
"@types/events": "^1.2.0",
Expand Down Expand Up @@ -66,8 +67,7 @@
"ts-proto": "^1.115.4",
"ts-protoc-gen": "^0.10.0",
"typescript": "4.6.4",
"uuid": "^3.1.0",
"@protobuf-ts/protoc": "^2.8.1"
"uuid": "^3.1.0"
},
"dependencies": {
"@dcl/catalyst-peer": "^1.0.4",
Expand All @@ -79,7 +79,7 @@
"@dcl/hashing": "^1.1.0",
"@dcl/kernel-interface": "^2.0.0-20210922153939.commit-017905d",
"@dcl/legacy-ecs": "^6.11.8",
"@dcl/protocol": "^1.0.0-3015628754.commit-7713e2e",
"@dcl/protocol": "^1.0.0-3199325469.commit-c9bc23f",
"@dcl/rpc": "^1.0.1-20220608232056.commit-741737c",
"@dcl/schemas": "^5.8.1",
"@dcl/urn-resolver": "^1.4.0",
Expand Down
1 change: 0 additions & 1 deletion packages/renderer-protocol/proto/README.md

This file was deleted.

Loading

0 comments on commit 0feec21

Please sign in to comment.