Skip to content

Conversation

@Pantani
Copy link
Collaborator

@Pantani Pantani commented Jul 19, 2021

closes #1342

What does this MR does?

  • Compile proto only from build.proto.path; instead, compile all proto files from the project.

Changes

  • Specify the proto folder to be analyzed.

How to test?

  • Compile Ethermint with proto files generated by tests:
$ git clone git@github.com:tharsis/ethermint.git
$ cd ethermint && make install
$ cd tests/solidity && yarn install
$ cd ../..
$ starport c serve -v

@Pantani Pantani requested review from fadeev, ilgooz and lumtis as code owners July 19, 2021 21:18
@Pantani Pantani self-assigned this Jul 19, 2021
fadeev
fadeev previously approved these changes Jul 20, 2021
Copy link
Contributor

@fadeev fadeev left a comment

Choose a reason for hiding this comment

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

Works like a charm! 🚀

Copy link
Member

@ilgooz ilgooz left a comment

Choose a reason for hiding this comment

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

👍

return err
}
modules, err := g.discoverModules(path)
modules, err := g.discoverModules(path, "")
Copy link
Member

Choose a reason for hiding this comment

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

we should also pass it for dependencies as they can contain invalid proto files for testing or other purposes

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But each dependency can have a proto file in a different place, right? How can we handle it?

Copy link
Member

Choose a reason for hiding this comment

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

that's right. this can be also configured in the config.yml per dependency basis with a default proto/. but this might be too much for now. how about if we pass some known patterns to ignore here? Starting from the ethermint example, we can make it ignore **/test/** and **/tests/**.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I like the pattern idea. It seems awesome. If we move the build.proto.path to a list, we can also define paths to skip, like ["proto/**, !proto/node_modules"]

Let's make this PR simple for a quick fix for the v0.17.1 and create an issue in the repo. What do you think?

@ilgooz ilgooz changed the title fix(proto): compile proto only from build.proto.path fix(proto): compile proto only from defined dirs Jul 20, 2021
@ilgooz ilgooz changed the title fix(proto): compile proto only from defined dirs fix(cosmosanalysis/module): discover proto files only in certain dirs Jul 20, 2021
args args
want []Module
}{
{
Copy link
Member

@ilgooz ilgooz Jul 21, 2021

Choose a reason for hiding this comment

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

can we add a test case here to actually compare a valid []Module value returned after module discovery? but not required for this PR I think.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The first two cases return the Module from the testdata project. But both have all empty parameters and no modules from 3trd part packages. I cannot think of a good way to do it without creating an entire chain scaffold into the testdata only for this test. maybe in the future we can create a common/global testdata folder for all packages with a scaffold chain for we can perform these tests

@Pantani Pantani requested a review from ilgooz July 21, 2021 16:04
@ilgooz ilgooz merged commit 82b39c2 into develop Jul 22, 2021
@ilgooz ilgooz deleted the fix/proto-folder-config branch July 22, 2021 10:43
Jchicode pushed a commit to Jchicode/cli that referenced this pull request Aug 9, 2023
…ignite#1389)

* avoid search proto files outside the proto folder defined into the config

* fix unit tests

* improve tests

* add unit test and testdata

* remove unused error assertion

* add relative testdata path

* remove nil variable parameter from tests

Co-authored-by: İlker G. Öztürk <ilkergoktugozturk@gmail.com>
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.

starport serve fails due to proto build error

4 participants