summaryrefslogtreecommitdiff
path: root/mesonbuild/templates
AgeCommit message (Collapse)Author
2025-12-01templates: simplify (whitespace, flatten array)Sam James
2025-12-01templates: fix remaining languages for source file discovery tooSam James
I missed this in 9104bb616766bd9a05f0b2f280359463d32e227d as we were only testing whitelisted languages for source file discovery. Tests now handle all of these by using the map we have in compilers, as we need to know the suffix to use for the invalid source files we inject. Note that for tests, we mix explicit --lang in some cases and not others, which we could probably do better with. For these 'must fail' tests, I've stuck with explicit `--lang` to make sure we're testing what we want, but the others are perhaps up for debate. Bug: https://github.com/mesonbuild/meson/issues/15286
2025-12-01templates: fix --executableSam James
* In 1.7.1, the behaviour of --executable was to just ignore it. * After my recent 9104bb616766bd9a05f0b2f280359463d32e227d, the behaviour was that we'd require, for --executable xyz, xyz.c to exist or we'd fail to generate. Neither are good! Instead, create the sample source file w/ the project name, but call the executable whatever the user passed with `--executable`. Bug: https://github.com/mesonbuild/meson/issues/15286
2025-11-28templates: Define a macro for pubic APIs on OS/2KO Myung-Hun
2025-11-23templates: respect parametersSam James
Respect collected sources for `meson init` as well as --executable. This regressed in 9f0ac314ba0c54cc18c2499845324efc14c1849e (part of https://github.com/mesonbuild/meson/pull/14086, it's easier to see how with the whole PR). Also, add subtests (distinguishing between empty directories and those with some file(s) within). We already had some of these but they weren't marked as such. Test `meson init` with a broken source file in the source directory as we should fail with that, not ignore the file. It's easier to test with a broken file than a working one as we can assert the build should fail, it'll pass with just the 1 example file we generate. Closes: https://github.com/mesonbuild/meson/issues/15286
2025-05-04templates: add missing space to cpp templateheather7283
2025-04-04templates: Fix style by adding space after ifPaul Caprioli
2025-01-08templates: use library() instead of shared_library()Dylan Baker
2025-01-08templates: Use modern pkgconfig generator APIDylan Baker
2025-01-08templates: add meson.override_dependency()Dylan Baker
2025-01-08templates: re-use existing template code for existing librariesDylan Baker
This reduces duplication around the meson version, default options, etc. It also allows us to use the default initialization for libraries
2025-01-08templates: plumb dependencies into the new project templateDylan Baker
The command line value exists, and we'll want it soon.
2025-01-08templates: Don't overwrite files that existDylan Baker
This is going to allow us to re-use the implementation for the "create a new project" in the "add meson for an existing project" path.
2025-01-08templates: replace abc.abstractproperty with abc.abstractmethod and propertyDylan Baker
because abstractproperty is deprecated
2025-01-08templates: standardize Meson formattingDylan Baker
We have all kinds of formatting, different indents, different line break standards.
2025-01-08templates: use a proper context manager with openDylan Baker
2025-01-08templates: avoid repeating ourselvesDylan Baker
2025-01-08templates: remove 'c' from vala projectsDylan Baker
Meson has added 'c' automatically to vala projects since 0.59, since the minimum version is now 1.0 this isn't needed
2025-01-08templates: Add a Meson versionDylan Baker
Without a version certain kinds of warnings will be suppressed, which is bad. I've picked 1.0 because it's pretty old, except for Rust where I've maintained the 1.3.0 requirement
2025-01-08templates: Update copyright informationDylan Baker
Intel's copyright was missing on these.
2024-12-09modernize Rust templatePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-07-25templates: use common classes for remaining languagesDylan Baker
These all break down into either a single file or a file + header. This means a little more customization per class, but not too much.
2023-07-25templates: use a common template for C# and JavaDylan Baker
The only real differences between these generators is the file extension and the templates themselves. We can uses a shared abstract class with a few abstract properties to provide all of this to the same base class. This results in less code duplication and easier maintanence. I've made a few cleanups to the shared template: - use `str.capitalize()` instead of `str.upper()[0] + str[1:]` - use `open` as a context manager - use f-strings - put some duplicate calculations in the initializer
2023-07-25templates: fix typo in function name `sameple` -> `sample`Dylan Baker
2023-07-25templates: move initializer to base classDylan Baker
Every class implements the exact same initializer, simplify this by putting it in the base class initializer
2023-07-25templates/samplefactory: move type checking only import to special blockDylan Baker
Don't import things we don't actually need at runtime
2023-07-25minit: use a Protocol for argumentsDylan Baker
Which gives better type hinting. It also points out that we're changing the type of sourcefiles. That's now fixed
2023-02-01treewide: add future annotations importEli Schwartz
2022-11-17Fix a typo in the CUDA templateZihua Wu
The original version will output something like `xtakes no arguments`, and the modified version will correctly output `x takes no arguments`.
2022-01-27flake8: fix indentation styleEli Schwartz
2021-11-16Add vala templateAlberto Fanjul
2021-08-15editorconfig: add setting to trim trailing whitespaceEli Schwartz
and clean up all outstanding issues Skip 'test cases/common/141 special characters/meson.build' since it intentionally uses trailing newlines.
2021-06-29fix: Always explicitly set encoding for text files (fixes #8263)Daniel Mensinger
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz
performed by running "pyupgrade --py36-plus" and committing the results
2020-09-08typing: Fix templatesDaniel Mensinger
2020-04-01cuda: Fix meson template (fixes #6869)Daniel Mensinger
2020-04-01Fix meson_jar_templateJan Alexander Steffens (heftig)
It was generating an extra comma. The Meson build system Version: 0.54.0 Source dir: /tmp/tmp34halxhe Build dir: /tmp/tmp34halxhe/build Build type: native build meson.build:6:15: ERROR: Expecting rparen got comma. 'Foo.java',, ^ For a block that started at 5,3 jar('tmp34halxhe', ^ A full log can be found at /tmp/tmp34halxhe/build/meson-logs/meson-log.txt Using "tmp34halxhe" (name of current directory) as project name. Using "tmp34halxhe" (project name) as name of executable to build. Detected source files: Foo.java Detected language: java Generated meson.build file: project('tmp34halxhe', 'java', version : '0.1', default_options : ['warning_level=3']) jar('tmp34halxhe', 'Foo.java',, main_class: tmp34halxhe, install : true) It was also missing quotes around the main class name. The Meson build system Version: 0.54.0 Source dir: /tmp/tmpjm5cg44a Build dir: /tmp/tmpjm5cg44a/build Build type: native build Project name: tmpjm5cg44a Project version: 0.1 Java compiler for the host machine: javac (unknown 1.8.0) Host machine cpu family: x86_64 Host machine cpu: x86_64 meson.build:5:0: ERROR: Unknown variable "tmpjm5cg44a". A full log can be found at /tmp/tmpjm5cg44a/build/meson-logs/meson-log.txt Using "tmpjm5cg44a" (name of current directory) as project name. Using "tmpjm5cg44a" (project name) as name of executable to build. Detected source files: Foo.java Detected language: java Generated meson.build file: project('tmpjm5cg44a', 'java', version : '0.1', default_options : ['warning_level=3']) jar('tmpjm5cg44a', 'Foo.java', main_class: tmpjm5cg44a, install : true)
2020-03-19sample factory implementationMichael
2020-03-08add logic for Java jar projectMichael
2020-02-22tests: Ensure that executable and library are named differentlyNirbheek Chauhan
On Windows, the basename is used to determine the name of the PDB file. So for a project called myproject, we will create myproject.dll and myproject.exe, both of which will have myproject.pdb. This is a file collision. Instead, append `_test`, similar to the C# template. Fixes AllPlatformTest.test_templates on MSVC. This became a hard error when we started listing PDBs in the implicit outputs list of ninja targets. Do the same for a test that was making the same mistake.
2020-02-02add new templatesMichael
2019-12-31Make D template work even if dub is not available.Jussi Pakkanen
2019-11-02Minit templates modularizationMichael Hirsch, Ph.D