feat: install and use tools at project scope level #850
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, in the project some tools are used to generate Go types and the OpenAPI specs from the OCM API model.
This tools are used by some Makefile targets of the project.
However, the project assumes that the tools are installed in the user's environment. This leads to errors when trying to use the Makefile targets and the user being confused as to why.
Aside from that, even if the user has those tools in the environment, the version used by those tools might be different than the version that was used to generate the Go types and OpenAPI specs in the repository's content, which might lead to differences in the autogenerated code with respect to what's commited in the repository and between users.
This set of changes ensures that the tools used by the Makefile are the ones installed by it. This ensures that anyone that used the project and generates the code sing the Makefile targets will use the same version of the tools
The tools are now always installed in the
bin
directory of the project's path.Users of the project that want to directly use the installed tools manually should run them using the binaries installed at project level to ensure that there are no differences in the tool versions.
This set of changes also ensures that
goimports
is also installed as a project-level binary it as it is a requirement to run themetamodel
tool. If the user didn't have it installed this ended up in errors.Finally, it removes the explicit install of the
goimports
binary as it is now automatically installed when runningmake generate
Testing
To test it make sure that you can run
make generate
successfully even if you don't havemetamodel
norgoimports
in your PATH. Also verify that the binaries are installed in thebin
directory of the project's root path