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

fix(devops): Fix proto-gen makefile script #24

Closed
wants to merge 6 commits into from

Conversation

NibiruHeisenberg
Copy link
Contributor

  • the copy-files target was copying the proto/ files from nibiru/ into a nested proto/proto/ directory, which is fixed by this PR
  • Re-ran the proto-gen makefile target
  • applied formatting to the README

@mkdir -p proto/
@cp -r ../nibiru/proto/ proto/
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why you'd copy to ./, the ./proto folder is then used in the script as the seed folder? @NibiruHeisenberg

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cp -r ../nibiru/proto/ ./ creates a ./proto/ directory under sdk-python.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, not for me, I'm on Mac OS X, if I copy cp -r ../nibiru/proto/ proto/ My ./proto folder contains the different modules perp, dex, ...

Copy link
Contributor

@john-connor84 john-connor84 left a comment

Choose a reason for hiding this comment

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

Not really sure why you'd want to move from .proto to .?

printf "import os\nimport sys\n\nsys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))" > nibiru/proto/__init__.py

# cleanup
rm -rf proto/
Copy link
Contributor

Choose a reason for hiding this comment

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

As you deleted this folder in the makefile, where is this now coming from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's coming from the cp -r ../nibiru/proto/ ./ command.

Copy link
Contributor

Choose a reason for hiding this comment

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

If I execute this all the modules end up in my nibiru folder and not nested in proto

@@ -14,17 +14,21 @@ protoc_gen_gocosmos() {
go get github.com/cosmos/cosmos-sdk 2>/dev/null
}

# grab the cosmos-sdk proto file locations from disk
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd generally extract the proto generation from the repos and have a standalone api repo with the proto definitions and auto generate for each language so we don't have to rely on the nibiru repo from the others

Copy link
Contributor Author

Choose a reason for hiding this comment

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

An artifact repository sounds good to me, though perhaps at a later date as a nice-to-have.

cd -;
proto_dirs=$(find $cosmos_sdk_dir/proto $cosmos_sdk_dir/third_party/proto/ ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
mkdir nibiru/proto/
proto_dirs=$(find $cosmos_sdk_dir/proto $cosmos_sdk_dir/third_party/proto ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we use the .proto path as well, as you copy to ., how does execution with your changes still work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean the ./proto/ path? It exists after running cp -r ../nibiru/proto/ ./

Copy link
Contributor

Choose a reason for hiding this comment

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

Not for me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Which shell interpreter are you running? I'm running zsh.

@@ -15,10 +15,10 @@ DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
class Params(google.protobuf.message.Message):
"""Params defines the parameters for the module."""
DESCRIPTOR: google.protobuf.descriptor.Descriptor
STARTING_POOL_NUMBER_FIELD_NUMBER: builtins.int
STARTINGPOOLNUMBER_FIELD_NUMBER: builtins.int
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting how my generated protobuf code has different fields than yours. @john-connor84 is there a proto option that I missed?

Copy link
Contributor

@john-connor84 john-connor84 Jul 25, 2022

Choose a reason for hiding this comment

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

That is odd, not sure why that'd be, you did generate with the proto-gen, right?

@@ -14,17 +14,21 @@ protoc_gen_gocosmos() {
go get github.com/cosmos/cosmos-sdk 2>/dev/null
}

# grab the cosmos-sdk proto file locations from disk
Copy link
Contributor Author

Choose a reason for hiding this comment

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

An artifact repository sounds good to me, though perhaps at a later date as a nice-to-have.

@mkdir -p proto/
@cp -r ../nibiru/proto/ proto/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

cp -r ../nibiru/proto/ ./ creates a ./proto/ directory under sdk-python.

cd -;
proto_dirs=$(find $cosmos_sdk_dir/proto $cosmos_sdk_dir/third_party/proto/ ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
mkdir nibiru/proto/
proto_dirs=$(find $cosmos_sdk_dir/proto $cosmos_sdk_dir/third_party/proto ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean the ./proto/ path? It exists after running cp -r ../nibiru/proto/ ./

printf "import os\nimport sys\n\nsys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))" > nibiru/proto/__init__.py

# cleanup
rm -rf proto/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's coming from the cp -r ../nibiru/proto/ ./ command.

@NibiruHeisenberg
Copy link
Contributor Author

Closed in favor of #44

@NibiruHeisenberg NibiruHeisenberg deleted the fix/devops/proto-gen branch August 10, 2022 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants