Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile thrift into dot-dir .thrift-gen-polyglot #140

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
.idea/
gen-*/
.fmt.log
.import.log
.proto-gen-polyglot/
.thrift-gen-polyglot/
.scripts/
.tools/
coverage.txt

10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -66,7 +63,6 @@ swagger-validate:

.PHONY: clean
clean:
rm -rf *gen-* || true
rm -rf .*gen-* || true
rm -rf coverage.txt

Expand All @@ -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:
Expand Down Expand Up @@ -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" ; \
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ As of Jan 2025 this repository also hosts Go code:
* `protoc`-generated Go types for `api_v2`
* Previous import path `"github.com/jaegertracing/jaeger/proto-gen/api_v2"`
* New import part is `"github.com/jaegertracing/jaeger-idl/proto-gen/api_v2"`
* All Thrift-generated types
* Previous import path `"github.com/jaegertracing/jaeger/thrift-gen/{agent,jaeger,sampling,zipkincore}"`
* New import part is `"github.com/jaegertracing/jaeger-idl/thrift-gen/..."`

## 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
Expand All @@ -29,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).


Expand Down