vala-lang / vala-language-server

Code Intelligence for Vala & Genie
GNU Lesser General Public License v2.1
291 stars 43 forks source link

Necessary vapi should gen by gnome.generate_vapi(), but target be removed #124

Closed soiamsoNG closed 4 years ago

soiamsoNG commented 4 years ago

Describe the bug Necessary vapi should gen by gnome.generate_vapi(), which depended by other target, compilation fail and syntax completion not work.

fail after below point project.vala:142: Project: target #0 (gupnp-1.0.vapi@cus) will be removed

Software OS and version : Fedora 32 Code editor: VSCode Vala Language Server : 0.48-1 copr Vala version : 0.48.6

To Reproduce

I want to apply a .metadata file to make some fix to the library existing on the system but don't want to install in to the system. Keep it under my project. below is the meson file It work with the usual command meson build;cd build;ninja. But fail under the vala-language-server.

meson.build

project('vala app', 'vala', 'c')
gnome = import('gnome')
meta_dir = meson.current_source_dir()/'src'

dependencies = [
    dependency('glib-2.0'),
    dependency('gobject-2.0'),
    dependency('gssdp-1.0'),
    dependency('libsoup-2.4'),
    dependency('libxml-2.0'),
    gnome.generate_vapi('gupnp-1.0', metadata_dirs: meta_dir, sources: '/usr/share/gir-1.0/GUPnP-1.0.gir', packages: ['glib-2.0','gio-2.0','libsoup-2.4','gssdp-1.0','libxml-2.0'], vapi_dirs:['/usr/share/vala/vapi']),
    meson.get_compiler('c').find_library('gupnp-1.0'),
]

sources = files('src/main.vala')

executable('ssdp_exp', sources, dependencies: dependencies)

Below is the detail Debug info under the VSCode

(process:8607): vls-DEBUG: 10:47:19.144: server.vala:164: Finished constructing
(process:8607): GLib-GIO-DEBUG: 10:47:19.165: _g_io_module_get_default: Found default implementation gvfs (GDaemonVfs) for ?gio-vfs?
(process:8607): vls-DEBUG: 10:47:19.165: server.vala:210: [initialize] root path is /home/someone/project/valaproject
(process:8607): GLib-DEBUG: 10:47:19.168: posix_spawn avoided (workdir specified) (fd close requested) 
(process:8607): vls-DEBUG: 10:47:19.820: mesonproject.vala:210: MesonProject: obtaining a new file monitor for /home/someone/project/valaproject/meson.build ...
(process:8607): vls-DEBUG: 10:47:19.821: mesonproject.vala:219: MesonProject: configuring build dir /tmp/vls-meson-2170131331-IF12L0 ...
(process:8607): GLib-DEBUG: 10:47:19.821: posix_spawn avoided (workdir specified) (fd close requested) 
(process:8607): vls-DEBUG: 10:47:21.218: mesonproject.vala:129: MesonProject: loading file /tmp/vls-meson-2170131331-IF12L0/meson-info/intro-dependencies.json ...
(process:8607): vls-DEBUG: 10:47:21.219: mesonproject.vala:129: MesonProject: loading file /tmp/vls-meson-2170131331-IF12L0/meson-info/intro-targets.json ...
(process:8607): vls-DEBUG: 10:47:21.221: buildtask.vala:43: BuildTask(gupnp-1.0.vapi@cus): uses Vala file /usr/share/gir-1.0/GUPnP-1.0.gir

(process:8607): vls-WARNING **: 10:47:21.222: compilation.vala:153: Compilation(ssdp_exp@exe) ignoring argument #0 (-C)

(process:8607): vls-WARNING **: 10:47:21.223: compilation.vala:153: Compilation(ssdp_exp@exe) ignoring argument #1 (--debug)

(process:8607): vls-WARNING **: 10:47:21.223: compilation.vala:153: Compilation(ssdp_exp@exe) ignoring argument #2 (--debug)

(process:8607): vls-WARNING **: 10:47:21.223: compilation.vala:153: Compilation(ssdp_exp@exe) ignoring argument #13 (--color=always)

(process:8607): vls-WARNING **: 10:47:21.223: compilation.vala:153: Compilation(ssdp_exp@exe) ignoring argument #15 (ssdp_exp@exe)

