Skip to content

Commit 17eb224

Browse files
dcbakerjpakkane
authored andcommitted
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.
1 parent bfd0678 commit 17eb224

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## Using Vala no longer requires C in the project languages
2+
3+
Meson will now add C automatically. Since the use of C is an implementation
4+
detail of Vala, Meson shouldn't require users to add it.

mesonbuild/interpreter/interpreter.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1187,13 +1187,12 @@ def should_skip_sanity_check(self, for_machine: MachineChoice) -> bool:
11871187
return False
11881188
return should
11891189

1190-
def add_languages_for(self, args, required, for_machine: MachineChoice):
1190+
def add_languages_for(self, args: T.List[str], required: bool, for_machine: MachineChoice) -> None:
11911191
args = [a.lower() for a in args]
11921192
langs = set(self.coredata.compilers[for_machine].keys())
11931193
langs.update(args)
1194-
if 'vala' in langs:
1195-
if 'c' not in langs:
1196-
raise InterpreterException('Compiling Vala requires C. Add C to your project languages and rerun Meson.')
1194+
if 'vala' in langs and 'c' not in langs:
1195+
args.append('c')
11971196

11981197
success = True
11991198
for lang in sorted(args, key=compilers.sort_clink):

test cases/failing/93 vala without c/meson.build

-2
This file was deleted.

test cases/failing/93 vala without c/test.json

-7
This file was deleted.

0 commit comments

Comments
 (0)