Commit Graph

9887 Commits

Author SHA1 Message Date
Nirbheek Chauhan 4c93da6531 project tests: Rename a variable for clarity 2020-09-17 22:25:37 +00:00
Nirbheek Chauhan ea46daa7bc Revert "windows: reduce chance of going over path limit in backend/vs"
This reverts commit 807f88739e.
2020-09-17 20:39:37 +00:00
Dylan Baker e9fea0fecf unittests: mock os.environ before mucking with it 2020-09-17 11:26:50 +00:00
Dylan Baker 80ec7ec681 tests: Make monkey patching smarter
There are two problems here. The first is that we're doing manual monkey
patching which is fragile and verbose, when unittest.mock is designed
specifically to solve this exact problem. The second is that we're
monkey patching os.environ at two different levels with the same
information. So let's only do it once.
2020-09-17 11:26:50 +00:00
Peter Harris 807f88739e windows: reduce chance of going over path limit in backend/vs
When building with vs2019 (not ninja), a path length error will be thrown
if the path to a resource file is even remotely deep within the tree.

This is largely because the target name includes the string "Windows
resource for file 'full path'", which is then expanded twice (once for
the .vcxproj itself, and once for IntDir) and added to the full path.
When combined with the tiny path limits on Windows, it is easy to exceed
path limits.

This error is largely avoided by the ninja back-end. Unlike the
vs back-end, the ninja back-end does not use target.get_id() as part of
the project file path, nor does it use target.get_id() as part of
get_target_private_dir().

Example error:

error MSB4184: The expression "[MSBuild]::NormalizePath(
C:\src\mesonbuild\Misc\FreeRDP-master\client\X11\xfreerdp\xfreerdp,
f3f7317@@Windows resource for file
'Misc_FreeRDP-master_client_X11_xfreerdp_xfreerdp_xfreerdp.rc'@cus\,
f3f7317@@Windows resource for file
'Misc_FreeRDP-master_client_X11_xfreerdp_xfreerdp_xfreerdp.rc'@cus.
vcxproj.CopyComplete)" cannot be evaluated. Path:
C:\src\mesonbuild\Misc\FreeRDP-master\client\X11\xfreerdp\xfreerdp\f3f7317
@@Windows resource for file
'Misc_FreeRDP-master_client_X11_xfreerdp_xfreerdp_xfreerdp.rc'@cus\f3f7317
@@Windows resource for file
'Misc_FreeRDP-master_client_X11_xfreerdp_xfreerdp_xfreerdp.rc'@cus.
vcxproj.CopyComplete exceeds the OS max path limit.
The fully qualified file name must be less than 260 characters.
2020-09-17 11:24:53 +00:00
Martin Storsjö deb1d7caba Canonicalize target architectures aarch64/armv* into arm64/arm for MSVC tools
If the architectures are taken from the output of "clang-cl --version",
we need to convert these names into names that the MSVC tools accept
as the -machine: parameter.
2020-09-17 11:23:36 +00:00
Marco Mastropaolo 93b1d31af9 Fixed MacOS dylib custom targets not marked as linkable 2020-09-17 11:22:41 +00:00
Dylan Baker 3526b36a77 linkers: fully type annotate and fix mypy issues
This makes GnuDynamicLinker not suitable for instantiation, so the tests
need to be changed to use the BFD class.
2020-09-16 20:28:56 -07:00
Dylan Baker 4401668c9a linkers/compilers: Move an emscripten method to the compiler
This needed an attribute the linker doesn't have.
2020-09-16 20:28:56 -07:00
Dylan Baker 67ab2880dd linkers: Make id a class variable for DynamicLinkers
Originally I had this idea that you'd be able to pass the id in to be
able to deduplicate some cases (like ld.gold and ld.bfd). That went away
because it ended up being really un-dry, but this id per instance
remained. Getting rid of it allows us to get rid of a bunch of otherwise
useless super calls, which makes adding type annotations easier.
2020-09-16 20:28:56 -07:00
Dylan Baker fc86df3d2c linkers: Fix argument error
The name of the argument passed was not the name of the argument used.
2020-09-16 20:28:56 -07:00
Dylan Baker a4a53237f1 envconfig: fix return type of get_env_var_pair
It doesn't return (None, None), it returns just None.
2020-09-16 01:32:19 +03:00
Sebastian Meyer a24fde6fde
Add support for the CompCert C Compiler
* Add preliminary support for the CompCert C Compiler

