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

Output warning in JSON generator if an unmatched argument is found in descriptor.json #1467

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rcjsuen
Copy link
Member

@rcjsuen rcjsuen commented Mar 20, 2018

When making additions or changes to NodeGit to match libgit2, we have to make changes to the generate/input/descriptor.json file. If we make a typo, it goes completely undetected until your test code fails or you when you manually inspect the generated C++ code. To make this feedback loop better, we should generate a warning if an argument name used in the descriptor does not match the name
in the C function. This fixes #1464 and will make everyone's lives a lot easier when adding new API to NodeGit.

The following is the new output from Travis CI.

[nodegit] Running pre-install script
[nodegit] Configuring libssh2.
[nodegit] Checking submodule status
[nodegit] Initializing submodules
[nodegit] Generating native code
Found non-matching argument named flags in descriptor.json for C function git_index_remove_all
Found non-matching argument named flags in descriptor.json for C function git_index_update_all
Found non-matching argument named force in descriptor.json for C function git_index_write
Found non-matching argument named signature in descriptor.json for C function git_rebase_init
Found non-matching argument named signature in descriptor.json for C function git_branch_create
Found non-matching argument named log_message in descriptor.json for C function git_branch_create
Found non-matching argument named log_message in descriptor.json for C function git_reset
Found non-matching argument named signature in descriptor.json for C function git_reset
Found non-matching argument named return in descriptor.json for C function git_status_file
[nodegit] Running install script

When making additions to the NodeGit API, it is necessary to make
changes to the descriptor.json. Small typos can cause the generated
code to not match the expected output. We should generate a warning
if an argument name used in descriptor.json does not match the name
in the C function. This will help make it a lot easier to discover
problems in the handwritten descriptor.json file.

Signed-off-by: Remy Suen <remy.suen@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.

Change generator to warn about invalid argument names
1 participant