interpreter: Automatically add 'c' to languages when 'vala' is used

This is so dumb, we can just insert C for you without you having to know
that you're using C under the hood. This is nicer because:
1) Meson doesn't make the user add a language they're not explicitly
   using
2) If there was ever an implementaiton of Vala that didn't use C as
   it's assembly language, this wouldn't make any sense.
This commit is contained in:
Dylan Baker authored and Jussi Pakkanen committed 2021-05-19 23:28:17 +03:00
1 parent bfd06783bd
commit 17eb224aa7
4 files changed
+7 -13

No files matched your search

@@ -0,0 +1,4 @@
## Using Vala no longer requires C in the project languages
Meson will now add C automatically. Since the use of C is an implementation
detail of Vala, Meson shouldn't require users to add it.
+3 -4
View File
@@ -1187,13 +1187,12 @@ external dependencies (including libraries) must go to "dependencies".''')
return False
return should
def add_languages_for(self, args, required, for_machine: MachineChoice):
def add_languages_for(self, args: T.List[str], required: bool, for_machine: MachineChoice) -> None:
args = [a.lower() for a in args]
langs = set(self.coredata.compilers[for_machine].keys())
langs.update(args)
if 'vala' in langs:
if 'c' not in langs:
raise InterpreterException('Compiling Vala requires C. Add C to your project languages and rerun Meson.')
if 'vala' in langs and 'c' not in langs:
args.append('c')
success = True
for lang in sorted(args, key=compilers.sort_clink):
@@ -1,2 +0,0 @@
project('vala without c')
add_languages('vala')
@@ -1,7 +0,0 @@
{
"stdout": [
{
"line": "test cases/failing/93 vala without c/meson.build:2:0: ERROR: Compiling Vala requires C. Add C to your project languages and rerun Meson."
}
]
}