The intention is to use this with the picolibc, so some GCC flags are
automatically filtered. Since CompCert uses GCC is for linking, those
GCC-linker flags which are used by picolibc, are automatically prefixed
with '-WUl', so that they're passed to GCC.

Squashed commit of the following:

commit 4e0ad66dca9de301d2e41e74aea4142afbd1da7d
Author: Sebastian Meyer <meyer@absint.com>
Date:   Mon Aug 31 14:20:39 2020 +0200

    remove '-fall' from default arguments, also filter -ftls-model=.*

commit 41afa3ccc62ae72824eb319cb8b34b7e6693cb67
Author: Sebastian Meyer <meyer@absint.com>
Date:   Mon Aug 31 14:13:55 2020 +0200

    use regex for filtering ccomp args

commit d68d242d0ad22f8bf53923ce849da9b86b696a75
Author: Sebastian Meyer <meyer@absint.com>
Date:   Mon Aug 31 13:54:36 2020 +0200

    filter some gcc arguments

commit 982a01756266bddbbd211c54e8dbfa2f43dec38f
Author: Sebastian Meyer <meyer@absint.com>
Date:   Fri Aug 28 15:03:14 2020 +0200

    fix ccomp meson configuration

commit dce0bea00b1caa094b1ed0c6c77cf6c12f0f58d9
Author: Sebastian Meyer <meyer@absint.com>
Date:   Thu Aug 27 13:02:19 2020 +0200

    add CompCert to meson (does not fully work, yet)

* remove unused import and s/cls/self/

fixes the two obvious LGTM warnings

* CompCert: Do not ignore unsupported GCC flags

Some are safe to ignore, however, as per
https://github.com/mesonbuild/meson/pull/7674, they should not be
ignored by meson itself. Instead the meson.build should take care to
select only those which are actually supported by the compiler.

* remove unused variable

* Only add arguments once.

* Apply suggestions from code review

Co-authored-by: Dylan Baker <dylan@pnwbakers.com>

* Remove erroneous ' ' from '-o {}'.format()

As noticed by @dcbaker

* added release note snippet for compcert

* properly split parameters

As suggested by @dcbaker, these parameters should be properly split into multiple strings.

Co-authored-by: Dylan Baker <dylan@pnwbakers.com>

* Update add_compcert_compiler.md

Added a sentence about the state of the implementation (experimental); use proper markdown

* properly separate arguments

Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2020-09-15 21:51:21 +03:00
Xavier Claessens 67c0ec1640 InternalDependency: Add as_link_whole() method 2020-09-14 20:32:22 -04:00
Christoph Reiter b872eea27f
CI: don't update MSYS2 [skip ci]
This should use the package database from the installer,
from the release choco provides and result in fewer potential
changes overall.
2020-09-15 01:51:38 +03:00
Dylan Baker 60f78e7981
CODEOWNERS: add dcbaker for compilers and linkers [skip ci]
I probably know more about that code than anyone else, so I'm probably
the right person to be reviewing stuff in there.
2020-09-15 00:13:53 +03:00
Xavier Claessens 8972c71522 externalproject: Fix typing annotation 2020-09-13 17:33:00 -04:00
Xavier Claessens 6ec0b535ba external-project: Add typing annotation 2020-09-13 13:54:47 -04:00
Xavier Claessens 9d338200da external-project: New module to build configure/make projects
This adds an experimental meson module to build projects with other
build systems.