(process:8607): vls-WARNING **: 10:47:21.223: compilation.vala:153: Compilation(ssdp_exp@exe) ignoring argument #17 (../../home/someone/project/valaproject/)
(process:8607): vls-DEBUG: 10:47:21.223: mesonproject.vala:458: MesonProject: loading file /tmp/vls-meson-2170131331-IF12L0/compile_commands.json ...
(process:8607): vls-DEBUG: 10:47:21.223: mesonproject.vala:514: MesonProject: found VAPI /tmp/vls-meson-2170131331-IF12L0/gupnp-1.0.vapi for compilation ssdp_exp@exe
(process:8607): vls-DEBUG: 10:47:21.224: mesonproject.vala:129: MesonProject: loading file /tmp/vls-meson-2170131331-IF12L0/meson-info/intro-buildsystem_files.json ...
(process:8607): vls-DEBUG: 10:47:21.224: project.vala:44: Project: analyzing build targets - producers and consumers ...
(process:8607): vls-DEBUG: 10:47:21.224: project.vala:52:   - gupnp-1.0.vapi@cus consumes /usr/share/gir-1.0/GUPnP-1.0.gir
(process:8607): vls-DEBUG: 10:47:21.224: project.vala:61:   - gupnp-1.0.vapi@cus produces /tmp/vls-meson-2170131331-IF12L0/gupnp-1.0.vapi
(process:8607): vls-DEBUG: 10:47:21.224: project.vala:52:   - ssdp_exp@exe consumes /tmp/vls-meson-2170131331-IF12L0/gupnp-1.0.vapi
(process:8607): vls-DEBUG: 10:47:21.224: project.vala:52:   - ssdp_exp@exe consumes /home/someone/project/valaproject/src/main.vala
(process:8607): vls-DEBUG: 10:47:21.224: project.vala:52:   - ssdp_exp@exe consumes /tmp/vls-meson-2170131331-IF12L0/gupnp-1.0.vapi
(process:8607): vls-DEBUG: 10:47:21.224: project.vala:142: Project: target #0 (gupnp-1.0.vapi@cus) will be removed
(process:8607): vls-DEBUG: 10:47:21.225: compilation.vala:233: Compilation(ssdp_exp@exe): will load input sources for the first time

(process:8607): vls-WARNING **: 10:47:21.225: compilation.vala:243: Compilation(ssdp_exp@exe): Failed to open file ?/tmp/vls-meson-2170131331-IF12L0/gupnp-1.0.vapi?: No such file or directory

(process:8607): vls-WARNING **: 10:47:21.225: compilation.vala:243: Compilation(ssdp_exp@exe): Failed to open file ?/tmp/vls-meson-2170131331-IF12L0/gupnp-1.0.vapi?: No such file or directory
(process:8607): GLib-DEBUG: 10:47:21.437: posix_spawn avoided (fd close requested) 
(process:8607): GLib-DEBUG: 10:47:21.460: posix_spawn avoided (fd close requested) 
(process:8607): vls-DEBUG: 10:47:21.518: girdocumentation.vala:59: adding GIR Gio-2.0 for package gio-2.0
(process:8607): vls-DEBUG: 10:47:21.519: girdocumentation.vala:59: adding GIR libxml2-2.0 for package libxml-2.0
(process:8607): vls-DEBUG: 10:47:21.519: girdocumentation.vala:59: adding GIR Soup-2.4 for package libsoup-2.4
(process:8607): vls-DEBUG: 10:47:21.520: girdocumentation.vala:59: adding GIR GSSDP-1.0 for package gssdp-1.0
(process:8607): vls-DEBUG: 10:47:21.520: girdocumentation.vala:76: did not add GIRs for these packages: 

(process:8607): vala-CRITICAL **: 10:47:24.139: vala_symbol_get_name: assertion 'self != NULL' failed
Prince781 commented 4 years ago

Can you try this with VLS master and see if you have the same problem?

soiamsoNG commented 4 years ago

Have the same problem, below is the debug info

(process:8860): vls-DEBUG: 09:13:19.187: project.vala:44: Project: analyzing build targets - producers and consumers ...
(process:8860): vls-DEBUG: 09:13:19.187: project.vala:52:   - gupnp-1.0.vapi@cus consumes /usr/share/gir-1.0/GUPnP-1.0.gir
(process:8860): vls-DEBUG: 09:13:19.187: project.vala:61:   - gupnp-1.0.vapi@cus produces /tmp/vls-meson-2170131331-FIG8L0/gupnp-1.0.vapi
(process:8860): vls-DEBUG: 09:13:19.187: project.vala:52:   - gupnp_exp@exe consumes /tmp/vls-meson-2170131331-FIG8L0/gupnp-1.0.vapi
(process:8860): vls-DEBUG: 09:13:19.187: project.vala:52:   - gupnp_exp@exe consumes /home/someone/project/valaproject/src/main.vala
(process:8860): vls-DEBUG: 09:13:19.187: project.vala:52:   - gupnp_exp@exe consumes /tmp/vls-meson-2170131331-FIG8L0/gupnp-1.0.vapi
(process:8860): vls-DEBUG: 09:13:19.187: project.vala:142: Project: target #0 (gupnp-1.0.vapi@cus) will be removed
(process:8860): vls-DEBUG: 09:13:19.188: compilation.vala:234: Compilation(gupnp_exp@exe): will load input sources for the first time
(process:8860): vls-WARNING **: 09:13:19.188: compilation.vala:244: Compilation(gupnp_exp@exe): Failed to open file ?/tmp/vls-meson-2170131331-FIG8L0/gupnp-1.0.vapi?: No such file or directory

(process:8860): vls-WARNING **: 09:13:19.188: compilation.vala:244: Compilation(gupnp_exp@exe): Failed to open file ?/tmp/vls-meson-2170131331-FIG8L0/gupnp-1.0.vapi?: No such file or directory