Skip to content

Commit 86b800d

Browse files
authored
Compile thrift into dot-dir .thrift-gen-polyglot (#140)
Similar to Proto Signed-off-by: Yuri Shkuro <[email protected]>
1 parent b6fbe1a commit 86b800d

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
.idea/
2-
gen-*/
32
.fmt.log
43
.import.log
54
.proto-gen-polyglot/
5+
.thrift-gen-polyglot/
66
.scripts/
77
.tools/
88
coverage.txt
9-

Makefile

+4-6
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ THRIFT_PY_ARGS=new_style,tornado
2424
THRIFT_JAVA_ARGS=private-members
2525
THRIFT_PHP_ARGS=psr4
2626

27-
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)
28-
THRIFT_CMD=$(THRIFT) -o /data $(THRIFT_GEN)
29-
3027
THRIFT_FILES=agent.thrift jaeger.thrift sampling.thrift zipkincore.thrift crossdock/tracetest.thrift \
3128
baggage.thrift dependency.thrift aggregation_validator.thrift
3229
THRIFT_GEN_DIR=thrift-gen
@@ -66,7 +63,6 @@ swagger-validate:
6663

6764
.PHONY: clean
6865
clean:
69-
rm -rf *gen-* || true
7066
rm -rf .*gen-* || true
7167
rm -rf coverage.txt
7268

@@ -84,9 +80,11 @@ thrift:
8480
.PHONY: thrift-all
8581
thrift-all: thrift-image clean $(THRIFT_FILES)
8682

83+
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)
8784
$(THRIFT_FILES):
8885
@echo Compiling $@
89-
$(THRIFT_CMD) /data/thrift/$@
86+
@mkdir -p .thrift-gen-polyglot
87+
$(THRIFT) -o /data/.thrift-gen-polyglot $(THRIFT_GEN_ARGS) /data/thrift/$@
9088

9189
.PHONY: thrift-image
9290
thrift-image:
@@ -213,7 +211,7 @@ lint-license: setup-lint-scripts
213211
@[ -s "$(FMT_LOG)" ] || echo "✅ All files have license headers"
214212

215213

216-
.PHONY: lint-nocommit
214+
.PHONY: lint-nocommit
217215
lint-nocommit:
218216
@if git diff origin/main | grep '@no''commit' ; then \
219217
echo "❌ Cannot merge PR that contains @no""commit string" ; \

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ As of Jan 2025 this repository also hosts Go code:
1515

1616
## Generating code
1717

18-
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)).
18+
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)).
1919

2020
To generate the stubs for your own purposes:
2121
* clone the repository
2222
* run `make proto-all` or `make thrift-all`
23-
* the stubs will be generated under `gen-{lang}` for Thrift and `proto-gen-{lang}` for Protobuf
23+
* the stubs will be generated under `.thrift-gen-polyglot/gen-{lang}` for Thrift and `.proto-gen-polyglot/{lang}` for Protobuf
2424

2525

2626
## Compatibility
@@ -32,7 +32,7 @@ The Jaeger repositories that use these IDL files usually import this repository
3232
See [CONTRIBUTING](./CONTRIBUTING.md).
3333

3434
## License
35-
35+
3636
[Apache 2.0 License](./LICENSE).
3737

3838

0 commit comments

Comments
 (0)