diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-04-27 12:19:58 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-05-19 23:28:17 +0300 |
commit | 17eb224aa7e7af17b50c39a224db54f895af578d (patch) | |
tree | 92e7c977afcfa5425bfc03bf16f21ce33eeec122 | |
parent | bfd06783bd999a59fb0a375d35c25a4ae7b3e17e (diff) | |
download | meson-17eb224aa7e7af17b50c39a224db54f895af578d.zip meson-17eb224aa7e7af17b50c39a224db54f895af578d.tar.gz meson-17eb224aa7e7af17b50c39a224db54f895af578d.tar.bz2 |
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.
-rw-r--r-- | docs/markdown/snippets/vala-no-longer-requires-c.md | 4 | ||||
-rw-r--r-- | mesonbuild/interpreter/interpreter.py | 7 | ||||
-rw-r--r-- | test cases/failing/93 vala without c/meson.build | 2 | ||||
-rw-r--r-- | test cases/failing/93 vala without c/test.json | 7 |
4 files changed, 7 insertions, 13 deletions
diff --git a/docs/markdown/snippets/vala-no-longer-requires-c.md b/docs/markdown/snippets/vala-no-longer-requires-c.md new file mode 100644 index 0000000..5744877 --- /dev/null +++ b/docs/markdown/snippets/vala-no-longer-requires-c.md @@ -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. diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 484db78..170092d 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -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): diff --git a/test cases/failing/93 vala without c/meson.build b/test cases/failing/93 vala without c/meson.build deleted file mode 100644 index ce39d5d..0000000 --- a/test cases/failing/93 vala without c/meson.build +++ /dev/null @@ -1,2 +0,0 @@ -project('vala without c') -add_languages('vala') diff --git a/test cases/failing/93 vala without c/test.json b/test cases/failing/93 vala without c/test.json deleted file mode 100644 index 6185b7e..0000000 --- a/test cases/failing/93 vala without c/test.json +++ /dev/null @@ -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." - } - ] -} |