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

Use the new ArrayBuffer API for Electron 13 #95

Merged
merged 3 commits into from
Apr 19, 2022

Conversation

gpetrov
Copy link
Contributor

@gpetrov gpetrov commented Nov 20, 2021

Changed the ArrayBuffer API to use new way so it compiles on Node 14+

@gpetrov
Copy link
Contributor Author

gpetrov commented Nov 20, 2021

Seems for Electron on Windows there is more fixes to be done as stated in:

electron/electron#29893 (comment)

@hahnbeelee
Copy link

Hi can this be merged?

@jasonwilliams
Copy link

Hey @maxbrunsfeld are you still maintaining this repo?

@maxbrunsfeld maxbrunsfeld merged commit aefa0dd into tree-sitter:master Apr 19, 2022
@maxbrunsfeld
Copy link
Contributor

Sorry for the delays, everyone.

verhovsky added a commit to verhovsky/node-tree-sitter that referenced this pull request Jun 22, 2023
@verhovsky
Copy link
Collaborator

verhovsky commented Jun 22, 2023

The first #if in this PR never worked. 'conditions' needs to be in one of the 'targets', it has no effect on its own. Here's two examples:

https://github.com/zeromq/zeromq.js/blob/62f6e252f530ea05c86be15b06a58214eac1b34d/binding.gyp#L98-L100

https://github.com/kriszyp/lmdb-js/blob/cc6b5991f5277f1d5149a89882b001c86833dd3c/binding.gyp#L98-L100

So NODE_RUNTIME_ELECTRON was never defined, even on Electron. I tried fixing this and other issues in #148 but it didn't help, I got this error:

gyp info spawn args [
gyp info spawn args   'D:\\a\\node-tree-sitter\\node-tree-sitter\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\a\\node-tree-sitter\\node-tree-sitter\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\a\\node-tree-sitter\\node-tree-sitter\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\prebuild\\electron\\13.0.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\prebuild\\electron\\13.0.0',
gyp info spawn args   '-Dnode_gyp_dir=D:\\a\\node-tree-sitter\\node-tree-sitter\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\RUNNER~1\\\\AppData\\\\Local\\\\Temp\\\\prebuild\\\\electron\\\\13.0.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=D:\\a\\node-tree-sitter\\node-tree-sitter',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'D:\\a\\node-tree-sitter\\node-tree-sitter\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args   'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
  lib.c
D:\a\node-tree-sitter\node-tree-sitter\vendor\tree-sitter\lib\src\query.c(3665,51): warning C4018: '>': signed/unsigned mismatch [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter.vcxproj]
  win_delay_load_hook.cc
  tree_sitter.vcxproj -> D:\a\node-tree-sitter\node-tree-sitter\build\Release\\tree_sitter.lib
  binding.cc
C:\Users\runneradmin\AppData\Local\Temp\prebuild\electron\13.0.0\include\node\v8.h(1670,55): warning C4996: 'v8::Module::ResolveCallback': Use ResolveModuleCallback [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj]
C:\Users\runneradmin\AppData\Local\Temp\prebuild\electron\13.0.0\include\node\v8.h(8652,7): warning C4996: 'v8::HostImportModuleDynamicallyCallback': Use HostImportModuleDynamicallyWithImportAssertionsCallback instead [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj]
  conversions.cc
C:\Users\runneradmin\AppData\Local\Temp\prebuild\electron\13.0.0\include\node\v8.h(1670,55): warning C4996: 'v8::Module::ResolveCallback': Use ResolveModuleCallback [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj]
C:\Users\runneradmin\AppData\Local\Temp\prebuild\electron\13.0.0\include\node\v8.h(8652,7): warning C4996: 'v8::HostImportModuleDynamicallyCallback': Use HostImportModuleDynamicallyWithImportAssertionsCallback instead [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj]
D:\a\node-tree-sitter\node-tree-sitter\src\conversions.cc(35,105): error C2665: 'node::Buffer::New': none of the 5 overloads could convert all the argument types [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj]
C:\Users\runneradmin\AppData\Local\Temp\prebuild\electron\13.0.0\include\node\node_buffer.h(69,44): message : could be 'v8::MaybeLocal<v8::Uint8Array> node::Buffer::New(v8::Isolate *,v8::Local<v8::ArrayBuffer>,size_t,size_t)' [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj]
D:\a\node-tree-sitter\node-tree-sitter\src\conversions.cc(35,105): message : while trying to match the argument list '(v8::Isolate *, uint32_t *, int, unsigned __int64)' [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj]
D:\a\node-tree-sitter\node-tree-sitter\src\conversions.cc(44,117): error C2665: 'v8::Uint32Array::New': none of the 2 overloads could convert all the argument types [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj]
C:\Users\runneradmin\AppData\Local\Temp\prebuild\electron\13.0.0\include\node\v8.h(5678,29): message : could be 'v8::Local<v8::Uint32Array> v8::Uint32Array::New(v8::Local<v8::SharedArrayBuffer>,size_t,size_t)' [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj]
C:\Users\runneradmin\AppData\Local\Temp\prebuild\electron\13.0.0\include\node\v8.h(5676,29): message : or       'v8::Local<v8::Uint32Array> v8::Uint32Array::New(v8::Local<v8::ArrayBuffer>,size_t,size_t)' [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj]
D:\a\node-tree-sitter\node-tree-sitter\src\conversions.cc(44,117): message : while trying to match the argument list '(char *, int, int)' [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj]
D:\a\node-tree-sitter\node-tree-sitter\src\conversions.cc(44,118): error C2661: 'Nan::Set': no overloaded function takes 2 arguments [D:\a\node-tree-sitter\node-tree-sitter\build\tree_sitter_runtime_binding.vcxproj]
prebuild ERR! build error 
prebuild ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
prebuild ERR! stack     at ChildProcess.onExit (D:\a\node-tree-sitter\node-tree-sitter\node_modules\node-gyp\lib\build.js:203:23)
prebuild ERR! stack     at ChildProcess.emit (node:events:511:28)
prebuild ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
prebuild ERR! not ok 
prebuild ERR! build Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
prebuild ERR! build     at ChildProcess.onExit (D:\a\node-tree-sitter\node-tree-sitter\node_modules\node-gyp\lib\build.js:203:23)
prebuild ERR! build     at ChildProcess.emit (node:events:511:28)
prebuild ERR! build     at ChildProcess._handle.onexit (node:internal/child_process:293:12)

so I'm going to remove that first #if in #149

verhovsky added a commit that referenced this pull request Jun 22, 2023
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.

None yet

5 participants