aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-12-14 10:59:36 -0800
committerJussi Pakkanen <jpakkane@gmail.com>2023-03-28 15:01:10 +0300
commit4a014d17240f50059e20ccae3e9faaa395bdbf98 (patch)
tree4b2ae56e23db1cee4d04d602bfb1e154259cba36 /test cases
parent65482497d326b0026eb11419d178d19b20ebe58b (diff)
downloadmeson-4a014d17240f50059e20ccae3e9faaa395bdbf98.zip
meson-4a014d17240f50059e20ccae3e9faaa395bdbf98.tar.gz
meson-4a014d17240f50059e20ccae3e9faaa395bdbf98.tar.bz2
Add support for meson.options as a replacement for meson_options.txt
We will still try to load `meson_options.txt` if `meson.options` doesn't exist. Because there are some advantages to using `meson.options` even with older versions of meson (such as better text editor handling) we will not warn about the existence of a `meson.options` file if a `meson_options.txt` file or symlink also exists. The name `meson.options` was picked instead of alternative proposals, such as `meson_options.build` for a couple of reasons: 1. meson.options is shorter 2. While the syntax is the same, only the `option()` function may be called in meson.options, while, it may not be called in meson.build 3. While the two files share a syntax and elementary types (strings, arrays, etc), they have different purposes: `meson.build` declares build targets, `meson.options` declares options. This is similar to the difference between C's `.c` and `.h` extensions. As an implementation detail `Interpreter.option_file` has been removed, as it is used exactly once, in the `project()` call to read the options, and we can just calculate it there and not store it. Fixes: #11176
Diffstat (limited to 'test cases')
-rw-r--r--test cases/warning/9 meson.options/meson.build3
-rw-r--r--test cases/warning/9 meson.options/meson.options1
-rw-r--r--test cases/warning/9 meson.options/subprojects/no-warn/meson.build1
-rw-r--r--test cases/warning/9 meson.options/subprojects/no-warn/meson.options1
l---------test cases/warning/9 meson.options/subprojects/no-warn/meson_options.txt1
-rw-r--r--test cases/warning/9 meson.options/test.json7
6 files changed, 14 insertions, 0 deletions
diff --git a/test cases/warning/9 meson.options/meson.build b/test cases/warning/9 meson.options/meson.build
new file mode 100644
index 0000000..59c3872
--- /dev/null
+++ b/test cases/warning/9 meson.options/meson.build
@@ -0,0 +1,3 @@
+project('options too old', meson_version : '>= 0.63')
+
+subproject('no-warn')
diff --git a/test cases/warning/9 meson.options/meson.options b/test cases/warning/9 meson.options/meson.options
new file mode 100644
index 0000000..b84ee83
--- /dev/null
+++ b/test cases/warning/9 meson.options/meson.options
@@ -0,0 +1 @@
+option('foo', type : 'string')
diff --git a/test cases/warning/9 meson.options/subprojects/no-warn/meson.build b/test cases/warning/9 meson.options/subprojects/no-warn/meson.build
new file mode 100644
index 0000000..f86fbf7
--- /dev/null
+++ b/test cases/warning/9 meson.options/subprojects/no-warn/meson.build
@@ -0,0 +1 @@
+project('has both no warn', meson_version : '>= 0.63')
diff --git a/test cases/warning/9 meson.options/subprojects/no-warn/meson.options b/test cases/warning/9 meson.options/subprojects/no-warn/meson.options
new file mode 100644
index 0000000..b84ee83
--- /dev/null
+++ b/test cases/warning/9 meson.options/subprojects/no-warn/meson.options
@@ -0,0 +1 @@
+option('foo', type : 'string')
diff --git a/test cases/warning/9 meson.options/subprojects/no-warn/meson_options.txt b/test cases/warning/9 meson.options/subprojects/no-warn/meson_options.txt
new file mode 120000
index 0000000..7b28df2
--- /dev/null
+++ b/test cases/warning/9 meson.options/subprojects/no-warn/meson_options.txt
@@ -0,0 +1 @@
+meson.options \ No newline at end of file
diff --git a/test cases/warning/9 meson.options/test.json b/test cases/warning/9 meson.options/test.json
new file mode 100644
index 0000000..f711924
--- /dev/null
+++ b/test cases/warning/9 meson.options/test.json
@@ -0,0 +1,7 @@
+{
+ "stdout": [
+ {
+ "line": "WARNING: Project targets '>= 0.63' but uses feature introduced in '1.1': meson.options file. Use meson_options.txt instead"
+ }
+ ]
+}