From 86b800d4449eaf2d76775a740bcc8bc871bd7993 Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Fri, 31 Jan 2025 12:29:51 -0400 Subject: [PATCH] Compile thrift into dot-dir .thrift-gen-polyglot (#140) Similar to Proto Signed-off-by: Yuri Shkuro --- .gitignore | 3 +-- Makefile | 10 ++++------ README.md | 6 +++--- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 96b2f2d..4083c17 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,8 @@ .idea/ -gen-*/ .fmt.log .import.log .proto-gen-polyglot/ +.thrift-gen-polyglot/ .scripts/ .tools/ coverage.txt - diff --git a/Makefile b/Makefile index 1468a07..5190480 100644 --- a/Makefile +++ b/Makefile @@ -24,9 +24,6 @@ THRIFT_PY_ARGS=new_style,tornado THRIFT_JAVA_ARGS=private-members THRIFT_PHP_ARGS=psr4 -THRIFT_GEN=--gen lua --gen go:$(THRIFT_GO_ARGS) --gen py:$(THRIFT_PY_ARGS) --gen java:$(THRIFT_JAVA_ARGS) --gen js:node --gen cpp --gen php:$(THRIFT_PHP_ARGS) -THRIFT_CMD=$(THRIFT) -o /data $(THRIFT_GEN) - THRIFT_FILES=agent.thrift jaeger.thrift sampling.thrift zipkincore.thrift crossdock/tracetest.thrift \ baggage.thrift dependency.thrift aggregation_validator.thrift THRIFT_GEN_DIR=thrift-gen @@ -66,7 +63,6 @@ swagger-validate: .PHONY: clean clean: - rm -rf *gen-* || true rm -rf .*gen-* || true rm -rf coverage.txt @@ -84,9 +80,11 @@ thrift: .PHONY: thrift-all thrift-all: thrift-image clean $(THRIFT_FILES) +THRIFT_GEN_ARGS=--gen lua --gen go:$(THRIFT_GO_ARGS) --gen py:$(THRIFT_PY_ARGS) --gen java:$(THRIFT_JAVA_ARGS) --gen js:node --gen cpp --gen php:$(THRIFT_PHP_ARGS) $(THRIFT_FILES): @echo Compiling $@ - $(THRIFT_CMD) /data/thrift/$@ + @mkdir -p .thrift-gen-polyglot + $(THRIFT) -o /data/.thrift-gen-polyglot $(THRIFT_GEN_ARGS) /data/thrift/$@ .PHONY: thrift-image thrift-image: @@ -213,7 +211,7 @@ lint-license: setup-lint-scripts @[ -s "$(FMT_LOG)" ] || echo "✅ All files have license headers" -.PHONY: lint-nocommit +.PHONY: lint-nocommit lint-nocommit: @if git diff origin/main | grep '@no''commit' ; then \ echo "❌ Cannot merge PR that contains @no""commit string" ; \ diff --git a/README.md b/README.md index a1b4048..f2f4760 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,12 @@ As of Jan 2025 this repository also hosts Go code: ## Generating code -This repository does not publish the generated code, but it does run Thrift and `protoc` generators as part of the CI to verify all IDL files. See the [Makefile](./Makefile) for example. In particular, the classes for different languages can be compiled using the `jaegertracing/protobuf` Docker image (see [README](https://github.com/jaegertracing/docker-protobuf/blob/master/README.md)). +This repository only include Go code for some of the Thrift and Protobuf modules. It also runs Thrift and `protoc` generators as part of the CI to verify all IDL files. See the [Makefile](./Makefile) for example. In particular, the classes for different languages can be compiled using the `jaegertracing/protobuf` Docker image (see [README](https://github.com/jaegertracing/docker-protobuf/blob/master/README.md)). To generate the stubs for your own purposes: * clone the repository * run `make proto-all` or `make thrift-all` - * the stubs will be generated under `gen-{lang}` for Thrift and `proto-gen-{lang}` for Protobuf + * the stubs will be generated under `.thrift-gen-polyglot/gen-{lang}` for Thrift and `.proto-gen-polyglot/{lang}` for Protobuf ## Compatibility @@ -32,7 +32,7 @@ The Jaeger repositories that use these IDL files usually import this repository See [CONTRIBUTING](./CONTRIBUTING.md). ## License - + [Apache 2.0 License](./LICENSE).