-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
NibiruHeisenberg
commented
Jul 24, 2022
- 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
It was creating an unnecessary folder under nibiru/
@mkdir -p proto/ | ||
@cp -r ../nibiru/proto/ proto/ |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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, ...
There was a problem hiding this 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/ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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/ ./
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for me
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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/ |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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/ |
There was a problem hiding this comment.
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.
Closed in favor of #44 |