Closes: #4316
2020-09-13 13:54:47 -04:00
Xavier Claessens 19696c3dcd Allow installing dir from build dir 2020-09-13 13:54:47 -04:00
Nirbheek Chauhan 7fbdf38ce3 mcompile: Add some basic XCode support
I wrote this to convert run_tests.get_backend_commands() over to the
new meson wrappers, but that turned out to be harder than I expected,
so just splitting this out for now.
2020-09-13 20:44:30 +03:00
Tamás Bálint Misius 9d017a9c15 Improve regexp for MSVC target arch detection again 2020-09-13 06:27:57 +00:00
Vili Väinölä 416b47c915 Remove redudant checks in vs2010 backend
- Implicit include dirs was checked twice in a row
- Add define only if it does not yet exist rather than remove.
2020-09-13 06:27:00 +00:00
Vili Väinölä 25ad10e501 Add VS include directories to projects as well
- "Go To Document" action previously only worked
on c/cpp files which had the include directories
 set but it was not possible to move from header to another header.
2020-09-13 06:27:00 +00:00
Nirbheek Chauhan 1945f381b2 unit tests: Print total time taken for running tests 2020-09-11 23:27:15 +00:00
Nirbheek Chauhan c7adeac137 unit tests: Don't use pytest when running single tests
On my machine this spawns 24 processes and then runs like the single
test I asked it to run. With this change, running a single test goes
from 7 seconds to less than a second.
2020-09-11 23:27:15 +00:00
Jon Turney 6053da7a00 Add build machine compilers to project tests compiler report
When cross-compiling, also report build machine compilers in the
compiler report produced by run_project_tests.py
2020-09-11 20:45:09 +00:00
Jon Turney 6a56291a2a Add a test run of MSVC ARM64 cross on Windows x64
Add a cross-file for MSVC UWP ARM64.

Bump cidata tag to get an updated install.ps1 script (run by run.ps1)
which sets the vcvars environment correctly when cross-compiling.

Since arranging the correct environment for simultaneous cross and
native 'cl' use is hard, this is test run uses '--cross-only' so we
don't require a native compiler.

Extend '--cross-only' so it also explicitly uses a machine file which
makes all build machine compilers unusable.
2020-09-11 20:45:09 +00:00
Jon Turney a908404e6d Fix test 'common/122 llvm ir and assembly' for Windows ARM 2020-09-11 20:45:09 +00:00
Jon Turney 1d5fef89f0 Skip test 'common/121 shared modules' on Windows UWP 2020-09-11 20:45:09 +00:00
Jon Turney 77930d80c3 Store first line of VisualStudio compiler output as full_version
Store the first line of VisualStudio compiler output as full_version,
so it gets output when we report compiler details.
2020-09-11 20:45:09 +00:00
Eli Schwartz d880f995ea Revert "Do not automatically set warning flags if buildtype is 'plain'"
This reverts commit 8ee1c9a07a.

No rationale was given for this change prior to merging. After the fact
it was described as desired by distro packagers, however as a distro
packager I believe this commit hurts me.

From a distro packaging perspective, we primarily care about one thing:
previously building code should still build. Hence, -Werror is bad for
our use case. meson handles this via -D werror which is different from
-D warning_level and as long as the former is disabled, warnings in the
build do not cause harm (but may attract review attention for upstream
to fix).

buildtype is a completely unrelated concern, and the intention for
=plain is to disable debug or optimization settings that result in
codegen differences and thus different built artifacts. This must not
happen in distro builds because the *distributed programs* should
conform to policy settings.

Unfortunately, completely disabling warnings happens silently, and
cannot be overridden even if you really, really believe you know what
you're doing. It is thematically broken, since use of
add_project_arguments() to add more -W flags is not likewise ignored.
But if you try to add -Wall in that manner, meson will lecture you to
use warning_level which you cannot do. And if you have custom warning
flags which depend on options enabled by judicious use of -Wall via
default_options: 'warning_level=1', then you end up with generated
warnings complaining about your command line rather than your code, such
as:

cc1: warning: ‘-Wformat-y2k’ ignored without ‘-Wformat’ [-Wformat-y2k]
cc1: warning: ‘-Wformat-extra-args’ ignored without ‘-Wformat’ [-Wformat-extra-args]
cc1: warning: ‘-Wformat-zero-length’ ignored without ‘-Wformat’ [-Wformat-zero-length]
cc1: warning: ‘-Wformat-contains-nul’ ignored without ‘-Wformat’ [-Wformat-contains-nul]
cc1: warning: ‘-Wformat-security’ ignored without ‘-Wformat’ [-Wformat-security]

