[WIP] Descriptor refactor.#162
Conversation
|
I'm currently stuck on figuring out the best way to access
Both of these approaches are setting values directly on a hash/object and returning that. Instead, I'm considering the approach of native v8 accessors to dynamic properties as outlined here: If this experiment ends up working for |
|
I've been experimenting with a new generated JSON descriptor file from the libgit2 project. @carlosmn has been putting work into https://github.com/libgit2/docurium using libclang's AST parser. I don't think it has all the information we need yet to fully generate |
|
I try to build this branch, but received an error, about not found files |
|
Pretty sure I broke something with the latest commit. If you go back a commit or two it should build fine. Need to figure out a way to keep the binding.gyp in sync with the current version of libgit2. I think it should be pretty easy to get a list and dynamically inject into the .gyp file. |
|
This pr is very hard to review, how about divide it on two (firstly)?
|
|
Agreed, I can clean it up and make it much easier to review. The most important task of this PR is to go from: https://github.com/nodegit/nodegit/blob/descriptor-refactor/build/codegen/descriptor.json to: https://github.com/nodegit/nodegit/blob/descriptor-refactor/build/codegen/compare.json The emphasis being on configuring as little as possible with the most accurate data for the templates to generate. |
generate/index.js
Outdated
There was a problem hiding this comment.
There's gonna be some weirdness as I'm rebasing this branch. Now that you're getting involved, I need to undo all my sloppy coding while I thought nobody was looking. I'll need a few more days to get it all in order for someone else to start reviewing and helping out.
There was a problem hiding this comment.
Ok. I will continue in read only mode ;-)
|
@3y3 progress! I'm ready for you to start helping out with this PR. All tests I have uncommented are passing at the moment. We need to go through all remaining ones and tweak the |
|
@tbranyen , Ok, I did checkout. I think that best way to understand that happening here - fixing some tests - this is my strategy for now. |
A somewhat experimental commit to demonstrate and lay the foundation for
the new code generation structure.
File breakdown:
idefs.json (Generated)
- Is a generated file that is substituting the heavily modified
descriptor that nkallen had left us.
nkallen.json (Will be deleted in the future)
- Reference of the modified v0.18.0.json file @nkallen had created.
descriptor.json (Developer maintained)
- Inform decisions to the descriptor generation.
setup.js
- A script that runs to generate the idefs.json file.
types.json (Will be deleted in the future)
- Maps functions/classes/structs/types/etc. to JS, C, C++, and
Emscripten (in the future).
That are also relevant to this branch.
I've been able to get most of the tests passing, just a handful left. There is a little manual intervention needed for most methods to get them to compile correctly. I'd love help on: - Getting more methods compiled and tested! - Code reviews. - Testing the code!
This allows node-gyp to clean the build directory without wiping out the code generation files.
|
I think I got Windows working. I had to reintroduce the For some reason the compiler is complaining it can't link |
|
I confirm - nodegit was builded now. I try to inspect v0.11 compatibility, but it's also mistery. |
|
@3y3 the issue appears to be caused by borrowing prototypes. For instance: // Broken.
var oldBlob = Blob.prototype.lookup;
oldBlob(this, oid, function() { });
// Working.
Blob.lookup(this, oid, function() {});I'm not entirely sure why this is. |
|
Well that was a weird bug, but it's fixed now. Full 0.11 support again. Once I can figure out this segfault issue, I can merge this branch and we can start enabling more methods people want :) |
There was a problem hiding this comment.
replacement is not equivalent. Are you sure that null is acceptable?
There was a problem hiding this comment.
Null is not acceptable, that's why this change exists:
> typeof null != 'undefined'
true
> null != undefined
false
> There was a problem hiding this comment.
For windows:
/vendor/Release
/vendor/*.vcxproj
/vendor/*.filters
/vendor/*.sln
|
I finish review. See the last comments. |
|
@3y3 still have to fix that one segfault in |
|
Figured it out, was a |
|
Okay cool, feedback to be addressed:
Blocking:
Miscellaneous tasks:
|
- Updated gitignore for Windows. - Renamed repo => repository. - Fixed DiffList => Diff conversion and tests.
|
Okay cool, since we're at full testing parity, I'm going to merge this. We'll break up the remaining tasks to lead up to a new release. Since there's such a massive change under the hood, I'm thinking we'll bump minor to 0.2.0. |
|
Congratulations! Great job! ;-) |
|
@3y3 thanks, but still so much work to do! So glad to get this major blocker out of the way. Still need to document the process of adding new methods and what kinds of tactics can be used to fix unexpected bugs. |
|
Also I'm pretty sure I messed up the Diff tests, need to revisit and figure out why I had to change numbers around to make things pass. |
This PR is working on completely decoupling the meta data required to generate the source binding from the JSON published by the libgit2 project. Once this is completed, we should be able to trivially add and remove new methods and classes as they change by simply updating the descriptor file.
So far it's going better than expected, libgit2 is so strict with the conventions that I can infer most manually added properties. This is a very important PR so time will be taken and it will not be rushed.
My goal is to improve the templates in a separate PR.