167 Commits

Author SHA1 Message Date
3b6084ddf4 fix: type fixes
Type fixes caught by emmylua
2025-06-06 15:36:48 +01:00
4a0ee22e77 build: make makefile work on msys
Relying on $(OS) doesn't work as it's too naive, so we check if $PATH
contains a colon instead.

Closes https://github.com/neovim/neovim/issues/31027
2025-02-23 11:38:29 +01:00
198a952c13 build: add luals check
This automatically downloads and uses the correct luals binary for the
currently used system. `make luals` will run luals on all lua files in
`runtime`.

We download lua-language-server manually instead of relying on
contributors downloading it on their own (like with stylua) as
lua-language-server is updated frequently which may cause unnecessary
friction. Therefore, we download a pinned version of luals which we then
can manually bump when needed. This can be re-evaluated if luals becomes
more stable in the future.

Currently this is not run when using `make lint` since cmake style "file
caching" doesn't seem possible at the moment. This is because checking a
single file doesn't seem to work.

Work on https://github.com/neovim/neovim/issues/24563.
2025-02-09 18:10:54 +01:00
6a425e7045 docs: misc
Co-authored-by: Axel <axelhjq@gmail.com>
Co-authored-by: Colin Kennedy <colinvfx@gmail.com>
Co-authored-by: Daiki Noda <sys9kdr@users.noreply.github.com>
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Co-authored-by: Jean-Jacq du Plessis <1030058+jj-du-plessis@users.noreply.github.com>
Co-authored-by: Juan Giordana <juangiordana@gmail.com>
Co-authored-by: Lincoln Wallace <locnnil0@gmail.com>
Co-authored-by: Matti Hellström <hellstrom@scm.com>
Co-authored-by: Steven Locorotondo <steven.locorotondo@justeattakeaway.com>
Co-authored-by: Yochem van Rosmalen <git@yochem.nl>
Co-authored-by: glepnir <glephunter@gmail.com>
Co-authored-by: ifish <fishioon@live.com>
2025-01-11 10:34:12 +01:00
e268fcbdaa build: work around bug in make when PATH includes cmake as dir
There appears to be a bug in `make` where if a rule asks `make` to
invoke a command called `foo`, and `foo` exists somewhere in `$PATH` as
a directory (not an executable file), `make` will attempt to `execve`
that directory instead of continuing to search in later parts of the
`$PATH` for `foo` as a true executable.

The cause can be traced back to a bug in Make 4.3 which stems from their
use of the findprog function in Gnulib. This was reported to the Make
maintainers here:

https://savannah.gnu.org/bugs/index.php?57962

and then forwarded to the Gnulib maintainers here:

https://github.com/coreutils/gnulib/commit/7b1de4a

Make 4.4 does not have this bug, and I can confirm that I'm able to run
make in the Neovim repo with no further modifications to my system than
upgrading the version of make I'm using to 4.4 or 4.4.1.

As the change is small enough, and it's unlikely that make version
around the world is going to be updated in a timely manner, it makes
sense to just add a workaround for this. Using `command -v` to resolve
the `cmake` command, similar to what is already being done with
`cmake3`, makes it work correctly in all cases. Continuing to include
`... || echo cmake` at the end means that if neither `cmake3` nor
`cmake` are installed, the user will still see a message about CMake
being missing.

Co-authored-by: Jake Zimmerman <zimmerman.jake@gmail.com>
2024-09-20 22:16:34 +02:00
ef8067a19d build: add quotes around CMAKE_GENERATOR variable
This will fix the following error when using generators that have a
space in them, e.g. "Unix Makefiles":

"CMake Error: Could not create named generator Unix".

Closes https://github.com/neovim/neovim/issues/30218.
2024-09-02 17:37:15 +02:00
4ee65484b1 build: make makefile work on windows
Using powershell as the default windows shell as using cmd alters $PATH
in a way that makes building neovim fail (powershell prioritizes visual
studio tools which is arguably more correct).

This was tested with gnu make for windows, which can be installed with
e.g. scoop. It does not work with nmake and it is extremely unlikely we
want to add nmake support as the makefile is merely supposed to be
syntactic sugar for the most common case. For similar reasons, the only
supported generator is ninja.
2024-08-31 23:05:36 +02:00
3085c9d9da revert: "Makefile: use pattern rules for build/.deps (#10366)"
This reverts commit 7f6ff829aa.

The given reasoning and usecase is unsatisfactory. While it is true that
it allows to run `make build/bin/nvim`, it can easily be recreated with
`ninja -C build bin/nvim` which does the exact same thing. This minor
convenience is not worth adding the extra code given how rare this
usecase should be.
2024-08-28 12:37:29 +02:00
a75ef40f4c build: set deps default build type to Release (#27495)
Debugging dependencies is rare so a Debug build type is usually not
needed. In cases where it _is_ needed it is easy to rebuild in Debug
mode. But since Release builds are more common, it makes more sense as a
default.

For Neovim itself we stick with a Debug build as a default, since
rebuilding and debugging is done _much_ more frequently than with
dependencies (which we _mostly_ expect to "just work").

Also remove the CMAKE_BUILD_TYPE variable in the Makefile, since this is
set by default in CMake.
2024-02-16 11:56:52 -06:00
01e82eba20 build(docs): separate lint job to validate vimdoc #27227
Summary: Separate the lint job (`make lintdoc`) to validate runtime/doc,
it is no longer as a part of functionaltest (help_spec).

Build (cmake) and CI:

- `make lintdoc`: validate vimdoc files and test-generate HTML docs.
  CI will run this as a part of the "docs" workflow.

- `scripts/lintdoc.lua` is added as an entry point (executable script)
  for validating vimdoc files.

scripts/gen_help_html.lua:

- Move the tests for validating docs and generating HTMLs from
  `help_spec.lua` to `gen_help_html`. Added:
  - `gen_help_html.run_validate()`.
  - `gen_help_html.test_gen()`.

- Do not hard-code `help_dir` to `build/runtime/doc`, but resolve from
  `$VIMRUNTIME`. Therefore, the `make lintdoc` job will check doc files
  on `./runtime/doc`, not on `./build/runtime/doc`.

- Add type annotations for gen_help_html.
2024-01-28 14:22:39 -08:00
ae3eed53d6 build: various build improvements
- remove "ran-" prefix from touch files as it's redundant since the
  they're already in the directory named `touches`.
- Include `contrib` when formatting with `make formatlua`.
- Use TARGET_FILE generator expression instead of assuming the
  executable location.
- reuse logic that determines whether to use lua or luajit.
- add translations to the `nvim` target.

Makefile improvements:
- rename variable `CMAKE_PRG` to `CMAKE` to make it more consistent with
  the builtin `MAKE` variable.
- stop propagating flags to generator. Users should use cmake for
  non-standard use cases.
- remove `+` prefix from targets. If the user for whatever reason wants
  to dry-run a target then they should be able to.
2024-01-24 12:41:09 +01:00
af93a74a0f refactor: run IWYU on entire repo
Reference: https://github.com/neovim/neovim/issues/6371.
2023-12-21 17:38:42 +01:00
8533adb484 refactor(IWYU): move decor provider types to decoration_defs.h (#26692) 2023-12-21 16:50:05 +08:00
6abdc1ac1f refactor: split WIN_EXECUTE() into two functions (#26627) 2023-12-18 09:05:59 +08:00
d82a586a9e refactor: move some anonymous enums back to non-defs headers (#26622)
It isn't really useful to put anonymous enums only used as arguments to
functions calls in _defs.h headers, as they will only be used by a file
that calls those functions, which requires including a non-defs header.

Also move os_msg() and os_errmsg() back to message.h, as on Windows they
are actual functions instead of macros.

Also remove gettext.h and globals.h from private/helpers.h.
2023-12-18 06:18:11 +08:00
69bc519b53 refactor: move non-symbols to defs.h headers 2023-12-17 19:03:18 +01:00
1457272726 refactor(IWYU): move marktree types to marktree_defs.h (#26402) 2023-12-05 20:05:12 +08:00
0bbe8e7fc2 refactor(IWYU): fix includes for highlight_group.h (#26340) 2023-12-01 09:38:04 +08:00
09e93d7c4d refactor(IWYU): create {ex_getln,rbuffer,os/fileio}_defs.h (#26338) 2023-12-01 08:06:37 +08:00
a6f26c86cb refactor(IWYU): fix includes for cmdhist.h (#26324) 2023-11-30 22:48:15 +08:00
c8e37a589a refactor(IWYU): move typedefs out of globals.h (#26322) 2023-11-30 19:52:23 +08:00
ce56e0a845 refactor(IWYU): move UI and LineFlags to ui_defs.h (#26318) 2023-11-30 17:16:57 +08:00
86cc791deb refactor: move function macros out of vim_defs.h (#26300) 2023-11-29 23:10:21 +08:00
a6cba103ce refactor: move some constants out of vim_defs.h (#26298) 2023-11-29 20:32:40 +08:00
64b53b71ba refactor(IWYU): create normal_defs.h (#26293) 2023-11-29 12:10:42 +08:00
79b6ff28ad refactor: fix headers with IWYU 2023-11-28 22:23:56 +01:00
71e954ad30 refactor(IWYU): fix includes for ugrid.h (#26267) 2023-11-28 17:01:27 +08:00
1a8f60c7d2 refactor: move hashtab types to hashtab_defs.h (#26262) 2023-11-28 10:47:22 +08:00
718053b7a9 refactor: fix runtime_defs.h (#26259) 2023-11-28 07:47:36 +08:00
e3f735ef10 refactor: fix includes for api/autocmd.h 2023-11-27 21:53:07 +01:00
f9231603c4 refactor: fix includes for iconv.h 2023-11-27 21:52:34 +01:00
ab7c0e9904 refactor: create runtime_defs.h 2023-11-27 21:35:21 +01:00
f4aedbae4c build(IWYU): fix includes for undo_defs.h 2023-11-27 19:33:17 +01:00
40139738eb build: enable IWYU on mac 2023-11-27 15:50:45 +01:00
38a20dd89f build(IWYU): replace most private mappings with pragmas (#26247) 2023-11-27 20:58:37 +08:00
574d25642f refactor: move Arena and ArenaMem to memory_defs.h (#26240) 2023-11-27 17:21:58 +08:00
6343d41436 refactor: move autocmd types to autocmd_defs.h (#26239) 2023-11-27 11:17:04 +08:00
7e2387f41b build(clint): more precise check for "defs" headers (#26236) 2023-11-27 08:34:06 +08:00
71141e8cf5 build(IWYU): fix headers for arabic.h 2023-11-26 22:15:53 +01:00
6361806aa2 refactor: move garray_T to garray_defs.h (#26227) 2023-11-26 22:58:52 +08:00
34509bbea3 build: sync IWYU and clint to ignore the same headers (#26228)
Also fix headers for autocmd.c.
2023-11-26 22:34:29 +08:00
ce6075f82a build: add check to clint to prevent non-defs header includes
Also enable iwyu on headers, but add an ignore for each file separately.

Work on https://github.com/neovim/neovim/issues/6371.
2023-11-26 15:06:51 +01:00
a827003e30 build: rework IWYU mapping files
Create mapping to most of the C spec and some POSIX specific functions.
This is more robust than relying files shipped with IWYU.
2023-11-25 17:41:33 +01:00
5cefec7349 build: various cmake fixes
- silence false warnings on MSVC
- merge `clang-tidy` cmake target into `lintc` and remove the
  corresponding make target
- use cmake's built-in endianness detection
2023-11-04 18:32:47 +01:00
6c0f900699 ci: enable clang-analyzer warnings
This adds the checks in https://neovim.io/doc/reports/clang/ when using
clang-tidy. The strategy is to enable all clang-analyzer checks, and
disable only the checks for the warnings that exist currently. This
allows us to eliminate each warning type without blocking ongoing work,
but also without adding bugs for already eliminated warnings.

The plan is to eventually eliminate https://neovim.io/doc/reports/clang/
by completely integrating it into the clang-tidy check.

Also add make and cmake targets `clang-analyzer` to run this check.
2023-10-09 16:52:28 +02:00
5bb17958c5 build: fix "make iwyu" not working (#24873) 2023-08-26 17:20:40 +08:00
2234b84a1b docs(generators): bake into cmake 2023-08-23 12:16:04 +01:00
48d533272e feat(lua-types): types for vim.api.* (#24523) 2023-08-01 14:20:44 +01:00
fd9ac5aa8e build(makefile): remove a phony target uninstall (#24349)
`uninstall` target was removed from makefile
2023-07-14 15:51:15 +02:00
ebb10d6248 build: remove functionaltest-lua target
It's not needed anymore as it does the exact same thing as
functionaltest. The functionaltest target will test the lua type neovim
was built with, which can be toggled with the PREFER_LUA option.
2023-05-24 21:14:47 +02:00