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

Sample protos build #5582

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
33 changes: 21 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,30 @@ CHECKSUM_FILE := .proto_checksums

generate-proto:
@echo "Regenerating proto files..."
@mkdir -p $(PROTO_DIR)
@touch $(CHECKSUM_FILE)
@current_checksum=$$(sha256sum $(PROTO_FILES) | sha256sum | awk '{print $$1}'); \
stored_checksum=$$(cat $(CHECKSUM_FILE)); \
if [ "$${current_checksum}" != "$${stored_checksum}" ]; then \
echo "Changes detected. Regenerating all proto files..."; \
protoc -I=$(PROTO_DIR) \
--go_out=$(PROTO_DIR) --go_opt=paths=source_relative \
--go-grpc_out=$(PROTO_DIR) --go-grpc_opt=paths=source_relative \
$(PROTO_FILES); \
echo "$${current_checksum}" > $(CHECKSUM_FILE); \
else \
echo "No changes detected in proto files."; \
fi
echo "Changes detected. Regenerating all proto files..."; \
MAP_OPTS=$$(for file in $(PROTO_FILES); do \
rel_path=$$(echo $$file | sed 's|$(PROTO_DIR)/||'); \
pkg_path=$$(dirname $$rel_path); \
go_pkg="github.com/stellar/go/ingest/$$pkg_path"; \
printf "M%s=%s," "$$rel_path" "$$go_pkg"; \
done); \
MAP_OPTS=$${MAP_OPTS%,}; \
echo "Running protoc with options:"; \
echo " --go_out=ingest"; \
echo " --go_opt=paths=source_relative"; \
echo " --go_opt=$$MAP_OPTS"; \
echo " $(PROTO_FILES)"; \
protoc -I=$(PROTO_DIR) \
--go_out=ingest --go_opt=paths=source_relative \
--go_opt=$$MAP_OPTS \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use -go_opt with the M flag to indicate what the package location/path inside the generated proto should look like

$(PROTO_FILES); \
echo "$${current_checksum}" > $(CHECKSUM_FILE); \
else \
echo "No changes detected in proto files."; \
fi

.PHONY: generate-proto


213 changes: 213 additions & 0 deletions ingest/address/address.pb.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import (
"fmt"
)

// String returns a human-readable representation of the Address.
func (a *Address) Strings() string {
func (a *Address) BetterString() string {
switch addr := a.AddressType.(type) {
case *Address_SmartContractAddress:
return fmt.Sprintf("Smart Contract Address: %s", addr.SmartContractAddress)
Expand Down
Loading
Loading