Repository: mesonbuild/meson

Issue:
Meson ignores Genie library project
**Describe the bug**
Meson ignores Genie library project and declared dependency in other projects

**To Reproduce**
Create a project with library subproject and executable subproject.
In library project, only one Genie source file (.gs)
Declare depency
In executable project, call previous dependency.
Run project (with ninja or other build system)

Archive with project : [test-meson.tar.gz](https://github.com/mesonbuild/meson/files/7498206/test-meson.tar.gz)

**Expected behavior**
Perfect build with library project, regardless source provided

**system parameters**
* Native build
* Ubuntu 21.10
* Python 3.9.7
* meson 0.60.0
* ninja 1.10.1



Discussion:
If you only have a .gs file then it is expected that meson won't recognize it as a meson subproject. Did you try adding a meson.build?

Alternatively, you can try using https://mesonbuild.com/External-Project-module.html
"Did you try adding a meson.build?" Yes, please read message above
(compressed project contains library project, with meson.build of course)
Temp fix : add vala source (or C source) to 'files' array in library project, dependency is recognized in other project

archived project for testing : [test-meson-2.tar.gz](https://github.com/mesonbuild/meson/files/7502706/test-meson-2.tar.gz)


I read your message above and saw:

> library subproject and executable subproject

And, since the word "subproject" has a *very* specific meaning as described at https://mesonbuild.com/Subprojects.html, I took you at your word that you were in fact using subprojects.

Also I have no idea what Genie is. I am aware of one possible meaning at https://github.com/bkaradzic/GENie which is a competing build system, but double-checking it seems that that uses .lua files...
open archive

root (meson.build)
|_ lib project (meson.build)
   |_ "my_dep = declare_dependency ...."
|_ src project (meson.build)
   |_ my_dep in executable dependencies doesn't exist in build commands or log
   
   
  Genie : https://wiki.gnome.org/Projects/Genie
  a genie file (with .gs extension)
  
 If a library project contains only .gs file, the dependency doesn't work. If you add another file (vala, C, C++, ...) the build passes

> If a library project

No. If a library target. Projects are very different from targets and using the completely wrong name will cause people to be confused and not initially know what you are trying to say.

Also. I ran your test case and was indeed able to reproduce the problem (now that I understand it).

Resolving patch:
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1402,7 +1402,7 @@ def determine_dep_vapis(self, target):
             for i in dep.sources:
                 if hasattr(i, 'fname'):
                     i = i.fname
-                if i.endswith('vala'):
+                if i.split('.')[-1] in compilers.lang_suffixes['vala']:
                     vapiname = dep.vala_vapi
                     fullname = os.path.join(self.get_target_dir(dep), vapiname)
                     result.add(fullname)


Test patch: