Commit Graph

265 Commits

Author SHA1 Message Date
Sergey Slipchenko
f859d16aea
fix(tests): set SHELL=sh #24941
Problem:
Some tests fail with $SHELL=fish #6172
Related: https://github.com/neovim/neovim/pull/6176

Solution:
Replace "echo -n" with "printf", because "echo" in sh may be provided
as a shell builtin, which does not accept an "-n" flag to avoid a
trailing newline (e.g. on macos). "printf" is more portable (defined by
POSIX) and it does not output a trailing newline by itself.
Fixes #6172

TODO:
Other test failures may be related to "session leader" issue: https://github.com/neovim/neovim/issues/2354
Checked by running `:terminal ./build/bin/tty-test` from Nvim with
`shell=/bin/fish` (inherited from `$SHELL`) and it indeed complains
about "process does not own the terminal". With `shell=sh` it doesn't complain. And
unsetting `$SHELL` seems to make `nvim` to fall back to `shell=sh`.

    FAILED   test/functional/terminal/tui_spec.lua @ 1017: TUI paste: terminal mode
    test/functional/terminal/tui_spec.lua:1024: Row 1 did not match.
    Expected:
      |*tty ready                                         |
      |*{1: }                                                 |
      |*                                                  |
      |                                                  |
      |{5:^^^^^^^                                           }|
      |{3:-- TERMINAL --}                                    |
      |{3:-- TERMINAL --}                                    |
    Actual:
      |*process does not own the terminal                 |
      |*                                                  |
      |*[Process exited 2]{1: }                               |
      |                                                  |
      |{5:^^^^^^^                                           }|
      |{3:-- TERMINAL --}                                    |
      |{3:-- TERMINAL --}                                    |

    To print the expect() call that would assert the current screen state, use
    screen:snapshot_util(). In case of non-deterministic failures, use
    screen:redraw_debug() to show all intermediate screen states.

    stack traceback:
        test/functional/ui/screen.lua:622: in function '_wait'
        test/functional/ui/screen.lua:352: in function 'expect'
        test/functional/terminal/tui_spec.lua:1024: in function <test/functional/terminal/tui_spec.lua:1017>

    FAILED   test/functional/terminal/tui_spec.lua @ 1551: TUI forwards :term palette colors with termguicolors
    test/functional/terminal/tui_spec.lua:1567: Row 1 did not match.
    Expected:
      |*{1:t}ty ready                                         |
      |                                                  |
      |*                                                  |
      |                                                  |
      |{2:^^^^^^^                                           }|
      |                                                  |
      |{3:-- TERMINAL --}                                    |
    Actual:
      |*{1:p}rocess does not own the terminal                 |
      |                                                  |
      |*[Process exited 2]                                |
      |                                                  |
      |{2:^^^^^^^                                           }|
      |                                                  |
      |{3:-- TERMINAL --}                                    |

    To print the expect() call that would assert the current screen state, use
    screen:snapshot_util(). In case of non-deterministic failures, use
    screen:redraw_debug() to show all intermediate screen states.

    stack traceback:
        test/functional/ui/screen.lua:622: in function '_wait'
        test/functional/ui/screen.lua:352: in function 'expect'
        test/functional/terminal/tui_spec.lua:1567: in function <test/functional/terminal/tui_spec.lua:1551>
2023-09-11 10:01:00 -07:00
dundargoc
9f8f287c61 build: remove luarocks
Luarocks is no longer needed after
25e51d393a.
2023-09-10 15:32:47 +02:00
bfredl
25e51d393a build(lua): vendor coxpcall
Do not require luarocks on PUC lua CI just because of this single lua file
2023-09-10 11:43:37 +02:00
Sergey Slipchenko
87db6d894a fix(deps): make sure --force-config takes effect
Fixes #24881

--force-config passed to luarocks' configure script is only taken into
account in case "make install" is used afterwards.

But if "make bootstrap" is used then this flag has no effect. And it can
actually copy an existing config on the system to the new installation.
That existing config can have a different version of Lua set by default.
In which case luarocks will install packages for that version instead of
the one used in tests. And trying to run tests then will fail because of
missing packages.
2023-09-09 18:41:36 +02:00
bfredl
6985e12cae refactor(build): derocksify luacheck 2023-09-07 15:26:30 +02:00
dundargoc
c50951a4d0
build: various fixes
- simplify lua interpreter search
- fix incorrect variable name in BuildLua.cmake
- build PUC Lua with -O2
- silence non-mandatory find_package search for libuv
- simplify Find modules
- Prefer using the explicitly set CI_BUILD over relying on the
  environment variable "CI".
2023-09-04 00:00:26 +02:00
dundargoc
f30844008b
build: download busted from own neovim/deps repository
Downloading the necessary files all at once instead of doing dependency
handling with luarocks speeds up installation immensely. We speed up the
process even more by using luv as a replacement for the C modules in the
busted dependencies, which allows us to skip costly compilation times.

Co-authored-by: bfredl <bjorn.linse@gmail.com>
2023-09-03 00:38:10 +02:00
Justin M. Keyes
43ded8d358
feat(version): unverbose ":version", ":verbose version" #24195
Problem:
`nvim -v` and `:version` prints system vimrc, fallback files, and compilation
info by default, which most people don't care about and just clutters up the
output.

Solution:
Omit extra info unless 'verbose' is set.
2023-07-01 03:45:45 -07:00
dundargoc
46e95909bf
ci: introduce CI_LINT option
This will abort if lint programs are not found, and is meant primarily
for the lint job in CI. Supersedes the REQUIRED argument in
add_glob_target as it's a superior replacement by being a built-in
solution.
2023-06-24 00:29:53 +02:00
treatybreaker
199a990c9e
feat: report "build" in vim.version() #23925
Problem:
Nvim version string typically has a "build" component
but vim.version() doesn't report it.

Solution:
Add the "build" field to vim.version().

Closes #23863
2023-06-11 14:57:23 -07:00
dundargoc
8b8e607284
build: move luarocks and rocks installation to main build
This will ensure luacheck and busted are only installed when they're
actually needed. This cuts total build time by over 50%.

Closes https://github.com/neovim/neovim/issues/22797.
2023-05-21 20:57:39 +02:00
dundargoc
24b60b0f71
build: don't format deleted files
Trying to format deleted files will otherwise throw an error.
2023-05-18 16:28:46 +02:00
dundargoc
826b95203a
build: bundle uncrustify
Uncrustify is sensitive to version changes, which causes friction for
contributors that doesn't have that exact version. It's also simpler to
download and install the correct version than to have bespoke version
checking.
2023-05-18 16:27:47 +02:00
dundargoc
1086016477
build: cmake cleanup
- Simplify error checking when using execute_process.
- Set BUILD_SHARED_LIBS to OFF when building dependencies.
  This is normally not needed, but msgpack interprets an unset
  BUILD_SHARED_LIBS to build a shared library, which is the opposite of
  the cmake behavior.
- Move function check_lua_module to Util.cmake.
- Remove unnecessary code.
- Make variable naming more consistent
2023-05-13 12:12:29 +02:00
Lewis Russell
af040c3a07
feat(treesitter): add support for setting query depths 2023-05-11 11:13:32 +01:00
dundargoc
9f9cef1b56
build: make lpeg an imported library
Cmake truncates the full link path to a shared library if it is missing
an SONAME in some undocumented scenarios. This causes builds in some
systems to fail if "lpeg" isn't a library on the system path.

The path of imported libraries aren't modified by cmake, so we can use
that as a workaround until a proper solution for this has been
identified.

Closes https://github.com/neovim/neovim/issues/23395.
2023-04-30 23:57:15 +02:00
bfredl
45bcf83869 refactor(build): include lpeg as a library 2023-04-27 11:40:00 +02:00
dundargoc
0a3645a723
build: find system luv on ubuntu
Also use the system luv in CI for the with-external-deps job.
2023-04-19 00:47:15 +02:00
dundargoc
81f2bce775
build: cmake cleanup
- Change libtermkeyCMakeLists.txt to LibtermkeyCMakeLists.txt
- Remove duplicate mark_as_advanced calls in FindLibuv.cmake
- Fix "Enabling Clang sanitizer" messages as it's no longer clang-only
- Simplify parser installation syntax
- Rename tree-sitter to treesitter
2023-04-04 19:27:21 +02:00
bfredl
30632dd21a refactor(build): make installation of runtime/ more effective
Currently files to install in runtime/ is detected by recursive glob
pattern which has two problems:

- cmake needs to do a of work at config time and
  build/runtime/cmake_install.cmake becomes HUGE (2.5MB, biggest config file)
- we need to explicitly specify each file suffix used in the entire
  runtime, which is duplication of information.

These globs specify every single file in a subdirectory.
Thus, we can just install every runtime/ subdirectory as a single
install command. Furthermore, at the top-level, only .vim and .lua files
need to be installed.

Further possible refactor: we could move files which does not belong
in $PREFIX/runtime out of $REPO/runtime. Then runtime could be installed
with a single install_helper(DIRECTORY ...) command.
2023-03-07 20:16:52 +01:00
dundargoc
da0c66bcdd build: remove workaround for incorrectly packaged libluv
This removes a workaround for incorrectly packaged libluv in
90e44ecf11 as it should not be needed
anymore.
2023-03-05 21:13:28 +01:00
Biswapriyo Nath
ca3bc56a3b
build: silence git describe error output
This change will silence the warning from git describe command when the project
is built using source tarball. The warning is
fatal: not a git repository: 'neovim/.git'
2023-03-05 18:50:25 +01:00
Christian Clason
46c4cbced5
build(deps): bump msgpack-c to v6.0.0 (#22522)
* Remove C++ requirement if test is disabled
* Change CMake package name of C library to msgpack-c
* Unified all C package, library, cmake, tarball name become msgpack-c.
2023-03-04 17:26:24 +01:00
bfredl
848dac0aaa refactor(build): graduate unibilium VAR_FROM feature from 2017 2023-03-03 14:26:11 +01:00
bfredl
c9b6db4541 refactor(build): graduate msgpack-c FLOAT32 "feature" since forever 2023-03-03 14:26:10 +01:00
bfredl
c002fd421e refactor(build): graduate libtreesitter features which are 1+ years old 2023-03-03 14:25:20 +01:00
dundargoc
4cf4ae93df
build: cmake cleanup (#22251)
- Remove unused code
- Use consistent casing. Variable names such as LibLuV_LIBRARIES is
  needlessly jarring, even if the name might be technically correct.
- Use title casing for packages. find_package(unibilium) requires the
  find_module to be named "Findunibilium.cmake", which makes it harder
  to spot when scanning the files. Instead, use "Unibilium".
2023-03-02 22:50:43 +01:00
dundargoc
a0292b4e5f
build: remove libfindmacros library (#22423)
Large parts the library weren't being used, and the parts that were was overly
abstracted for our use case. Additionally, part of its use case was to abstract
pkgconfig boilerplate, which is no longer needed as pkgconfig has been removed
in favor of relying on cmake alone in 09118052ce.
2023-03-02 10:22:41 +01:00
dundargoc
1e37703a74
build: remove pkgconfig-related code (#22422)
Cmake should already be able to find everything on its own.
2023-02-26 22:32:08 +01:00
dundargoc
b62c0c8d9c
docs: fix typos (#21961)
Co-authored-by: Ben Morgan <cassava@iexu.de>
2023-02-20 15:12:59 +08:00
ii14
6dfabd0145
build: use libuv config file (#22209)
Libuv's recent changes in their pc file breaks cmake; they are using
-l:libuv.a for the linker, and it seems cmake can't resolve that.

Prefer using their cmake config file instead instead, and use the find
module as a fall-back in case it fails.

Closes https://github.com/neovim/neovim/issues/22271.
2023-02-16 22:09:05 +01:00
Enan Ajmain
b4a92309f8
ci: print DLL copy messages only in CI environment (#22260)
In Windows, library DLL's are copied in the building process, and a message for each copy is printed. This is useful to have in the log of CI, but annoying to see when you're building and rebuilding nvim constantly. Work around this issue by only enabling the messages on CI.
2023-02-14 18:58:38 +01:00
dundargoc
f573fcbc0d
build: don't check environment variable to detect CI (#22234)
Instead use the cmake option, which should act as the definitive source
to determine whether we use CI or not.
2023-02-12 14:42:00 +01:00
bfredl
b8ad1bfe8b
Merge pull request #22077 from bfredl/neolua_client
refactor(tests): integrate lua-client into core and use core for functionaltests
2023-02-10 20:51:36 +01:00
dundargoc
4c64cbe99f
build: mark uninteresting variables as advanced (#22208)
Only the most important variables should be shown by default.
2023-02-10 20:20:18 +01:00
bfredl
d6279f9392 refactor(tests): move lua-client into core and use it for functionaltests
Eliminates lua-client and non-static libluv as test time dependencies

Note: the API for a public lua-client is not yet finished.
The interface needs to be adjusted to work in the embedded loop
of a nvim instance (to use it to talk between instances)
2023-02-10 20:19:04 +01:00
Christian Clason
07a6bc2be3
build(deps): bump libuv to HEAD - 62c2374a8 (#22166) 2023-02-08 14:37:04 +01:00
dundargoc
4d2c1004e9
build: prefer -D <variable>=<value> over -D<variable>=<value> (#22164)
This makes it easier to see that -D is referring to the entire
"<variable>=<value>", rather than only <variable>. It also help syntax
highlighters highlight built-in variables.
2023-02-08 11:00:16 +01:00
dundargoc
d38dfdca58
build: remove duplicate INTERFACE keyword (#22106) 2023-02-07 21:37:16 +01:00
dundargoc
f9826e1dff
build: stop relying on CMAKE_BUILD_TYPE to determine the build type (#22051)
Any logic involving CMAKE_BUILD_TYPE is automatically broken as it won't
work with multi-config generators. The only exception is if we
explicitly check whether the current generator is single-config as well.
Instead, use generator expressions or cmake variables that allows to set
options for certain build types only such as
INTERPROCEDURAL_OPTIMIZATION_<CONFIG>.

Opt to generate all headers with optimization level O2 with no debug
information for all build types as that is the simplest way to make it
behave the same for all generators.
2023-02-03 00:00:15 +01:00
bfredl
13aa23b62a refactor(tests): run unittests using main nvim binary in interpreter mode
This allows us to get rid of the separate "nvim-test" target
2023-01-31 19:28:26 +01:00
dundargoc
38365fa2ef
build: fix dependencies in find modules (#22017)
Find modules should only link to libraries defined in the find module,
and not the main project. This helps the find modules be more self-contained and easier to understand.
2023-01-27 14:16:31 +01:00
dundargoc
d85ed00a8c
build: find unibilium without relying on libfindmacros (#22015)
This will remove the warning about the find module not providing a
version.
2023-01-27 11:53:32 +01:00
dundargoc
843c9025ae
build: check if libvterm version meets requirement (#22010)
The vterm.h file only specifies major and minor version, but not patch,
meaning that requiring a specific patch number isn't currently possible.
2023-01-26 21:35:06 +01:00
dundargoc
4c5c6ca800
build: various cmake fixes (#21902)
* build: various cmake refactors and simplifications

- Add STATUS keyword to message to ensure messages are shown in the
  correct order.
- Remove DEPS_CXX_COMPILER as we don't rely on C++ for any of our
  dependencies.
- Simplify how msgpack and luv configure options are constructed.
- Rely on the default installation for luv instead of manually passing
  configure, build and install commands.
- Simplify return code conditional.

* build: remove CMAKE_OSX_ARCHITECTURES_ALT_SEP workaround

CMAKE_OSX_ARCHITECTURES_ALT_SEP was defined as a workaround to prevent
the shell from interpreting `;`, which CMake uses as a list separator.
However, the same thing can be achieved by instead passing
CMAKE_OSX_ARCHITECTURES as a cache variable instead, which is a more
idiomatic way of achieving the same thing.

* build: define CMAKE_BUILD_TYPE before adding it to BUILD_TYPE_STRING

The problem with the current setup is that CMAKE_BUILD_TYPE is defined
after BUILD_TYPE_STRING. BUILD_TYPE_STRING will then be empty on the
first run, meaning that dependencies are built without a build type.
However, since CMAKE_BUILD_TYPE is a cache variable its value will
persist in subsequent runs. On the second run BUILD_TYPE_STRING will
have the correct value, but it's a different value from the ones the
dependencies were built with. This will force some dependencies to be
built again.

Fixes https://github.com/neovim/neovim/issues/21672.
2023-01-20 23:48:46 +01:00
Enan Ajmain
7f7b83baef
build(Windows): fix redoing version generation (#21880)
Problem: On Windows, neovim's version is generated every time nvim is
built, even if code hasn't been changed.  That is because version
generation is done based on a hash matching of a file and the content of
the file.  And in Windows they don't match, because of the DOS
line-endings.

Solution: Write the file containing nvim version with UNIX line-endings.
2023-01-18 11:48:01 +01:00
dundargoc
69c71c4ab4
build: exclude tui/terminfo_defs.h from lintc-clint (#21822)
clint takes around 5-10 seconds to lint tui/terminfo_defs.h. For CI this
is negligible, but it's annoying for local development as touching
terminfo_defs.h will skyrocket lint times. Furthermore, we have no
reason to touch or modify terminfo_defs.h as it's a generated file, so
linting it shouldn't be necessary. This should speed up "make lint" by
the same amount, so around 5-10 seconds.
2023-01-15 19:30:17 +01:00
dundargoc
9220755302
build: remove clint error suppression #21782
Fix remaining clint errors and remove error suppression completely.

Rename the lint targets to align with the established naming convention:

- lintc-clint lints with clint.py.
- lintc-uncrustify lints with uncrustify.
- lintc runs both targets.

lintc is also provided as a make target for convenience.

After this change we can remove these files:
https://github.com/neovim/doc/tree/gh-pages/reports/clint
https://github.com/neovim/doc/blob/main/ci/clint-errors.sh
2023-01-13 15:48:10 -08:00
dundargoc
438b4361cc
build: use modern cmake (#21589)
Replace old-school cmake with the so-called "Modern CMake", meaning
preferring using targets and properties over directory settings and
variables. This allows greater flexibility, robustness and clarity over
how the code works.

The following deprecated commands will be replaced with their modern
alternatives that operates on a specific target, rather than all targets
in the current directory:

- add_compile_options -> target_compile_options
- include_directories -> target_include_directories
- link_libraries -> target_link_libraries
- add_definitions -> target_compile_definitions

There are mainly four main targets that we currently use: nvim, libnvim,
nvim-test (used by unittests) and ${texe} (used by
check-single-includes). The goal is to explicitly define the
dependencies of each target fully, rather than having everything be
dependent on everything else.
2023-01-10 18:49:57 +01:00
Jan Palus
a3f01d32cb
build: restrict git describe to top level source directory (#20993)
fix version determination when building neovim from release tarball
extracted within another git repository
2022-12-02 13:45:37 +01:00