which then break the build with -Werror.

Throughout all this, a buildtype of "plain" does *not* disable -D
werror=true, which is the part where distro builds actually break down!

Users who both wish to disable debug/optimization codegen, *and* disable
warning commentary, are encouraged to do so by doing both, not by doing
one and having the other be assumed.

Fixes #7399
2020-09-11 18:22:57 +00:00
Xavier Claessens 14c1a6983d msubprojects: Allow comma separated list of types 2020-09-10 11:39:30 -04:00
Xavier Claessens a3ac25b0c3 msubprojects: Fix review comments 2020-09-10 11:39:30 -04:00
Xavier Claessens 552432e507 git: Use Popen_safe to avoid encoding issues 2020-09-10 11:39:30 -04:00
Xavier Claessens 276c3fcb5a Move verbose_git() and quiet_git() to mesonlib 2020-09-10 11:39:30 -04:00
Xavier Claessens 8a9baab4d3 mesonlib: Move MesonException declaration to the top 2020-09-10 11:39:30 -04:00
Xavier Claessens 1101144d86 doc: Update new `meson subprojects` behaviors 2020-09-10 11:39:30 -04:00
Xavier Claessens d3c06bb023 msubprojects: Rework update command
Besides refactoring code into smaller functions:
- Makes the --rebase behaviour the default for consistency: it was
  already rebasing when current branch and revision are the same, it is
  less confusing to rebase when they are different too.
- Add --reset mode that checkout the new branch and hard reset that
  branch to remote commit. This new mode guarantees that every
  subproject are exactly at the wrap's revision.
- Local changes are always stashed first to avoid any data loss. In the
  worst case scenario the user can always check reflog and stash list to
  rollback.

Fixes: #7526
2020-09-10 11:39:30 -04:00
Xavier Claessens 8cb5e3d7d2 msubprojects: Return failure if some commands failed
If the command fails on some subprojects continue with the rest but
return non-0 code. This is useful for CI scripts to ensure it tests
latest code instead of old cached code in case of network error or
something.
2020-09-10 11:39:30 -04:00
Xavier Claessens 064f7241d8 msubprojects: Stash changes before checkout 2020-09-10 11:39:30 -04:00
Xavier Claessens 98d445a070 msubprojects: Support git subprojects with no wrap file
User could have cloned manually a subproject.
2020-09-10 11:39:30 -04:00
Xavier Claessens 3d443d84bd msubprojects: Use less cryptic "git branch --show-current" command
It describes well what it does, compared to obscure "rev-parse".
2020-09-10 11:39:30 -04:00
Xavier Claessens 400a35e9ea msubprojects: Add --type argument
It is often desired to only update git repositories and not pull
files from wrapdb.
2020-09-10 11:39:30 -04:00
Xavier Claessens 7ba0035db7 msubprojects: Use wrap.Resolver() to load all PackageDefinition
Besides being simpler, it has the advantage of picking directories that
don't have a .wrap file assotiated.
2020-09-10 11:39:30 -04:00
Nirbheek Chauhan 9fb839687b minstall: Add version field to install data
And check the install data in the same way that mtest checks
serialisation data.

Fixes https://github.com/mesonbuild/meson/issues/2354
2020-09-10 12:38:05 +00:00
Nirbheek Chauhan 8bb3f16f09 mtest: Refactor test data checking 2020-09-10 12:38:05 +00:00
Nirbheek Chauhan fb7099c6cf mtest: Check version in the test data after loading
Same as coredata.dat and build.dat loading. Also, do not assert if
things change. Raise the appropriate exception.

Fixes https://github.com/mesonbuild/meson/issues/7613
2020-09-10 08:18:16 +00:00
Jon Turney 36600d7465 Add a test run in an environment which only has a cross compiler
Add '--cross-only' option to run_tests.py, so we can arrange not to run
tests in the 'native' suite when only a cross-compiler is available, as
they can't succeed.
2020-09-10 07:20:41 +00:00
Jon Turney 1480fdfa9a Add release note snippet 2020-09-10 07:20:41 +00:00