Commit Graph

165 Commits

Author SHA1 Message Date
Wolfgang Stöggl f037e7ef45 Fix typos found by codespell
- Typos were found by codespell v1.16.0
2019-11-06 09:55:30 -05:00
Aaron Plattner b626978dc6 Add missing newlines to "meson introspect" error
The lack of newlines in the print() statement for this error causes the result
to be jumbled and hard to read:

 $ ./meson.py introspect
 Current directory is not a meson build directory.Please specify a valid build dir or change the working directory to it.It is also possible that the build directory was generated with an oldmeson version. Please regenerate it in this case.

Add newlines so the message is more readable:

 $ ./meson.py introspect
 Current directory is not a meson build directory.
 Please specify a valid build dir or change the working directory to it.
 It is also possible that the build directory was generated with an old
 meson version. Please regenerate it in this case.
2019-10-18 00:48:00 +03:00
Peter Hutterer 4ebce2c3f2 Add test priorities to force test start order 2019-08-24 21:26:41 +03:00
Daniel Mensinger 3b3f53ab55 mintro: Fix section key in buildoptions
This reverts the changes to the `section` key for the
buildoptions and moves the machine choice into it's
own `machine` key.

With this commit the __undocumented__ breaking change
to the introspection format (introduced in 0.51.0) is
reverted and a new key is added instead.
2019-07-17 19:20:33 +03:00
Daniel Mensinger 54b1c43277 mintro: Add installed subdirs introspection (fixes #5556) 2019-07-01 11:28:54 -07:00
John Ericson af2d7af998 Per machine do 'build.' and '' option prefixes
See the docs/ changes for details.
2019-06-05 23:05:34 -04:00
Paolo Bonzini 9491878681 meson-introspect: do not include host environment in test/benchmark introspection
The host environment could change between the time "meson setup"
produces intro-tests.json, and the time "meson test" is run.
Including it only adds clutter to the introspection data.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-05-28 20:18:10 +03:00
Dylan Baker 146e97e974 Use dependency cache 2019-05-20 10:05:36 -07:00
John Ericson 4030e7cb7a UserOption no longer has a name field.
This avoids the duplication where the option is stored in a dict at its
name, and also contains its own name. In general, the maxim in
programming is things shouldn't know their own name, so removed the name
field just leaving the option's position in the dictionary as its name.
2019-05-15 14:21:47 +03:00
Daniel Mensinger 3581839f4c
Fix unused variables warnings 2019-04-29 12:22:50 +02:00
Daniel Mensinger 2b5831f94f
Fix flake8-bugbear warnings 2019-04-29 12:22:50 +02:00
Dylan Baker 5678468c2c Don't use len() to test for container emptiness
I ran the numbers once before (it's in the meson history) but it's
*much* faster to *not* use len for testing if a container is empty or
not.
2019-04-25 12:28:51 -07:00
Daniel Mensinger d72d98d3af mintro: removed deprecated --target-files API 2019-04-08 21:06:15 +03:00
Daniel Mensinger 7074f12644
mintro: Renamed --dependencies --> --scan-dependencies 2019-03-03 23:19:04 +01:00
Daniel Mensinger 185dc8c2e5
mintro: Fix unit test 2019-03-03 23:19:04 +01:00
Daniel Mensinger f9da03fb7b
mintro: Address code review 2019-03-03 23:19:03 +01:00
Daniel Mensinger f9b41d5ecb
mintro: Dependencies from source 2019-03-03 23:19:03 +01:00
Daniel Mensinger 8a1411a1e8
Target introspection from source 2019-03-03 23:19:03 +01:00
Daniel Mensinger 98e60f59ac
Minor introspection refactoring 2019-03-03 23:19:03 +01:00
Daniel Schulte f0b0bcf86d mintro: Add subproject_dir to --projectinfo 2019-03-01 23:40:33 +02:00
Daniel Schulte 924cf5e622 mintro: Add name of subproject the target is contained in to --target output 2019-03-01 22:29:52 +02:00
Jussi Pakkanen a32f31fdfa
Merge pull request #4826 from mensinda/confDefOpts
mconf: Use introspection to print the project default options (fixes #2543)
2019-02-12 20:00:34 +02:00
Daniel Mensinger 71d174bcbe
Fixed some code issues 2019-02-05 11:18:57 +01:00
John Ericson 19f81d3e33 Never access environment.properties downstream
Instead use coredata.compiler_options.<machine>. This brings the cross
and native code paths closer together, since both now use that.

Command line options are interpreted just as before, for backwards
compatibility. This does introduce some funny conditionals. In the
future, I'd like to change the interpretation of command line options so

 - The logic is cross-agnostic, i.e. there are no conditions affected by
   `is_cross_build()`.

 - Compiler args for both the build and host machines can always be
   controlled by the command line.

 - Compiler args for both machines can always be controlled separately.
2019-02-02 13:59:14 -05:00
Daniel Mensinger 750af9c853
Moved the introspection interpreter 2019-01-22 16:09:34 +01:00
Daniel Mensinger ccad493e85
Basic AST visitor pattern 2019-01-22 16:09:34 +01:00
Daniel Mensinger af38722f89 mintro: Introspection interpreter refactoring (#4733)
* Fixed spelling

* Merged the Buildoptions and Projectinfo interpreter

* Moved detect_compilers to Environment

* Added removed test case

* Split detect_compilers and moved even more code into Environment

* Moved set_default_options to coredata

* Small code simplification in mintro.run

* Move cmd_line_options back to `environment`

We don't actually wish to persist something this unstructured, so we
shouldn't make it a field on `coredata`. It would also be data
denormalization since the information we already store in coredata
depends on the CLI args.
2019-01-16 23:42:54 +02:00
Daniel Mensinger 609ecba37f mintro: Added `defined_in` key in the targets introspection 2019-01-15 20:28:12 +02:00
Daniel Mensinger 96f354ebde
Load source dir from meson-info.json 2019-01-13 19:04:57 +01:00
Daniel Mensinger 243eca6cee
mintro: Check meson-info.json version instead of loading coredata 2019-01-13 19:01:38 +01:00
Jussi Pakkanen 49557e15ec
Merge pull request #4731 from mensinda/introBreak2
mintro: Changes to the introspection API
2019-01-13 19:50:10 +02:00
John Ericson 913c87b327 `environment.cross_info.need_cross_compiler()` doesn't exist
It is no longer needed either.
2019-01-10 23:02:23 +02:00
Daniel Mensinger 5c139032b8
Deprecated --target-files API 2019-01-07 22:35:56 +01:00
Daniel Mensinger a1d8c1d3e9
Changed introspection target format 2019-01-07 22:24:49 +01:00
Daniel Mensinger b82cbbdd4c
Fixed missing newline 2019-01-06 22:20:15 +01:00
Daniel Mensinger ab32f1fe00 Added meson-info.json 2019-01-06 22:03:29 +01:00
Daniel Mensinger 38241f5fce Introspection refactoring 2019-01-06 22:03:21 +01:00
Daniel Mensinger bcb8146280
Indent flag only toggles 2019-01-06 12:19:35 +01:00
Daniel Mensinger aa6e3dc470
Fixed flake8 issues 2019-01-06 12:19:34 +01:00
Daniel Mensinger 9c214f4a70
Fixed buildoptions form source 2019-01-06 12:19:34 +01:00
Daniel Mensinger 25618c6a4d
Atomic write 2019-01-06 12:19:34 +01:00
Daniel Mensinger bd8bad46c3
Code cleanup and renamed variables 2019-01-06 12:19:33 +01:00
Daniel Mensinger 63e16fbcc3
Fixed flake8 2019-01-06 12:19:32 +01:00
Daniel Mensinger e1719c5d37
Load coredata 2019-01-06 12:19:32 +01:00
Daniel Mensinger 02734cc5c3
Better documentation 2019-01-06 12:19:31 +01:00
Daniel Mensinger c33df1fd73
Revert to old behavior 2019-01-06 12:19:31 +01:00
Daniel Mensinger 3588786138
Some small fixes 2019-01-06 12:19:31 +01:00
Daniel Mensinger 84948ea6cd
Renamed `--force-new` to `--force-dict-output` 2019-01-06 12:19:31 +01:00
Daniel Mensinger 2e81631d0c
Keep 'filename' and 'install_filename' as strings 2019-01-06 12:19:31 +01:00
Daniel Mensinger 7691b0460c
Ninja backend target introspection 2019-01-06 12:19:30 +01:00
Daniel Mensinger d4ac832bf6
Split the monolithic introspection file into chunks 2019-01-06 12:19:29 +01:00
Daniel Mensinger b11df88395
Documentation and unit test update 2019-01-06 12:19:29 +01:00
Daniel Mensinger b034f52656
Filenames are now lists 2019-01-06 12:19:29 +01:00
Daniel Mensinger b91c5aad85
Update intro dump on meson configure 2019-01-06 12:19:29 +01:00
Daniel Mensinger 24d668bea0
Removed determine_installed_path since it is no longer needed 2019-01-06 12:19:28 +01:00
Daniel Mensinger 4addd176db
Removed fallback detection logic 2019-01-06 12:19:28 +01:00
Daniel Mensinger a5be893b19
Some code cleanup 2019-01-06 12:19:28 +01:00
Daniel Mensinger 74274e23ca
Moved the source and compiler generation to the backend 2019-01-06 12:19:28 +01:00
Daniel Mensinger 71d17b44e4
Fixed list_target_files and list_targets 2019-01-06 12:19:28 +01:00
Daniel Mensinger a0d478da39
More refactoring 2019-01-06 12:19:27 +01:00
Daniel Mensinger 98eb7a48ab
Added unit test 2019-01-06 12:19:27 +01:00
Daniel Mensinger b2854e9edc
Fixed rebase error 2019-01-06 12:19:27 +01:00
Daniel Mensinger 111e596200
Fixed tests and benchmarks 2019-01-06 12:19:27 +01:00
Daniel Mensinger f4285f350e
Initial automatic target file generation 2019-01-06 12:19:27 +01:00
Daniel Mensinger a6034d1f19
Added option to force use the new format 2019-01-06 12:15:10 +01:00
Daniel Mensinger 8288555aa1
mintro: Added option to introspect multiple parameters at once 2019-01-06 12:15:10 +01:00
Daniel Mensinger 1a0e1afbdd
Updated format to include sources 2019-01-06 12:15:10 +01:00
mensinda 9d13855544
Fixed hardcode is_cross = False 2019-01-06 12:15:10 +01:00
Daniel Mensinger 0a12594847
Added include_directories and extra_args keys to target introspection 2019-01-06 12:15:04 +01:00
Daniel Mensinger 64372d5cfc
Do not require build dir for introspection 2018-12-29 23:55:45 +01:00
Daniel Mensinger 6864ed60dd mintro: Bug fix for determine_installed_path for multiple target outputs 2018-12-20 23:03:55 +02:00
Daniel Schulte f954eee906 Remove name property from introspect --projectinfo as it is not used 2018-11-26 23:12:00 +01:00
Daniel Schulte 0e62193730 mintro: Allow introspect --projectinfo without build directory.
This variant was added to allow introspection before configuring a build
directory. This is useful for IDE integration to allow displaying and/or
setting options for the initial configuration of the build directory.

It also allows showing basic information about the project even if it's
not yet configured or configuring failed.

The project 'name' field in --projectinfo is used inconsistently:
For the top level project it always shows the name configured in
the top level meson.build file. For subprojects it's referring to the
name of the directory the subproject's meson.build is contained in.

To have a consistent output and preserve the existing behavior this adds
the 'descriptive_name' field which always shows the name set in the
project.

To be consistent the 'descriptive_name' field was also added to the
--projectfiles variant that uses an already configured build.

It also extends the information shown with the list of buildsystem-files.
This is currently only implemented in the variant for unconfigured
projects.
2018-11-26 23:12:00 +01:00
Daniel Schulte bdc9f6846c mintro: Split list_buildsystem_files into generation and command function 2018-11-26 23:10:53 +01:00
Daniel Mensinger 1759fc8f45
Sorted arrays alphabetically 2018-11-24 10:57:22 +01:00
Daniel Mensinger 1f48aa595d
Added 'section' key to buildoptions introspection 2018-11-24 09:49:33 +01:00
Xavier Claessens 37067a53c4 Use a single ArgumentParser for all subcommands
This has the adventage that "meson --help" shows a list of all commands,
making them discoverable. This also reduce the manual parsing of
arguments to the strict minimum needed for backward compatibility.
2018-10-04 09:40:21 -04:00
Xavier Claessens 1e6d72eb5a Remove useless __main__ in files that cannot be executed 2018-08-22 15:15:54 -04:00
Nirbheek Chauhan 96b7fdb723 macos: Rewrite install_name for dependent built libraries on install
On macOS, we set the install_name for built libraries to
@rpath/libfoo.dylib, and when linking to the library, we set the RPATH
to its path in the build directory. This allows all built binaries to
be run as-is from the build directory (uninstalled).

However, on install, we have to strip all the RPATHs because they
point to the build directory, and we change the install_name of all
built libraries to the absolute path to the library. This causes the
install name in binaries to be out of date.

We now change that install name to point to the absolute path to each
built library after installation.

Fixes https://github.com/mesonbuild/meson/issues/3038
Fixes https://github.com/mesonbuild/meson/issues/3077

With this, the default workflow on macOS matches what everyone seems
to do, including Autotools and CMake. The next step is providing a way
for build files to override the install_name that is used after
installation for use with, f.ex., private libraries when combined with
the install_rpath: kwarg on targets.
2018-06-18 06:33:23 +00:00
Thibault Saunier aee9b5a518 mintro: Fix introspecting installation paths
A new custom_install_mode element was added in 05c43cdcd
2018-06-08 12:18:16 +00:00
Nirbheek Chauhan 68001193d3 meson introspect: Fix --installed argument
Traceback (most recent call last):
  File "meson.py", line 29, in <module>
    sys.exit(mesonmain.main())
  File "mesonbuild/mesonmain.py", line 411, in main
    return run(sys.argv[1:], launcher)
  File "mesonbuild/mesonmain.py", line 320, in run
    return mintro.run(remaining_args)
  File "mesonbuild/mintro.py", line 234, in run
    list_installed(installdata)
  File "mesonbuild/mintro.py", line 72, in list_installed
    for path, installdir, aliases, unknown1, unknown2 in installdata.targets:
ValueError: too many values to unpack (expected 5)
2018-06-06 06:59:06 +00:00
Nirbheek Chauhan 6485f04c16 introspect: Fix listing target files that are File objects 2018-05-09 21:01:00 +05:30
Andrei Alexeyev e9860cff41 introspect: default builddir to . to prevent a crash
Fixes #3250
2018-04-11 21:43:59 +03:00
Jussi Pakkanen 9b2e533d87 Always build parser objects anew to avoid leaking old data. 2018-03-27 00:39:45 +03:00
Thibault Saunier f48da481ab introspect: tests: Inform about tests run parallelization 2018-03-18 20:29:35 +02:00
Hemmo Nieminen 7fb8e518b2 Harmonize data pickling.
Try to be more consistent on using save() and load() methods to pickle
data.
2018-03-01 01:06:51 +02:00
Jussi Pakkanen 0204895143 Expose integer options to build option files. 2018-02-07 22:10:04 +02:00
Aleksey Filippov 2cf85ae16f Use os.path: basename() and dirname() instead of split()
According to Python documentation[1] dirname and basename
are defined as follows:
    os.path.dirname() = os.path.split()[0]
    os.path.basename() = os.path.split()[1]
For the purpose of better readability split() is replaced
by appropriate function if only one part of returned tuple
is used.

[1]: https://docs.python.org/3/library/os.path.html#os.path.split
2018-01-30 07:08:22 +11:00
Eric Engestrom 3d63f21b60 Fix `array` type name
c9351ce30c introduced the type as `array`,
so mintro should expose it under the same name.

(while at it, rename test 169 to be coherent)
2017-12-07 21:31:50 +02:00
Jussi Pakkanen 4ae0cadb7f Renamed UserStringArrayOption to UserArrayOption for short. 2017-12-07 00:00:34 +02:00
Eric Engestrom 5f7f5cdb05 Print correct command in help message
Taking mconf for instance:
before:
  $ meson configure --help
  usage: meson [-h] [-D SETS] [--clearcache] [directory [directory ...]]
after:
  $ meson configure --help
  usage: meson configure [-h] [-D SETS] [--clearcache] [directory [directory ...]]
2017-11-09 21:12:34 +02:00
Eric Engestrom 74967bd1d1 introspect: print `build_by_default` field 2017-11-09 21:12:08 +02:00
Martin Ejdestig 76c1faf8bf Modify mesonintrospect --dependencies so 1 element in list is 1 dependency
Makes it less awkward for tools to parse the data.

Was modified to return a list, with two elements for each dependency,
instead of a dictionary in ac1c929f66 .

Closes #2018.
2017-07-20 12:43:55 +02:00
Jussi Pakkanen fa9fde5029 Storage object has changed so use values(). Closes #1963. 2017-06-19 16:45:09 -04:00
Elliott Sales de Andrade e66465369d Use more direct dictionary literals. 2017-05-17 04:24:18 -04:00
Nirbheek Chauhan ac1c929f66 mesonintrospect: Print all deps, not just those with the same name
This breaks the API, but the original API was just broken.
2017-05-09 14:23:15 +05:30
Quentin Glidic 10c435fabe mesonintrospect: List all installed files
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-05-08 20:21:29 +02:00
Nirbheek Chauhan b3d5db49e8 mesonintrospect: Normalize install_filename in the output
Without this, we can output a mixture of '/' and '\' on platforms where
os.path.sep is '\' and prefix or outdir uses '/'. Let's always return
the path in the format of the platform we're running on.

This is needed to make the test_install_introspection() unittest work
properly on Windows.
2017-02-18 02:38:54 +05:30
Nirbheek Chauhan 67d3d512ff mesonintrospect: Also print builtins for --buildoptions
This is needed to be able to introspect the value of xxxdir options such
as libdir and prefix.
2017-02-18 02:37:32 +05:30
Thibault Saunier 1d6147a592 Fix mesonintrospect --installed
The prefix has been recently added to the install data
2017-01-26 22:48:02 +02:00