mirror of
https://github.com/neovim/neovim
synced 2025-07-23 23:01:44 +00:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
8a6bb66e80 | |||
4553fc5e6c | |||
877d539904 | |||
60c3c92db1 | |||
d7cf93ce34 | |||
1060bfd033 | |||
f891131c6b | |||
9a5488c2a6 | |||
1793ba8176 | |||
947069ba14 | |||
46c7e12f27 | |||
b98be54148 | |||
f1843c0035 | |||
1204421888 | |||
aaa8c3d711 |
@ -1,44 +0,0 @@
|
||||
image: freebsd/12.x
|
||||
|
||||
packages:
|
||||
- cmake
|
||||
- gmake
|
||||
- ninja
|
||||
- libtool
|
||||
- sha
|
||||
- automake
|
||||
- pkgconf
|
||||
- unzip
|
||||
- wget
|
||||
- gettext
|
||||
- python
|
||||
- libffi
|
||||
|
||||
sources:
|
||||
- https://github.com/neovim/neovim
|
||||
|
||||
environment:
|
||||
SOURCEHUT: 1
|
||||
LANG: en_US.UTF-8
|
||||
CMAKE_EXTRA_FLAGS: -DCI_BUILD=ON -DMIN_LOG_LEVEL=3
|
||||
|
||||
tasks:
|
||||
- build-deps: |
|
||||
cd neovim
|
||||
gmake deps
|
||||
- build: |
|
||||
cd neovim
|
||||
gmake CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="${CMAKE_EXTRA_FLAGS}" nvim
|
||||
- functionaltest: |
|
||||
cd neovim
|
||||
gmake functionaltest
|
||||
- unittest: |
|
||||
cd neovim
|
||||
gmake unittest
|
||||
|
||||
# Unfortunately, oldtest is tanking hard on sourcehut's FreeBSD instance
|
||||
# and not producing any logs as a result. So don't do this task for now.
|
||||
# Ref: https://github.com/neovim/neovim/pull/11477#discussion_r352095005.
|
||||
# - test-oldtest: |
|
||||
# cd neovim
|
||||
# gmake oldtest
|
@ -1,43 +0,0 @@
|
||||
# sourcehut CI: https://builds.sr.ht/~jmk/neovim
|
||||
|
||||
image: openbsd/6.9
|
||||
|
||||
packages:
|
||||
- autoconf-2.71
|
||||
- automake-1.16.3
|
||||
- cmake
|
||||
- gettext-runtime-0.21p1
|
||||
- gettext-tools-0.21p1
|
||||
- gmake
|
||||
- libtool
|
||||
- ninja-1.10.2p0
|
||||
- unzip-6.0p14
|
||||
|
||||
sources:
|
||||
- https://github.com/neovim/neovim
|
||||
|
||||
environment:
|
||||
SOURCEHUT: 1
|
||||
LC_CTYPE: en_US.UTF-8
|
||||
CMAKE_EXTRA_FLAGS: -DCI_BUILD=ON -DMIN_LOG_LEVEL=3
|
||||
|
||||
tasks:
|
||||
- build-deps: |
|
||||
export AUTOCONF_VERSION=2.71
|
||||
export AUTOMAKE_VERSION=1.16
|
||||
mkdir neovim/.deps
|
||||
cd neovim/.deps
|
||||
cmake -G Ninja ../third-party/
|
||||
cmake --build . --config RelWithDebInfo
|
||||
- build: |
|
||||
mkdir neovim/build
|
||||
cd neovim/build
|
||||
cmake -G Ninja $CMAKE_EXTRA_FLAGS ..
|
||||
cmake --build . --config RelWithDebInfo
|
||||
./bin/nvim --version
|
||||
- functionaltest: |
|
||||
cd neovim/build
|
||||
cmake --build . --config RelWithDebInfo --target functionaltest
|
||||
- oldtest: |
|
||||
cd neovim
|
||||
gmake oldtest
|
2
.clangd
2
.clangd
@ -1,2 +0,0 @@
|
||||
CompileFlags:
|
||||
CompilationDatabase: build/ # Search build/ directory for compile_commands.json
|
@ -3,7 +3,6 @@ root = true
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
tab_width = 8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
charset = utf-8
|
||||
|
7
.gitattributes
vendored
7
.gitattributes
vendored
@ -1,7 +0,0 @@
|
||||
*.h linguist-language=C
|
||||
src/nvim/testdir/test42.in diff
|
||||
.github/ export-ignore
|
||||
ci/ export-ignore
|
||||
.travis.yml export-ignore
|
||||
codecov.yml export-ignore
|
||||
.builds/ export-ignore
|
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@ -1,2 +0,0 @@
|
||||
github: neovim
|
||||
open_collective: neovim
|
34
.github/ISSUE_TEMPLATE/bug_report.md
vendored
34
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -1,34 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Report a problem in Nvim
|
||||
title: ''
|
||||
labels: bug
|
||||
|
||||
---
|
||||
|
||||
<!-- Before reporting: search existing issues and check the FAQ. -->
|
||||
|
||||
- `nvim --version`:
|
||||
- Operating system/version:
|
||||
- Terminal name/version:
|
||||
- `$TERM`:
|
||||
|
||||
<!--
|
||||
If this report is about different behaviour between Nvim and Vim, make sure to
|
||||
read `:h vim-differences` first. Otherwise remove the next line.
|
||||
-->
|
||||
[ ] `vim -u DEFAULTS` (version: ) behaves differently
|
||||
|
||||
### Steps to reproduce using `nvim -u NORC`
|
||||
|
||||
```
|
||||
nvim -u NORC
|
||||
# Alternative for shell-related problems:
|
||||
# env -i TERM=ansi-256color "$(which nvim)"
|
||||
|
||||
```
|
||||
|
||||
### Actual behaviour
|
||||
|
||||
### Expected behaviour
|
||||
|
58
.github/ISSUE_TEMPLATE/lsp_bug_report.md
vendored
58
.github/ISSUE_TEMPLATE/lsp_bug_report.md
vendored
@ -1,58 +0,0 @@
|
||||
---
|
||||
name: Language server client bug report
|
||||
about: Report a built-in lsp problem in Nvim
|
||||
title: ''
|
||||
labels: bug, lsp
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
Before reporting: search existing issues and check the FAQ. Usage questions
|
||||
such as "How do I...?" or "Why isn't X language server/feature working?" belong
|
||||
on the [Neovim Discourse](https://neovim.discourse.group/c/7-category/7) and will
|
||||
be closed.
|
||||
-->
|
||||
|
||||
- `nvim --version`:
|
||||
- language server name/version:
|
||||
- Operating system/version:
|
||||
|
||||
<details>
|
||||
<summary>nvim -c ":checkhealth nvim lspconfig"</summary>
|
||||
|
||||
<!-- Paste the results from `nvim -c ":checkhealth nvim lspconfig"` here. -->
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>lsp.log</summary>
|
||||
|
||||
<!--
|
||||
Please paste the lsp log before and after the problem.
|
||||
|
||||
You can set log level like this.
|
||||
`:lua vim.lsp.set_log_level("debug")`
|
||||
|
||||
You can find the location of the log with the following command.
|
||||
`:lua print(vim.lsp.get_log_path())`
|
||||
-->
|
||||
|
||||
</details>
|
||||
|
||||
### Steps to reproduce using nvim -u minimal_init.lua
|
||||
<!--
|
||||
Note, if the issue is with an autocompletion or other LSP plugin, please
|
||||
report to the upstream tracker. Download the minmal config with
|
||||
wget https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/test/minimal_init.lua
|
||||
and modify it to include any specific commands or servers pertaining to your issues.
|
||||
-->
|
||||
|
||||
|
||||
```
|
||||
nvim -u minimal_init.lua
|
||||
```
|
||||
|
||||
### Actual behaviour
|
||||
|
||||
### Expected behaviour
|
||||
|
49
.github/labeler.yml
vendored
49
.github/labeler.yml
vendored
@ -1,49 +0,0 @@
|
||||
"lsp":
|
||||
- runtime/lua/vim/lsp.lua
|
||||
- runtime/lua/vim/lsp/*
|
||||
|
||||
"lua":
|
||||
- runtime/lua/**/*
|
||||
- src/nvim/lua
|
||||
|
||||
"tui":
|
||||
- src/nvim/tui/tui.*
|
||||
|
||||
"treesitter":
|
||||
- src/nvim/lua/treesitter.*
|
||||
- runtime/lua/vim/treesitter.lua
|
||||
- runtime/lua/vim/treesitter/*
|
||||
|
||||
"dependencies":
|
||||
- third-party/**/*
|
||||
|
||||
"topic: spell":
|
||||
- src/nvim/spell*
|
||||
|
||||
"topic: :terminal":
|
||||
- src/nvim/terminal.*
|
||||
|
||||
"topic: column":
|
||||
- src/nvim/mark.h
|
||||
- src/nvim/mark.c
|
||||
- src/nvim/sign*
|
||||
|
||||
"topic: folds":
|
||||
- src/nvim/fold*
|
||||
|
||||
"topic: mouse":
|
||||
- src/nvim/mouse*
|
||||
|
||||
"topic: documentation":
|
||||
- runtime/doc/*
|
||||
|
||||
"topic: clipboard":
|
||||
- runtime/autoload/provider/clipboard.vim
|
||||
|
||||
"topic: diff":
|
||||
- src/nvim/diff.*
|
||||
|
||||
"topic: build":
|
||||
- CMakeLists.txt
|
||||
- "**/CMakeLists.txt"
|
||||
- "**/*.cmake"
|
51
.github/workflows/api-docs.yml
vendored
51
.github/workflows/api-docs.yml
vendored
@ -1,51 +0,0 @@
|
||||
name: Autogenerate API docs
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'src/nvim/api/*.[ch]'
|
||||
- 'src/nvim/**.lua'
|
||||
- 'runtime/lua/**.lua'
|
||||
branches:
|
||||
- 'master'
|
||||
- 'release-[0-9]+.[0-9]+'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
regen-api-docs:
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y doxygen python3 python3-msgpack luajit
|
||||
|
||||
- name: Setup git config
|
||||
run: |
|
||||
git config --global user.name 'marvim'
|
||||
git config --global user.email 'marvim@users.noreply.github.com'
|
||||
|
||||
- run: printf 'DOC_BRANCH=marvim/api-doc-update/%s\n' ${GITHUB_REF#refs/heads/} >> $GITHUB_ENV
|
||||
|
||||
- name: Generate docs
|
||||
id: docs
|
||||
run: |
|
||||
git checkout -b ${DOC_BRANCH}
|
||||
python3 scripts/gen_vimdoc.py
|
||||
printf '::set-output name=UPDATED_DOCS::%s\n' $([ -z "$(git diff)" ]; echo $?)
|
||||
|
||||
- name: Automatic PR
|
||||
if: ${{ steps.docs.outputs.UPDATED_DOCS != 0 }}
|
||||
run: |
|
||||
git add -u
|
||||
git commit -m 'docs: regenerate'
|
||||
git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${DOC_BRANCH}
|
||||
gh pr create --fill --base ${GITHUB_REF#refs/heads/} --head ${DOC_BRANCH} || true
|
116
.github/workflows/ci.yml
vendored
116
.github/workflows/ci.yml
vendored
@ -1,116 +0,0 @@
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches: '**'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'release-[0-9]+.[0-9]+'
|
||||
|
||||
jobs:
|
||||
unixish:
|
||||
name: ${{ matrix.os }} ${{ matrix.flavor }} (cc=${{ matrix.cc }})
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- flavor: asan
|
||||
cc: clang-12
|
||||
runner: ubuntu-20.04
|
||||
os: linux
|
||||
- flavor: lint
|
||||
cc: gcc
|
||||
runner: ubuntu-20.04
|
||||
os: linux
|
||||
- flavor: tsan
|
||||
cc: clang-12
|
||||
runner: ubuntu-20.04
|
||||
os: linux
|
||||
- cc: clang
|
||||
runner: macos-10.15
|
||||
os: osx
|
||||
- flavor: functionaltest-lua
|
||||
cc: gcc
|
||||
runner: ubuntu-20.04
|
||||
os: linux
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: github.event.pull_request.draft == false
|
||||
env:
|
||||
CC: ${{ matrix.cc }}
|
||||
CI_OS_NAME: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Setup commom environment variables
|
||||
run: ./.github/workflows/env.sh ${{ matrix.flavor }}
|
||||
|
||||
- name: Install apt packages
|
||||
if: matrix.os == 'linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y autoconf automake build-essential ccache cmake cpanminus cscope gcc-multilib gdb gettext gperf language-pack-tr libtool-bin locales ninja-build pkg-config python3 python3-pip python3-setuptools unzip valgrind xclip
|
||||
|
||||
- name: Install new clang
|
||||
if: matrix.flavor == 'asan' || matrix.flavor == 'tsan'
|
||||
run: |
|
||||
wget https://apt.llvm.org/llvm.sh
|
||||
chmod a+x llvm.sh
|
||||
sudo ./llvm.sh 12
|
||||
rm llvm.sh
|
||||
|
||||
- name: Install brew packages
|
||||
if: matrix.os == 'osx'
|
||||
run: |
|
||||
# Workaround brew issues
|
||||
rm -f /usr/local/bin/2to3
|
||||
brew update >/dev/null
|
||||
brew upgrade
|
||||
brew install automake ccache perl cpanminus ninja
|
||||
|
||||
- name: Setup interpreter packages
|
||||
run: |
|
||||
./ci/before_install.sh
|
||||
./ci/install.sh
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
${{ env.CACHE_NVIM_DEPS_DIR }}
|
||||
~/.ccache
|
||||
key: ${{ runner.os }}-${{ matrix.flavor }}-${{ matrix.cc }}-${{ hashFiles('cmake/*', 'third-party/**', '**/CMakeLists.txt') }}-${{ github.base_ref }}
|
||||
|
||||
- name: Build third-party
|
||||
run: ./ci/before_script.sh
|
||||
|
||||
- name: Build and test
|
||||
run: ./ci/script.sh
|
||||
|
||||
- name: Cache dependencies
|
||||
if: ${{ success() }}
|
||||
run: ./ci/before_cache.sh
|
||||
|
||||
windows:
|
||||
runs-on: windows-2016
|
||||
if: github.event.pull_request.draft == false
|
||||
env:
|
||||
DEPS_BUILD_DIR: ${{ format('{0}/nvim-deps', github.workspace) }}
|
||||
DEPS_PREFIX: ${{ format('{0}/nvim-deps/usr', github.workspace) }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config: [ MINGW_64-gcov, MINGW_32, MSVC_64, MSVC_32 ]
|
||||
name: windows (${{ matrix.config }})
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.DEPS_BUILD_DIR }}
|
||||
key: ${{ matrix.config }}-${{ hashFiles('third-party\**') }}
|
||||
|
||||
- name: Run CI
|
||||
run: powershell ci\build.ps1
|
||||
env:
|
||||
CONFIGURATION: ${{ matrix.config }}
|
44
.github/workflows/coverity-scan.yml
vendored
44
.github/workflows/coverity-scan.yml
vendored
@ -1,44 +0,0 @@
|
||||
name: Coverity
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 10 * * 1' # Run every Monday at 00:10
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
scan:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y autoconf automake build-essential cmake gettext gperf libtool-bin locales ninja-build pkg-config unzip
|
||||
|
||||
- name: Download Coverity
|
||||
run: |
|
||||
wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=neovim%2Fneovim" -O coverity_tool.tgz
|
||||
mkdir cov-scan
|
||||
tar ax -f coverity_tool.tgz --strip-components=1 -C cov-scan
|
||||
env:
|
||||
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
||||
|
||||
- name: Build dependencies
|
||||
run: make deps
|
||||
|
||||
- name: Build/scan neovim
|
||||
run: |
|
||||
env PATH=$(pwd)/cov-scan/bin:$PATH cov-build --dir cov-int make
|
||||
|
||||
- name: Submit results
|
||||
run: |
|
||||
tar zcf cov-scan.tgz cov-int
|
||||
curl --form token=$TOKEN \
|
||||
--form email=$EMAIL \
|
||||
--form file=@cov-scan.tgz \
|
||||
--form version="$(git rev-parse HEAD)" \
|
||||
--form description="Weekly GHA scan" \
|
||||
'https://scan.coverity.com/builds?project=neovim%2Fneovim'
|
||||
env:
|
||||
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
||||
EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
|
65
.github/workflows/env.sh
vendored
65
.github/workflows/env.sh
vendored
@ -1,65 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e -u
|
||||
|
||||
FLAVOR=${1:-}
|
||||
|
||||
cat <<EOF >> "$GITHUB_PATH"
|
||||
$HOME/.local/bin
|
||||
EOF
|
||||
|
||||
cat <<EOF >> "$GITHUB_ENV"
|
||||
CACHE_ENABLE=true
|
||||
CI_TARGET=tests
|
||||
CI_BUILD_DIR=$GITHUB_WORKSPACE
|
||||
BUILD_DIR=$GITHUB_WORKSPACE/build
|
||||
DEPS_BUILD_DIR=$HOME/nvim-deps
|
||||
INSTALL_PREFIX=$HOME/nvim-install
|
||||
LOG_DIR=$GITHUB_WORKSPACE/build/log
|
||||
NVIM_LOG_FILE=$GITHUB_WORKSPACE/build/.nvimlog
|
||||
VALGRIND_LOG=$GITHUB_WORKSPACE/build/log/valgrind-%p.log
|
||||
CACHE_NVIM_DEPS_DIR=$HOME/.cache/nvim-deps
|
||||
CACHE_MARKER=$HOME/.cache/nvim-deps/.ci_cache_marker
|
||||
CCACHE_BASEDIR=$GITHUB_WORKSPACE
|
||||
CCACHE_COMPRESS=1
|
||||
CCACHE_SLOPPINESS=time_macros,file_macro
|
||||
CCACHE_DIR=$HOME/.ccache
|
||||
EOF
|
||||
|
||||
DEPS_CMAKE_FLAGS=-DUSE_BUNDLED_GPERF=OFF
|
||||
FUNCTIONALTEST=functionaltest
|
||||
BUILD_FLAGS="CMAKE_FLAGS=-DCI_BUILD=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=$HOME/nvim-install -DBUSTED_OUTPUT_TYPE=nvim -DDEPS_PREFIX=$HOME/nvim-deps/usr -DMIN_LOG_LEVEL=3"
|
||||
|
||||
case "$FLAVOR" in
|
||||
asan)
|
||||
BUILD_FLAGS="$BUILD_FLAGS -DPREFER_LUA=ON"
|
||||
cat <<EOF >> "$GITHUB_ENV"
|
||||
CLANG_SANITIZER=ASAN_UBSAN
|
||||
SYMBOLIZER=asan_symbolize-12
|
||||
ASAN_OPTIONS=detect_leaks=1:check_initialization_order=1:log_path=$GITHUB_WORKSPACE/build/log/asan
|
||||
UBSAN_OPTIONS=print_stacktrace=1 log_path=$GITHUB_WORKSPACE/build/log/ubsan
|
||||
EOF
|
||||
;;
|
||||
tsan)
|
||||
cat <<EOF >> "$GITHUB_ENV"
|
||||
TSAN_OPTIONS=log_path=$GITHUB_WORKSPACE/build/log/tsan
|
||||
EOF
|
||||
;;
|
||||
lint)
|
||||
cat <<EOF >> "$GITHUB_ENV"
|
||||
CI_TARGET=lint
|
||||
EOF
|
||||
;;
|
||||
functionaltest-lua)
|
||||
BUILD_FLAGS="$BUILD_FLAGS -DPREFER_LUA=ON"
|
||||
FUNCTIONALTEST=functionaltest-lua
|
||||
DEPS_CMAKE_FLAGS="$DEPS_CMAKE_FLAGS -DUSE_BUNDLED_LUAJIT=OFF"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
cat <<EOF >> "$GITHUB_ENV"
|
||||
$BUILD_FLAGS
|
||||
DEPS_CMAKE_FLAGS=$DEPS_CMAKE_FLAGS
|
||||
FUNCTIONALTEST=$FUNCTIONALTEST
|
||||
EOF
|
13
.github/workflows/labeler.yml
vendored
13
.github/workflows/labeler.yml
vendored
@ -1,13 +0,0 @@
|
||||
name: "Pull Request Labeler"
|
||||
on:
|
||||
- pull_request_target
|
||||
jobs:
|
||||
triage:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/labeler@main
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
258
.github/workflows/release.yml
vendored
258
.github/workflows/release.yml
vendored
@ -1,258 +0,0 @@
|
||||
name: Release
|
||||
on:
|
||||
schedule:
|
||||
- cron: '5 5 * * *'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag_name:
|
||||
description: 'Tag name for release'
|
||||
required: false
|
||||
default: nightly
|
||||
push:
|
||||
tags:
|
||||
- v[0-9]+.[0-9]+.[0-9]+
|
||||
|
||||
# Build on the oldest supported images, so we have broader compatibility
|
||||
# Upgrade to gcc-11 to prevent it from using its builtins (#14150)
|
||||
jobs:
|
||||
linux:
|
||||
runs-on: ubuntu-18.04
|
||||
outputs:
|
||||
version: ${{ steps.build.outputs.version }}
|
||||
release: ${{ steps.build.outputs.release }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y autoconf automake build-essential cmake gcc-11 gettext gperf libtool-bin locales ninja-build pkg-config unzip
|
||||
- name: Build release
|
||||
id: build
|
||||
run: |
|
||||
CC=gcc-11 make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX:PATH="
|
||||
printf '::set-output name=version::%s\n' "$(./build/bin/nvim --version | head -n 3 | sed -z 's/\n/%0A/g')"
|
||||
printf '::set-output name=release::%s\n' "$(./build/bin/nvim --version | head -n 1)"
|
||||
make DESTDIR="$GITHUB_WORKSPACE/build/release/nvim-linux64" install
|
||||
cd "$GITHUB_WORKSPACE/build/release"
|
||||
tar cfz nvim-linux64.tar.gz nvim-linux64
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: nvim-linux64
|
||||
path: build/release/nvim-linux64.tar.gz
|
||||
retention-days: 1
|
||||
|
||||
appimage:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y autoconf automake build-essential cmake gcc-11 gettext gperf libtool-bin locales ninja-build pkg-config unzip
|
||||
- if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly')
|
||||
run: CC=gcc-11 make appimage-latest
|
||||
- if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly')
|
||||
run: CC=gcc-11 make appimage-nightly
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: appimage
|
||||
path: build/bin/nvim.appimage
|
||||
retention-days: 1
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: appimage
|
||||
path: build/bin/nvim.appimage.zsync
|
||||
retention-days: 1
|
||||
|
||||
macOS:
|
||||
runs-on: macos-10.15
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install brew packages
|
||||
run: |
|
||||
rm -f /usr/local/bin/2to3
|
||||
brew update >/dev/null
|
||||
brew upgrade
|
||||
brew install automake ninja
|
||||
- name: Build release
|
||||
run: |
|
||||
make CMAKE_BUILD_TYPE=Release CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11"
|
||||
make DESTDIR="$GITHUB_WORKSPACE/build/release/nvim-osx64" install
|
||||
- name: Create package
|
||||
run: |
|
||||
cd "$GITHUB_WORKSPACE/build/release"
|
||||
mkdir -p nvim-osx64/libs
|
||||
libs=($(otool -L nvim-osx64/bin/nvim | sed 1d | sed -E -e 's|^[[:space:]]*||' -e 's| .*||'))
|
||||
echo "libs:"
|
||||
for lib in "${libs[@]}"; do
|
||||
if echo "$lib" | grep -q -E 'libSystem|CoreFoundation' 2>/dev/null; then
|
||||
echo " [skipped] $lib"
|
||||
else
|
||||
echo " $lib"
|
||||
relname="libs/${lib##*/}"
|
||||
cp -L "$lib" "nvim-osx64/$relname"
|
||||
install_name_tool -change "$lib" "@executable_path/../$relname" nvim-osx64/bin/nvim
|
||||
fi
|
||||
done
|
||||
tar cfz nvim-macos.tar.gz nvim-osx64
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: nvim-macos
|
||||
path: build/release/nvim-macos.tar.gz
|
||||
retention-days: 1
|
||||
|
||||
windows:
|
||||
runs-on: windows-2016
|
||||
env:
|
||||
DEPS_BUILD_DIR: ${{ format('{0}/nvim-deps', github.workspace) }}
|
||||
DEPS_PREFIX: ${{ format('{0}/nvim-deps/usr', github.workspace) }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- config: MSVC_64
|
||||
archive: nvim-win64
|
||||
- config: MSVC_32
|
||||
archive: nvim-win32
|
||||
name: windows (${{ matrix.config }})
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- run: powershell ci\build.ps1 -NoTests
|
||||
env:
|
||||
CONFIGURATION: ${{ matrix.config }}
|
||||
- run: move build\Neovim.zip build\${{ matrix.archive }}.zip
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ matrix.archive }}
|
||||
path: build/${{ matrix.archive }}.zip
|
||||
retention-days: 1
|
||||
|
||||
publish:
|
||||
needs: [linux, appimage, macOS, windows]
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/download-artifact@v2
|
||||
- if: github.event_name == 'workflow_dispatch'
|
||||
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
|
||||
- if: github.event_name == 'schedule'
|
||||
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
|
||||
- if: github.event_name == 'push'
|
||||
run: |
|
||||
TAG_NAME=${{ github.ref }}
|
||||
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
|
||||
- if: env.TAG_NAME == 'nightly'
|
||||
run: echo 'SUBJECT=Nvim development (prerelease) build' >> $GITHUB_ENV
|
||||
- if: env.TAG_NAME != 'nightly'
|
||||
run: echo 'SUBJECT=Nvim release build' >> $GITHUB_ENV
|
||||
- if: env.TAG_NAME == 'nightly'
|
||||
uses: dev-drprasad/delete-tag-and-release@v0.1.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
delete_release: true
|
||||
tag_name: nightly
|
||||
# `sha256sum` outputs <sha> <path>, so we cd into each dir to drop the
|
||||
# containing folder from the output.
|
||||
- name: Generate Linux64 SHA256 checksums
|
||||
run: |
|
||||
cd ./nvim-linux64
|
||||
sha256sum nvim-linux64.tar.gz > nvim-linux64.tar.gz.sha256sum
|
||||
echo "SHA_LINUX_64=$(cat nvim-linux64.tar.gz.sha256sum)" >> $GITHUB_ENV
|
||||
- name: Generate App Image SHA256 checksums
|
||||
run: |
|
||||
cd ./appimage
|
||||
sha256sum nvim.appimage > nvim.appimage.sha256sum
|
||||
echo "SHA_APP_IMAGE=$(cat nvim.appimage.sha256sum)" >> $GITHUB_ENV
|
||||
- name: Generate App Image Zsync SHA256 checksums
|
||||
run: |
|
||||
cd ./appimage
|
||||
sha256sum nvim.appimage.zsync > nvim.appimage.zsync.sha256sum
|
||||
echo "SHA_APP_IMAGE_ZSYNC=$(cat nvim.appimage.zsync.sha256sum)" >> $GITHUB_ENV
|
||||
- name: Generate macOS SHA256 checksums
|
||||
run: |
|
||||
cd ./nvim-macos
|
||||
sha256sum nvim-macos.tar.gz > nvim-macos.tar.gz.sha256sum
|
||||
echo "SHA_MACOS=$(cat nvim-macos.tar.gz.sha256sum)" >> $GITHUB_ENV
|
||||
- name: Generate Win32 SHA256 checksums
|
||||
run: |
|
||||
cd ./nvim-win32
|
||||
sha256sum nvim-win32.zip > nvim-win32.zip.sha256sum
|
||||
echo "SHA_WIN_32=$(cat nvim-win32.zip.sha256sum)" >> $GITHUB_ENV
|
||||
- name: Generate Win64 SHA256 checksums
|
||||
run: |
|
||||
cd ./nvim-win64
|
||||
sha256sum nvim-win64.zip > nvim-win64.zip.sha256sum
|
||||
echo "SHA_WIN_64=$(cat nvim-win64.zip.sha256sum)" >> $GITHUB_ENV
|
||||
- uses: meeDamian/github-release@2.0
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
tag: ${{ env.TAG_NAME }}
|
||||
name: ${{ needs.linux.outputs.release }}
|
||||
prerelease: ${{ env.TAG_NAME == 'nightly' }}
|
||||
commitish: ${{ github.sha }}
|
||||
gzip: false
|
||||
allow_override: ${{ env.TAG_NAME == 'nightly' }}
|
||||
files: |
|
||||
nvim-macos.tar.gz:./nvim-macos/nvim-macos.tar.gz
|
||||
nvim-macos.tar.gz.sha256sum:./nvim-macos/nvim-macos.tar.gz.sha256sum
|
||||
nvim-linux64.tar.gz:./nvim-linux64/nvim-linux64.tar.gz
|
||||
nvim-linux64.tar.gz.sha256sum:./nvim-linux64/nvim-linux64.tar.gz.sha256sum
|
||||
nvim.appimage:./appimage/nvim.appimage
|
||||
nvim.appimage.sha256sum:./appimage/nvim.appimage.sha256sum
|
||||
nvim.appimage.zsync:./appimage/nvim.appimage.zsync
|
||||
nvim.appimage.zsync.sha256sum:./appimage/nvim.appimage.zsync.sha256sum
|
||||
nvim-win32.zip:./nvim-win32/nvim-win32.zip
|
||||
nvim-win32.zip.sha256sum:./nvim-win32/nvim-win32.zip.sha256sum
|
||||
nvim-win64.zip:./nvim-win64/nvim-win64.zip
|
||||
nvim-win64.zip.sha256sum:./nvim-win64/nvim-win64.zip.sha256sum
|
||||
body: |
|
||||
${{ env.SUBJECT }}
|
||||
```
|
||||
${{ needs.linux.outputs.version }}```
|
||||
|
||||
## Install
|
||||
|
||||
### Windows
|
||||
|
||||
1. Extract **nvim-win64.zip** (or **nvim-win32.zip**)
|
||||
2. Run `nvim-qt.exe`
|
||||
|
||||
### macOS
|
||||
|
||||
1. Download **nvim-macos.tar.gz**
|
||||
2. Extract: `tar xzvf nvim-macos.tar.gz`
|
||||
3. Run `./nvim-osx64/bin/nvim`
|
||||
|
||||
### Linux (x64)
|
||||
|
||||
1. Download **nvim.appimage**
|
||||
2. Run `chmod u+x nvim.appimage && ./nvim.appimage`
|
||||
- If your system does not have FUSE you can [extract the appimage](https://github.com/AppImage/AppImageKit/wiki/FUSE#type-2-appimage):
|
||||
```
|
||||
./nvim.appimage --appimage-extract
|
||||
./squashfs-root/usr/bin/nvim
|
||||
```
|
||||
|
||||
### Other
|
||||
|
||||
- Install by [package manager](https://github.com/neovim/neovim/wiki/Installing-Neovim)
|
||||
|
||||
## SHA256 Checksums
|
||||
|
||||
```
|
||||
${{ env.SHA_LINUX_64 }}
|
||||
${{ env.SHA_APP_IMAGE }}
|
||||
${{ env.SHA_APP_IMAGE_ZSYNC }}
|
||||
${{ env.SHA_MACOS }}
|
||||
${{ env.SHA_WIN_64 }}
|
||||
${{ env.SHA_WIN_32 }}
|
||||
```
|
52
.github/workflows/vim-patches.yml
vendored
52
.github/workflows/vim-patches.yml
vendored
@ -1,52 +0,0 @@
|
||||
name: vim-patches
|
||||
on:
|
||||
schedule:
|
||||
- cron: '3 3 * * *'
|
||||
|
||||
jobs:
|
||||
update-vim-patches:
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
env:
|
||||
VIM_SOURCE_DIR: ${{ format('{0}/vim-src', github.workspace) }}
|
||||
VERSION_BRANCH: marvim/ci-version-update
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
repository: vim/vim
|
||||
path: ${{ env.VIM_SOURCE_DIR }}
|
||||
fetch-depth: 0
|
||||
|
||||
- run: |
|
||||
gh release download -R neovim/neovim -p nvim.appimage
|
||||
chmod a+x nvim.appimage
|
||||
mkdir -p $HOME/.local/bin
|
||||
mv nvim.appimage $HOME/.local/bin/nvim
|
||||
printf '%s\n' "$HOME/.local/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Setup git config
|
||||
run: |
|
||||
git config --global user.name 'marvim'
|
||||
git config --global user.email 'marvim@users.noreply.github.com'
|
||||
|
||||
- name: Update src/version.c
|
||||
id: update-version
|
||||
run: |
|
||||
git checkout -b ${VERSION_BRANCH}
|
||||
nvim -i NONE -u NONE --headless +'luafile scripts/vimpatch.lua' +q
|
||||
printf '::set-output name=NEW_PATCHES::%s\n' $([ -z "$(git diff)" ]; echo $?)
|
||||
|
||||
- name: Automatic PR
|
||||
if: ${{ steps.update-version.outputs.NEW_PATCHES != 0 }}
|
||||
run: |
|
||||
git add -u
|
||||
git commit -m 'version.c: update [skip ci]'
|
||||
git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${VERSION_BRANCH}
|
||||
gh pr create --fill --label vim-patch --base ${GITHUB_REF#refs/heads/} --head ${VERSION_BRANCH} || true
|
38
.gitignore
vendored
38
.gitignore
vendored
@ -1,20 +1,15 @@
|
||||
# Tools
|
||||
/venv/
|
||||
compile_commands.json
|
||||
|
||||
# IDEs
|
||||
.ropeproject/
|
||||
# Visual Studio
|
||||
/.vs/
|
||||
/.vscode/
|
||||
/.idea/
|
||||
|
||||
# Build/deps dir
|
||||
/build/
|
||||
/cmake-build-debug/
|
||||
/dist/
|
||||
/.deps/
|
||||
/tmp/
|
||||
/.clangd/
|
||||
/.cache/clangd/
|
||||
|
||||
.DS_Store
|
||||
*.mo
|
||||
.*.sw?
|
||||
*~
|
||||
@ -22,6 +17,8 @@ compile_commands.json
|
||||
*.o
|
||||
*.so
|
||||
|
||||
tags
|
||||
|
||||
/src/nvim/po/vim.pot
|
||||
/src/nvim/po/*.ck
|
||||
|
||||
@ -29,14 +26,13 @@ compile_commands.json
|
||||
/.nvimlog
|
||||
|
||||
# Generated by scripts/vim-patch.sh
|
||||
/.vim-src
|
||||
*.rej
|
||||
/.vim-src/
|
||||
|
||||
# Generated by old (Vim) tests.
|
||||
/src/nvim/testdir/del
|
||||
/src/nvim/testdir/test*.out
|
||||
/src/nvim/testdir/test*.res
|
||||
/src/nvim/testdir/test*.log
|
||||
/src/nvim/testdir/test.log
|
||||
/src/nvim/testdir/messages
|
||||
/src/nvim/testdir/viminfo
|
||||
/src/nvim/testdir/test.ok
|
||||
@ -44,29 +40,17 @@ compile_commands.json
|
||||
/src/nvim/testdir/X*
|
||||
/src/nvim/testdir/valgrind.*
|
||||
/src/nvim/testdir/.gdbinit
|
||||
/runtime/indent/testdir/*.out
|
||||
+runtime/indent/testdir/*.fail
|
||||
# Generated by src/nvim/testdir/runnvim.sh.
|
||||
/src/nvim/testdir/*.tlog
|
||||
|
||||
# Generated by unit tests.
|
||||
/test/includes/post/
|
||||
|
||||
# Generated by luacheck during `make lualint'
|
||||
.luacheckcache
|
||||
# Generated by luacheck during `make testlint'
|
||||
/test/.luacheckcache
|
||||
|
||||
# local make targets
|
||||
local.mk
|
||||
|
||||
# Generated from :help docs
|
||||
tags
|
||||
# runtime/doc
|
||||
/runtime/doc/*.html
|
||||
/runtime/doc/tags.ref
|
||||
/runtime/doc/errors.log
|
||||
|
||||
# Generated by gen_vimdoc.py:
|
||||
/runtime/doc/*.mpack
|
||||
/tmp-*-doc
|
||||
|
||||
# vim patches
|
||||
/vim-*.patch
|
||||
|
27
.luacheckrc
27
.luacheckrc
@ -1,27 +0,0 @@
|
||||
-- vim: ft=lua tw=80
|
||||
|
||||
stds.nvim = {
|
||||
read_globals = { "jit" }
|
||||
}
|
||||
std = "lua51+nvim"
|
||||
|
||||
-- Ignore W211 (unused variable) with preload files.
|
||||
files["**/preload.lua"] = {ignore = { "211" }}
|
||||
-- Allow vim module to modify itself, but only here.
|
||||
files["src/nvim/lua/vim.lua"] = {ignore = { "122/vim" }}
|
||||
|
||||
-- Don't report unused self arguments of methods.
|
||||
self = false
|
||||
|
||||
-- Rerun tests only if their modification time changed.
|
||||
cache = true
|
||||
|
||||
ignore = {
|
||||
"631", -- max_line_length
|
||||
"212/_.*", -- unused argument, for vars with "_" prefix
|
||||
}
|
||||
|
||||
-- Global objects defined by the C code
|
||||
read_globals = {
|
||||
"vim",
|
||||
}
|
22
.luacov
22
.luacov
@ -1,22 +0,0 @@
|
||||
-- Configuration file for LuaCov
|
||||
|
||||
local source = require("lfs").currentdir()
|
||||
|
||||
local function pesc(s)
|
||||
assert(type(s) == 'string', s)
|
||||
return s:gsub('[%(%)%.%%%+%-%*%?%[%]%^%$]', '%%%1')
|
||||
end
|
||||
|
||||
return {
|
||||
include = {
|
||||
-- Absolute paths (starting with source dir, not hidden (i.e. .deps)).
|
||||
pesc(source) .. "[/\\][^.].+",
|
||||
-- Relative (non-hidden) paths.
|
||||
'^[^/\\.]',
|
||||
},
|
||||
modules = {
|
||||
['vim'] = 'runtime/lua/vim/shared.lua'
|
||||
},
|
||||
}
|
||||
|
||||
-- vim: ft=lua tw=80 sw=2 et
|
209
.travis.yml
209
.travis.yml
@ -1,29 +1,17 @@
|
||||
dist: bionic
|
||||
dist: xenial
|
||||
|
||||
language: c
|
||||
|
||||
env:
|
||||
global:
|
||||
# Encrypted environment variables, see
|
||||
# http://docs.travis-ci.com/user/encryption-keys/
|
||||
#
|
||||
# SNAP_SECRET_KEY: generated by:
|
||||
# travis encrypt SNAP_SECRET_KEY=xx --add
|
||||
# https://github.com/neovim/neovim/pull/11428
|
||||
# snapcraft key expires after 1 year. Steps to refresh it:
|
||||
# 1. snapcraft enable-ci travis --refresh
|
||||
# 2. mv .snapcraft/travis_snapcraft.cfg ci/snap/travis_snapcraft.cfg
|
||||
# 3. Copy after_success command to ci/snap/deploy.sh from .travis.yml
|
||||
# 4. Undo changes to .travis.yml
|
||||
- secure: hd0qn2u8ABbJg5Bx4pBRcUQbKYFmcSHoecyHIPTCnGJT+NI41Bvm/IkN/N5DhBF+LbD3Q2nmR/dzI5H/dqS7RxMFvEx1DuFLendFHHX3MYf0AuKpXYY3gwgMTmqx8p/v6srlU7RBGWNGzHCWqksAem+EIWCe3I7WvfdKo1/DV/Y=
|
||||
|
||||
- PATH="$HOME/.local/bin:$PATH"
|
||||
# Set "false" to force rebuild of third-party dependencies.
|
||||
- CACHE_ENABLE=true
|
||||
# Build directory for Neovim.
|
||||
- BUILD_DIR="$TRAVIS_BUILD_DIR/build"
|
||||
# Build directory for third-party dependencies.
|
||||
- DEPS_BUILD_DIR="$HOME/nvim-deps"
|
||||
# Directory where third-party dependency sources are downloaded to.
|
||||
- DEPS_DOWNLOAD_DIR="$TRAVIS_BUILD_DIR/deps-downloads"
|
||||
# Install directory for Neovim.
|
||||
- INSTALL_PREFIX="$HOME/nvim-install"
|
||||
# Log directory for Clang sanitizers and Valgrind.
|
||||
@ -31,22 +19,26 @@ env:
|
||||
# Nvim log file.
|
||||
- NVIM_LOG_FILE="$BUILD_DIR/.nvimlog"
|
||||
# Default CMake flags.
|
||||
- CMAKE_FLAGS="-DCI_BUILD=ON
|
||||
- CMAKE_FLAGS="-DTRAVIS_CI_BUILD=ON
|
||||
-DCMAKE_BUILD_TYPE=Debug
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX
|
||||
-DBUSTED_OUTPUT_TYPE=nvim
|
||||
-DDEPS_PREFIX=$DEPS_BUILD_DIR/usr
|
||||
-DMIN_LOG_LEVEL=3"
|
||||
- DEPS_CMAKE_FLAGS="-DUSE_BUNDLED_GPERF=OFF"
|
||||
- DEPS_CMAKE_FLAGS="-DDEPS_DOWNLOAD_DIR:PATH=$DEPS_DOWNLOAD_DIR -DUSE_BUNDLED_GPERF=OFF"
|
||||
# Additional CMake flags for 32-bit builds.
|
||||
- CMAKE_FLAGS_32BIT="-DCMAKE_SYSTEM_LIBRARY_PATH=/lib32:/usr/lib32:/usr/local/lib32
|
||||
-DCMAKE_IGNORE_PATH=/lib:/usr/lib:/usr/local/lib
|
||||
-DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake"
|
||||
# Environment variables for Clang sanitizers.
|
||||
- ASAN_OPTIONS="detect_leaks=1:check_initialization_order=1:log_path=$LOG_DIR/asan"
|
||||
- TSAN_OPTIONS="log_path=$LOG_DIR/tsan"
|
||||
- UBSAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/ubsan"
|
||||
- ASAN_SYMBOLIZE=asan_symbolize
|
||||
# Environment variables for Valgrind.
|
||||
- VALGRIND_LOG="$LOG_DIR/valgrind-%p.log"
|
||||
- CACHE_NVIM_DEPS_DIR="$HOME/.cache/nvim-deps"
|
||||
# If this file exists, the cache is valid (compile was successful).
|
||||
- CACHE_MARKER="$CACHE_NVIM_DEPS_DIR/.ci_cache_marker"
|
||||
- CACHE_MARKER="$HOME/.cache/nvim-deps/.travis_cache_marker"
|
||||
# default target name for functional tests
|
||||
- FUNCTIONALTEST=functionaltest
|
||||
- CI_TARGET=tests
|
||||
@ -54,29 +46,71 @@ env:
|
||||
- CCACHE_COMPRESS=1
|
||||
- CCACHE_SLOPPINESS=time_macros,file_macro
|
||||
- CCACHE_BASEDIR="$TRAVIS_BUILD_DIR"
|
||||
- CI_OS_NAME="$TRAVIS_OS_NAME"
|
||||
|
||||
anchors:
|
||||
envs: &common-job-env
|
||||
# Do not fall back to cache for "master" for PR on "release" branch:
|
||||
# adds the target branch to the cache key.
|
||||
FOR_TRAVIS_CACHE=v1-$TRAVIS_BRANCH
|
||||
jobs:
|
||||
include:
|
||||
- stage: normal builds
|
||||
os: linux
|
||||
compiler: clang-4.0
|
||||
# Use Lua so that ASAN can test our embedded Lua support. 8fec4d53d0f6
|
||||
env: >
|
||||
CLANG_SANITIZER=ASAN_UBSAN
|
||||
CMAKE_FLAGS="$CMAKE_FLAGS -DPREFER_LUA=ON"
|
||||
ASAN_SYMBOLIZE=asan_symbolize-4.0
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: >
|
||||
FUNCTIONALTEST=functionaltest-lua
|
||||
CMAKE_FLAGS="$CMAKE_FLAGS -DPREFER_LUA=ON"
|
||||
DEPS_CMAKE_FLAGS="$DEPS_CMAKE_FLAGS -DUSE_BUNDLED_LUAJIT=OFF"
|
||||
- os: linux
|
||||
# Travis creates a cache per compiler. Set a different value here to
|
||||
# store 32-bit dependencies in a separate cache.
|
||||
compiler: gcc
|
||||
env: BUILD_32BIT=ON
|
||||
- os: osx
|
||||
compiler: clang
|
||||
osx_image: xcode9.4 # macOS 10.13
|
||||
- os: osx
|
||||
compiler: gcc
|
||||
osx_image: xcode9.4 # macOS 10.13
|
||||
- if: branch = master
|
||||
os: linux
|
||||
env: CI_TARGET=lint
|
||||
- stage: Flaky builds
|
||||
os: linux
|
||||
compiler: gcc
|
||||
env: GCOV=gcov CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON"
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: CLANG_SANITIZER=TSAN
|
||||
allow_failures:
|
||||
- env: GCOV=gcov CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON"
|
||||
- env: CLANG_SANITIZER=TSAN
|
||||
fast_finish: true
|
||||
|
||||
before_install: ci/before_install.sh
|
||||
install: ci/install.sh
|
||||
before_script: ci/before_script.sh
|
||||
script: ci/script.sh
|
||||
before_cache: ci/before_cache.sh
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages: &common-apt-packages
|
||||
packages:
|
||||
- apport
|
||||
- autoconf
|
||||
- automake
|
||||
- build-essential
|
||||
- clang
|
||||
- clang-4.0
|
||||
- cmake
|
||||
- cpanminus
|
||||
- cscope
|
||||
- g++-multilib
|
||||
- gcc-multilib
|
||||
- gdb
|
||||
- gperf
|
||||
- language-pack-tr
|
||||
- libc6-dev-i386
|
||||
- libtool-bin
|
||||
- locales
|
||||
- ninja-build
|
||||
@ -86,121 +120,9 @@ addons:
|
||||
- xclip
|
||||
homebrew:
|
||||
update: true
|
||||
casks:
|
||||
- powershell
|
||||
packages:
|
||||
- ccache
|
||||
- cpanminus
|
||||
- ninja
|
||||
- perl
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- name: gcc-coverage (gcc 9)
|
||||
os: linux
|
||||
compiler: gcc-9
|
||||
env:
|
||||
- GCOV=gcov-9
|
||||
- CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON"
|
||||
- GCOV_ERROR_FILE="/tmp/libgcov-errors.log"
|
||||
- USE_LUACOV=1
|
||||
- BUSTED_ARGS="--coverage"
|
||||
- *common-job-env
|
||||
addons:
|
||||
snaps:
|
||||
- name: powershell
|
||||
confinement: classic
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
||||
packages:
|
||||
- *common-apt-packages
|
||||
- gcc-9
|
||||
- name: gcc-functionaltest-lua
|
||||
os: linux
|
||||
compiler: gcc
|
||||
env:
|
||||
- FUNCTIONALTEST=functionaltest-lua
|
||||
- CMAKE_FLAGS="$CMAKE_FLAGS -DPREFER_LUA=ON"
|
||||
- DEPS_CMAKE_FLAGS="$DEPS_CMAKE_FLAGS -DUSE_BUNDLED_LUAJIT=OFF"
|
||||
- *common-job-env
|
||||
- name: gcc-32bit
|
||||
os: linux
|
||||
# Travis creates a cache per compiler. Set a different value here to
|
||||
# store 32-bit dependencies in a separate cache.
|
||||
compiler: gcc
|
||||
env:
|
||||
- BUILD_32BIT=ON
|
||||
- CMAKE_FLAGS="$CMAKE_FLAGS -m32 -DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake"
|
||||
- DEPS_CMAKE_FLAGS="$DEPS_CMAKE_FLAGS -m32 -DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake"
|
||||
# Minimum required CMake.
|
||||
- CMAKE_URL=https://cmake.org/files/v2.8/cmake-2.8.12-Linux-i386.sh
|
||||
- *common-job-env
|
||||
- name: big-endian
|
||||
os: linux
|
||||
arch: s390x
|
||||
compiler: gcc
|
||||
env:
|
||||
- FUNCTIONALTEST=functionaltest-lua
|
||||
- CMAKE_FLAGS="$CMAKE_FLAGS -DPREFER_LUA=ON"
|
||||
- DEPS_CMAKE_FLAGS="$DEPS_CMAKE_FLAGS -DUSE_BUNDLED_LUAJIT=OFF"
|
||||
- *common-job-env
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- *common-apt-packages
|
||||
- gettext
|
||||
- python-pip
|
||||
- python3-pip
|
||||
- python-setuptools
|
||||
- python3-setuptools
|
||||
- python-dev
|
||||
- python3-dev
|
||||
- if: type != pull_request
|
||||
name: snap
|
||||
os: linux
|
||||
env:
|
||||
- LC_ALL: C.UTF-8
|
||||
- LANG: C.UTF-8
|
||||
- SNAPCRAFT_ENABLE_SILENT_REPORT: y
|
||||
- SNAPCRAFT_ENABLE_DEVELOPER_DEBUG: y
|
||||
- SNAPCRAFT_BUILD_ENVIRONMENT: lxd
|
||||
addons:
|
||||
snaps:
|
||||
- name: snapcraft
|
||||
channel: stable
|
||||
classic: true
|
||||
- name: http
|
||||
- name: transfer
|
||||
- name: lxd
|
||||
channel: stable
|
||||
# Override default before_install, before_cache.
|
||||
before_install: /bin/true
|
||||
before_cache: /bin/true
|
||||
install: ci/snap/install.sh
|
||||
before_script: echo "Building snap..."
|
||||
script: ci/snap/script.sh
|
||||
after_success: ci/snap/after_success.sh
|
||||
deploy:
|
||||
skip_cleanup: true
|
||||
provider: script
|
||||
script: ci/snap/deploy.sh
|
||||
on:
|
||||
branch: master
|
||||
allow_failures:
|
||||
- env:
|
||||
- LC_ALL: C.UTF-8
|
||||
- LANG: C.UTF-8
|
||||
- SNAPCRAFT_ENABLE_SILENT_REPORT: y
|
||||
- SNAPCRAFT_ENABLE_DEVELOPER_DEBUG: y
|
||||
- SNAPCRAFT_BUILD_ENVIRONMENT: lxd
|
||||
fast_finish: true
|
||||
|
||||
before_install: ci/before_install.sh
|
||||
install: ci/install.sh
|
||||
before_script: ci/before_script.sh
|
||||
script: ci/script.sh
|
||||
before_cache: ci/before_cache.sh
|
||||
|
||||
branches:
|
||||
only:
|
||||
@ -211,10 +133,9 @@ cache:
|
||||
apt: true
|
||||
ccache: true
|
||||
directories:
|
||||
- "$CACHE_NVIM_DEPS_DIR"
|
||||
|
||||
git:
|
||||
quiet: true
|
||||
- "$HOME/.cache/pip"
|
||||
- "$HOME/.cache/nvim-deps"
|
||||
- "$HOME/.cache/nvim-deps-downloads"
|
||||
|
||||
notifications:
|
||||
webhooks:
|
||||
|
324
CMakeLists.txt
324
CMakeLists.txt
@ -2,15 +2,14 @@
|
||||
# intro: https://codingnest.com/basic-cmake/
|
||||
# best practices (3.0+): https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1
|
||||
|
||||
# Version should match the tested CMAKE_URL in .travis.yml.
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
project(nvim C)
|
||||
|
||||
if(POLICY CMP0065)
|
||||
cmake_policy(SET CMP0065 NEW)
|
||||
endif()
|
||||
if(POLICY CMP0060)
|
||||
cmake_policy(SET CMP0060 NEW)
|
||||
if(POLICY CMP0059)
|
||||
# Needed for use of DEFINITIONS variable, which is used to collect the
|
||||
# compilation flags for reporting in "nvim --version"
|
||||
# https://github.com/neovim/neovim/pull/8558#issuecomment-398033140
|
||||
cmake_policy(SET CMP0059 OLD)
|
||||
endif()
|
||||
|
||||
# Point CMake at any custom modules we may ship
|
||||
@ -23,23 +22,9 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
# Prefer our bundled versions of dependencies.
|
||||
if(DEFINED ENV{DEPS_BUILD_DIR})
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
|
||||
# pkg-config 29.2 has a bug on OpenBSD which causes it to drop any paths that
|
||||
# *contain* system include paths. To avoid this, we prefix what would be
|
||||
# "/usr/include" as "/_usr/include".
|
||||
# This check is also performed in the third-party/CMakeLists.txt and in the
|
||||
# else clause following here.
|
||||
# https://github.com/neovim/neovim/pull/14745#issuecomment-860201794
|
||||
set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/_usr" CACHE PATH "Path prefix for finding dependencies")
|
||||
else()
|
||||
set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/usr" CACHE PATH "Path prefix for finding dependencies")
|
||||
endif()
|
||||
set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/usr" CACHE PATH "Path prefix for finding dependencies")
|
||||
else()
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
|
||||
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/_usr" CACHE PATH "Path prefix for finding dependencies")
|
||||
else()
|
||||
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies")
|
||||
endif()
|
||||
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies")
|
||||
# When running from within CLion or Visual Studio,
|
||||
# build bundled dependencies automatically.
|
||||
if(NOT EXISTS ${DEPS_PREFIX}
|
||||
@ -97,8 +82,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
endif()
|
||||
|
||||
if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
# Ignore case when comparing filenames on Windows and Mac.
|
||||
set(CASE_INSENSITIVE_FILENAME TRUE)
|
||||
# Enable fixing case-insensitive filenames for Windows and Mac.
|
||||
set(USE_FNAME_CASE TRUE)
|
||||
endif()
|
||||
@ -114,67 +97,64 @@ else()
|
||||
option(ENABLE_LTO "enable link time optimization" ON)
|
||||
endif()
|
||||
|
||||
message(STATUS "CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
# Build type.
|
||||
# Set default build type.
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
message(STATUS "CMAKE_BUILD_TYPE not specified, default is 'Debug'")
|
||||
message(STATUS "CMAKE_BUILD_TYPE not given, defaulting to 'Debug'")
|
||||
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build" FORCE)
|
||||
else()
|
||||
message(STATUS "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
|
||||
endif()
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(DEBUG 1)
|
||||
else()
|
||||
set(DEBUG 0)
|
||||
endif()
|
||||
|
||||
# Set available build types for CMake GUIs.
|
||||
# Other build types can still be set by -DCMAKE_BUILD_TYPE=...
|
||||
# A different build type can still be set by -DCMAKE_BUILD_TYPE=...
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
|
||||
STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
||||
|
||||
# If not in a git repo (e.g., a tarball) these tokens define the complete
|
||||
# version string, else they are combined with the result of `git describe`.
|
||||
set(NVIM_VERSION_MAJOR 0)
|
||||
set(NVIM_VERSION_MINOR 5)
|
||||
set(NVIM_VERSION_PATCH 0)
|
||||
set(NVIM_VERSION_MINOR 3)
|
||||
set(NVIM_VERSION_PATCH 6)
|
||||
set(NVIM_VERSION_PRERELEASE "") # for package maintainers
|
||||
|
||||
# API level
|
||||
set(NVIM_API_LEVEL 7) # Bump this after any API change.
|
||||
set(NVIM_API_LEVEL 5) # Bump this after any API change.
|
||||
set(NVIM_API_LEVEL_COMPAT 0) # Adjust this after a _breaking_ API change.
|
||||
set(NVIM_API_PRERELEASE false)
|
||||
|
||||
file(TO_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/.git FORCED_GIT_DIR)
|
||||
include(GetGitRevisionDescription)
|
||||
get_git_head_revision(GIT_REFSPEC NVIM_VERSION_COMMIT)
|
||||
if(NVIM_VERSION_COMMIT) # is a git repo
|
||||
git_describe(NVIM_VERSION_MEDIUM)
|
||||
# `git describe` annotates the most recent tagged release; for pre-release
|
||||
# builds we must replace that with the unreleased version.
|
||||
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+"
|
||||
"v${NVIM_VERSION_MAJOR}.${NVIM_VERSION_MINOR}.${NVIM_VERSION_PATCH}"
|
||||
NVIM_VERSION_MEDIUM
|
||||
${NVIM_VERSION_MEDIUM})
|
||||
endif()
|
||||
|
||||
set(NVIM_VERSION_BUILD_TYPE "${CMAKE_BUILD_TYPE}")
|
||||
# NVIM_VERSION_CFLAGS set further below.
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Log level (MIN_LOG_LEVEL in log.h)
|
||||
if("${MIN_LOG_LEVEL}" MATCHES "^$")
|
||||
# Minimize logging for release-type builds.
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release"
|
||||
OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"
|
||||
OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
|
||||
message(STATUS "MIN_LOG_LEVEL not specified, default is 3 (ERROR) for release builds")
|
||||
set(MIN_LOG_LEVEL 3)
|
||||
else()
|
||||
message(STATUS "MIN_LOG_LEVEL not specified, default is 1 (INFO)")
|
||||
set(MIN_LOG_LEVEL 1)
|
||||
endif()
|
||||
else()
|
||||
if(NOT MIN_LOG_LEVEL MATCHES "^[0-3]$")
|
||||
message(FATAL_ERROR "invalid MIN_LOG_LEVEL: " ${MIN_LOG_LEVEL})
|
||||
endif()
|
||||
message(STATUS "MIN_LOG_LEVEL=${MIN_LOG_LEVEL}")
|
||||
endif()
|
||||
|
||||
# Default to -O2 on release builds.
|
||||
if(CMAKE_C_FLAGS_RELEASE MATCHES "-O3")
|
||||
message(STATUS "Replacing -O3 in CMAKE_C_FLAGS_RELEASE with -O2")
|
||||
string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
||||
endif()
|
||||
|
||||
# Minimize logging for release-type builds.
|
||||
if(NOT CMAKE_C_FLAGS_RELEASE MATCHES DMIN_LOG_LEVEL)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DMIN_LOG_LEVEL=3")
|
||||
endif()
|
||||
if(NOT CMAKE_C_FLAGS_MINSIZEREL MATCHES DMIN_LOG_LEVEL)
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DMIN_LOG_LEVEL=3")
|
||||
endif()
|
||||
if(NOT CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DMIN_LOG_LEVEL)
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DMIN_LOG_LEVEL=3")
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
check_c_compiler_flag(-Og HAS_OG_FLAG)
|
||||
else()
|
||||
@ -192,6 +172,11 @@ if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DNDEBUG)
|
||||
string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
endif()
|
||||
|
||||
# Enable -Wconversion.
|
||||
if(NOT MSVC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion")
|
||||
endif()
|
||||
|
||||
# gcc 4.0+ sets _FORTIFY_SOURCE=2 automatically. This currently
|
||||
# does not work with Neovim due to some uses of dynamically-sized structures.
|
||||
# https://github.com/neovim/neovim/issues/223
|
||||
@ -258,40 +243,28 @@ check_c_source_compiles("
|
||||
int main(void)
|
||||
{
|
||||
void *trace[1];
|
||||
backtrace(trace, 1);
|
||||
int trace_size = backtrace(trace, 1);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_EXECINFO_BACKTRACE)
|
||||
|
||||
check_c_source_compiles("
|
||||
int main(void)
|
||||
{
|
||||
int a = 42;
|
||||
__builtin_add_overflow(a, a, &a);
|
||||
__builtin_sub_overflow(a, a, &a);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_BUILTIN_ADD_OVERFLOW)
|
||||
|
||||
if(MSVC)
|
||||
# XXX: /W4 gives too many warnings. #3241
|
||||
add_compile_options(/W3)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
add_definitions(/W3 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
add_definitions(-DWIN32)
|
||||
else()
|
||||
add_compile_options(-Wall -Wextra -pedantic -Wno-unused-parameter
|
||||
-Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion
|
||||
-Wmissing-prototypes)
|
||||
add_definitions(-Wall -Wextra -pedantic -Wno-unused-parameter
|
||||
-Wstrict-prototypes -std=gnu99)
|
||||
|
||||
check_c_compiler_flag(-Wimplicit-fallthrough HAVE_WIMPLICIT_FALLTHROUGH_FLAG)
|
||||
if(HAVE_WIMPLICIT_FALLTHROUGH_FLAG)
|
||||
add_compile_options(-Wimplicit-fallthrough)
|
||||
check_c_compiler_flag(-Wimplicit-fallthrough HAS_WIMPLICIT_FALLTHROUGH_FLAG)
|
||||
if(HAS_WIMPLICIT_FALLTHROUGH_FLAG)
|
||||
add_definitions(-Wimplicit-fallthrough)
|
||||
endif()
|
||||
|
||||
# On FreeBSD 64 math.h uses unguarded C11 extension, which taints clang
|
||||
# 3.4.1 used there.
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(-Wno-c11-extensions)
|
||||
add_definitions(-Wno-c11-extensions)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -307,7 +280,7 @@ endif()
|
||||
# OpenBSD's GCC (4.2.1) doesn't have -Wvla
|
||||
check_c_compiler_flag(-Wvla HAS_WVLA_FLAG)
|
||||
if(HAS_WVLA_FLAG)
|
||||
add_compile_options(-Wvla)
|
||||
add_definitions(-Wvla)
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
@ -316,39 +289,46 @@ if(UNIX)
|
||||
check_c_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR_FLAG)
|
||||
|
||||
if(HAS_FSTACK_PROTECTOR_STRONG_FLAG)
|
||||
add_compile_options(-fstack-protector-strong)
|
||||
link_libraries(-fstack-protector-strong)
|
||||
add_definitions(-fstack-protector-strong)
|
||||
elseif(HAS_FSTACK_PROTECTOR_FLAG)
|
||||
add_compile_options(-fstack-protector --param ssp-buffer-size=4)
|
||||
link_libraries(-fstack-protector --param ssp-buffer-size=4)
|
||||
add_definitions(-fstack-protector --param ssp-buffer-size=4)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
check_c_compiler_flag(-fno-common HAVE_FNO_COMMON)
|
||||
if (HAVE_FNO_COMMON)
|
||||
add_compile_options(-fno-common)
|
||||
endif()
|
||||
|
||||
check_c_compiler_flag(-fdiagnostics-color=auto HAS_DIAG_COLOR_FLAG)
|
||||
if(HAS_DIAG_COLOR_FLAG)
|
||||
if(CMAKE_GENERATOR MATCHES "Ninja")
|
||||
add_compile_options(-fdiagnostics-color=always)
|
||||
else()
|
||||
add_compile_options(-fdiagnostics-color=auto)
|
||||
add_definitions(-fdiagnostics-color=auto)
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
# 1. Array-bounds testing is broken in some GCC versions before 4.8.5.
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
|
||||
# 2. But _Pragma("...ignored") is broken (unresolved) in GCC 5+:
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66099
|
||||
# So we must disable -Warray-bounds globally for GCC (for kbtree.h, #7083).
|
||||
check_c_compiler_flag(-Wno-array-bounds HAS_NO_ARRAY_BOUNDS_FLAG)
|
||||
if(HAS_NO_ARRAY_BOUNDS_FLAG)
|
||||
add_definitions(-Wno-array-bounds)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(CI_BUILD "CI, extra flags will be set" OFF)
|
||||
option(TRAVIS_CI_BUILD "Travis/QuickBuild CI, extra flags will be set" OFF)
|
||||
|
||||
if(CI_BUILD)
|
||||
message(STATUS "CI build enabled")
|
||||
add_compile_options(-Werror)
|
||||
if(TRAVIS_CI_BUILD)
|
||||
message(STATUS "Travis/QuickBuild CI build enabled")
|
||||
add_definitions(-Werror)
|
||||
if(DEFINED ENV{BUILD_32BIT})
|
||||
# Get some test coverage for unsigned char
|
||||
add_compile_options(-funsigned-char)
|
||||
add_definitions(-funsigned-char)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(DEBUG 1)
|
||||
else()
|
||||
set(DEBUG 0)
|
||||
endif()
|
||||
|
||||
option(LOG_LIST_ACTIONS "Add list actions logging" OFF)
|
||||
|
||||
add_definitions(-DINCLUDE_GENERATED_DECLARATIONS)
|
||||
@ -368,8 +348,8 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
add_definitions(-D_GNU_SOURCE)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT PREFER_LUA AND LUAJIT_VERSION LESS "2.1.0-beta3")
|
||||
# Required for luajit < 2.1.0-beta3.
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Required for luajit.
|
||||
set(CMAKE_EXE_LINKER_FLAGS
|
||||
"${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 10000 -image_base 100000000")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS
|
||||
@ -381,34 +361,12 @@ endif()
|
||||
include_directories("${PROJECT_BINARY_DIR}/config")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/src")
|
||||
|
||||
find_package(LibUV 1.28.0 REQUIRED)
|
||||
find_package(LibUV REQUIRED)
|
||||
include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
|
||||
|
||||
find_package(Msgpack 1.0.0 REQUIRED)
|
||||
include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS})
|
||||
|
||||
find_package(LibLUV 1.30.0 REQUIRED)
|
||||
include_directories(SYSTEM ${LIBLUV_INCLUDE_DIRS})
|
||||
|
||||
find_package(TreeSitter REQUIRED)
|
||||
include_directories(SYSTEM ${TreeSitter_INCLUDE_DIRS})
|
||||
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES "${TreeSitter_INCLUDE_DIRS}")
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "${TreeSitter_LIBRARIES}")
|
||||
check_c_source_compiles("
|
||||
#include <tree_sitter/api.h>
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
TSQueryCursor *cursor = ts_query_cursor_new();
|
||||
ts_query_cursor_set_match_limit(cursor, 32);
|
||||
return 0;
|
||||
}
|
||||
" TS_HAS_SET_MATCH_LIMIT)
|
||||
if(TS_HAS_SET_MATCH_LIMIT)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVIM_TS_HAS_SET_MATCH_LIMIT")
|
||||
endif()
|
||||
|
||||
# Note: The test lib requires LuaJIT; it will be skipped if LuaJIT is missing.
|
||||
option(PREFER_LUA "Prefer Lua over LuaJIT in the nvim executable." OFF)
|
||||
|
||||
@ -434,7 +392,7 @@ main(void)
|
||||
return MSGPACK_OBJECT_FLOAT32;
|
||||
}
|
||||
" MSGPACK_HAS_FLOAT32)
|
||||
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${MSGPACK_INCLUDE_DIRS}")
|
||||
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||
if(MSGPACK_HAS_FLOAT32)
|
||||
add_definitions(-DNVIM_MSGPACK_HAS_FLOAT32)
|
||||
endif()
|
||||
@ -442,7 +400,7 @@ endif()
|
||||
option(FEAT_TUI "Enable the Terminal UI" ON)
|
||||
|
||||
if(FEAT_TUI)
|
||||
find_package(UNIBILIUM 2.0 REQUIRED)
|
||||
find_package(Unibilium REQUIRED)
|
||||
include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS})
|
||||
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIRS}")
|
||||
@ -456,8 +414,8 @@ if(FEAT_TUI)
|
||||
return unibi_num_from_var(unibi_var_from_num(0));
|
||||
}
|
||||
" UNIBI_HAS_VAR_FROM)
|
||||
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIRS}")
|
||||
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARIES}")
|
||||
unset(CMAKE_REQUIRED_INCLUDES)
|
||||
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||
if(UNIBI_HAS_VAR_FROM)
|
||||
add_definitions(-DNVIM_UNIBI_HAS_VAR_FROM)
|
||||
endif()
|
||||
@ -466,7 +424,7 @@ if(FEAT_TUI)
|
||||
include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
find_package(LIBVTERM 0.1 REQUIRED)
|
||||
find_package(LibVterm REQUIRED)
|
||||
include_directories(SYSTEM ${LIBVTERM_INCLUDE_DIRS})
|
||||
|
||||
if(WIN32)
|
||||
@ -488,9 +446,20 @@ if((CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN) AND NOT CMAKE_C_COMPILER_ID MA
|
||||
message(FATAL_ERROR "Sanitizers are only supported for Clang")
|
||||
endif()
|
||||
|
||||
if(ENABLE_LIBICONV)
|
||||
find_package(Iconv REQUIRED)
|
||||
include_directories(SYSTEM ${Iconv_INCLUDE_DIRS})
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD|FreeBSD|Windows") # see #5318
|
||||
message(STATUS "skipping jemalloc on this system: ${CMAKE_SYSTEM_NAME}")
|
||||
option(ENABLE_JEMALLOC "enable jemalloc" OFF)
|
||||
else()
|
||||
option(ENABLE_JEMALLOC "enable jemalloc" ON)
|
||||
endif()
|
||||
|
||||
if(ENABLE_JEMALLOC)
|
||||
if(CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN)
|
||||
message(STATUS "Sanitizers enabled; disabling jemalloc")
|
||||
else()
|
||||
find_package(JeMalloc REQUIRED)
|
||||
include_directories(SYSTEM ${JEMALLOC_INCLUDE_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_LIBINTL)
|
||||
@ -499,6 +468,11 @@ if(ENABLE_LIBINTL)
|
||||
include_directories(SYSTEM ${LibIntl_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if(ENABLE_LIBICONV)
|
||||
find_package(Iconv REQUIRED)
|
||||
include_directories(SYSTEM ${Iconv_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
# Determine platform's threading library. Set CMAKE_THREAD_PREFER_PTHREAD
|
||||
# explicitly to indicate a strong preference for pthread.
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD ON)
|
||||
@ -520,19 +494,18 @@ include(LuaHelpers)
|
||||
set(LUA_DEPENDENCIES lpeg mpack bit)
|
||||
if(NOT LUA_PRG)
|
||||
foreach(CURRENT_LUA_PRG luajit lua5.1 lua5.2 lua)
|
||||
unset(_CHECK_LUA_PRG CACHE)
|
||||
# If LUA_PRG is set find_program() will not search
|
||||
unset(LUA_PRG CACHE)
|
||||
unset(LUA_PRG_WORKS)
|
||||
find_program(_CHECK_LUA_PRG ${CURRENT_LUA_PRG})
|
||||
find_program(LUA_PRG ${CURRENT_LUA_PRG})
|
||||
|
||||
if(_CHECK_LUA_PRG)
|
||||
check_lua_deps(${_CHECK_LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS)
|
||||
if(LUA_PRG)
|
||||
check_lua_deps(${LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS)
|
||||
if(LUA_PRG_WORKS)
|
||||
set(LUA_PRG "${_CHECK_LUA_PRG}" CACHE FILEPATH "Path to a program.")
|
||||
break()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_CHECK_LUA_PRG CACHE)
|
||||
else()
|
||||
check_lua_deps(${LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS)
|
||||
endif()
|
||||
@ -551,7 +524,6 @@ if(NOT BUSTED_OUTPUT_TYPE)
|
||||
endif()
|
||||
|
||||
find_program(LUACHECK_PRG luacheck)
|
||||
find_program(FLAKE8_PRG flake8)
|
||||
find_program(GPERF_PRG gperf)
|
||||
|
||||
include(InstallHelpers)
|
||||
@ -563,17 +535,27 @@ install_helper(
|
||||
FILES ${MANPAGES}
|
||||
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
||||
|
||||
#
|
||||
# MIN_LOG_LEVEL for log.h
|
||||
if("${MIN_LOG_LEVEL}" MATCHES "^$")
|
||||
message(STATUS "MIN_LOG_LEVEL not specified")
|
||||
else()
|
||||
if(NOT MIN_LOG_LEVEL MATCHES "^[0-3]$")
|
||||
message(FATAL_ERROR "invalid MIN_LOG_LEVEL: " ${MIN_LOG_LEVEL})
|
||||
endif()
|
||||
message(STATUS "MIN_LOG_LEVEL set to ${MIN_LOG_LEVEL}")
|
||||
endif()
|
||||
|
||||
# Go down the tree.
|
||||
#
|
||||
|
||||
add_subdirectory(src/nvim)
|
||||
get_directory_property(NVIM_VERSION_CFLAGS DIRECTORY src/nvim DEFINITION NVIM_VERSION_CFLAGS)
|
||||
# Read compilation flags from src/nvim, used in config subdirectory below.
|
||||
include(GetCompileFlags)
|
||||
get_compile_flags(NVIM_VERSION_CFLAGS)
|
||||
|
||||
add_subdirectory(test/includes)
|
||||
add_subdirectory(config)
|
||||
add_subdirectory(test/functional/fixtures) # compile test programs
|
||||
add_subdirectory(runtime)
|
||||
get_directory_property(GENERATED_HELP_TAGS DIRECTORY runtime DEFINITION GENERATED_HELP_TAGS)
|
||||
if(WIN32)
|
||||
install_helper(
|
||||
FILES ${DEPS_PREFIX}/share/nvim-qt/runtime/plugin/nvim_gui_shim.vim
|
||||
@ -595,7 +577,10 @@ if(BUSTED_PRG)
|
||||
endif()
|
||||
|
||||
set(UNITTEST_PREREQS nvim-test unittest-headers)
|
||||
set(FUNCTIONALTEST_PREREQS nvim printenv-test printargs-test shell-test streams-test tty-test ${GENERATED_HELP_TAGS})
|
||||
set(FUNCTIONALTEST_PREREQS nvim printargs-test shell-test)
|
||||
if(NOT WIN32)
|
||||
list(APPEND FUNCTIONALTEST_PREREQS tty-test)
|
||||
endif()
|
||||
set(BENCHMARK_PREREQS nvim tty-test)
|
||||
|
||||
# Useful for automated build systems, if they want to manually run the tests.
|
||||
@ -620,6 +605,7 @@ if(BUSTED_PRG)
|
||||
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
||||
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
||||
-DTEST_TYPE=unit
|
||||
-DSYSTEM_NAME=${CMAKE_SYSTEM_NAME}
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
||||
DEPENDS ${UNITTEST_PREREQS}
|
||||
${TEST_TARGET_ARGS})
|
||||
@ -650,6 +636,7 @@ if(BUSTED_PRG)
|
||||
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
||||
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
||||
-DTEST_TYPE=functional
|
||||
-DSYSTEM_NAME=${CMAKE_SYSTEM_NAME}
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
||||
DEPENDS ${FUNCTIONALTEST_PREREQS}
|
||||
${TEST_TARGET_ARGS})
|
||||
@ -666,6 +653,7 @@ if(BUSTED_PRG)
|
||||
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
||||
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
||||
-DTEST_TYPE=benchmark
|
||||
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
||||
DEPENDS ${BENCHMARK_PREREQS}
|
||||
${TEST_TARGET_ARGS})
|
||||
@ -683,6 +671,7 @@ if(BUSTED_LUA_PRG)
|
||||
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
||||
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
||||
-DTEST_TYPE=functional
|
||||
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
||||
DEPENDS ${FUNCTIONALTEST_PREREQS}
|
||||
${TEST_TARGET_ARGS})
|
||||
@ -690,12 +679,40 @@ if(BUSTED_LUA_PRG)
|
||||
endif()
|
||||
|
||||
if(LUACHECK_PRG)
|
||||
add_custom_target(lualint
|
||||
COMMAND ${LUACHECK_PRG} -q runtime/ src/ test/ --exclude-files test/functional/fixtures/lua/syntax_error.lua
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
else()
|
||||
add_custom_target(lualint false
|
||||
COMMENT "lualint: LUACHECK_PRG not defined")
|
||||
add_custom_target(testlint
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DLUACHECK_PRG=${LUACHECK_PRG}
|
||||
-DLUAFILES_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
||||
-DIGNORE_PATTERN="*/preload.lua"
|
||||
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunLuacheck.cmake)
|
||||
|
||||
add_custom_target(
|
||||
lintbuiltinlua
|
||||
COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
-DLUACHECK_PRG=${LUACHECK_PRG}
|
||||
-DLUAFILES_DIR=${CMAKE_CURRENT_SOURCE_DIR}/src/nvim/lua
|
||||
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
|
||||
-DREAD_GLOBALS=vim
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunLuacheck.cmake
|
||||
)
|
||||
add_custom_target(
|
||||
lintruntimelua
|
||||
COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
-DLUACHECK_PRG=${LUACHECK_PRG}
|
||||
-DLUAFILES_DIR=${CMAKE_CURRENT_SOURCE_DIR}/runtime/lua
|
||||
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
|
||||
-DREAD_GLOBALS=vim
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunLuacheck.cmake
|
||||
)
|
||||
# TODO(ZyX-I): Run linter for all lua code in src
|
||||
add_custom_target(
|
||||
lualint
|
||||
DEPENDS lintruntimelua
|
||||
DEPENDS lintbuiltinlua
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_NAME "Neovim")
|
||||
@ -709,14 +726,3 @@ set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
||||
set(CPACK_NSIS_MODIFY_PATH ON)
|
||||
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
|
||||
include(CPack)
|
||||
|
||||
#add uninstall target
|
||||
if(NOT TARGET uninstall)
|
||||
configure_file(
|
||||
"cmake/UninstallHelper.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/UninstallHelper.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
|
||||
add_custom_target(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/UninstallHelper.cmake)
|
||||
endif()
|
||||
|
215
CONTRIBUTING.md
215
CONTRIBUTING.md
@ -1,5 +1,4 @@
|
||||
Contributing to Neovim
|
||||
======================
|
||||
# Contributing to Neovim
|
||||
|
||||
Getting started
|
||||
---------------
|
||||
@ -8,27 +7,14 @@ If you want to help but don't know where to start, here are some
|
||||
low-risk/isolated tasks:
|
||||
|
||||
- [Merge a Vim patch].
|
||||
- Try a [good first issue](../../labels/good%20first%20issue) or [complexity:low] issue.
|
||||
- Fix bugs found by [Clang](#clang-scan-build), [PVS](#pvs-studio) or
|
||||
[Coverity](#coverity).
|
||||
|
||||
Reporting problems
|
||||
------------------
|
||||
|
||||
- [Check the FAQ][wiki-faq].
|
||||
- [Search existing issues][github-issues] (including closed!)
|
||||
- Update Neovim to the latest version to see if your problem persists.
|
||||
- Disable plugins incrementally, to narrow down the cause of the issue.
|
||||
- When reporting a crash, [include a stacktrace](https://github.com/neovim/neovim/wiki/FAQ#backtrace-linux).
|
||||
- Use [ASAN/UBSAN](#clang-sanitizers-asan-and-ubsan) to get detailed errors for segfaults and undefined behavior.
|
||||
- [Bisect][git-bisect] to the cause of a regression, if you are able. This is _extremely_ helpful.
|
||||
- Check `$NVIM_LOG_FILE`, if it exists.
|
||||
- Include `cmake --system-information` for build-related issues.
|
||||
- Try a [complexity:low] issue.
|
||||
- Fix bugs found by [clang scan-build](#clang-scan-build),
|
||||
[coverity](#coverity), and [PVS](#pvs-studio).
|
||||
|
||||
Developer guidelines
|
||||
--------------------
|
||||
|
||||
- Nvim contributors should read `:help dev`.
|
||||
- Nvim contributors should read `:help dev` (especially `:help dev-api`).
|
||||
- External UI developers should read `:help dev-ui`.
|
||||
- API client developers should read `:help dev-api-client`.
|
||||
- Nvim developers are _strongly encouraged_ to install `ninja` for faster builds.
|
||||
@ -37,13 +23,23 @@ Developer guidelines
|
||||
make distclean
|
||||
make # Nvim build system uses ninja automatically, if available.
|
||||
```
|
||||
- [Improve documentation][wiki-contribute-help]
|
||||
|
||||
Pull requests (PRs)
|
||||
Reporting problems
|
||||
------------------
|
||||
|
||||
- Check the [**FAQ**][wiki-faq].
|
||||
- Search [existing issues][github-issues] (including closed!)
|
||||
- Update Neovim to the latest version to see if your problem persists.
|
||||
- Disable plugins incrementally, to narrow down the cause of the issue.
|
||||
- When reporting a crash, [include a stacktrace](https://github.com/neovim/neovim/wiki/Development-tips#backtrace-linux).
|
||||
- [Bisect][git-bisect] to the cause of a regression, if you are able. This is _extremely_ helpful.
|
||||
- Check `$NVIM_LOG_FILE`, if it exists.
|
||||
- Include `cmake --system-information` for **build** issues.
|
||||
|
||||
Pull requests ("PRs")
|
||||
---------------------
|
||||
|
||||
- To avoid duplicate work, create a `[WIP]` pull request as soon as possible.
|
||||
- Your PR must include **test coverage.** See [test/README.md][run-tests].
|
||||
- Avoid cosmetic changes to unrelated files in the same commit.
|
||||
- Use a [feature branch][git-feature-branch] instead of the master branch.
|
||||
- Use a **rebase workflow** for small PRs.
|
||||
@ -67,39 +63,37 @@ Pull requests (PRs)
|
||||
Pull requests have three stages: `[WIP]` (Work In Progress), `[RFC]` (Request
|
||||
For Comment) and `[RDY]` (Ready).
|
||||
|
||||
1. `[RFC]` is assumed by default, **do not** put "RFC" in the PR title (it adds
|
||||
noise to merge commit messages).
|
||||
2. Add `[WIP]` to the PR title if you are _not_ requesting feedback and the work
|
||||
is still in flux.
|
||||
3. Add `[RDY]` to the PR title if you are _done_ and only waiting on merge.
|
||||
- Untagged PRs are assumed to be `[RFC]`, i.e. you are requesting a review.
|
||||
- Prepend `[WIP]` to the PR title if you are _not_ requesting feedback and the
|
||||
work is still in flux.
|
||||
- Prepend `[RDY]` to the PR title if you are _done_ with the PR and are only
|
||||
waiting on it to be merged.
|
||||
|
||||
For example, a typical workflow is:
|
||||
|
||||
1. You open a `[WIP]` PR where the work is _not_ ready for feedback, you just want to
|
||||
let others know what you are doing.
|
||||
2. Once the PR is ready for review, you replace `[WIP]` in the title with `[RFC]`.
|
||||
You may add fix up commits to address issues that come up during review.
|
||||
3. Once the PR is ready for merging, you rebase/squash your work appropriately and
|
||||
then replace `[RFC]` in the title with `[RDY]`.
|
||||
|
||||
### Commit messages
|
||||
|
||||
Follow the [convential commits guidelines][conventional_commits] to *make reviews easier* and to make
|
||||
the VCS/git logs more valuable. The general structure of a commit message is as follows:
|
||||
Follow [commit message hygiene][hygiene] to *make reviews easier* and to make
|
||||
the VCS/git logs more valuable.
|
||||
|
||||
```
|
||||
<type>([optional scope]): <description>
|
||||
|
||||
[optional body]
|
||||
|
||||
[optional footer(s)]
|
||||
```
|
||||
|
||||
- **Prefix the commit subject with a _type_:** `doc:`, `test:`
|
||||
`runtime:`, ...
|
||||
- Subject line for commits with only style/lint changes can be a single
|
||||
word: `style` or `lint`.
|
||||
- **Add the optional scope following <type> if possible:** `(lsp)`, `(treesitter)`, `(multigrid)`, ...
|
||||
- Try to keep the first line under 72 characters.
|
||||
- **Prefix the commit subject with a _scope_:** `doc:`, `test:`, `foo.c:`,
|
||||
`runtime:`, ...
|
||||
- For commits that contain only style/lint changes, a single-word subject
|
||||
line is preferred: `style` or `lint`.
|
||||
- A blank line must separate the subject from the description.
|
||||
- Breaking changes must be indicated at the very beginning of the footer or body section of a commit. A breaking change must consist of the uppercase text BREAKING CHANGE, followed by a colon, a space, and a description of what has changed about the API.
|
||||
- Check your commit message for spelling and grammatical mistakes.
|
||||
- Use the _imperative voice_: "Fix bug" rather than "Fixed bug" or "Fixes bug."
|
||||
|
||||
### Automated builds (CI)
|
||||
|
||||
Each pull request must pass the automated builds on [Travis CI], [sourcehut]
|
||||
Each pull request must pass the automated builds on [travis CI], [quickbuild]
|
||||
and [AppVeyor].
|
||||
|
||||
- CI builds are compiled with [`-Werror`][gcc-warnings], so compiler warnings
|
||||
@ -111,116 +105,47 @@ and [AppVeyor].
|
||||
- CI runs [ASan] and other analyzers.
|
||||
- To run valgrind locally: `VALGRIND=1 make test`
|
||||
- To run Clang ASan/UBSan locally: `CC=clang make CMAKE_FLAGS="-DCLANG_ASAN_UBSAN=ON"`
|
||||
- The [lint](#lint) build checks modified lines _and their immediate
|
||||
neighbors_, to encourage incrementally updating the legacy style to meet our
|
||||
[style](#style). (See [#3174][3174] for background.)
|
||||
- CI for freebsd and openbsd runs on [sourcehut].
|
||||
- To get a backtrace on freebsd (after connecting via ssh):
|
||||
```sh
|
||||
sudo pkg install tmux # If you want tmux.
|
||||
lldb build/bin/nvim -c nvim.core
|
||||
- The `lint` build ([#3174][3174]) checks modified lines _and their immediate
|
||||
neighbors_. This is to encourage incrementally updating the legacy style to
|
||||
meet our style guidelines.
|
||||
- A single word (`lint` or `style`) is sufficient as the subject line of
|
||||
a commit that contains only style changes.
|
||||
- [How to investigate QuickBuild failures](https://github.com/neovim/neovim/pull/4718#issuecomment-217631350)
|
||||
|
||||
QuickBuild uses this invocation:
|
||||
|
||||
mkdir -p build/${params.get("buildType")} \
|
||||
&& cd build/${params.get("buildType")} \
|
||||
&& cmake -G "Unix Makefiles" -DBUSTED_OUTPUT_TYPE=TAP -DCMAKE_BUILD_TYPE=${params.get("buildType")}
|
||||
-DTRAVIS_CI_BUILD=ON ../.. && ${node.getAttribute("make", "make")}
|
||||
VERBOSE=1 nvim unittest-prereqs functionaltest-prereqs
|
||||
|
||||
# To get a full backtrace:
|
||||
# 1. Rebuild with debug info.
|
||||
rm -rf nvim.core build
|
||||
gmake CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="-DCI_BUILD=ON -DMIN_LOG_LEVEL=3" nvim
|
||||
# 2. Run the failing test to generate a new core file.
|
||||
TEST_FILE=test/functional/foo.lua gmake functionaltest
|
||||
lldb build/bin/nvim -c nvim.core
|
||||
```
|
||||
|
||||
### Clang scan-build
|
||||
|
||||
View the [Clang report] to see potential bugs found by the Clang
|
||||
[scan-build](https://clang-analyzer.llvm.org/scan-build.html) analyzer.
|
||||
The auto-generated [clang-scan] report presents walk-throughs of bugs found by
|
||||
Clang's [scan-build](https://clang-analyzer.llvm.org/scan-build.html) static
|
||||
analyzer. To verify a fix locally, run `scan-build` like this:
|
||||
|
||||
- Search the Neovim commit history to find examples:
|
||||
```
|
||||
git log --oneline --no-merges --grep clang
|
||||
```
|
||||
- To verify a fix locally, run `scan-build` like this:
|
||||
```
|
||||
rm -rf build/
|
||||
scan-build --use-analyzer=/usr/bin/clang make
|
||||
```
|
||||
|
||||
### PVS-Studio
|
||||
|
||||
View the [PVS report](https://neovim.io/doc/reports/pvs/PVS-studio.html.d/) to
|
||||
see potential bugs found by [PVS Studio](https://www.viva64.com/en/pvs-studio/).
|
||||
|
||||
- Use this format for commit messages (where `{id}` is the PVS warning-id)):
|
||||
```
|
||||
PVS/V{id}: {description}
|
||||
```
|
||||
- Search the Neovim commit history to find examples:
|
||||
```
|
||||
git log --oneline --no-merges --grep PVS
|
||||
```
|
||||
- Try `./scripts/pvscheck.sh` to run PVS locally.
|
||||
rm -rf build/
|
||||
scan-build --use-analyzer=/usr/bin/clang make
|
||||
|
||||
### Coverity
|
||||
|
||||
[Coverity](https://scan.coverity.com/projects/neovim-neovim) runs against the
|
||||
master build. To view the defects, just request access; you will be approved.
|
||||
|
||||
- Use this format for commit messages (where `{id}` is the CID (Coverity ID);
|
||||
([example](https://github.com/neovim/neovim/pull/804))):
|
||||
```
|
||||
coverity/{id}: {description}
|
||||
```
|
||||
- Search the Neovim commit history to find examples:
|
||||
```
|
||||
git log --oneline --no-merges --grep coverity
|
||||
```
|
||||
|
||||
### Clang sanitizers (ASAN and UBSAN)
|
||||
Use this commit-message format for coverity fixes:
|
||||
|
||||
ASAN/UBSAN can be used to detect memory errors and other common forms of undefined behavior at runtime in debug builds.
|
||||
To build neovim with sanitizers enabled, use
|
||||
```
|
||||
rm -rf build && CMAKE_EXTRA_FLAGS="-DCMAKE_C_COMPILER=clang -DCLANG_ASAN_UBSAN=1" make
|
||||
```
|
||||
When running neovim, use
|
||||
```
|
||||
UBSAN_OPTIONS=print_stacktrace=1 ASAN_OPTIONS=log_path=/tmp/nvim_asan nvim args...
|
||||
```
|
||||
If neovim exits unexpectedly, check `/tmp/nvim_asan.{PID}` (or your preferred `log_path`) for log files with error messages.
|
||||
|
||||
coverity/<id>: <description of what fixed the defect>
|
||||
|
||||
Coding
|
||||
------
|
||||
where `<id>` is the Coverity ID (CID). For example see [#804](https://github.com/neovim/neovim/pull/804).
|
||||
|
||||
### Lint
|
||||
|
||||
You can run the linter locally by:
|
||||
|
||||
make lint
|
||||
|
||||
The lint step downloads the [master error list] and excludes them, so only lint
|
||||
errors related to the local changes are reported.
|
||||
|
||||
You can lint a single file (but this will _not_ exclude legacy errors):
|
||||
|
||||
./src/clint.py src/nvim/ops.c
|
||||
|
||||
### Style
|
||||
|
||||
The repo includes a `.clang-format` config file which (mostly) matches the
|
||||
[style-guide]. You can use `clang-format` to format code with the `gq`
|
||||
operator in Nvim:
|
||||
|
||||
if !empty(findfile('.clang-format', ';'))
|
||||
setlocal formatprg=clang-format\ -style=file
|
||||
endif
|
||||
|
||||
### Navigate
|
||||
|
||||
- Use **[universal-ctags](https://github.com/universal-ctags/ctags).**
|
||||
("Exuberant ctags", the typical `ctags` binary provided by your distro, is
|
||||
unmaintained and won't recognize many function signatures in Neovim source.)
|
||||
- Explore the source code [on the web](https://sourcegraph.com/github.com/neovim/neovim).
|
||||
### PVS-Studio
|
||||
|
||||
View the [PVS analysis report](https://neovim.io/doc/reports/pvs/) to see bugs
|
||||
found by [PVS Studio](https://www.viva64.com/en/pvs-studio/).
|
||||
You can run `scripts/pvscheck.sh` locally to run PVS on your machine.
|
||||
|
||||
Reviewing
|
||||
---------
|
||||
@ -247,18 +172,16 @@ as context, use the `-W` argument as well.
|
||||
[github-issues]: https://github.com/neovim/neovim/issues
|
||||
[1820]: https://github.com/neovim/neovim/pull/1820
|
||||
[hub]: https://hub.github.com/
|
||||
[conventional_commits]: https://www.conventionalcommits.org
|
||||
[hygiene]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
||||
[style-guide]: http://neovim.io/develop/style-guide.xml
|
||||
[ASan]: http://clang.llvm.org/docs/AddressSanitizer.html
|
||||
[run-tests]: https://github.com/neovim/neovim/blob/master/test/README.md#running-tests
|
||||
[wiki-faq]: https://github.com/neovim/neovim/wiki/FAQ
|
||||
[review-checklist]: https://github.com/neovim/neovim/wiki/Code-review-checklist
|
||||
[3174]: https://github.com/neovim/neovim/issues/3174
|
||||
[Travis CI]: https://travis-ci.org/neovim/neovim
|
||||
[sourcehut]: https://builds.sr.ht/~jmk
|
||||
[travis CI]: https://travis-ci.org/neovim/neovim
|
||||
[quickbuild]: http://neovim-qb.szakmeister.net/dashboard
|
||||
[AppVeyor]: https://ci.appveyor.com/project/neovim/neovim
|
||||
[Merge a Vim patch]: https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-Vim
|
||||
[Clang report]: https://neovim.io/doc/reports/clang/
|
||||
[clang-scan]: https://neovim.io/doc/reports/clang/
|
||||
[complexity:low]: https://github.com/neovim/neovim/issues?q=is%3Aopen+is%3Aissue+label%3Acomplexity%3Alow
|
||||
[master error list]: https://raw.githubusercontent.com/neovim/doc/gh-pages/reports/clint/errors.json
|
||||
[wiki-contribute-help]: https://github.com/neovim/neovim/wiki/contribute-%3Ahelp
|
||||
|
@ -1,15 +1,7 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Request an enhancement for Nvim
|
||||
title: ''
|
||||
labels: enhancement
|
||||
|
||||
---
|
||||
|
||||
<!-- Before reporting: search existing issues and check the FAQ. -->
|
||||
|
||||
- `nvim --version`:
|
||||
- `vim -u DEFAULTS` (version: ) behaves differently?
|
||||
- Vim (version: ) behaves differently?
|
||||
- Operating system/version:
|
||||
- Terminal name/version:
|
||||
- `$TERM`:
|
47
MAINTAIN.md
47
MAINTAIN.md
@ -3,16 +3,9 @@ Maintaining the Neovim project
|
||||
|
||||
Notes on maintaining the Neovim project.
|
||||
|
||||
General guidelines
|
||||
------------------
|
||||
See also: https://github.com/git/git/blob/master/Documentation/howto/maintain-git.txt
|
||||
|
||||
* Decide by cost-benefit
|
||||
* Write down what was decided
|
||||
* Constraints are good
|
||||
* Use automation to solve problems
|
||||
* Never break the API
|
||||
|
||||
Ticket triage
|
||||
Ticket Triage
|
||||
-------------
|
||||
|
||||
In practice we haven't found a meaningful way to forecast more precisely than
|
||||
@ -26,9 +19,9 @@ The forecasting problem might be solved with an explicit priority system (like
|
||||
Bram's todo.txt). Meanwhile the Neovim priority system is defined by:
|
||||
|
||||
- PRs nearing completion (RDY).
|
||||
- Issue labels. E.g. the `+plan` label increases the ticket's priority merely
|
||||
for having a plan written down: it is _closer to completion_ than tickets
|
||||
without a plan.
|
||||
- Issue labels. E.g. the +plan label increases the ticket's priority merely for
|
||||
having a plan written down: it is _closer to completion_ than tickets without
|
||||
a plan.
|
||||
- Comment activity or new information.
|
||||
|
||||
Anything that isn't in the next milestone, and doesn't have a RDY PR ... is
|
||||
@ -36,28 +29,20 @@ just not something you care very much about, by construction. Post-release you
|
||||
can review open issues, but chances are your next milestone is already getting
|
||||
full :)
|
||||
|
||||
Release policy
|
||||
Release Policy
|
||||
--------------
|
||||
|
||||
Release "often", but not "early".
|
||||
The goal is "early and often".
|
||||
|
||||
The (unreleased) `master` branch is the "early" channel; it should not be
|
||||
released if it's not stable. High-risk changes may be merged to `master` if
|
||||
the next release is not imminent.
|
||||
Up to now we use only one branch, the `master` branch.
|
||||
|
||||
For maintenance releases, create a `release-x.y` branch. If the current release
|
||||
has a major bug:
|
||||
- If `master` is unstable we don't release.
|
||||
- If the last release has a major bug, we:
|
||||
1. Fix the bug on `master`.
|
||||
2. Disable or remove any known risks present on `master`.
|
||||
3. Cut a release from `master`.
|
||||
|
||||
1. Fix the bug on `master`.
|
||||
2. Cherry-pick the fix to `release-x.y`.
|
||||
3. Cut a release from `release-x.y`.
|
||||
- Run `./scripts/release.sh`
|
||||
- Update (force-push) the remote `stable` tag.
|
||||
- The [nightly job](https://github.com/neovim/bot-ci/blob/master/ci/nightly.sh)
|
||||
will update the release assets based on the `stable` tag.
|
||||
This is a bit silly, but it works ok. And it keeps `master` from biting off
|
||||
more feature-creep than it can chew.
|
||||
|
||||
See also
|
||||
--------
|
||||
|
||||
- https://github.com/neovim/neovim/issues/862
|
||||
- https://github.com/git/git/blob/master/Documentation/howto/maintain-git.txt
|
||||
See also: https://github.com/neovim/neovim/issues/862
|
||||
|
113
Makefile
113
Makefile
@ -5,39 +5,15 @@ filter-true = $(strip $(filter-out 1 on ON true TRUE,$1))
|
||||
# See contrib/local.mk.example
|
||||
-include local.mk
|
||||
|
||||
all: nvim
|
||||
|
||||
CMAKE_PRG ?= $(shell (command -v cmake3 || echo cmake))
|
||||
CMAKE_BUILD_TYPE ?= Debug
|
||||
|
||||
CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
|
||||
# Extra CMake flags which extend the default set
|
||||
CMAKE_EXTRA_FLAGS ?=
|
||||
|
||||
# CMAKE_INSTALL_PREFIX
|
||||
# - May be passed directly or as part of CMAKE_EXTRA_FLAGS.
|
||||
# - `checkprefix` target checks that it matches the CMake-cached value. #9615
|
||||
ifneq (,$(CMAKE_INSTALL_PREFIX)$(CMAKE_EXTRA_FLAGS))
|
||||
CMAKE_INSTALL_PREFIX := $(shell echo $(CMAKE_EXTRA_FLAGS) | 2>/dev/null \
|
||||
grep -o 'CMAKE_INSTALL_PREFIX=[^ ]\+' | cut -d '=' -f2)
|
||||
endif
|
||||
ifneq (,$(CMAKE_INSTALL_PREFIX))
|
||||
override CMAKE_EXTRA_FLAGS += -DCMAKE_INSTALL_PREFIX=$(CMAKE_INSTALL_PREFIX)
|
||||
|
||||
checkprefix:
|
||||
@if [ -f build/.ran-cmake ]; then \
|
||||
cached_prefix=$(shell $(CMAKE_PRG) -L -N build | 2>/dev/null grep 'CMAKE_INSTALL_PREFIX' | cut -d '=' -f2); \
|
||||
if ! [ "$(CMAKE_INSTALL_PREFIX)" = "$$cached_prefix" ]; then \
|
||||
printf "Re-running CMake: CMAKE_INSTALL_PREFIX '$(CMAKE_INSTALL_PREFIX)' does not match cached value '%s'.\n" "$$cached_prefix"; \
|
||||
$(RM) build/.ran-cmake; \
|
||||
fi \
|
||||
fi
|
||||
else
|
||||
checkprefix: ;
|
||||
endif
|
||||
|
||||
BUILD_TYPE ?= $(shell (type ninja > /dev/null 2>&1 && echo "Ninja") || \
|
||||
echo "Unix Makefiles")
|
||||
DEPS_BUILD_DIR ?= .deps
|
||||
|
||||
ifneq (1,$(words [$(DEPS_BUILD_DIR)]))
|
||||
$(error DEPS_BUILD_DIR must not contain whitespace)
|
||||
endif
|
||||
@ -56,19 +32,17 @@ ifeq (,$(BUILD_TOOL))
|
||||
endif
|
||||
endif
|
||||
|
||||
BUILD_CMD = $(BUILD_TOOL)
|
||||
|
||||
# Only need to handle Ninja here. Make will inherit the VERBOSE variable, and the -j and -n flags.
|
||||
ifeq ($(BUILD_TYPE),Ninja)
|
||||
ifneq ($(VERBOSE),)
|
||||
BUILD_CMD += -v
|
||||
endif
|
||||
BUILD_CMD += $(shell printf '%s' '$(MAKEFLAGS)' | grep -o -- '-j[0-9]\+')
|
||||
ifeq (n,$(findstring n,$(firstword -$(MAKEFLAGS))))
|
||||
BUILD_CMD += -n
|
||||
ifneq ($(VERBOSE),)
|
||||
# Only need to handle Ninja here. Make will inherit the VERBOSE variable.
|
||||
ifeq ($(BUILD_TYPE),Ninja)
|
||||
VERBOSE_FLAG := -v
|
||||
endif
|
||||
endif
|
||||
|
||||
BUILD_CMD = $(BUILD_TOOL) $(VERBOSE_FLAG)
|
||||
|
||||
# Extra CMake flags which extend the default set
|
||||
CMAKE_EXTRA_FLAGS ?=
|
||||
DEPS_CMAKE_FLAGS ?=
|
||||
# Back-compat: USE_BUNDLED_DEPS was the old name.
|
||||
USE_BUNDLED ?= $(USE_BUNDLED_DEPS)
|
||||
@ -86,6 +60,8 @@ endif
|
||||
# a warning, but we need to keep SCRIPTS argument.
|
||||
SINGLE_MAKE = export MAKEFLAGS= ; $(MAKE)
|
||||
|
||||
all: nvim
|
||||
|
||||
nvim: build/.ran-cmake deps
|
||||
+$(BUILD_CMD) -C build
|
||||
|
||||
@ -105,37 +81,30 @@ ifeq ($(call filter-true,$(USE_BUNDLED)),)
|
||||
+$(BUILD_CMD) -C $(DEPS_BUILD_DIR)
|
||||
endif
|
||||
|
||||
build/.ran-third-party-cmake:
|
||||
ifeq ($(call filter-true,$(USE_BUNDLED)),)
|
||||
$(DEPS_BUILD_DIR):
|
||||
mkdir -p "$@"
|
||||
build/.ran-third-party-cmake:: $(DEPS_BUILD_DIR)
|
||||
mkdir -p $(DEPS_BUILD_DIR)
|
||||
cd $(DEPS_BUILD_DIR) && \
|
||||
$(CMAKE_PRG) -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \
|
||||
$(DEPS_CMAKE_FLAGS) $(THIS_DIR)/third-party
|
||||
endif
|
||||
build/.ran-third-party-cmake::
|
||||
mkdir -p build
|
||||
touch $@
|
||||
|
||||
# TODO: cmake 3.2+ add_custom_target() has a USES_TERMINAL flag.
|
||||
oldtest: | nvim build/runtime/doc/tags
|
||||
oldtest: | nvim helptags
|
||||
+$(SINGLE_MAKE) -C src/nvim/testdir clean
|
||||
ifeq ($(strip $(TEST_FILE)),)
|
||||
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" $(MAKEOVERRIDES)
|
||||
else
|
||||
@# Handle TEST_FILE=test_foo{,.res,.vim}.
|
||||
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" SCRIPTS= $(MAKEOVERRIDES) $(patsubst %.vim,%,$(patsubst %.res,%,$(TEST_FILE)))
|
||||
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" NEW_TESTS=$(TEST_FILE) SCRIPTS= $(MAKEOVERRIDES)
|
||||
endif
|
||||
# Build oldtest by specifying the relative .vim filename.
|
||||
.PHONY: phony_force
|
||||
src/nvim/testdir/%.vim: phony_force
|
||||
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" SCRIPTS= $(MAKEOVERRIDES) $(patsubst src/nvim/testdir/%.vim,%,$@)
|
||||
|
||||
build/runtime/doc/tags helptags: | nvim
|
||||
+$(BUILD_CMD) -C build runtime/doc/tags
|
||||
helptags: | nvim
|
||||
+$(BUILD_CMD) -C build helptags
|
||||
|
||||
# Builds help HTML _and_ checks for invalid help tags.
|
||||
helphtml: | nvim build/runtime/doc/tags
|
||||
helphtml: | nvim helptags
|
||||
+$(BUILD_CMD) -C build doc_html
|
||||
|
||||
functionaltest: | nvim
|
||||
@ -144,25 +113,12 @@ functionaltest: | nvim
|
||||
functionaltest-lua: | nvim
|
||||
+$(BUILD_CMD) -C build functionaltest-lua
|
||||
|
||||
testlint: | build/.ran-cmake deps
|
||||
$(BUILD_CMD) -C build testlint
|
||||
|
||||
lualint: | build/.ran-cmake deps
|
||||
$(BUILD_CMD) -C build lualint
|
||||
|
||||
shlint:
|
||||
@shellcheck --version | head -n 2
|
||||
shellcheck scripts/vim-patch.sh
|
||||
|
||||
_opt_shlint:
|
||||
@command -v shellcheck && { $(MAKE) shlint; exit $$?; } \
|
||||
|| echo "SKIP: shlint (shellcheck not found)"
|
||||
|
||||
pylint:
|
||||
flake8 contrib/ scripts/ src/ test/
|
||||
|
||||
# Run pylint only if flake8 is installed.
|
||||
_opt_pylint:
|
||||
@command -v flake8 && { $(MAKE) pylint; exit $$?; } \
|
||||
|| echo "SKIP: pylint (flake8 not found)"
|
||||
|
||||
unittest: | nvim
|
||||
+$(BUILD_CMD) -C build unittest
|
||||
|
||||
@ -175,13 +131,11 @@ clean:
|
||||
+test -d build && $(BUILD_CMD) -C build clean || true
|
||||
$(MAKE) -C src/nvim/testdir clean
|
||||
$(MAKE) -C runtime/doc clean
|
||||
$(MAKE) -C runtime/indent clean
|
||||
|
||||
distclean:
|
||||
distclean: clean
|
||||
rm -rf $(DEPS_BUILD_DIR) build
|
||||
$(MAKE) clean
|
||||
|
||||
install: checkprefix nvim
|
||||
install: | nvim
|
||||
+$(BUILD_CMD) -C build install
|
||||
|
||||
clint: build/.ran-cmake
|
||||
@ -199,22 +153,11 @@ generated-sources: build/.ran-cmake
|
||||
appimage:
|
||||
bash scripts/genappimage.sh
|
||||
|
||||
# Build an appimage with embedded update information.
|
||||
# appimage-nightly: for nightly builds
|
||||
# appimage-latest: for a release
|
||||
# Build an appimage with embedded update information appimage-nightly for
|
||||
# nightly builds or appimage-latest for a release
|
||||
appimage-%:
|
||||
bash scripts/genappimage.sh $*
|
||||
|
||||
lint: check-single-includes clint lualint _opt_pylint _opt_shlint
|
||||
lint: check-single-includes clint testlint lualint
|
||||
|
||||
# Generic pattern rules, allowing for `make build/bin/nvim` etc.
|
||||
# Does not work with "Unix Makefiles".
|
||||
ifeq ($(BUILD_TYPE),Ninja)
|
||||
build/%: phony_force
|
||||
$(BUILD_CMD) -C build $(patsubst build/%,%,$@)
|
||||
|
||||
$(DEPS_BUILD_DIR)/%: phony_force
|
||||
$(BUILD_CMD) -C $(DEPS_BUILD_DIR) $(patsubst $(DEPS_BUILD_DIR)/%,%,$@)
|
||||
endif
|
||||
|
||||
.PHONY: test lualint pylint shlint functionaltest unittest lint clint clean distclean nvim libnvim cmake deps install appimage checkprefix
|
||||
.PHONY: test testlint lualint functionaltest unittest lint clint clean distclean nvim libnvim cmake deps install appimage
|
||||
|
82
README.md
82
README.md
@ -1,10 +1,13 @@
|
||||
[](https://neovim.io)
|
||||
[](https://neovim.io)
|
||||
|
||||
[Documentation](https://neovim.io/doc/general/) |
|
||||
[Chat](https://gitter.im/neovim/neovim) |
|
||||
[Twitter](https://twitter.com/Neovim)
|
||||
[Wiki](https://github.com/neovim/neovim/wiki) |
|
||||
[Documentation](https://neovim.io/doc) |
|
||||
[Twitter](https://twitter.com/Neovim) |
|
||||
[Community](https://neovim.io/community/) |
|
||||
[Gitter **Chat**](https://gitter.im/neovim/neovim)
|
||||
|
||||
[](https://github.com/neovim/neovim/actions?query=workflow%3A%22CI%22)
|
||||
[](https://travis-ci.org/neovim/neovim)
|
||||
[](https://ci.appveyor.com/project/neovim/neovim/branch/master)
|
||||
[](https://codecov.io/gh/neovim/neovim)
|
||||
[](https://scan.coverity.com/projects/2227)
|
||||
[](https://neovim.io/doc/reports/clang)
|
||||
@ -13,7 +16,6 @@
|
||||
[](https://repology.org/metapackage/neovim)
|
||||
[](https://buildd.debian.org/neovim)
|
||||
[](https://github.com/neovim/neovim/releases/)
|
||||
[](https://snapcraft.io/nvim)
|
||||
|
||||
Neovim is a project that seeks to aggressively refactor Vim in order to:
|
||||
|
||||
@ -25,13 +27,15 @@ Neovim is a project that seeks to aggressively refactor Vim in order to:
|
||||
See the [Introduction](https://github.com/neovim/neovim/wiki/Introduction) wiki page and [Roadmap]
|
||||
for more information.
|
||||
|
||||
[](https://waffle.io/neovim/neovim/metrics)
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
- Modern [GUIs](https://github.com/neovim/neovim/wiki/Related-projects#gui)
|
||||
- [API access](https://github.com/neovim/neovim/wiki/Related-projects#api-clients)
|
||||
from any language including C/C++, C#, Clojure, D, Elixir, Go, Haskell, Java,
|
||||
JavaScript/Node.js, Julia, Lisp, Lua, Perl, Python, Racket, Ruby, Rust
|
||||
- [API](https://github.com/neovim/neovim/wiki/Related-projects#api-clients)
|
||||
access from any language including Clojure, Lisp, Go, Haskell, Lua,
|
||||
JavaScript, Perl, Python, Ruby, and Rust
|
||||
- Embedded, scriptable [terminal emulator](https://neovim.io/doc/user/nvim_terminal_emulator.html)
|
||||
- Asynchronous [job control](https://github.com/neovim/neovim/pull/2247)
|
||||
- [Shared data (shada)](https://github.com/neovim/neovim/pull/2506) among multiple editor instances
|
||||
@ -46,31 +50,50 @@ Install from package
|
||||
Pre-built packages for Windows, macOS, and Linux are found on the
|
||||
[Releases](https://github.com/neovim/neovim/releases/) page.
|
||||
|
||||
[Managed packages] are in [Homebrew], [Debian], [Ubuntu], [Fedora], [Arch Linux],
|
||||
[Gentoo], and more!
|
||||
Managed packages are in [Homebrew], [Debian], [Ubuntu], [Fedora], [Arch Linux], [Gentoo],
|
||||
and [more](https://github.com/neovim/neovim/wiki/Installing-Neovim)!
|
||||
|
||||
Install from source
|
||||
-------------------
|
||||
|
||||
See the [Building Neovim](https://github.com/neovim/neovim/wiki/Building-Neovim) wiki page for details.
|
||||
|
||||
The build is CMake-based, but a Makefile is provided as a convenience.
|
||||
After installing the dependencies, run the following command.
|
||||
|
||||
make CMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
sudo make install
|
||||
|
||||
To install to a non-default location:
|
||||
To install to a non-default location, set `CMAKE_INSTALL_PREFIX`:
|
||||
|
||||
make CMAKE_INSTALL_PREFIX=/full/path/
|
||||
make CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=/full/path/"
|
||||
make install
|
||||
|
||||
To inspect the build, these CMake features are useful:
|
||||
To skip bundled (`third-party/*`) dependencies:
|
||||
|
||||
- `cmake --build build --target help` lists all build targets.
|
||||
- `build/CMakeCache.txt` (or `cmake -LAH build/`) contains the resolved values of all CMake variables.
|
||||
1. Install the dependencies using a package manager.
|
||||
```
|
||||
sudo apt install gperf luajit luarocks libuv1-dev libluajit-5.1-dev libunibilium-dev libmsgpack-dev libtermkey-dev libvterm-dev libjemalloc-dev
|
||||
sudo luarocks build mpack
|
||||
sudo luarocks build lpeg
|
||||
sudo luarocks build inspect
|
||||
```
|
||||
2. Build with `USE_BUNDLED=OFF`:
|
||||
```
|
||||
make CMAKE_BUILD_TYPE=RelWithDebInfo USE_BUNDLED=OFF
|
||||
sudo make install
|
||||
```
|
||||
|
||||
CMake features:
|
||||
|
||||
- List all build targets:
|
||||
```
|
||||
cmake --build build --target help
|
||||
```
|
||||
- Print all variable definitions:
|
||||
```
|
||||
cmake -LAH
|
||||
```
|
||||
- `build/CMakeCache.txt` contains the resolved values of all CMake variables.
|
||||
- `build/compile_commands.json` shows the full compiler invocations for each translation unit.
|
||||
|
||||
See the [Building Neovim](https://github.com/neovim/neovim/wiki/Building-Neovim) wiki page for details.
|
||||
|
||||
Transitioning from Vim
|
||||
--------------------
|
||||
|
||||
@ -98,9 +121,17 @@ Project layout
|
||||
License
|
||||
-------
|
||||
|
||||
Neovim contributions since [b17d96][license-commit] are licensed under the
|
||||
Apache 2.0 license, except for contributions copied from Vim (identified by the
|
||||
`vim-patch` token). See LICENSE for details.
|
||||
Neovim is licensed under the terms of the Apache 2.0 license, except for
|
||||
parts that were contributed under the Vim license.
|
||||
|
||||
- Contributions committed before [b17d96][license-commit] remain under the Vim
|
||||
license.
|
||||
|
||||
- Contributions committed after [b17d96][license-commit] are licensed under
|
||||
Apache 2.0 unless those contributions were copied from Vim (identified in
|
||||
the commit logs by the `vim-patch` token).
|
||||
|
||||
See `LICENSE` for details.
|
||||
|
||||
Vim is Charityware. You can use and copy it as much as you like, but you are
|
||||
encouraged to make a donation for needy children in Uganda. Please see the
|
||||
@ -117,12 +148,11 @@ Apache 2.0 license, except for contributions copied from Vim (identified by the
|
||||
[nvim-features]: https://neovim.io/doc/user/vim_diff.html#nvim-features
|
||||
[Roadmap]: https://neovim.io/roadmap/
|
||||
[advanced UIs]: https://github.com/neovim/neovim/wiki/Related-projects#gui
|
||||
[Managed packages]: https://github.com/neovim/neovim/wiki/Installing-Neovim#install-from-package
|
||||
[Homebrew]: https://github.com/neovim/homebrew-neovim#installation
|
||||
[Debian]: https://packages.debian.org/testing/neovim
|
||||
[Ubuntu]: http://packages.ubuntu.com/search?keywords=neovim
|
||||
[Fedora]: https://apps.fedoraproject.org/packages/neovim
|
||||
[Arch Linux]: https://www.archlinux.org/packages/?q=neovim
|
||||
[Gentoo]: https://packages.gentoo.org/packages/app-editors/neovim
|
||||
[Homebrew]: https://formulae.brew.sh/formula/neovim
|
||||
|
||||
<!-- vim: set tw=80: -->
|
||||
|
25
appveyor.yml
Normal file
25
appveyor.yml
Normal file
@ -0,0 +1,25 @@
|
||||
version: '{build}'
|
||||
environment:
|
||||
APPVEYOR_CACHE_ENTRY_ZIP_ARGS: "-t7z -m0=lzma -mx=9"
|
||||
image: Visual Studio 2017
|
||||
configuration:
|
||||
- MSVC_64
|
||||
- MSVC_32
|
||||
- MINGW_64
|
||||
- MINGW_32
|
||||
- MINGW_64-gcov
|
||||
matrix:
|
||||
allow_failures:
|
||||
- configuration: MINGW_64-gcov
|
||||
install: []
|
||||
before_build:
|
||||
- ps: Install-Product node 8
|
||||
build_script:
|
||||
- powershell ci\build.ps1
|
||||
cache:
|
||||
- C:\msys64\var\cache\pacman\pkg -> ci\build.ps1
|
||||
- .deps -> ci\build.ps1
|
||||
- .deps -> third-party\**
|
||||
artifacts:
|
||||
- path: build/Neovim.zip
|
||||
- path: build/bin/nvim.exe
|
94
busted/outputHandlers/TAP.lua
Normal file
94
busted/outputHandlers/TAP.lua
Normal file
@ -0,0 +1,94 @@
|
||||
-- TODO(jkeyes): Use the upstream version when busted releases it. (But how to
|
||||
-- inject our call to global_helpers.read_nvim_log() ?)
|
||||
|
||||
local pretty = require 'pl.pretty'
|
||||
local global_helpers = require('test.helpers')
|
||||
|
||||
return function(options)
|
||||
local busted = require 'busted'
|
||||
local handler = require 'busted.outputHandlers.base'()
|
||||
|
||||
local success = 'ok %u - %s'
|
||||
local failure = 'not ' .. success
|
||||
local skip = 'ok %u - # SKIP %s'
|
||||
local counter = 0
|
||||
|
||||
handler.suiteReset = function()
|
||||
counter = 0
|
||||
return nil, true
|
||||
end
|
||||
|
||||
handler.suiteEnd = function()
|
||||
io.write(global_helpers.read_nvim_log())
|
||||
print('1..' .. counter)
|
||||
io.flush()
|
||||
return nil, true
|
||||
end
|
||||
|
||||
local function showFailure(t)
|
||||
local message = t.message
|
||||
local trace = t.trace or {}
|
||||
|
||||
if message == nil then
|
||||
message = 'Nil error'
|
||||
elseif type(message) ~= 'string' then
|
||||
message = pretty.write(message)
|
||||
end
|
||||
|
||||
print(failure:format(counter, t.name))
|
||||
print('# ' .. t.element.trace.short_src .. ' @ ' .. t.element.trace.currentline)
|
||||
if t.randomseed then print('# Random seed: ' .. t.randomseed) end
|
||||
print('# Failure message: ' .. message:gsub('\n', '\n# '))
|
||||
if options.verbose and trace.traceback then
|
||||
print('# ' .. trace.traceback:gsub('^\n', '', 1):gsub('\n', '\n# '))
|
||||
end
|
||||
end
|
||||
|
||||
handler.testStart = function(element, parent)
|
||||
local trace = element.trace
|
||||
if options.verbose and trace and trace.short_src then
|
||||
local fileline = trace.short_src .. ' @ ' .. trace.currentline .. ': '
|
||||
local testName = fileline .. handler.getFullName(element)
|
||||
print('# ' .. testName)
|
||||
end
|
||||
io.flush()
|
||||
|
||||
return nil, true
|
||||
end
|
||||
|
||||
handler.testEnd = function(element, parent, status, trace)
|
||||
counter = counter + 1
|
||||
if status == 'success' then
|
||||
local t = handler.successes[#handler.successes]
|
||||
print(success:format(counter, t.name))
|
||||
elseif status == 'pending' then
|
||||
local t = handler.pendings[#handler.pendings]
|
||||
print(skip:format(counter, (t.message or t.name)))
|
||||
elseif status == 'failure' then
|
||||
showFailure(handler.failures[#handler.failures])
|
||||
elseif status == 'error' then
|
||||
showFailure(handler.errors[#handler.errors])
|
||||
end
|
||||
io.flush()
|
||||
|
||||
return nil, true
|
||||
end
|
||||
|
||||
handler.error = function(element, parent, message, debug)
|
||||
if element.descriptor ~= 'it' then
|
||||
counter = counter + 1
|
||||
showFailure(handler.errors[#handler.errors])
|
||||
end
|
||||
io.flush()
|
||||
|
||||
return nil, true
|
||||
end
|
||||
|
||||
busted.subscribe({ 'suite', 'reset' }, handler.suiteReset)
|
||||
busted.subscribe({ 'suite', 'end' }, handler.suiteEnd)
|
||||
busted.subscribe({ 'test', 'start' }, handler.testStart, { predicate = handler.cancelOnPending })
|
||||
busted.subscribe({ 'test', 'end' }, handler.testEnd, { predicate = handler.cancelOnPending })
|
||||
busted.subscribe({ 'error' }, handler.error)
|
||||
|
||||
return handler
|
||||
end
|
@ -1,4 +1,6 @@
|
||||
local s = require 'say'
|
||||
local pretty = require 'pl.pretty'
|
||||
local term = require 'term'
|
||||
local global_helpers = require('test.helpers')
|
||||
|
||||
local colors
|
||||
@ -63,6 +65,8 @@ return function(options)
|
||||
},
|
||||
}
|
||||
|
||||
c = nil
|
||||
|
||||
local fileCount = 0
|
||||
local fileTestCount = 0
|
||||
local testCount = 0
|
||||
@ -72,6 +76,7 @@ return function(options)
|
||||
local errorCount = 0
|
||||
|
||||
local pendingDescription = function(pending)
|
||||
local name = pending.name
|
||||
local string = ''
|
||||
|
||||
if type(pending.message) == 'string' then
|
||||
@ -170,7 +175,7 @@ return function(options)
|
||||
return nil, true
|
||||
end
|
||||
|
||||
handler.suiteStart = function(_suite, count, total, randomseed)
|
||||
handler.suiteStart = function(suite, count, total, randomseed)
|
||||
if total > 1 then
|
||||
io.write(repeatSuiteString:format(count, total))
|
||||
end
|
||||
@ -191,12 +196,12 @@ return function(options)
|
||||
end
|
||||
end
|
||||
|
||||
handler.suiteEnd = function(suite, _count, _total)
|
||||
handler.suiteEnd = function(suite, count, total)
|
||||
local elapsedTime_ms = getElapsedTime(suite)
|
||||
local tests = (testCount == 1 and 'test' or 'tests')
|
||||
local files = (fileCount == 1 and 'file' or 'files')
|
||||
io.write(globalTeardown)
|
||||
io.write(global_helpers.read_nvim_log(nil, true))
|
||||
io.write(global_helpers.read_nvim_log())
|
||||
io.write(suiteEndString:format(testCount, tests, fileCount, files, elapsedTime_ms))
|
||||
io.write(getSummaryString())
|
||||
io.flush()
|
||||
@ -220,19 +225,15 @@ return function(options)
|
||||
return nil, true
|
||||
end
|
||||
|
||||
handler.testStart = function(element, _parent)
|
||||
handler.testStart = function(element, parent)
|
||||
io.write(runString:format(handler.getFullName(element)))
|
||||
io.flush()
|
||||
|
||||
return nil, true
|
||||
end
|
||||
|
||||
local function write_status(element, string)
|
||||
io.write(timeString:format(getElapsedTime(element)) .. ' ' .. string)
|
||||
io.flush()
|
||||
end
|
||||
|
||||
handler.testEnd = function(element, _parent, status, _debug)
|
||||
handler.testEnd = function(element, parent, status, debug)
|
||||
local elapsedTime_ms = getElapsedTime(element)
|
||||
local string
|
||||
|
||||
fileTestCount = fileTestCount + 1
|
||||
@ -245,21 +246,45 @@ return function(options)
|
||||
string = skippedString
|
||||
elseif status == 'failure' then
|
||||
failureCount = failureCount + 1
|
||||
string = failureString .. failureDescription(handler.failures[#handler.failures])
|
||||
string = nil
|
||||
elseif status == 'error' then
|
||||
errorCount = errorCount + 1
|
||||
string = errorString .. failureDescription(handler.errors[#handler.errors])
|
||||
else
|
||||
string = "unexpected test status! ("..status..")"
|
||||
string = nil
|
||||
end
|
||||
|
||||
if string ~= nil then
|
||||
if elapsedTime_ms == elapsedTime_ms then
|
||||
string = timeString:format(elapsedTime_ms) .. ' ' .. string
|
||||
end
|
||||
io.write(string)
|
||||
io.flush()
|
||||
end
|
||||
write_status(element, string)
|
||||
|
||||
return nil, true
|
||||
end
|
||||
|
||||
handler.error = function(element, _parent, _message, _debug)
|
||||
handler.testFailure = function(element, parent, message, debug)
|
||||
io.write(failureString)
|
||||
io.flush()
|
||||
|
||||
io.write(failureDescription(handler.failures[#handler.failures]))
|
||||
io.flush()
|
||||
return nil, true
|
||||
end
|
||||
|
||||
handler.testError = function(element, parent, message, debug)
|
||||
io.write(errorString)
|
||||
io.flush()
|
||||
|
||||
io.write(failureDescription(handler.errors[#handler.errors]))
|
||||
io.flush()
|
||||
return nil, true
|
||||
end
|
||||
|
||||
handler.error = function(element, parent, message, debug)
|
||||
if element.descriptor ~= 'it' then
|
||||
write_status(element, failureDescription(handler.errors[#handler.errors]))
|
||||
io.write(failureDescription(handler.errors[#handler.errors]))
|
||||
io.flush()
|
||||
errorCount = errorCount + 1
|
||||
end
|
||||
|
||||
@ -273,6 +298,8 @@ return function(options)
|
||||
busted.subscribe({ 'file', 'end' }, handler.fileEnd)
|
||||
busted.subscribe({ 'test', 'start' }, handler.testStart, { predicate = handler.cancelOnPending })
|
||||
busted.subscribe({ 'test', 'end' }, handler.testEnd, { predicate = handler.cancelOnPending })
|
||||
busted.subscribe({ 'failure', 'it' }, handler.testFailure)
|
||||
busted.subscribe({ 'error', 'it' }, handler.testError)
|
||||
busted.subscribe({ 'failure' }, handler.error)
|
||||
busted.subscribe({ 'error' }, handler.error)
|
||||
|
@ -7,20 +7,23 @@ CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "${CI_DIR}/common/build.sh"
|
||||
source "${CI_DIR}/common/suite.sh"
|
||||
|
||||
# Don't cache pip's log and selfcheck.
|
||||
rm -rf "${HOME}/.cache/pip/log"
|
||||
rm -f "${HOME}/.cache/pip/selfcheck.json"
|
||||
|
||||
echo "before_cache.sh: cache size"
|
||||
du -chd 1 "${HOME}/.cache" | sort -rh | head -20
|
||||
du -d 2 "${HOME}/.cache" | sort -n
|
||||
|
||||
echo "before_cache.sh: ccache stats"
|
||||
ccache -s 2>/dev/null || true
|
||||
# Do not keep ccache stats (uploaded to cache otherwise; reset initially anyway).
|
||||
find "${HOME}/.ccache" -name stats -delete
|
||||
|
||||
# Update the third-party dependency cache only if the build was successful.
|
||||
if ended_successfully; then
|
||||
# Do not cache downloads. They should not be needed with up-to-date deps.
|
||||
rm -rf "${DEPS_BUILD_DIR}/build/downloads"
|
||||
rm -rf "${CACHE_NVIM_DEPS_DIR}"
|
||||
mv "${DEPS_BUILD_DIR}" "${CACHE_NVIM_DEPS_DIR}"
|
||||
rm -rf "${HOME}/.cache/nvim-deps"
|
||||
mv "${DEPS_BUILD_DIR}" "${HOME}/.cache/nvim-deps"
|
||||
|
||||
rm -rf "${HOME}/.cache/nvim-deps-downloads"
|
||||
mv "${DEPS_DOWNLOAD_DIR}" "${HOME}/.cache/nvim-deps-downloads"
|
||||
|
||||
touch "${CACHE_MARKER}"
|
||||
echo "Updated third-party dependencies (timestamp: $(_stat "${CACHE_MARKER}"))."
|
||||
|
@ -3,37 +3,32 @@
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
echo 'Python info:'
|
||||
if [[ "${CI_TARGET}" == lint ]]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
echo 'python info:'
|
||||
(
|
||||
set -x
|
||||
python3 --version
|
||||
python2 --version
|
||||
python --version
|
||||
pip3 --version
|
||||
pip2 --version
|
||||
pip --version
|
||||
2>&1 python --version || true
|
||||
2>&1 python2 --version || true
|
||||
2>&1 python3 --version || true
|
||||
2>&1 pip --version || true
|
||||
2>&1 pip2 --version || true
|
||||
2>&1 pip3 --version || true
|
||||
echo 'pyenv versions:'
|
||||
2>&1 pyenv versions || true
|
||||
) | sed 's/^/ /'
|
||||
|
||||
pyenv --version
|
||||
pyenv versions
|
||||
) 2>&1 | sed 's/^/ /' || true
|
||||
|
||||
# Use pyenv, but not for OSX on Travis, where it only has the "system" version.
|
||||
if [[ "${TRAVIS_OS_NAME}" != osx ]] && command -v pyenv; then
|
||||
echo 'Setting Python versions via pyenv'
|
||||
|
||||
# Prefer Python 2 over 3 (more conservative).
|
||||
pyenv global 2.7:3.8
|
||||
|
||||
echo 'Updated Python info:'
|
||||
(
|
||||
set -x
|
||||
python3 --version
|
||||
python2 --version
|
||||
python --version
|
||||
|
||||
python3 -m pip --version
|
||||
python2 -m pip --version
|
||||
) 2>&1 | sed 's/^/ /'
|
||||
if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
|
||||
echo "Upgrade Python 3 pip"
|
||||
python3 -m pip -q install --user --upgrade pip
|
||||
else
|
||||
echo "Upgrade Python 2 pip"
|
||||
python2.7 -m pip -q install --user --upgrade pip
|
||||
echo "Upgrade Python 3 pip"
|
||||
# Allow failure. pyenv pip3 on travis is broken:
|
||||
# https://github.com/travis-ci/travis-ci/issues/8363
|
||||
python3 -m pip -q install --user --upgrade pip || true
|
||||
fi
|
||||
|
||||
echo "Install node (LTS)"
|
||||
@ -43,17 +38,5 @@ if [[ "${TRAVIS_OS_NAME}" == osx ]] || [ ! -f ~/.nvm/nvm.sh ]; then
|
||||
fi
|
||||
|
||||
source ~/.nvm/nvm.sh
|
||||
nvm install 10
|
||||
|
||||
if [[ -n "$CMAKE_URL" ]]; then
|
||||
echo "Installing custom CMake: $CMAKE_URL"
|
||||
curl --retry 5 --silent --show-error --fail -o /tmp/cmake-installer.sh "$CMAKE_URL"
|
||||
mkdir -p "$HOME/.local/bin" /opt/cmake-custom
|
||||
bash /tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license
|
||||
ln -sfn /opt/cmake-custom/bin/cmake "$HOME/.local/bin/cmake"
|
||||
cmake_version="$(cmake --version)"
|
||||
echo "$cmake_version" | grep -qF '2.8.12' || {
|
||||
echo "Unexpected CMake version: $cmake_version"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
nvm install --lts
|
||||
nvm use --lts
|
||||
|
@ -3,15 +3,13 @@
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
if [[ "${CI_TARGET}" == lint ]]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "${CI_DIR}/common/build.sh"
|
||||
|
||||
# Enable ipv6 on Travis. ref: a39c8b7ce30d
|
||||
if test -n "${TRAVIS_OS_NAME}" && ! test "${TRAVIS_OS_NAME}" = osx ; then
|
||||
echo "before_script.sh: enable ipv6"
|
||||
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
|
||||
fi
|
||||
|
||||
# Test some of the configuration variables.
|
||||
if [[ -n "${GCOV}" ]] && [[ ! $(type -P "${GCOV}") ]]; then
|
||||
echo "\$GCOV: '${GCOV}' is not executable."
|
||||
@ -22,10 +20,8 @@ if [[ -n "${LLVM_SYMBOLIZER}" ]] && [[ ! $(type -P "${LLVM_SYMBOLIZER}") ]]; the
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "before_script.sh: ccache stats (will be cleared)"
|
||||
ccache -s
|
||||
# Reset ccache stats for real results in before_cache.
|
||||
ccache --zero-stats
|
||||
# Show ccache stats so we can compare in before_cache
|
||||
ccache -s 2>/dev/null || true
|
||||
|
||||
if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
|
||||
# Adds user to a dummy group.
|
||||
@ -37,10 +33,5 @@ fi
|
||||
# Compile dependencies.
|
||||
build_deps
|
||||
|
||||
# Install cluacov for Lua coverage.
|
||||
if [[ "$USE_LUACOV" == 1 ]]; then
|
||||
"${DEPS_BUILD_DIR}/usr/bin/luarocks" install cluacov
|
||||
fi
|
||||
|
||||
rm -rf "${LOG_DIR}"
|
||||
mkdir -p "${LOG_DIR}"
|
||||
|
146
ci/build.ps1
146
ci/build.ps1
@ -1,45 +1,32 @@
|
||||
param([switch]$NoTests)
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
$ErrorActionPreference = 'stop'
|
||||
Set-PSDebug -Strict -Trace 1
|
||||
|
||||
$env:CONFIGURATION -match '^(?<compiler>\w+)_(?<bits>32|64)(?:-(?<option>\w+))?$'
|
||||
$compiler = $Matches.compiler
|
||||
$compileOption = if ($Matches -contains 'option') {$Matches.option} else {''}
|
||||
$compileOption = $Matches.option
|
||||
$bits = $Matches.bits
|
||||
$cmakeBuildType = $(if ($env:CMAKE_BUILD_TYPE -ne $null) {$env:CMAKE_BUILD_TYPE} else {'RelWithDebInfo'});
|
||||
$buildDir = [System.IO.Path]::GetFullPath("$(pwd)")
|
||||
$cmakeBuildType = 'RelWithDebInfo'
|
||||
$depsCmakeVars = @{
|
||||
CMAKE_BUILD_TYPE = $cmakeBuildType;
|
||||
}
|
||||
$nvimCmakeVars = @{
|
||||
CMAKE_BUILD_TYPE = $cmakeBuildType;
|
||||
BUSTED_OUTPUT_TYPE = 'nvim';
|
||||
DEPS_PREFIX=$(if ($env:DEPS_PREFIX -ne $null) {$env:DEPS_PREFIX} else {".deps/usr"});
|
||||
}
|
||||
if ($env:DEPS_BUILD_DIR -eq $null) {
|
||||
$env:DEPS_BUILD_DIR = ".deps";
|
||||
}
|
||||
$uploadToCodeCov = $false
|
||||
|
||||
# For pull requests, skip some build configurations to save time.
|
||||
if ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT -and $env:CONFIGURATION -match '^(MSVC_64|MINGW_32|MINGW_64-gcov)$') {
|
||||
exit 0
|
||||
}
|
||||
|
||||
function exitIfFailed() {
|
||||
if ($LastExitCode -ne 0) {
|
||||
Set-PSDebug -Off
|
||||
exit $LastExitCode
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $NoTests) {
|
||||
node --version
|
||||
npm.cmd --version
|
||||
}
|
||||
|
||||
if (-Not (Test-Path -PathType container $env:DEPS_BUILD_DIR)) {
|
||||
write-host "cache dir not found: $($env:DEPS_BUILD_DIR)"
|
||||
mkdir $env:DEPS_BUILD_DIR
|
||||
} else {
|
||||
write-host "cache dir $($env:DEPS_BUILD_DIR) size: $(Get-ChildItem $env:DEPS_BUILD_DIR -recurse | Measure-Object -property length -sum | Select -expand sum)"
|
||||
}
|
||||
|
||||
if ($compiler -eq 'MINGW') {
|
||||
if ($bits -eq 32) {
|
||||
$arch = 'i686'
|
||||
@ -50,18 +37,13 @@ if ($compiler -eq 'MINGW') {
|
||||
if ($compileOption -eq 'gcov') {
|
||||
$nvimCmakeVars['USE_GCOV'] = 'ON'
|
||||
$uploadToCodecov = $true
|
||||
$env:GCOV = "C:\msys64\mingw$bits\bin\gcov"
|
||||
|
||||
# Setup/build Lua coverage.
|
||||
$env:USE_LUACOV = 1
|
||||
$env:BUSTED_ARGS = "--coverage"
|
||||
}
|
||||
# These are native MinGW builds, but they use the toolchain inside
|
||||
# MSYS2, this allows using all the dependencies and tools available
|
||||
# in MSYS2, but we cannot build inside the MSYS2 shell.
|
||||
$cmakeGenerator = 'Ninja'
|
||||
$cmakeGeneratorArgs = '-v'
|
||||
$mingwPackages = @('ninja', 'cmake', 'diffutils').ForEach({
|
||||
$mingwPackages = @('ninja', 'cmake', 'perl', 'diffutils', 'unibilium').ForEach({
|
||||
"mingw-w64-$arch-$_"
|
||||
})
|
||||
|
||||
@ -85,89 +67,67 @@ elseif ($compiler -eq 'MSVC') {
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $NoTests) {
|
||||
# Setup python (use AppVeyor system python)
|
||||
# Setup python (use AppVeyor system python)
|
||||
C:\Python27\python.exe -m pip install pynvim ; exitIfFailed
|
||||
C:\Python35\python.exe -m pip install pynvim ; exitIfFailed
|
||||
# Disambiguate python3
|
||||
move c:\Python35\python.exe c:\Python35\python3.exe
|
||||
$env:PATH = "C:\Python35;C:\Python27;$env:PATH"
|
||||
# Sanity check
|
||||
python -c "import pynvim; print(str(pynvim))" ; exitIfFailed
|
||||
python3 -c "import pynvim; print(str(pynvim))" ; exitIfFailed
|
||||
|
||||
# Disambiguate python3, if needed
|
||||
if (-not (Test-Path -Path C:\hostedtoolcache\windows\Python\3.5.4\x64\python3.exe) ) {
|
||||
move C:\hostedtoolcache\windows\Python\3.5.4\x64\python.exe C:\hostedtoolcache\windows\Python\3.5.4\x64\python3.exe
|
||||
}
|
||||
$env:PATH = "C:\hostedtoolcache\windows\Python\2.7.18\x64;C:\hostedtoolcache\windows\Python\3.5.4\x64;$env:PATH"
|
||||
$env:PATH = "C:\Ruby24\bin;$env:PATH"
|
||||
gem.cmd install neovim
|
||||
Get-Command -CommandType Application neovim-ruby-host.bat
|
||||
|
||||
python -m pip install pynvim ; exitIfFailed
|
||||
python3 -m pip install pynvim ; exitIfFailed
|
||||
# Sanity check
|
||||
python -c "import pynvim; print(str(pynvim))" ; exitIfFailed
|
||||
python3 -c "import pynvim; print(str(pynvim))" ; exitIfFailed
|
||||
|
||||
gem.cmd install --pre neovim
|
||||
Get-Command -CommandType Application neovim-ruby-host.bat
|
||||
|
||||
npm.cmd install -g neovim
|
||||
Get-Command -CommandType Application neovim-node-host.cmd
|
||||
npm.cmd link neovim
|
||||
}
|
||||
|
||||
if ($compiler -eq 'MSVC') {
|
||||
# Required for LuaRocks (https://github.com/luarocks/luarocks/issues/1039#issuecomment-507296940).
|
||||
$env:VCINSTALLDIR = "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/"
|
||||
}
|
||||
npm.cmd install -g neovim
|
||||
Get-Command -CommandType Application neovim-node-host.cmd
|
||||
npm.cmd link neovim
|
||||
|
||||
function convertToCmakeArgs($vars) {
|
||||
return $vars.GetEnumerator() | foreach { "-D$($_.Key)=$($_.Value)" }
|
||||
}
|
||||
|
||||
cd $env:DEPS_BUILD_DIR
|
||||
cmake -G $cmakeGenerator $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed
|
||||
if (-Not (Test-Path -PathType container .deps)) {
|
||||
mkdir .deps
|
||||
}
|
||||
cd .deps
|
||||
cmake -G $cmakeGenerator $(convertToCmakeArgs($depsCmakeVars)) ..\third-party\ ; exitIfFailed
|
||||
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
|
||||
cd $buildDir
|
||||
cd ..
|
||||
|
||||
# Build Neovim
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G $cmakeGenerator $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed
|
||||
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
|
||||
.\bin\nvim --version ; exitIfFailed
|
||||
bin\nvim --version ; exitIfFailed
|
||||
|
||||
# Ensure that the "win32" feature is set.
|
||||
.\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"' ; exitIfFailed
|
||||
# Functional tests
|
||||
# The $LastExitCode from MSBuild can't be trusted
|
||||
$failed = $false
|
||||
# Temporarily turn off tracing to reduce log file output
|
||||
Set-PSDebug -Off
|
||||
cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs 2>&1 |
|
||||
foreach { $failed = $failed -or
|
||||
$_ -match 'functional tests failed with error'; $_ }
|
||||
if ($failed) {
|
||||
exit $LastExitCode
|
||||
}
|
||||
Set-PSDebug -Strict -Trace 1
|
||||
|
||||
if ($env:USE_LUACOV -eq 1) {
|
||||
& $env:DEPS_PREFIX\luarocks\luarocks.bat install cluacov
|
||||
|
||||
if ($uploadToCodecov) {
|
||||
C:\msys64\usr\bin\bash -lc "cd /c/projects/neovim; bash <(curl -s https://codecov.io/bash) -c -F functionaltest || echo 'codecov upload failed.'"
|
||||
}
|
||||
|
||||
if (-not $NoTests) {
|
||||
# Functional tests
|
||||
# The $LastExitCode from MSBuild can't be trusted
|
||||
$failed = $false
|
||||
# Old tests
|
||||
$env:PATH = "C:\msys64\usr\bin;$env:PATH"
|
||||
& "C:\msys64\mingw$bits\bin\mingw32-make.exe" -C $(Convert-Path ..\src\nvim\testdir) VERBOSE=1
|
||||
|
||||
# Run only this test file:
|
||||
# $env:TEST_FILE = "test\functional\foo.lua"
|
||||
cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs 2>&1 |
|
||||
foreach { $failed = $failed -or
|
||||
$_ -match 'functional tests failed with error'; $_ }
|
||||
|
||||
if ($uploadToCodecov) {
|
||||
if ($env:USE_LUACOV -eq 1) {
|
||||
& $env:DEPS_PREFIX\bin\luacov.bat
|
||||
}
|
||||
bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest
|
||||
}
|
||||
if ($failed) {
|
||||
exit $LastExitCode
|
||||
}
|
||||
|
||||
# Old tests
|
||||
# Add MSYS to path, required for e.g. `find` used in test scripts.
|
||||
# But would break functionaltests, where its `more` would be used then.
|
||||
$OldPath = $env:PATH
|
||||
$env:PATH = "C:\msys64\usr\bin;$env:PATH"
|
||||
& "C:\msys64\mingw$bits\bin\mingw32-make.exe" -C $(Convert-Path ..\src\nvim\testdir) VERBOSE=1 ; exitIfFailed
|
||||
$env:PATH = $OldPath
|
||||
|
||||
if ($uploadToCodecov) {
|
||||
bash -l /c/projects/neovim/ci/common/submit_coverage.sh oldtest
|
||||
}
|
||||
if ($uploadToCodecov) {
|
||||
C:\msys64\usr\bin\bash -lc "cd /c/projects/neovim; bash <(curl -s https://codecov.io/bash) -c -F oldtest || echo 'codecov upload failed.'"
|
||||
}
|
||||
|
||||
# Build artifacts
|
||||
|
@ -1,5 +1,5 @@
|
||||
_stat() {
|
||||
if test "${CI_OS_NAME}" = osx ; then
|
||||
if test "${TRAVIS_OS_NAME}" = osx ; then
|
||||
stat -f %Sm "${@}"
|
||||
else
|
||||
stat -c %y "${@}"
|
||||
@ -18,43 +18,51 @@ build_make() {
|
||||
}
|
||||
|
||||
build_deps() {
|
||||
if test "${BUILD_32BIT}" = ON ; then
|
||||
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}"
|
||||
fi
|
||||
if test "${FUNCTIONALTEST}" = "functionaltest-lua" \
|
||||
|| test "${CLANG_SANITIZER}" = "ASAN_UBSAN" ; then
|
||||
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON"
|
||||
fi
|
||||
|
||||
mkdir -p "${DEPS_BUILD_DIR}"
|
||||
mkdir -p "${DEPS_DOWNLOAD_DIR}"
|
||||
|
||||
# Use cached dependencies if $CACHE_MARKER exists.
|
||||
if test "${CACHE_ENABLE}" = "false" ; then
|
||||
export CCACHE_RECACHE=1
|
||||
elif test -f "${CACHE_MARKER}" ; then
|
||||
echo "Using third-party dependencies from cache (last update: $(_stat "${CACHE_MARKER}"))."
|
||||
cp -a "${CACHE_NVIM_DEPS_DIR}"/. "${DEPS_BUILD_DIR}"
|
||||
echo "Using third-party dependencies from Travis cache (last update: $(_stat "${CACHE_MARKER}"))."
|
||||
cp -r "${HOME}/.cache/nvim-deps"/. "${DEPS_BUILD_DIR}"
|
||||
cp -r "${HOME}/.cache/nvim-deps-downloads"/. "${DEPS_DOWNLOAD_DIR}"
|
||||
fi
|
||||
|
||||
# Even if we're using cached dependencies, run CMake and make to
|
||||
# update CMake configuration and update to newer deps versions.
|
||||
cd "${DEPS_BUILD_DIR}"
|
||||
echo "Configuring with '${DEPS_CMAKE_FLAGS}'."
|
||||
CC= cmake -G Ninja ${DEPS_CMAKE_FLAGS} "${CI_BUILD_DIR}/third-party/"
|
||||
CC= cmake -G Ninja ${DEPS_CMAKE_FLAGS} "${TRAVIS_BUILD_DIR}/third-party/"
|
||||
|
||||
if ! top_make; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "${CI_BUILD_DIR}"
|
||||
cd "${TRAVIS_BUILD_DIR}"
|
||||
}
|
||||
|
||||
prepare_build() {
|
||||
if test -n "${CLANG_SANITIZER}" ; then
|
||||
CMAKE_FLAGS="${CMAKE_FLAGS} -DCLANG_${CLANG_SANITIZER}=ON"
|
||||
fi
|
||||
if test "${BUILD_32BIT}" = ON ; then
|
||||
CMAKE_FLAGS="${CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}"
|
||||
fi
|
||||
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
cd "${BUILD_DIR}"
|
||||
echo "Configuring with '${CMAKE_FLAGS} $@'."
|
||||
cmake -G Ninja ${CMAKE_FLAGS} "$@" "${CI_BUILD_DIR}"
|
||||
cmake -G Ninja ${CMAKE_FLAGS} "$@" "${TRAVIS_BUILD_DIR}"
|
||||
}
|
||||
|
||||
build_nvim() {
|
||||
@ -78,11 +86,21 @@ build_nvim() {
|
||||
fi
|
||||
|
||||
# Invoke nvim to trigger *San early.
|
||||
if ! (bin/nvim --version && bin/nvim -u NONE -e -cq | cat -vet) ; then
|
||||
check_sanitizer "${LOG_DIR}"
|
||||
if ! (bin/nvim --version && bin/nvim -u NONE -e -c ':qall') ; then
|
||||
asan_check "${LOG_DIR}"
|
||||
exit 1
|
||||
fi
|
||||
check_sanitizer "${LOG_DIR}"
|
||||
asan_check "${LOG_DIR}"
|
||||
|
||||
cd "${CI_BUILD_DIR}"
|
||||
|
||||
cd "${TRAVIS_BUILD_DIR}"
|
||||
}
|
||||
|
||||
macos_rvm_dance() {
|
||||
# neovim-ruby gem requires a ruby newer than the macOS default.
|
||||
source ~/.rvm/scripts/rvm
|
||||
rvm get stable --auto-dotfiles
|
||||
rvm reload
|
||||
rvm use 2.2.5
|
||||
rvm use
|
||||
}
|
||||
|
@ -1,56 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Collect and submit coverage reports.
|
||||
#
|
||||
# Args:
|
||||
# $1: Flag(s) for codecov, separated by comma.
|
||||
|
||||
set -ex
|
||||
|
||||
# Change to grandparent dir (POSIXly).
|
||||
CDPATH='' cd -P -- "$(dirname -- "$0")/../.." || exit
|
||||
|
||||
echo "=== running submit_coverage in $PWD: $* ==="
|
||||
"$GCOV" --version
|
||||
|
||||
# Download/install codecov-bash and gcovr once.
|
||||
codecov_sh="${TEMP:-/tmp}/codecov.bash"
|
||||
if ! [ -f "$codecov_sh" ]; then
|
||||
curl --retry 5 --silent --fail -o "$codecov_sh" https://codecov.io/bash
|
||||
chmod +x "$codecov_sh"
|
||||
|
||||
python3 -m pip install --quiet --user gcovr
|
||||
fi
|
||||
|
||||
(
|
||||
cd build
|
||||
python3 -m gcovr --branches --exclude-unreachable-branches --print-summary -j 2 --exclude '.*/auto/.*' --root .. --delete -o ../coverage.xml --xml
|
||||
)
|
||||
|
||||
# Upload to codecov.
|
||||
# -X gcov: disable gcov, done manually above.
|
||||
# -X fix: disable fixing of reports (not necessary, rather slow)
|
||||
# -Z: exit non-zero on failure
|
||||
# -F: flag(s)
|
||||
# NOTE: ignoring flags for now, since this causes timeouts on codecov.io then,
|
||||
# which they know about for about a year already...
|
||||
# Flags must match pattern ^[\w\,]+$ ("," as separator).
|
||||
codecov_flags="$(uname -s),${1}"
|
||||
codecov_flags=$(echo "$codecov_flags" | sed 's/[^,_a-zA-Z0-9]/_/g')
|
||||
if ! "$codecov_sh" -f coverage.xml -X gcov -X fix -Z -F "${codecov_flags}"; then
|
||||
echo "codecov upload failed."
|
||||
fi
|
||||
|
||||
# Cleanup always, especially collected data.
|
||||
find . \( -name '*.gcov' -o -name '*.gcda' \) -ls -delete | wc -l
|
||||
rm -f coverage.xml
|
||||
|
||||
# Upload Lua coverage (generated manually on AppVeyor/Windows).
|
||||
if [ "$USE_LUACOV" = 1 ] && [ "$1" != "oldtest" ]; then
|
||||
if [ -x "${DEPS_BUILD_DIR}/usr/bin/luacov" ]; then
|
||||
"${DEPS_BUILD_DIR}/usr/bin/luacov"
|
||||
fi
|
||||
if ! "$codecov_sh" -f luacov.report.out -X gcov -X fix -Z -F "lua,${codecov_flags}"; then
|
||||
echo "codecov upload failed."
|
||||
fi
|
||||
rm luacov.stats.out
|
||||
fi
|
@ -13,33 +13,16 @@ FAIL_SUMMARY_FILE="$BUILD_DIR/.test_errors"
|
||||
|
||||
ANSI_CLEAR="\033[0K"
|
||||
|
||||
if test "$TRAVIS" = "true"; then
|
||||
ci_fold() {
|
||||
local action="$1"
|
||||
local name="$2"
|
||||
name="$(echo -n "$name" | tr '\n\0' '--' | sed 's/[^A-Za-z0-9]\{1,\}/-/g')"
|
||||
name="$(echo -n "$name" | sed 's/-$//')"
|
||||
echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}"
|
||||
}
|
||||
elif test "$GITHUB_ACTIONS" = "true"; then
|
||||
ci_fold() {
|
||||
local action="$1"
|
||||
local name="$2"
|
||||
name="$(echo -n "$name" | tr '\n\0' '--' | sed 's/[^A-Za-z0-9]\{1,\}/-/g')"
|
||||
name="$(echo -n "$name" | sed 's/-$//')"
|
||||
case "$action" in
|
||||
start)
|
||||
echo "::group::${name}"
|
||||
;;
|
||||
end)
|
||||
echo "::endgroup::"
|
||||
;;
|
||||
*)
|
||||
:;;
|
||||
esac
|
||||
}
|
||||
else
|
||||
ci_fold() {
|
||||
travis_fold() {
|
||||
local action="$1"
|
||||
local name="$2"
|
||||
name="$(echo -n "$name" | tr '\n\0' '--' | sed 's/[^A-Za-z0-9]\{1,\}/-/g')"
|
||||
name="$(echo -n "$name" | sed 's/-$//')"
|
||||
echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}"
|
||||
}
|
||||
|
||||
if test "$TRAVIS" != "true" ; then
|
||||
travis_fold() {
|
||||
return 0
|
||||
}
|
||||
fi
|
||||
@ -50,17 +33,16 @@ enter_suite() {
|
||||
rm -f "${END_MARKER}"
|
||||
local suite_name="$1"
|
||||
export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE}/$suite_name"
|
||||
ci_fold start "${NVIM_TEST_CURRENT_SUITE}"
|
||||
travis_fold start "${NVIM_TEST_CURRENT_SUITE}"
|
||||
set -x
|
||||
}
|
||||
|
||||
exit_suite() {
|
||||
set +x
|
||||
travis_fold end "${NVIM_TEST_CURRENT_SUITE}"
|
||||
if test $FAILED -ne 0 ; then
|
||||
echo "Suite ${NVIM_TEST_CURRENT_SUITE} failed, summary:"
|
||||
echo "${FAIL_SUMMARY}"
|
||||
else
|
||||
ci_fold end "${NVIM_TEST_CURRENT_SUITE}"
|
||||
fi
|
||||
export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE%/*}"
|
||||
if test "$1" != "--continue" ; then
|
||||
|
@ -3,7 +3,10 @@
|
||||
|
||||
submit_coverage() {
|
||||
if [ -n "${GCOV}" ]; then
|
||||
"${CI_DIR}/common/submit_coverage.sh" "$@" || echo 'codecov upload failed.'
|
||||
if curl --fail --output codecov.bash --silent https://codecov.io/bash; then
|
||||
bash codecov.bash -c -F "$1" || echo "codecov upload failed."
|
||||
rm -f codecov.bash
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -15,7 +18,7 @@ print_core() {
|
||||
return 0
|
||||
fi
|
||||
echo "======= Core file $core ======="
|
||||
if test "${CI_OS_NAME}" = osx ; then
|
||||
if test "${TRAVIS_OS_NAME}" = osx ; then
|
||||
lldb -Q -o "bt all" -f "${app}" -c "${core}"
|
||||
else
|
||||
gdb -n -batch -ex 'thread apply all bt full' "${app}" -c "${core}"
|
||||
@ -29,12 +32,11 @@ check_core_dumps() {
|
||||
shift
|
||||
fi
|
||||
local app="${1:-${BUILD_DIR}/bin/nvim}"
|
||||
local cores
|
||||
if test "${CI_OS_NAME}" = osx ; then
|
||||
cores="$(find /cores/ -type f -print)"
|
||||
if test "${TRAVIS_OS_NAME}" = osx ; then
|
||||
local cores="$(find /cores/ -type f -print)"
|
||||
local _sudo='sudo'
|
||||
else
|
||||
cores="$(find ./ -type f \( -name 'core.*' -o -name core -o -name nvim.core \) -print)"
|
||||
local cores="$(find ./ -type f -name 'core.*' -print)"
|
||||
local _sudo=
|
||||
fi
|
||||
|
||||
@ -69,7 +71,6 @@ check_logs() {
|
||||
for log in $(find "${1}" -type f -name "${2}" -size +0); do
|
||||
cat "${log}"
|
||||
err=1
|
||||
rm "${log}"
|
||||
done
|
||||
if test -n "${err}" ; then
|
||||
fail 'logs' E 'Runtime errors detected.'
|
||||
@ -80,9 +81,9 @@ valgrind_check() {
|
||||
check_logs "${1}" "valgrind-*"
|
||||
}
|
||||
|
||||
check_sanitizer() {
|
||||
if test -n "${CLANG_SANITIZER}"; then
|
||||
check_logs "${1}" "*san.*" | ${SYMBOLIZER:-cat}
|
||||
asan_check() {
|
||||
if test "${CLANG_SANITIZER}" = "ASAN_UBSAN" ; then
|
||||
check_logs "${1}" "*san.*" | $ASAN_SYMBOLIZE
|
||||
fi
|
||||
}
|
||||
|
||||
@ -93,7 +94,7 @@ run_unittests() {(
|
||||
fail 'unittests' F 'Unit tests failed'
|
||||
fi
|
||||
submit_coverage unittest
|
||||
check_core_dumps "$(command -v luajit)"
|
||||
check_core_dumps "$(which luajit)"
|
||||
exit_suite
|
||||
)}
|
||||
|
||||
@ -104,7 +105,7 @@ run_functionaltests() {(
|
||||
fail 'functionaltests' F 'Functional tests failed'
|
||||
fi
|
||||
submit_coverage functionaltest
|
||||
check_sanitizer "${LOG_DIR}"
|
||||
asan_check "${LOG_DIR}"
|
||||
valgrind_check "${LOG_DIR}"
|
||||
check_core_dumps
|
||||
exit_suite
|
||||
@ -113,12 +114,12 @@ run_functionaltests() {(
|
||||
run_oldtests() {(
|
||||
enter_suite oldtests
|
||||
ulimit -c unlimited || true
|
||||
if ! make oldtest; then
|
||||
if ! make -C "${TRAVIS_BUILD_DIR}/src/nvim/testdir"; then
|
||||
reset
|
||||
fail 'oldtests' F 'Legacy tests failed'
|
||||
fi
|
||||
submit_coverage oldtest
|
||||
check_sanitizer "${LOG_DIR}"
|
||||
asan_check "${LOG_DIR}"
|
||||
valgrind_check "${LOG_DIR}"
|
||||
check_core_dumps
|
||||
exit_suite
|
||||
|
@ -4,7 +4,6 @@ set -e
|
||||
set -o pipefail
|
||||
|
||||
if [[ "${CI_TARGET}" == lint ]]; then
|
||||
python3 -m pip -q install --user --upgrade flake8
|
||||
exit
|
||||
fi
|
||||
|
||||
@ -12,22 +11,22 @@ if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
|
||||
export PATH="/usr/local/opt/ccache/libexec:$PATH"
|
||||
fi
|
||||
|
||||
# Use default CC to avoid compilation problems when installing Python modules.
|
||||
echo "Install neovim module for Python 3."
|
||||
CC=cc python3 -m pip -q install --user --upgrade pynvim
|
||||
if python2 -m pip -c True 2>&1; then
|
||||
# Allow failure. pyenv pip3 on travis is broken:
|
||||
# https://github.com/travis-ci/travis-ci/issues/8363
|
||||
CC=cc python3 -m pip -q install --user --upgrade neovim || true
|
||||
|
||||
if ! [ "${TRAVIS_OS_NAME}" = osx ] ; then
|
||||
# Update PATH for pip.
|
||||
export PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:$PATH"
|
||||
# Use default CC to avoid compilation problems when installing Python modules.
|
||||
echo "Install neovim module for Python 2."
|
||||
CC=cc python2 -m pip -q install --user --upgrade pynvim
|
||||
CC=cc python2.7 -m pip -q install --user --upgrade neovim
|
||||
fi
|
||||
|
||||
echo "Install neovim RubyGem."
|
||||
gem install --no-document --bindir "$HOME/.local/bin" --user-install --pre neovim
|
||||
gem install --no-document --version ">= 0.8.0" neovim
|
||||
|
||||
echo "Install neovim npm package"
|
||||
source ~/.nvm/nvm.sh
|
||||
nvm use 10
|
||||
npm install -g neovim
|
||||
npm link neovim
|
||||
|
||||
sudo cpanm -n Neovim::Ext || cat "$HOME/.cpanm/build.log"
|
||||
perl -W -e 'use Neovim::Ext; print $Neovim::Ext::VERSION'
|
||||
|
@ -9,28 +9,32 @@ source "${CI_DIR}/common/build.sh"
|
||||
source "${CI_DIR}/common/suite.sh"
|
||||
|
||||
enter_suite 'clint'
|
||||
|
||||
run_test 'make clint-full' clint
|
||||
|
||||
exit_suite --continue
|
||||
|
||||
enter_suite 'testlint'
|
||||
|
||||
run_test 'make testlint' testlint
|
||||
|
||||
exit_suite --continue
|
||||
|
||||
enter_suite 'lualint'
|
||||
|
||||
run_test 'make lualint' lualint
|
||||
exit_suite --continue
|
||||
|
||||
enter_suite 'pylint'
|
||||
run_test 'make pylint' pylint
|
||||
exit_suite --continue
|
||||
|
||||
enter_suite 'shlint'
|
||||
run_test 'make shlint' shlint
|
||||
exit_suite --continue
|
||||
|
||||
enter_suite single-includes
|
||||
|
||||
CLICOLOR_FORCE=1 run_test_wd \
|
||||
--allow-hang \
|
||||
10s \
|
||||
'make check-single-includes' \
|
||||
'csi_clean' \
|
||||
single-includes
|
||||
|
||||
exit_suite --continue
|
||||
|
||||
end_tests
|
||||
|
@ -17,10 +17,6 @@ build_nvim
|
||||
|
||||
exit_suite --continue
|
||||
|
||||
source ~/.nvm/nvm.sh
|
||||
nvm use 10
|
||||
|
||||
|
||||
enter_suite tests
|
||||
|
||||
if test "$CLANG_SANITIZER" != "TSAN" ; then
|
||||
|
@ -11,9 +11,3 @@ if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
|
||||
else
|
||||
ci/run_${CI_TARGET}.sh
|
||||
fi
|
||||
|
||||
if [[ -s "${GCOV_ERROR_FILE}" ]]; then
|
||||
echo '=== Unexpected gcov errors: ==='
|
||||
cat "${GCOV_ERROR_FILE}"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -1,194 +0,0 @@
|
||||
{
|
||||
"ref": "refs/heads/master",
|
||||
"before": "66b136c43c12df3dcf8f19ff48f206ad2e4f43fc",
|
||||
"after": "1bf69c32217cc455603ce8aa2b5415d9717f0fa2",
|
||||
"repository": {
|
||||
"id": 292861950,
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyOTI4NjE5NTA=",
|
||||
"name": "neovim-snap",
|
||||
"full_name": "hurricanehrndz/neovim-snap",
|
||||
"private": false,
|
||||
"owner": {
|
||||
"name": "hurricanehrndz",
|
||||
"email": "hurricanehrndz@users.noreply.github.com",
|
||||
"login": "hurricanehrndz",
|
||||
"id": 5804237,
|
||||
"node_id": "MDQ6VXNlcjU4MDQyMzc=",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/5804237?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/hurricanehrndz",
|
||||
"html_url": "https://github.com/hurricanehrndz",
|
||||
"followers_url": "https://api.github.com/users/hurricanehrndz/followers",
|
||||
"following_url": "https://api.github.com/users/hurricanehrndz/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/hurricanehrndz/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/hurricanehrndz/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/hurricanehrndz/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/hurricanehrndz/orgs",
|
||||
"repos_url": "https://api.github.com/users/hurricanehrndz/repos",
|
||||
"events_url": "https://api.github.com/users/hurricanehrndz/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/hurricanehrndz/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"html_url": "https://github.com/hurricanehrndz/neovim-snap",
|
||||
"description": "snap build for neovim",
|
||||
"fork": false,
|
||||
"url": "https://github.com/hurricanehrndz/neovim-snap",
|
||||
"forks_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/forks",
|
||||
"keys_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/teams",
|
||||
"hooks_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/events",
|
||||
"assignees_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/tags",
|
||||
"blobs_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/subscription",
|
||||
"commits_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/merges",
|
||||
"archive_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/downloads",
|
||||
"issues_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/releases{/id}",
|
||||
"deployments_url": "https://api.github.com/repos/hurricanehrndz/neovim-snap/deployments",
|
||||
"created_at": 1599227980,
|
||||
"updated_at": "2020-09-04T14:02:38Z",
|
||||
"pushed_at": 1599228352,
|
||||
"git_url": "git://github.com/hurricanehrndz/neovim-snap.git",
|
||||
"ssh_url": "git@github.com:hurricanehrndz/neovim-snap.git",
|
||||
"clone_url": "https://github.com/hurricanehrndz/neovim-snap.git",
|
||||
"svn_url": "https://github.com/hurricanehrndz/neovim-snap",
|
||||
"homepage": null,
|
||||
"size": 0,
|
||||
"stargazers_count": 0,
|
||||
"watchers_count": 0,
|
||||
"language": null,
|
||||
"has_issues": true,
|
||||
"has_projects": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"forks_count": 0,
|
||||
"mirror_url": null,
|
||||
"archived": false,
|
||||
"disabled": false,
|
||||
"open_issues_count": 0,
|
||||
"license": {
|
||||
"key": "mit",
|
||||
"name": "MIT License",
|
||||
"spdx_id": "MIT",
|
||||
"url": "https://api.github.com/licenses/mit",
|
||||
"node_id": "MDc6TGljZW5zZTEz"
|
||||
},
|
||||
"forks": 0,
|
||||
"open_issues": 0,
|
||||
"watchers": 0,
|
||||
"default_branch": "master",
|
||||
"stargazers": 0,
|
||||
"master_branch": "master"
|
||||
},
|
||||
"pusher": {
|
||||
"name": "hurricanehrndz",
|
||||
"email": "hurricanehrndz@users.noreply.github.com"
|
||||
},
|
||||
"sender": {
|
||||
"login": "hurricanehrndz",
|
||||
"id": 5804237,
|
||||
"node_id": "MDQ6VXNlcjU4MDQyMzc=",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/5804237?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/hurricanehrndz",
|
||||
"html_url": "https://github.com/hurricanehrndz",
|
||||
"followers_url": "https://api.github.com/users/hurricanehrndz/followers",
|
||||
"following_url": "https://api.github.com/users/hurricanehrndz/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/hurricanehrndz/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/hurricanehrndz/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/hurricanehrndz/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/hurricanehrndz/orgs",
|
||||
"repos_url": "https://api.github.com/users/hurricanehrndz/repos",
|
||||
"events_url": "https://api.github.com/users/hurricanehrndz/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/hurricanehrndz/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
},
|
||||
"created": false,
|
||||
"deleted": false,
|
||||
"forced": false,
|
||||
"base_ref": null,
|
||||
"compare": "https://github.com/hurricanehrndz/neovim-snap/compare/66b136c43c12...1bf69c32217c",
|
||||
"commits": [
|
||||
{
|
||||
"id": "1bf69c32217cc455603ce8aa2b5415d9717f0fa2",
|
||||
"tree_id": "62ea83a2349be8c930c45fdc199f71b08bf5927e",
|
||||
"distinct": true,
|
||||
"message": "Build of latest tag",
|
||||
"timestamp": "2020-09-04T14:05:40Z",
|
||||
"url": "https://github.com/hurricanehrndz/neovim-snap/commit/1bf69c32217cc455603ce8aa2b5415d9717f0fa2",
|
||||
"author": {
|
||||
"name": "Carlos Hernandez",
|
||||
"email": "carlos@techbyte.ca",
|
||||
"username": "hurricanehrndz"
|
||||
},
|
||||
"committer": {
|
||||
"name": "Carlos Hernandez",
|
||||
"email": "carlos@techbyte.ca",
|
||||
"username": "hurricanehrndz"
|
||||
},
|
||||
"added": [
|
||||
|
||||
],
|
||||
"removed": [
|
||||
|
||||
],
|
||||
"modified": [
|
||||
"snap/snapcraft.yaml"
|
||||
]
|
||||
}
|
||||
],
|
||||
"head_commit": {
|
||||
"id": "1bf69c32217cc455603ce8aa2b5415d9717f0fa2",
|
||||
"tree_id": "62ea83a2349be8c930c45fdc199f71b08bf5927e",
|
||||
"distinct": true,
|
||||
"message": "Build of latest tag",
|
||||
"timestamp": "2020-09-04T14:05:40Z",
|
||||
"url": "https://github.com/hurricanehrndz/neovim-snap/commit/1bf69c32217cc455603ce8aa2b5415d9717f0fa2",
|
||||
"author": {
|
||||
"name": "Carlos Hernandez",
|
||||
"email": "carlos@techbyte.ca",
|
||||
"username": "hurricanehrndz"
|
||||
},
|
||||
"committer": {
|
||||
"name": "Carlos Hernandez",
|
||||
"email": "carlos@techbyte.ca",
|
||||
"username": "hurricanehrndz"
|
||||
},
|
||||
"added": [
|
||||
|
||||
],
|
||||
"removed": [
|
||||
|
||||
],
|
||||
"modified": [
|
||||
"snap/snapcraft.yaml"
|
||||
]
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
|
||||
RESULT_SNAP=$(find ./ -name "*.snap")
|
||||
|
||||
sudo snap install "$RESULT_SNAP" --dangerous --classic
|
||||
|
||||
/snap/bin/nvim --version
|
||||
|
||||
SHA256=$(sha256sum "$RESULT_SNAP")
|
||||
echo "SHA256: ${SHA256} ."
|
@ -1,39 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
SNAP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
WEBHOOK_PAYLOAD="$(cat "${SNAP_DIR}/.snapcraft_payload")"
|
||||
PAYLOAD_SIG="${SECRET_SNAP_SIG}"
|
||||
|
||||
|
||||
snap_realease_needed() {
|
||||
last_committed_tag="$(git tag -l --sort=refname|head -1)"
|
||||
last_snap_release="$(snap info nvim | awk '$1 == "latest/edge:" { print $2 }' | perl -lpe 's/v\d.\d.\d-//g')"
|
||||
git fetch -f --tags
|
||||
git checkout "${last_committed_tag}" 2> /dev/null
|
||||
last_git_release="$(git describe --first-parent 2> /dev/null | perl -lpe 's/v\d.\d.\d-//g')"
|
||||
|
||||
if [[ -z "$(echo $last_snap_release | perl -ne "print if /${last_git_release}.*/")" ]]; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
trigger_snapcraft_webhook() {
|
||||
[[ -n "${PAYLOAD_SIG}" ]] || exit
|
||||
echo "Triggering new snap relase via webhook..."
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Hub-Signature: sha1=${PAYLOAD_SIG}" \
|
||||
--data "${WEBHOOK_PAYLOAD}" \
|
||||
https://snapcraft.io/nvim/webhook/notify
|
||||
}
|
||||
|
||||
|
||||
if $(snap_realease_needed); then
|
||||
echo "New snap release required"
|
||||
trigger_snapcraft_webhook
|
||||
fi
|
@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
sudo apt update
|
||||
sudo usermod -aG lxd $USER
|
||||
sudo /snap/bin/lxd.migrate -yes
|
||||
sudo /snap/bin/lxd waitready
|
||||
sudo /snap/bin/lxd init --auto
|
||||
|
@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
mkdir -p "$CI_BUILD_DIR/snaps-cache"
|
||||
sg lxd -c snapcraft
|
||||
|
Binary file not shown.
50
cmake/FindJeMalloc.cmake
Normal file
50
cmake/FindJeMalloc.cmake
Normal file
@ -0,0 +1,50 @@
|
||||
# - Try to find jemalloc
|
||||
# Once done this will define
|
||||
# JEMALLOC_FOUND - System has jemalloc
|
||||
# JEMALLOC_INCLUDE_DIRS - The jemalloc include directories
|
||||
# JEMALLOC_LIBRARIES - The libraries needed to use jemalloc
|
||||
|
||||
if(NOT USE_BUNDLED_JEMALLOC)
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_JEMALLOC QUIET jemalloc)
|
||||
endif()
|
||||
else()
|
||||
set(PC_JEMALLOC_INCLUDEDIR)
|
||||
set(PC_JEMALLOC_INCLUDE_DIRS)
|
||||
set(PC_JEMALLOC_LIBDIR)
|
||||
set(PC_JEMALLOC_LIBRARY_DIRS)
|
||||
set(LIMIT_SEARCH NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
set(JEMALLOC_DEFINITIONS ${PC_JEMALLOC_CFLAGS_OTHER})
|
||||
|
||||
find_path(JEMALLOC_INCLUDE_DIR jemalloc/jemalloc.h
|
||||
PATHS ${PC_JEMALLOC_INCLUDEDIR} ${PC_JEMALLOC_INCLUDE_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
# If we're asked to use static linkage, add libjemalloc.a as a preferred library name.
|
||||
if(JEMALLOC_USE_STATIC)
|
||||
list(APPEND JEMALLOC_NAMES
|
||||
"${CMAKE_STATIC_LIBRARY_PREFIX}jemalloc${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
list(INSERT JEMALLOC_NAMES 0
|
||||
"${CMAKE_STATIC_LIBRARY_PREFIX}jemalloc${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
|
||||
list(APPEND JEMALLOC_NAMES jemalloc)
|
||||
|
||||
find_library(JEMALLOC_LIBRARY NAMES ${JEMALLOC_NAMES}
|
||||
HINTS ${PC_JEMALLOC_LIBDIR} ${PC_JEMALLOC_LIBRARY_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
set(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY})
|
||||
set(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args(JeMalloc DEFAULT_MSG
|
||||
JEMALLOC_LIBRARY JEMALLOC_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(JEMALLOC_INCLUDE_DIR JEMALLOC_LIBRARY)
|
@ -1,10 +0,0 @@
|
||||
# - Try to find libvterm
|
||||
# Once done this will define
|
||||
# LIBVTERM_FOUND - System has libvterm
|
||||
# LIBVTERM_INCLUDE_DIRS - The libvterm include directories
|
||||
# LIBVTERM_LIBRARIES - The libraries needed to use libvterm
|
||||
|
||||
include(LibFindMacros)
|
||||
|
||||
libfind_pkg_detect(LIBVTERM vterm FIND_PATH vterm.h FIND_LIBRARY vterm)
|
||||
libfind_process(LIBVTERM REQUIRED)
|
@ -31,16 +31,15 @@ find_library(LibIntl_LIBRARY
|
||||
)
|
||||
|
||||
if (LibIntl_INCLUDE_DIR)
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES "${LibIntl_INCLUDE_DIR}")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${LibIntl_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
# On some systems (linux+glibc) libintl is passively available.
|
||||
# So only specify the library if one was found.
|
||||
if (LibIntl_LIBRARY)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LibIntl_LIBRARY}")
|
||||
endif()
|
||||
if (MSVC)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${LibIntl_LIBRARY}")
|
||||
endif()
|
||||
|
||||
check_c_source_compiles("
|
||||
#include <libintl.h>
|
||||
|
||||
@ -51,15 +50,6 @@ int main(int argc, char** argv) {
|
||||
bind_textdomain_codeset(\"foo\", \"bar\");
|
||||
textdomain(\"foo\");
|
||||
}" HAVE_WORKING_LIBINTL)
|
||||
if (MSVC)
|
||||
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
|
||||
endif()
|
||||
if (LibIntl_INCLUDE_DIR)
|
||||
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${LibIntl_INCLUDE_DIR}")
|
||||
endif()
|
||||
if (LibIntl_LIBRARY)
|
||||
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${LibIntl_LIBRARY}")
|
||||
endif()
|
||||
|
||||
if (HAVE_WORKING_LIBINTL)
|
||||
# On some systems (linux+glibc) libintl is passively available.
|
||||
@ -68,7 +58,6 @@ if (HAVE_WORKING_LIBINTL)
|
||||
if(LibIntl_FIND_REQUIRED)
|
||||
unset(LibIntl_FIND_REQUIRED)
|
||||
endif()
|
||||
set(LibIntl_FIND_QUIETLY ON)
|
||||
|
||||
check_variable_exists(_nl_msg_cat_cntr HAVE_NL_MSG_CAT_CNTR)
|
||||
endif()
|
||||
|
@ -1,32 +0,0 @@
|
||||
# - Try to find luv
|
||||
# Once done this will define
|
||||
# LIBLUV_FOUND - System has libluv
|
||||
# LIBLUV_INCLUDE_DIRS - The libluv include directories
|
||||
# LIBLUV_LIBRARIES - The libraries needed to use libluv
|
||||
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_LIBLUV QUIET luv)
|
||||
endif()
|
||||
|
||||
set(LIBLUV_DEFINITIONS ${PC_LIBLUV_CFLAGS_OTHER})
|
||||
|
||||
find_path(LIBLUV_INCLUDE_DIR luv/luv.h
|
||||
PATHS ${PC_LIBLUV_INCLUDEDIR} ${PC_LIBLUV_INCLUDE_DIRS})
|
||||
|
||||
# Explicitly look for luv.so. #10407
|
||||
list(APPEND LIBLUV_NAMES luv luv${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
|
||||
find_library(LIBLUV_LIBRARY NAMES ${LIBLUV_NAMES}
|
||||
HINTS ${PC_LIBLUV_LIBDIR} ${PC_LIBLUV_LIBRARY_DIRS})
|
||||
|
||||
set(LIBLUV_LIBRARIES ${LIBLUV_LIBRARY})
|
||||
set(LIBLUV_INCLUDE_DIRS ${LIBLUV_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set LIBLUV_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args(LibLUV DEFAULT_MSG
|
||||
LIBLUV_LIBRARY LIBLUV_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(LIBLUV_INCLUDE_DIR LIBLUV_LIBRARY)
|
@ -4,20 +4,36 @@
|
||||
# LIBTERMKEY_INCLUDE_DIRS - The libtermkey include directories
|
||||
# LIBTERMKEY_LIBRARIES - The libraries needed to use libtermkey
|
||||
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_LIBTERMKEY QUIET termkey)
|
||||
if(NOT USE_BUNDLED_LIBTERMKEY)
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_LIBTERMKEY QUIET termkey)
|
||||
endif()
|
||||
else()
|
||||
set(PC_LIBTERMKEY_INCLUDEDIR)
|
||||
set(PC_LIBTERMKEY_INCLUDE_DIRS)
|
||||
set(PC_LIBTERMKEY_LIBDIR)
|
||||
set(PC_LIBTERMKEY_LIBRARY_DIRS)
|
||||
set(LIMIT_SEARCH NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
set(LIBTERMKEY_DEFINITIONS ${PC_LIBTERMKEY_CFLAGS_OTHER})
|
||||
|
||||
find_path(LIBTERMKEY_INCLUDE_DIR termkey.h
|
||||
PATHS ${PC_LIBTERMKEY_INCLUDEDIR} ${PC_LIBTERMKEY_INCLUDE_DIRS})
|
||||
PATHS ${PC_LIBTERMKEY_INCLUDEDIR} ${PC_LIBTERMKEY_INCLUDE_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
# If we're asked to use static linkage, add libuv.a as a preferred library name.
|
||||
if(LIBTERMKEY_USE_STATIC)
|
||||
list(APPEND LIBTERMKEY_NAMES
|
||||
"${CMAKE_STATIC_LIBRARY_PREFIX}termkey${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
|
||||
list(APPEND LIBTERMKEY_NAMES termkey)
|
||||
|
||||
find_library(LIBTERMKEY_LIBRARY NAMES ${LIBTERMKEY_NAMES}
|
||||
HINTS ${PC_LIBTERMKEY_LIBDIR} ${PC_LIBTERMKEY_LIBRARY_DIRS})
|
||||
HINTS ${PC_LIBTERMKEY_LIBDIR} ${PC_LIBTERMKEY_LIBRARY_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
set(LIBTERMKEY_LIBRARIES ${LIBTERMKEY_LIBRARY})
|
||||
set(LIBTERMKEY_INCLUDE_DIRS ${LIBTERMKEY_INCLUDE_DIR})
|
||||
|
@ -4,19 +4,38 @@
|
||||
# LIBUV_FOUND - system has libuv
|
||||
# LIBUV_INCLUDE_DIRS - the libuv include directories
|
||||
# LIBUV_LIBRARIES - link these to use libuv
|
||||
#
|
||||
# Set the LIBUV_USE_STATIC variable to specify if static libraries should
|
||||
# be preferred to shared ones.
|
||||
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_LIBUV QUIET libuv)
|
||||
if(NOT USE_BUNDLED_LIBUV)
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_LIBUV QUIET libuv)
|
||||
endif()
|
||||
else()
|
||||
set(PC_LIBUV_INCLUDEDIR)
|
||||
set(PC_LIBUV_INCLUDE_DIRS)
|
||||
set(PC_LIBUV_LIBDIR)
|
||||
set(PC_LIBUV_LIBRARY_DIRS)
|
||||
set(LIMIT_SEARCH NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
find_path(LIBUV_INCLUDE_DIR uv.h
|
||||
HINTS ${PC_LIBUV_INCLUDEDIR} ${PC_LIBUV_INCLUDE_DIRS})
|
||||
HINTS ${PC_LIBUV_INCLUDEDIR} ${PC_LIBUV_INCLUDE_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
# If we're asked to use static linkage, add libuv.a as a preferred library name.
|
||||
if(LIBUV_USE_STATIC)
|
||||
list(APPEND LIBUV_NAMES
|
||||
"${CMAKE_STATIC_LIBRARY_PREFIX}uv${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endif(LIBUV_USE_STATIC)
|
||||
|
||||
list(APPEND LIBUV_NAMES uv)
|
||||
|
||||
find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES}
|
||||
HINTS ${PC_LIBUV_LIBDIR} ${PC_LIBUV_LIBRARY_DIRS})
|
||||
HINTS ${PC_LIBUV_LIBDIR} ${PC_LIBUV_LIBRARY_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY)
|
||||
|
||||
|
47
cmake/FindLibVterm.cmake
Normal file
47
cmake/FindLibVterm.cmake
Normal file
@ -0,0 +1,47 @@
|
||||
# - Try to find libvterm
|
||||
# Once done this will define
|
||||
# LIBVTERM_FOUND - System has libvterm
|
||||
# LIBVTERM_INCLUDE_DIRS - The libvterm include directories
|
||||
# LIBVTERM_LIBRARIES - The libraries needed to use libvterm
|
||||
|
||||
if(NOT USE_BUNDLED_LIBVTERM)
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_LIBVTERM QUIET vterm)
|
||||
endif()
|
||||
else()
|
||||
set(PC_LIBVTERM_INCLUDEDIR)
|
||||
set(PC_LIBVTERM_INCLUDE_DIRS)
|
||||
set(PC_LIBVTERM_LIBDIR)
|
||||
set(PC_LIBVTERM_LIBRARY_DIRS)
|
||||
set(LIMIT_SEARCH NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
set(LIBVTERM_DEFINITIONS ${PC_LIBVTERM_CFLAGS_OTHER})
|
||||
|
||||
find_path(LIBVTERM_INCLUDE_DIR vterm.h
|
||||
PATHS ${PC_LIBVTERM_INCLUDEDIR} ${PC_LIBVTERM_INCLUDE_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
# If we're asked to use static linkage, add libuv.a as a preferred library name.
|
||||
if(LIBVTERM_USE_STATIC)
|
||||
list(APPEND LIBVTERM_NAMES
|
||||
"${CMAKE_STATIC_LIBRARY_PREFIX}vterm${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
|
||||
list(APPEND LIBVTERM_NAMES vterm)
|
||||
|
||||
find_library(LIBVTERM_LIBRARY NAMES ${LIBVTERM_NAMES}
|
||||
HINTS ${PC_LIBVTERM_LIBDIR} ${PC_LIBVTERM_LIBRARY_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
set(LIBVTERM_LIBRARIES ${LIBVTERM_LIBRARY})
|
||||
set(LIBVTERM_INCLUDE_DIRS ${LIBVTERM_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set LIBVTERM_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args(LibVterm DEFAULT_MSG
|
||||
LIBVTERM_LIBRARY LIBVTERM_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(LIBVTERM_INCLUDE_DIR LIBVTERM_LIBRARY)
|
@ -42,7 +42,7 @@ unset(_lua_append_versions)
|
||||
|
||||
# this is a function only to have all the variables inside go away automatically
|
||||
function(_lua_set_version_vars)
|
||||
set(LUA_VERSIONS5 5.4 5.3 5.2 5.1 5.0)
|
||||
set(LUA_VERSIONS5 5.3 5.2 5.1 5.0)
|
||||
|
||||
if (Lua_FIND_VERSION_EXACT)
|
||||
if (Lua_FIND_VERSION_COUNT GREATER 1)
|
||||
|
@ -4,16 +4,32 @@
|
||||
# LUAJIT_INCLUDE_DIRS - The luajit include directories
|
||||
# LUAJIT_LIBRARIES - The libraries needed to use luajit
|
||||
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_LUAJIT QUIET luajit)
|
||||
if(NOT USE_BUNDLED_LUAJIT)
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_LUAJIT QUIET luajit)
|
||||
endif()
|
||||
else()
|
||||
set(PC_LUAJIT_INCLUDEDIR)
|
||||
set(PC_LUAJIT_INCLUDE_DIRS)
|
||||
set(PC_LUAJIT_LIBDIR)
|
||||
set(PC_LUAJIT_LIBRARY_DIRS)
|
||||
set(LIMIT_SEARCH NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
set(LUAJIT_DEFINITIONS ${PC_LUAJIT_CFLAGS_OTHER})
|
||||
|
||||
find_path(LUAJIT_INCLUDE_DIR luajit.h
|
||||
PATHS ${PC_LUAJIT_INCLUDEDIR} ${PC_LUAJIT_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES luajit-2.0 luajit-2.1)
|
||||
PATH_SUFFIXES luajit-2.0
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
# If we're asked to use static linkage, add libluajit-5.1.a as a preferred
|
||||
# library name.
|
||||
if(LUAJIT_USE_STATIC)
|
||||
list(APPEND LUAJIT_NAMES
|
||||
"${CMAKE_STATIC_LIBRARY_PREFIX}luajit-5.1${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
list(APPEND LUAJIT_NAMES lua51)
|
||||
@ -24,7 +40,8 @@ else()
|
||||
endif()
|
||||
|
||||
find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES}
|
||||
PATHS ${PC_LUAJIT_LIBDIR} ${PC_LUAJIT_LIBRARY_DIRS})
|
||||
PATHS ${PC_LUAJIT_LIBDIR} ${PC_LUAJIT_LIBRARY_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARY})
|
||||
set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR})
|
||||
|
@ -4,17 +4,26 @@
|
||||
# MSGPACK_INCLUDE_DIRS - The msgpack include directories
|
||||
# MSGPACK_LIBRARIES - The libraries needed to use msgpack
|
||||
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_search_module(PC_MSGPACK QUIET
|
||||
msgpackc>=${Msgpack_FIND_VERSION}
|
||||
msgpack>=${Msgpack_FIND_VERSION})
|
||||
if(NOT USE_BUNDLED_MSGPACK)
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_search_module(PC_MSGPACK QUIET
|
||||
msgpackc>=${Msgpack_FIND_VERSION}
|
||||
msgpack>=${Msgpack_FIND_VERSION})
|
||||
endif()
|
||||
else()
|
||||
set(PC_MSGPACK_INCLUDEDIR)
|
||||
set(PC_MSGPACK_INCLUDE_DIRS)
|
||||
set(PC_MSGPACK_LIBDIR)
|
||||
set(PC_MSGPACK_LIBRARY_DIRS)
|
||||
set(LIMIT_SEARCH NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
set(MSGPACK_DEFINITIONS ${PC_MSGPACK_CFLAGS_OTHER})
|
||||
|
||||
find_path(MSGPACK_INCLUDE_DIR msgpack/version_master.h
|
||||
HINTS ${PC_MSGPACK_INCLUDEDIR} ${PC_MSGPACK_INCLUDE_DIRS})
|
||||
HINTS ${PC_MSGPACK_INCLUDEDIR} ${PC_MSGPACK_INCLUDE_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
if(MSGPACK_INCLUDE_DIR)
|
||||
file(READ ${MSGPACK_INCLUDE_DIR}/msgpack/version_master.h msgpack_version_h)
|
||||
@ -26,6 +35,13 @@ else()
|
||||
set(MSGPACK_VERSION_STRING)
|
||||
endif()
|
||||
|
||||
# If we're asked to use static linkage, add libmsgpack{,c}.a as a preferred library name.
|
||||
if(MSGPACK_USE_STATIC)
|
||||
list(APPEND MSGPACK_NAMES
|
||||
"${CMAKE_STATIC_LIBRARY_PREFIX}msgpackc${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||||
"${CMAKE_STATIC_LIBRARY_PREFIX}msgpack${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
# The import library for the msgpack DLL has a different name
|
||||
list(APPEND MSGPACK_NAMES msgpackc_import)
|
||||
@ -37,7 +53,8 @@ find_library(MSGPACK_LIBRARY NAMES ${MSGPACK_NAMES}
|
||||
# Check each directory for all names to avoid using headers/libraries from
|
||||
# different places.
|
||||
NAMES_PER_DIR
|
||||
HINTS ${PC_MSGPACK_LIBDIR} ${PC_MSGPACK_LIBRARY_DIRS})
|
||||
HINTS ${PC_MSGPACK_LIBDIR} ${PC_MSGPACK_LIBRARY_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY)
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
# - Try to find tree-sitter
|
||||
# Once done, this will define
|
||||
#
|
||||
# TreeSitter_FOUND - system has tree-sitter
|
||||
# TreeSitter_INCLUDE_DIRS - the tree-sitter include directories
|
||||
# TreeSitter_LIBRARIES - link these to use tree-sitter
|
||||
|
||||
include(LibFindMacros)
|
||||
|
||||
libfind_pkg_detect(TreeSitter tree-sitter FIND_PATH tree_sitter/api.h FIND_LIBRARY tree-sitter)
|
||||
libfind_process(TreeSitter)
|
@ -1,12 +0,0 @@
|
||||
# - Try to find unibilium
|
||||
# Once done this will define
|
||||
# UNIBILIUM_FOUND - System has unibilium
|
||||
# UNIBILIUM_INCLUDE_DIRS - The unibilium include directories
|
||||
# UNIBILIUM_LIBRARIES - The libraries needed to use unibilium
|
||||
|
||||
include(LibFindMacros)
|
||||
|
||||
libfind_pkg_detect(UNIBILIUM unibilium
|
||||
FIND_PATH unibilium.h
|
||||
FIND_LIBRARY unibilium)
|
||||
libfind_process(UNIBILIUM)
|
47
cmake/FindUnibilium.cmake
Normal file
47
cmake/FindUnibilium.cmake
Normal file
@ -0,0 +1,47 @@
|
||||
# - Try to find unibilium
|
||||
# Once done this will define
|
||||
# UNIBILIUM_FOUND - System has unibilium
|
||||
# UNIBILIUM_INCLUDE_DIRS - The unibilium include directories
|
||||
# UNIBILIUM_LIBRARIES - The libraries needed to use unibilium
|
||||
|
||||
if(NOT USE_BUNDLED_UNIBILIUM)
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_UNIBILIUM QUIET unibilium)
|
||||
endif()
|
||||
else()
|
||||
set(PC_UNIBILIUM_INCLUDEDIR)
|
||||
set(PC_UNIBILIUM_INCLUDE_DIRS)
|
||||
set(PC_UNIBILIUM_LIBDIR)
|
||||
set(PC_UNIBILIUM_LIBRARY_DIRS)
|
||||
set(LIMIT_SEARCH NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
set(UNIBILIUM_DEFINITIONS ${PC_UNIBILIUM_CFLAGS_OTHER})
|
||||
|
||||
find_path(UNIBILIUM_INCLUDE_DIR unibilium.h
|
||||
PATHS ${PC_UNIBILIUM_INCLUDEDIR} ${PC_UNIBILIUM_INCLUDE_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
# If we're asked to use static linkage, add libunibilium.a as a preferred library name.
|
||||
if(UNIBILIUM_USE_STATIC)
|
||||
list(APPEND UNIBILIUM_NAMES
|
||||
"${CMAKE_STATIC_LIBRARY_PREFIX}unibilium${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
|
||||
list(APPEND UNIBILIUM_NAMES unibilium)
|
||||
|
||||
find_library(UNIBILIUM_LIBRARY NAMES ${UNIBILIUM_NAMES}
|
||||
HINTS ${PC_UNIBILIUM_LIBDIR} ${PC_UNIBILIUM_LIBRARY_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
set(UNIBILIUM_LIBRARIES ${UNIBILIUM_LIBRARY})
|
||||
set(UNIBILIUM_INCLUDE_DIRS ${UNIBILIUM_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set UNIBILIUM_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args(unibilium DEFAULT_MSG
|
||||
UNIBILIUM_LIBRARY UNIBILIUM_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(UNIBILIUM_INCLUDE_DIR UNIBILIUM_LIBRARY)
|
39
cmake/GenerateHelptags.cmake.in
Normal file
39
cmake/GenerateHelptags.cmake.in
Normal file
@ -0,0 +1,39 @@
|
||||
if(DEFINED ENV{DESTDIR})
|
||||
file(TO_CMAKE_PATH
|
||||
$ENV{DESTDIR}/@CMAKE_INSTALL_FULL_DATADIR@/nvim/runtime/doc
|
||||
HELPTAGS_WORKING_DIRECTORY)
|
||||
else()
|
||||
file(TO_CMAKE_PATH
|
||||
@CMAKE_INSTALL_FULL_DATADIR@/nvim/runtime/doc
|
||||
HELPTAGS_WORKING_DIRECTORY)
|
||||
endif()
|
||||
|
||||
message(STATUS "Generating helptags in ${HELPTAGS_WORKING_DIRECTORY}")
|
||||
if(EXISTS ${HELPTAGS_WORKING_DIRECTORY}/)
|
||||
message(STATUS "${HELPTAGS_WORKING_DIRECTORY} already exists")
|
||||
# If the doc directory already exists, helptags could fail due to duplicate
|
||||
# tags. Tell the user to remove the directory and try again.
|
||||
set(TROUBLESHOOTING "\nRemove \"${HELPTAGS_WORKING_DIRECTORY}\" and try again.")
|
||||
endif()
|
||||
|
||||
# Workaround for hanging "yes | nvim -c 'helptags ++t .'"
|
||||
# and therefore hanging "yes | make install":
|
||||
# Set INPUT_FILE to an empty file, causing execute_process
|
||||
# to disregard other standard input (such as "yes |").
|
||||
set(EMPTY_FILE ${CMAKE_CURRENT_BINARY_DIR}/.GenerateHelptags)
|
||||
file(WRITE ${EMPTY_FILE} "")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/nvim
|
||||
-u NONE
|
||||
-es
|
||||
-c "helptags ++t ."
|
||||
-c quit
|
||||
WORKING_DIRECTORY ${HELPTAGS_WORKING_DIRECTORY}
|
||||
INPUT_FILE ${EMPTY_FILE}
|
||||
OUTPUT_VARIABLE err
|
||||
ERROR_VARIABLE err
|
||||
RESULT_VARIABLE res)
|
||||
|
||||
if(NOT res EQUAL 0)
|
||||
message(FATAL_ERROR "Generating helptags failed: ${err} - ${res}${TROUBLESHOOTING}")
|
||||
endif()
|
@ -1,51 +1,21 @@
|
||||
function(get_compile_flags _compile_flags)
|
||||
# Create template akin to CMAKE_C_COMPILE_OBJECT.
|
||||
set(compile_flags "<CMAKE_C_COMPILER> <CFLAGS> <BUILD_TYPE_CFLAGS> <COMPILE_OPTIONS><COMPILE_DEFINITIONS> <INCLUDES>")
|
||||
set(compile_flags "<CMAKE_C_COMPILER> <CFLAGS> <BUILD_TYPE_CFLAGS> <DEFINITIONS> <INCLUDES>")
|
||||
|
||||
# Get C compiler.
|
||||
if(CMAKE_C_COMPILER_ARG1)
|
||||
string(REPLACE
|
||||
"<CMAKE_C_COMPILER>"
|
||||
"<CMAKE_C_COMPILER> ${CMAKE_C_COMPILER_ARG1}"
|
||||
compile_flags
|
||||
"${compile_flags}")
|
||||
endif()
|
||||
string(REPLACE
|
||||
"<CMAKE_C_COMPILER>"
|
||||
"${CMAKE_C_COMPILER}"
|
||||
compile_flags
|
||||
"${compile_flags}")
|
||||
|
||||
# Get flags set by add_definitions().
|
||||
get_property(compile_definitions DIRECTORY PROPERTY COMPILE_DEFINITIONS)
|
||||
get_target_property(compile_definitions_target nvim COMPILE_DEFINITIONS)
|
||||
if(compile_definitions_target)
|
||||
list(APPEND compile_definitions ${compile_definitions_target})
|
||||
list(REMOVE_DUPLICATES compile_definitions)
|
||||
endif()
|
||||
# NOTE: list(JOIN) requires CMake 3.12, string(CONCAT) requires CMake 3.
|
||||
string(REPLACE ";" " -D" compile_definitions "${compile_definitions}")
|
||||
if(compile_definitions)
|
||||
set(compile_definitions " -D${compile_definitions}")
|
||||
endif()
|
||||
# Get flags set by add_definition().
|
||||
get_directory_property(definitions
|
||||
DIRECTORY "src/nvim"
|
||||
DEFINITIONS)
|
||||
string(REPLACE
|
||||
"<COMPILE_DEFINITIONS>"
|
||||
"${compile_definitions}"
|
||||
compile_flags
|
||||
"${compile_flags}")
|
||||
|
||||
# Get flags set by add_compile_options().
|
||||
get_property(compile_options DIRECTORY PROPERTY COMPILE_OPTIONS)
|
||||
get_target_property(compile_options_target nvim COMPILE_OPTIONS)
|
||||
if(compile_options_target)
|
||||
list(APPEND compile_options ${compile_options_target})
|
||||
list(REMOVE_DUPLICATES compile_options)
|
||||
endif()
|
||||
# NOTE: list(JOIN) requires CMake 3.12.
|
||||
string(REPLACE ";" " " compile_options "${compile_options}")
|
||||
string(REPLACE
|
||||
"<COMPILE_OPTIONS>"
|
||||
"${compile_options}"
|
||||
"<DEFINITIONS>"
|
||||
"${definitions}"
|
||||
compile_flags
|
||||
"${compile_flags}")
|
||||
|
||||
@ -65,7 +35,9 @@ function(get_compile_flags _compile_flags)
|
||||
"${compile_flags}")
|
||||
|
||||
# Get include directories.
|
||||
get_property(include_directories_list DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
|
||||
get_directory_property(include_directories_list
|
||||
DIRECTORY "src/nvim"
|
||||
INCLUDE_DIRECTORIES)
|
||||
list(REMOVE_DUPLICATES include_directories_list)
|
||||
foreach(include_directory ${include_directories_list})
|
||||
set(include_directories "${include_directories} -I${include_directory}")
|
||||
|
180
cmake/GetGitRevisionDescription.cmake
Normal file
180
cmake/GetGitRevisionDescription.cmake
Normal file
@ -0,0 +1,180 @@
|
||||
# https://github.com/rpavlik/cmake-modules
|
||||
#
|
||||
# - Returns a version string from Git
|
||||
#
|
||||
# These functions force a re-configure on each git commit so that you can
|
||||
# trust the values of the variables in your build system.
|
||||
#
|
||||
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the refspec and sha hash of the current head revision
|
||||
#
|
||||
# git_describe(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe on the source tree, and adjusting
|
||||
# the output so that it tests false if an error occurs.
|
||||
#
|
||||
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe --exact-match on the source tree,
|
||||
# and adjusting the output so that it tests false if there was no exact
|
||||
# matching tag.
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
if(__get_git_revision_description)
|
||||
return()
|
||||
endif()
|
||||
set(__get_git_revision_description YES)
|
||||
|
||||
# We must run the following at "include" time, not at function call time,
|
||||
# to find the path to this module rather than the path to a calling list file
|
||||
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
|
||||
function(get_git_dir _gitdir)
|
||||
# check FORCED_GIT_DIR first
|
||||
if(FORCED_GIT_DIR)
|
||||
set(${_gitdir} ${FORCED_GIT_DIR} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check GIT_DIR in environment
|
||||
set(GIT_DIR $ENV{GIT_DIR})
|
||||
if(NOT GIT_DIR)
|
||||
set(GIT_PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(GIT_DIR ${GIT_PARENT_DIR}/.git)
|
||||
endif()
|
||||
# .git dir not found, search parent directories
|
||||
while(NOT EXISTS ${GIT_DIR})
|
||||
set(GIT_PREVIOUS_PARENT ${GIT_PARENT_DIR})
|
||||
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
|
||||
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
|
||||
return()
|
||||
endif()
|
||||
set(GIT_DIR ${GIT_PARENT_DIR}/.git)
|
||||
endwhile()
|
||||
# check if this is a submodule
|
||||
if(NOT IS_DIRECTORY ${GIT_DIR})
|
||||
file(READ ${GIT_DIR} submodule)
|
||||
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
|
||||
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
|
||||
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
|
||||
endif()
|
||||
set(${_gitdir} ${GIT_DIR} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(get_git_head_revision _refspecvar _hashvar)
|
||||
get_git_dir(GIT_DIR)
|
||||
if(NOT GIT_DIR)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(GIT_DATA ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data)
|
||||
if(NOT EXISTS ${GIT_DATA})
|
||||
file(MAKE_DIRECTORY ${GIT_DATA})
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${GIT_DIR}/HEAD)
|
||||
return()
|
||||
endif()
|
||||
set(HEAD_FILE ${GIT_DATA}/HEAD)
|
||||
configure_file(${GIT_DIR}/HEAD ${HEAD_FILE} COPYONLY)
|
||||
|
||||
configure_file(${_gitdescmoddir}/GetGitRevisionDescription.cmake.in
|
||||
${GIT_DATA}/grabRef.cmake
|
||||
@ONLY)
|
||||
include(${GIT_DATA}/grabRef.cmake)
|
||||
|
||||
set(${_refspecvar} ${HEAD_REF} PARENT_SCOPE)
|
||||
set(${_hashvar} ${HEAD_HASH} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_describe _var)
|
||||
get_git_dir(GIT_DIR)
|
||||
if(NOT GIT_DIR)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT hash)
|
||||
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND
|
||||
${GIT_EXECUTABLE}
|
||||
describe
|
||||
${hash}
|
||||
${ARGN}
|
||||
WORKING_DIRECTORY
|
||||
${GIT_DIR}
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_VARIABLE
|
||||
out
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var} ${out} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_timestamp _var)
|
||||
get_git_dir(GIT_DIR)
|
||||
if(NOT GIT_DIR)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
if(NOT GIT_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT hash)
|
||||
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format="%ci" ${hash} ${ARGN}
|
||||
WORKING_DIRECTORY ${GIT_DIR}
|
||||
RESULT_VARIABLE res
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(res EQUAL 0)
|
||||
string(REGEX REPLACE "[-\" :]" "" out ${out})
|
||||
string(SUBSTRING ${out} 0 12 out)
|
||||
else()
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var} ${out} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_get_exact_tag _var)
|
||||
git_describe(out --exact-match ${ARGN})
|
||||
set(${_var} ${out} PARENT_SCOPE)
|
||||
endfunction()
|
38
cmake/GetGitRevisionDescription.cmake.in
Normal file
38
cmake/GetGitRevisionDescription.cmake.in
Normal file
@ -0,0 +1,38 @@
|
||||
#
|
||||
# Internal file for GetGitRevisionDescription.cmake
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
set(HEAD_HASH)
|
||||
|
||||
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
|
||||
|
||||
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
|
||||
if(HEAD_CONTENTS MATCHES "ref")
|
||||
# named branch
|
||||
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
|
||||
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
|
||||
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}")
|
||||
configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
set(HEAD_HASH "${HEAD_REF}")
|
||||
endif()
|
||||
else()
|
||||
# detached HEAD
|
||||
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
endif()
|
||||
|
||||
if(NOT HEAD_HASH)
|
||||
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
|
||||
string(STRIP "${HEAD_HASH}" HEAD_HASH)
|
||||
endif()
|
@ -1,101 +1,46 @@
|
||||
# Version 2.2
|
||||
# Public Domain, originally written by Lasse Kärkkäinen <tronic>
|
||||
# Maintained at https://github.com/Tronic/cmake-modules
|
||||
# Please send your improvements as pull requests on Github.
|
||||
# Version 1.0 (2013-04-12)
|
||||
# Public Domain, originally written by Lasse Kärkkäinen <tronic@zi.fi>
|
||||
# Published at http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries
|
||||
|
||||
# Find another package and make it a dependency of the current package.
|
||||
# This also automatically forwards the "REQUIRED" argument.
|
||||
# Usage: libfind_package(<prefix> <another package> [extra args to find_package])
|
||||
macro (libfind_package PREFIX PKG)
|
||||
set(${PREFIX}_args ${PKG} ${ARGN})
|
||||
# If you improve the script, please modify the forementioned wiki page because
|
||||
# I no longer maintain my scripts (hosted as static files at zi.fi). Feel free
|
||||
# to remove this entire header if you use real version control instead.
|
||||
|
||||
# Changelog:
|
||||
# 2013-04-12 Added version number (1.0) and this header, no other changes
|
||||
# 2009-10-08 Originally published
|
||||
|
||||
|
||||
# Works the same as find_package, but forwards the "REQUIRED" and "QUIET" arguments
|
||||
# used for the current package. For this to work, the first parameter must be the
|
||||
# prefix of the current package, then the prefix of the new package etc, which are
|
||||
# passed to find_package.
|
||||
macro (libfind_package PREFIX)
|
||||
set (LIBFIND_PACKAGE_ARGS ${ARGN})
|
||||
if (${PREFIX}_FIND_QUIETLY)
|
||||
set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} QUIET)
|
||||
endif (${PREFIX}_FIND_QUIETLY)
|
||||
if (${PREFIX}_FIND_REQUIRED)
|
||||
set(${PREFIX}_args ${${PREFIX}_args} REQUIRED)
|
||||
endif()
|
||||
find_package(${${PREFIX}_args})
|
||||
set(${PREFIX}_DEPENDENCIES ${${PREFIX}_DEPENDENCIES};${PKG})
|
||||
unset(${PREFIX}_args)
|
||||
endmacro()
|
||||
set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} REQUIRED)
|
||||
endif (${PREFIX}_FIND_REQUIRED)
|
||||
find_package(${LIBFIND_PACKAGE_ARGS})
|
||||
endmacro (libfind_package)
|
||||
|
||||
# A simple wrapper to make pkg-config searches a bit easier.
|
||||
# Works the same as CMake's internal pkg_check_modules but is always quiet.
|
||||
macro (libfind_pkg_check_modules)
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(${ARGN} QUIET)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Avoid useless copy&pasta by doing what most simple libraries do anyway:
|
||||
# pkg-config, find headers, find library.
|
||||
# Usage: libfind_pkg_detect(<prefix> <pkg-config args> FIND_PATH <name> [other args] FIND_LIBRARY <name> [other args])
|
||||
# E.g. libfind_pkg_detect(SDL2 sdl2 FIND_PATH SDL.h PATH_SUFFIXES SDL2 FIND_LIBRARY SDL2)
|
||||
function (libfind_pkg_detect PREFIX)
|
||||
# Parse arguments
|
||||
set(argname pkgargs)
|
||||
foreach (i ${ARGN})
|
||||
if ("${i}" STREQUAL "FIND_PATH")
|
||||
set(argname pathargs)
|
||||
elseif ("${i}" STREQUAL "FIND_LIBRARY")
|
||||
set(argname libraryargs)
|
||||
else()
|
||||
set(${argname} ${${argname}} ${i})
|
||||
endif()
|
||||
endforeach()
|
||||
if (NOT pkgargs)
|
||||
message(FATAL_ERROR "libfind_pkg_detect requires at least a pkg_config package name to be passed.")
|
||||
endif()
|
||||
# Find library
|
||||
libfind_pkg_check_modules(${PREFIX}_PKGCONF ${pkgargs})
|
||||
if (pathargs)
|
||||
find_path(${PREFIX}_INCLUDE_DIR NAMES ${pathargs} HINTS ${${PREFIX}_PKGCONF_INCLUDE_DIRS})
|
||||
endif()
|
||||
if (libraryargs)
|
||||
find_library(${PREFIX}_LIBRARY NAMES ${libraryargs} HINTS ${${PREFIX}_PKGCONF_LIBRARY_DIRS})
|
||||
endif()
|
||||
# Read pkg-config version
|
||||
if (${PREFIX}_PKGCONF_VERSION)
|
||||
set(${PREFIX}_VERSION ${${PREFIX}_PKGCONF_VERSION} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Extracts a version #define from a version.h file, output stored to <PREFIX>_VERSION.
|
||||
# Usage: libfind_version_header(Foobar foobar/version.h FOOBAR_VERSION_STR)
|
||||
# Fourth argument "QUIET" may be used for silently testing different define names.
|
||||
# This function does nothing if the version variable is already defined.
|
||||
function (libfind_version_header PREFIX VERSION_H DEFINE_NAME)
|
||||
# Skip processing if we already have a version or if the include dir was not found
|
||||
if (${PREFIX}_VERSION OR NOT ${PREFIX}_INCLUDE_DIR)
|
||||
return()
|
||||
endif()
|
||||
set(quiet ${${PREFIX}_FIND_QUIETLY})
|
||||
# Process optional arguments
|
||||
foreach(arg ${ARGN})
|
||||
if (arg STREQUAL "QUIET")
|
||||
set(quiet TRUE)
|
||||
else()
|
||||
message(AUTHOR_WARNING "Unknown argument ${arg} to libfind_version_header ignored.")
|
||||
endif()
|
||||
endforeach()
|
||||
# Read the header and parse for version number
|
||||
set(filename "${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
|
||||
if (NOT EXISTS ${filename})
|
||||
if (NOT quiet)
|
||||
message(AUTHOR_WARNING "Unable to find ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
file(READ "${filename}" header)
|
||||
string(REGEX REPLACE ".*#[ \t]*define[ \t]*${DEFINE_NAME}[ \t]*\"([^\n]*)\".*" "\\1" match "${header}")
|
||||
# No regex match?
|
||||
if (match STREQUAL header)
|
||||
if (NOT quiet)
|
||||
message(AUTHOR_WARNING "Unable to find \#define ${DEFINE_NAME} \"<version>\" from ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
# Export the version string
|
||||
set(${PREFIX}_VERSION "${match}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
# CMake developers made the UsePkgConfig system deprecated in the same release (2.6)
|
||||
# where they added pkg_check_modules. Consequently I need to support both in my scripts
|
||||
# to avoid those deprecated warnings. Here's a helper that does just that.
|
||||
# Works identically to pkg_check_modules, except that no checks are needed prior to use.
|
||||
macro (libfind_pkg_check_modules PREFIX PKGNAME)
|
||||
if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
|
||||
include(UsePkgConfig)
|
||||
pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS)
|
||||
else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(${PREFIX} ${PKGNAME})
|
||||
endif (PKG_CONFIG_FOUND)
|
||||
endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
|
||||
endmacro (libfind_pkg_check_modules)
|
||||
|
||||
# Do the final processing once the paths have been detected.
|
||||
# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain
|
||||
@ -103,167 +48,65 @@ endfunction()
|
||||
# Ditto for ${PREFIX}_PROCESS_LIBS and library files.
|
||||
# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES.
|
||||
# Also handles errors in case library detection was required, etc.
|
||||
function (libfind_process PREFIX)
|
||||
# Skip processing if already processed during this configuration run
|
||||
if (${PREFIX}_FOUND)
|
||||
return()
|
||||
endif()
|
||||
macro (libfind_process PREFIX)
|
||||
# Skip processing if already processed during this run
|
||||
if (NOT ${PREFIX}_FOUND)
|
||||
# Start with the assumption that the library was found
|
||||
set (${PREFIX}_FOUND TRUE)
|
||||
|
||||
set(found TRUE) # Start with the assumption that the package was found
|
||||
# Process all includes and set _FOUND to false if any are missing
|
||||
foreach (i ${${PREFIX}_PROCESS_INCLUDES})
|
||||
if (${i})
|
||||
set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}})
|
||||
mark_as_advanced(${i})
|
||||
else (${i})
|
||||
set (${PREFIX}_FOUND FALSE)
|
||||
endif (${i})
|
||||
endforeach (i)
|
||||
|
||||
# Did we find any files? Did we miss includes? These are for formatting better error messages.
|
||||
set(some_files FALSE)
|
||||
set(missing_headers FALSE)
|
||||
# Process all libraries and set _FOUND to false if any are missing
|
||||
foreach (i ${${PREFIX}_PROCESS_LIBS})
|
||||
if (${i})
|
||||
set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}})
|
||||
mark_as_advanced(${i})
|
||||
else (${i})
|
||||
set (${PREFIX}_FOUND FALSE)
|
||||
endif (${i})
|
||||
endforeach (i)
|
||||
|
||||
# Shorthands for some variables that we need often
|
||||
set(quiet ${${PREFIX}_FIND_QUIETLY})
|
||||
set(required ${${PREFIX}_FIND_REQUIRED})
|
||||
set(exactver ${${PREFIX}_FIND_VERSION_EXACT})
|
||||
set(findver "${${PREFIX}_FIND_VERSION}")
|
||||
set(version "${${PREFIX}_VERSION}")
|
||||
# Print message and/or exit on fatal error
|
||||
if (${PREFIX}_FOUND)
|
||||
if (NOT ${PREFIX}_FIND_QUIETLY)
|
||||
message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
|
||||
endif (NOT ${PREFIX}_FIND_QUIETLY)
|
||||
else (${PREFIX}_FOUND)
|
||||
if (${PREFIX}_FIND_REQUIRED)
|
||||
foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS})
|
||||
message("${i}=${${i}}")
|
||||
endforeach (i)
|
||||
message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.")
|
||||
endif (${PREFIX}_FIND_REQUIRED)
|
||||
endif (${PREFIX}_FOUND)
|
||||
endif (NOT ${PREFIX}_FOUND)
|
||||
endmacro (libfind_process)
|
||||
|
||||
# Lists of config option names (all, includes, libs)
|
||||
unset(configopts)
|
||||
set(includeopts ${${PREFIX}_PROCESS_INCLUDES})
|
||||
set(libraryopts ${${PREFIX}_PROCESS_LIBS})
|
||||
macro(libfind_library PREFIX basename)
|
||||
set(TMP "")
|
||||
if(MSVC80)
|
||||
set(TMP -vc80)
|
||||
endif(MSVC80)
|
||||
if(MSVC90)
|
||||
set(TMP -vc90)
|
||||
endif(MSVC90)
|
||||
set(${PREFIX}_LIBNAMES ${basename}${TMP})
|
||||
if(${ARGC} GREATER 2)
|
||||
set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2})
|
||||
string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES})
|
||||
set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP})
|
||||
endif(${ARGC} GREATER 2)
|
||||
find_library(${PREFIX}_LIBRARY
|
||||
NAMES ${${PREFIX}_LIBNAMES}
|
||||
PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS}
|
||||
)
|
||||
endmacro(libfind_library)
|
||||
|
||||
# Process deps to add to
|
||||
foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES})
|
||||
if (DEFINED ${i}_INCLUDE_OPTS OR DEFINED ${i}_LIBRARY_OPTS)
|
||||
# The package seems to export option lists that we can use, woohoo!
|
||||
list(APPEND includeopts ${${i}_INCLUDE_OPTS})
|
||||
list(APPEND libraryopts ${${i}_LIBRARY_OPTS})
|
||||
else()
|
||||
# If plural forms don't exist or they equal singular forms
|
||||
if ((NOT DEFINED ${i}_INCLUDE_DIRS AND NOT DEFINED ${i}_LIBRARIES) OR
|
||||
(${i}_INCLUDE_DIR STREQUAL ${i}_INCLUDE_DIRS AND ${i}_LIBRARY STREQUAL ${i}_LIBRARIES))
|
||||
# Singular forms can be used
|
||||
if (DEFINED ${i}_INCLUDE_DIR)
|
||||
list(APPEND includeopts ${i}_INCLUDE_DIR)
|
||||
endif()
|
||||
if (DEFINED ${i}_LIBRARY)
|
||||
list(APPEND libraryopts ${i}_LIBRARY)
|
||||
endif()
|
||||
else()
|
||||
# Oh no, we don't know the option names
|
||||
message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes and libs. Aieeh!")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (includeopts)
|
||||
list(REMOVE_DUPLICATES includeopts)
|
||||
endif()
|
||||
|
||||
if (libraryopts)
|
||||
list(REMOVE_DUPLICATES libraryopts)
|
||||
endif()
|
||||
|
||||
string(REGEX REPLACE ".*[ ;]([^ ;]*(_INCLUDE_DIRS|_LIBRARIES))" "\\1" tmp "${includeopts} ${libraryopts}")
|
||||
if (NOT tmp STREQUAL "${includeopts} ${libraryopts}")
|
||||
message(AUTHOR_WARNING "Plural form ${tmp} found in config options of ${PREFIX}. This works as before but is now deprecated. Please only use singular forms INCLUDE_DIR and LIBRARY, and update your find scripts for LibFindMacros > 2.0 automatic dependency system (most often you can simply remove the PROCESS variables entirely).")
|
||||
endif()
|
||||
|
||||
# Include/library names separated by spaces (notice: not CMake lists)
|
||||
unset(includes)
|
||||
unset(libs)
|
||||
|
||||
# Process all includes and set found false if any are missing
|
||||
foreach (i ${includeopts})
|
||||
list(APPEND configopts ${i})
|
||||
if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND")
|
||||
list(APPEND includes "${${i}}")
|
||||
else()
|
||||
set(found FALSE)
|
||||
set(missing_headers TRUE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Process all libraries and set found false if any are missing
|
||||
foreach (i ${libraryopts})
|
||||
list(APPEND configopts ${i})
|
||||
if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND")
|
||||
list(APPEND libs "${${i}}")
|
||||
else()
|
||||
set (found FALSE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Version checks
|
||||
if (found AND findver)
|
||||
if (NOT version)
|
||||
message(WARNING "The find module for ${PREFIX} does not provide version information, so we'll just assume that it is OK. Please fix the module or remove package version requirements to get rid of this warning.")
|
||||
elseif (version VERSION_LESS findver OR (exactver AND NOT version VERSION_EQUAL findver))
|
||||
set(found FALSE)
|
||||
set(version_unsuitable TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If all-OK, hide all config options, export variables, print status and exit
|
||||
if (found)
|
||||
foreach (i ${configopts})
|
||||
mark_as_advanced(${i})
|
||||
endforeach()
|
||||
if (NOT quiet)
|
||||
message(STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
|
||||
if (LIBFIND_DEBUG)
|
||||
message(STATUS " ${PREFIX}_DEPENDENCIES=${${PREFIX}_DEPENDENCIES}")
|
||||
message(STATUS " ${PREFIX}_INCLUDE_OPTS=${includeopts}")
|
||||
message(STATUS " ${PREFIX}_INCLUDE_DIRS=${includes}")
|
||||
message(STATUS " ${PREFIX}_LIBRARY_OPTS=${libraryopts}")
|
||||
message(STATUS " ${PREFIX}_LIBRARIES=${libs}")
|
||||
endif()
|
||||
endif()
|
||||
set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE)
|
||||
set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE)
|
||||
set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE)
|
||||
set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE)
|
||||
set (${PREFIX}_FOUND TRUE PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Format messages for debug info and the type of error
|
||||
set(vars "Relevant CMake configuration variables:\n")
|
||||
foreach (i ${configopts})
|
||||
mark_as_advanced(CLEAR ${i})
|
||||
set(val ${${i}})
|
||||
if ("${val}" STREQUAL "${i}-NOTFOUND")
|
||||
set (val "<not found>")
|
||||
elseif (val AND NOT EXISTS ${val})
|
||||
set (val "${val} (does not exist)")
|
||||
else()
|
||||
set(some_files TRUE)
|
||||
endif()
|
||||
set(vars "${vars} ${i}=${val}\n")
|
||||
endforeach()
|
||||
set(vars "${vars}You may use CMake GUI, cmake -D or ccmake to modify the values. Delete CMakeCache.txt to discard all values and force full re-detection if necessary.\n")
|
||||
if (version_unsuitable)
|
||||
set(msg "${PREFIX} ${${PREFIX}_VERSION} was found but")
|
||||
if (exactver)
|
||||
set(msg "${msg} only version ${findver} is acceptable.")
|
||||
else()
|
||||
set(msg "${msg} version ${findver} is the minimum requirement.")
|
||||
endif()
|
||||
else()
|
||||
if (missing_headers)
|
||||
set(msg "We could not find development headers for ${PREFIX}. Do you have the necessary dev package installed?")
|
||||
elseif (some_files)
|
||||
set(msg "We only found some files of ${PREFIX}, not all of them. Perhaps your installation is incomplete or maybe we just didn't look in the right place?")
|
||||
if(findver)
|
||||
set(msg "${msg} This could also be caused by incompatible version (if it helps, at least ${PREFIX} ${findver} should work).")
|
||||
endif()
|
||||
else()
|
||||
set(msg "We were unable to find package ${PREFIX}.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Fatal error out if REQUIRED
|
||||
if (required)
|
||||
set(msg "REQUIRED PACKAGE NOT FOUND\n${msg} This package is REQUIRED and you need to install it or adjust CMake configuration in order to continue building ${CMAKE_PROJECT_NAME}.")
|
||||
message(FATAL_ERROR "${msg}\n${vars}")
|
||||
endif()
|
||||
# Otherwise just print a nasty warning
|
||||
if (NOT quiet)
|
||||
message(WARNING "WARNING: MISSING PACKAGE\n${msg} This package is NOT REQUIRED and you may ignore this warning but by doing so you may miss some functionality of ${CMAKE_PROJECT_NAME}. \n${vars}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
22
cmake/RunLuacheck.cmake
Normal file
22
cmake/RunLuacheck.cmake
Normal file
@ -0,0 +1,22 @@
|
||||
set(LUACHECK_ARGS -q "${LUAFILES_DIR}")
|
||||
if(DEFINED IGNORE_PATTERN)
|
||||
list(APPEND LUACHECK_ARGS --exclude-files "${LUAFILES_DIR}/${IGNORE_PATTERN}")
|
||||
endif()
|
||||
if(DEFINED CHECK_PATTERN)
|
||||
list(APPEND LUACHECK_ARGS --include-files "${LUAFILES_DIR}/${CHECK_PATTERN}")
|
||||
endif()
|
||||
if(DEFINED READ_GLOBALS)
|
||||
list(APPEND LUACHECK_ARGS --read-globals "${READ_GLOBALS}")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${LUACHECK_PRG}" ${LUACHECK_ARGS}
|
||||
WORKING_DIRECTORY "${LUAFILES_DIR}"
|
||||
ERROR_VARIABLE err
|
||||
RESULT_VARIABLE res
|
||||
)
|
||||
|
||||
if(NOT res EQUAL 0)
|
||||
message(STATUS "Output to stderr:\n${err}")
|
||||
message(FATAL_ERROR "Linting tests failed with error: ${res}")
|
||||
endif()
|
@ -1,18 +1,13 @@
|
||||
# Set LC_ALL to meet expectations of some locale-sensitive tests.
|
||||
set(ENV{LC_ALL} "en_US.UTF-8")
|
||||
|
||||
if(POLICY CMP0012)
|
||||
# Handle CI=true, without dev warnings.
|
||||
cmake_policy(SET CMP0012 NEW)
|
||||
endif()
|
||||
|
||||
set(ENV{VIMRUNTIME} ${WORKING_DIR}/runtime)
|
||||
set(ENV{NVIM_RPLUGIN_MANIFEST} ${BUILD_DIR}/Xtest_rplugin_manifest)
|
||||
set(ENV{XDG_CONFIG_HOME} ${BUILD_DIR}/Xtest_xdg/config)
|
||||
set(ENV{XDG_DATA_HOME} ${BUILD_DIR}/Xtest_xdg/share)
|
||||
set(ENV{NVIM_RPLUGIN_MANIFEST} ${WORKING_DIR}/Xtest_rplugin_manifest)
|
||||
set(ENV{XDG_CONFIG_HOME} ${WORKING_DIR}/Xtest_xdg/config)
|
||||
set(ENV{XDG_DATA_HOME} ${WORKING_DIR}/Xtest_xdg/share)
|
||||
|
||||
if(NOT DEFINED ENV{NVIM_LOG_FILE})
|
||||
set(ENV{NVIM_LOG_FILE} ${BUILD_DIR}/.nvimlog)
|
||||
set(ENV{NVIM_LOG_FILE} ${WORKING_DIR}/.nvimlog)
|
||||
endif()
|
||||
|
||||
if(NVIM_PRG)
|
||||
@ -25,62 +20,38 @@ else()
|
||||
set(TEST_PATH "${TEST_DIR}/${TEST_TYPE}")
|
||||
endif()
|
||||
|
||||
# Force $TEST_PATH to workdir-relative path ("test/…").
|
||||
if(IS_ABSOLUTE ${TEST_PATH})
|
||||
file(RELATIVE_PATH TEST_PATH "${WORKING_DIR}" "${TEST_PATH}")
|
||||
endif()
|
||||
|
||||
if(BUSTED_OUTPUT_TYPE STREQUAL junit)
|
||||
set(EXTRA_ARGS OUTPUT_FILE ${BUILD_DIR}/${TEST_TYPE}test-junit.xml)
|
||||
endif()
|
||||
|
||||
set(BUSTED_ARGS $ENV{BUSTED_ARGS})
|
||||
separate_arguments(BUSTED_ARGS)
|
||||
|
||||
if(DEFINED ENV{TEST_TAG} AND NOT "$ENV{TEST_TAG}" STREQUAL "")
|
||||
list(APPEND BUSTED_ARGS --tags $ENV{TEST_TAG})
|
||||
set(TEST_TAG "--tags=$ENV{TEST_TAG}")
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{TEST_FILTER} AND NOT "$ENV{TEST_FILTER}" STREQUAL "")
|
||||
list(APPEND BUSTED_ARGS --filter $ENV{TEST_FILTER})
|
||||
set(TEST_FILTER "--filter=$ENV{TEST_FILTER}")
|
||||
endif()
|
||||
|
||||
# TMPDIR: use relative test path (for parallel test runs / isolation).
|
||||
set(ENV{TMPDIR} "${BUILD_DIR}/Xtest_tmpdir/${TEST_PATH}")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory $ENV{TMPDIR})
|
||||
|
||||
set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua.
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${WORKING_DIR}/Xtest-tmpdir)
|
||||
set(ENV{TMPDIR} ${WORKING_DIR}/Xtest-tmpdir)
|
||||
set(ENV{SYSTEM_NAME} ${SYSTEM_NAME})
|
||||
execute_process(
|
||||
COMMAND ${BUSTED_PRG} -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE}
|
||||
--lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
|
||||
COMMAND ${BUSTED_PRG} ${TEST_TAG} ${TEST_FILTER} -v -o ${BUSTED_OUTPUT_TYPE}
|
||||
--lua=${LUA_PRG} --lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
|
||||
--lpath=${BUILD_DIR}/?.lua
|
||||
--lpath=${WORKING_DIR}/runtime/lua/?.lua
|
||||
--lpath=?.lua
|
||||
${BUSTED_ARGS}
|
||||
${TEST_PATH}
|
||||
WORKING_DIRECTORY ${WORKING_DIR}
|
||||
ERROR_VARIABLE err
|
||||
RESULT_VARIABLE res
|
||||
${EXTRA_ARGS})
|
||||
|
||||
file(GLOB RM_FILES ${BUILD_DIR}/Xtest_*)
|
||||
file(REMOVE_RECURSE ${RM_FILES})
|
||||
file(REMOVE ${WORKING_DIR}/Xtest_rplugin_manifest)
|
||||
file(REMOVE_RECURSE ${WORKING_DIR}/Xtest_xdg)
|
||||
file(REMOVE_RECURSE ${WORKING_DIR}/Xtest-tmpdir)
|
||||
|
||||
if(NOT res EQUAL 0)
|
||||
message(STATUS "Tests exited non-zero: ${res}")
|
||||
if("${err}" STREQUAL "")
|
||||
message(STATUS "No output to stderr.")
|
||||
else()
|
||||
message(STATUS "Output to stderr:\n${err}")
|
||||
endif()
|
||||
|
||||
# Dump the logfile on CI (if not displayed and moved already).
|
||||
if($ENV{CI})
|
||||
if(EXISTS $ENV{NVIM_LOG_FILE} AND NOT EXISTS $ENV{NVIM_LOG_FILE}.displayed)
|
||||
file(READ $ENV{NVIM_LOG_FILE} out)
|
||||
message(STATUS "$NVIM_LOG_FILE: $ENV{NVIM_LOG_FILE}\n${out}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "Output to stderr:\n${err}")
|
||||
message(FATAL_ERROR "${TEST_TYPE} tests failed with error: ${res}")
|
||||
endif()
|
||||
|
@ -1,21 +0,0 @@
|
||||
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
|
||||
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
|
||||
endif()
|
||||
|
||||
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
foreach(file ${files})
|
||||
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
|
||||
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
exec_program(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
if(NOT "${rm_retval}" STREQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
|
||||
endif()
|
||||
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
|
||||
endif()
|
||||
endforeach()
|
53
cmake/mingw32-w64-cross-travis.toolchain.cmake
Normal file
53
cmake/mingw32-w64-cross-travis.toolchain.cmake
Normal file
@ -0,0 +1,53 @@
|
||||
#
|
||||
# Mingw-w64 cross compiler toolchain
|
||||
#
|
||||
# - The usual CMAKE variables will point to the cross compiler
|
||||
# - HOST_EXE_LINKER, HOST_C_COMPILER, HOST_EXE_LINKER_FLAGS,
|
||||
# HOST_C_FLAGS point to a host compiler
|
||||
#
|
||||
|
||||
set(MINGW_TRIPLET i686-w64-mingw32)
|
||||
# For x86_64 use
|
||||
#set(MINGW_TRIPLET x86_64-w64-mingw32)
|
||||
|
||||
# The location of your toolchain sys-root
|
||||
set(MINGW_PREFIX_PATH /opt/mingw32/${MINGW_TRIPLET}/)
|
||||
# or sometimes like this
|
||||
#set(MINGW_PREFIX_PATH /usr/${MINGW_TRIPLET}/sys-root)
|
||||
|
||||
# the name of the target operating system
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
# which compilers to use for C and C++
|
||||
set(CMAKE_C_COMPILER ${MINGW_TRIPLET}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${MINGW_TRIPLET}-g++)
|
||||
set(CMAKE_RC_COMPILER ${MINGW_TRIPLET}-windres)
|
||||
set(CMAKE_C_COMPILER ${MINGW_TRIPLET}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${MINGW_TRIPLET}-g++)
|
||||
set(CMAKE_RC_COMPILER ${MINGW_TRIPLET}-windres)
|
||||
|
||||
# Where is the target environment located
|
||||
set(CMAKE_FIND_ROOT_PATH "${MINGW_PREFIX_PATH}/mingw")
|
||||
|
||||
# adjust the default behaviour of the FIND_XXX() commands:
|
||||
# search headers and libraries in the target environment, search
|
||||
# programs in the host environment
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
set(CROSS_TARGET ${MINGW_TRIPLET})
|
||||
|
||||
# We need a host compiler too - assuming mildly sane Unix
|
||||
# defaults here
|
||||
set(HOST_C_COMPILER cc)
|
||||
set(HOST_EXE_LINKER ld)
|
||||
|
||||
if (MINGW_TRIPLET MATCHES "^x86_64")
|
||||
set(HOST_C_FLAGS)
|
||||
set(HOST_EXE_LINKER_FLAGS)
|
||||
else()
|
||||
# In 32 bits systems have the HOST compiler generate 32 bits binaries
|
||||
set(HOST_C_FLAGS -m32)
|
||||
set(HOST_EXE_LINKER_FLAGS -m32)
|
||||
endif()
|
16
codecov.yml
16
codecov.yml
@ -1,6 +1,3 @@
|
||||
# To validate:
|
||||
# cat codecov.yml | curl --data-binary @- https://codecov.io/validate
|
||||
|
||||
codecov:
|
||||
notify:
|
||||
require_ci_to_pass: no
|
||||
@ -15,13 +12,18 @@ coverage:
|
||||
range: "70...100"
|
||||
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
threshold: 1
|
||||
project: yes
|
||||
patch:
|
||||
default:
|
||||
threshold: 1
|
||||
only_pulls: true
|
||||
changes: no
|
||||
|
||||
parsers:
|
||||
gcov:
|
||||
branch_detection:
|
||||
conditional: yes
|
||||
loop: yes
|
||||
method: no
|
||||
macro: no
|
||||
|
||||
comment: off
|
||||
|
@ -12,7 +12,7 @@ check_type_size("size_t" SIZEOF_SIZE_T)
|
||||
check_type_size("long long" SIZEOF_LONG_LONG)
|
||||
check_type_size("void *" SIZEOF_VOID_PTR)
|
||||
|
||||
if (CMAKE_HOST_SYSTEM_VERSION MATCHES ".*-(Microsoft|microsoft-standard)")
|
||||
if (CMAKE_HOST_SYSTEM_VERSION MATCHES ".*-Microsoft")
|
||||
# Windows Subsystem for Linux
|
||||
set(HAVE_WSL 1)
|
||||
endif()
|
||||
@ -20,6 +20,7 @@ endif()
|
||||
check_symbol_exists(_NSGetEnviron crt_externs.h HAVE__NSGETENVIRON)
|
||||
|
||||
# Headers
|
||||
check_include_files(iconv.h HAVE_ICONV_H)
|
||||
check_include_files(langinfo.h HAVE_LANGINFO_H)
|
||||
check_include_files(locale.h HAVE_LOCALE_H)
|
||||
check_include_files(pwd.h HAVE_PWD_H)
|
||||
@ -31,28 +32,43 @@ if(NOT HAVE_SYS_WAIT_H AND UNIX)
|
||||
endif()
|
||||
check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H)
|
||||
check_include_files(termios.h HAVE_TERMIOS_H)
|
||||
check_include_files(utime.h HAVE_UTIME_H)
|
||||
check_include_files(sys/uio.h HAVE_SYS_UIO_H)
|
||||
check_include_files(sys/sdt.h HAVE_SYS_SDT_H)
|
||||
|
||||
# Functions
|
||||
check_function_exists(fseeko HAVE_FSEEKO)
|
||||
check_function_exists(getpwent HAVE_GETPWENT)
|
||||
check_function_exists(getpwnam HAVE_GETPWNAM)
|
||||
check_function_exists(getpwuid HAVE_GETPWUID)
|
||||
check_function_exists(uv_translate_sys_error HAVE_UV_TRANSLATE_SYS_ERROR)
|
||||
check_function_exists(readv HAVE_READV)
|
||||
|
||||
if(Iconv_FOUND)
|
||||
set(HAVE_ICONV 1)
|
||||
endif()
|
||||
|
||||
if(JEMALLOC_FOUND)
|
||||
set(HAVE_JEMALLOC 1)
|
||||
endif()
|
||||
|
||||
check_function_exists(_putenv_s HAVE_PUTENV_S)
|
||||
if(WIN32 AND NOT HAVE_PUTENV_S)
|
||||
message(SEND_ERROR "_putenv_s() function not found on your system.")
|
||||
endif()
|
||||
check_function_exists(opendir HAVE_OPENDIR)
|
||||
check_function_exists(readlink HAVE_READLINK)
|
||||
check_function_exists(setenv HAVE_SETENV)
|
||||
if(UNIX AND NOT HAVE_SETENV)
|
||||
message(SEND_ERROR "setenv() function not found on your system.")
|
||||
endif()
|
||||
check_function_exists(unsetenv HAVE_UNSETENV)
|
||||
check_function_exists(setpgid HAVE_SETPGID)
|
||||
check_function_exists(setsid HAVE_SETSID)
|
||||
check_function_exists(sigaction HAVE_SIGACTION)
|
||||
check_function_exists(strcasecmp HAVE_STRCASECMP)
|
||||
check_function_exists(strncasecmp HAVE_STRNCASECMP)
|
||||
check_function_exists(strptime HAVE_STRPTIME)
|
||||
check_function_exists(utime HAVE_UTIME)
|
||||
check_function_exists(utimes HAVE_UTIMES)
|
||||
|
||||
# Symbols
|
||||
check_symbol_exists(FD_CLOEXEC "fcntl.h" HAVE_FD_CLOEXEC)
|
||||
|
@ -13,6 +13,7 @@
|
||||
#endif
|
||||
|
||||
#define PROJECT_NAME "@PROJECT_NAME@"
|
||||
#define LOCALE_INSTALL_DIR "@CMAKE_INSTALL_FULL_LOCALEDIR@"
|
||||
|
||||
#cmakedefine HAVE__NSGETENVIRON
|
||||
#cmakedefine HAVE_FD_CLOEXEC
|
||||
@ -21,27 +22,34 @@
|
||||
#cmakedefine HAVE_GETPWNAM
|
||||
#cmakedefine HAVE_GETPWUID
|
||||
#cmakedefine HAVE_ICONV
|
||||
#cmakedefine HAVE_ICONV_H
|
||||
#cmakedefine HAVE_LANGINFO_H
|
||||
#cmakedefine HAVE_LOCALE_H
|
||||
#cmakedefine HAVE_NL_LANGINFO_CODESET
|
||||
#cmakedefine HAVE_NL_MSG_CAT_CNTR
|
||||
#cmakedefine HAVE_PUTENV_S
|
||||
#cmakedefine HAVE_PWD_H
|
||||
#cmakedefine HAVE_READLINK
|
||||
#cmakedefine HAVE_UV_TRANSLATE_SYS_ERROR
|
||||
// TODO: add proper cmake check
|
||||
// #define HAVE_SELINUX 1
|
||||
#cmakedefine HAVE_SETENV
|
||||
#cmakedefine HAVE_UNSETENV
|
||||
#cmakedefine HAVE_SETPGID
|
||||
#cmakedefine HAVE_SETSID
|
||||
#cmakedefine HAVE_SIGACTION
|
||||
#cmakedefine HAVE_STRCASECMP
|
||||
#cmakedefine HAVE_STRINGS_H
|
||||
#cmakedefine HAVE_STRNCASECMP
|
||||
#cmakedefine HAVE_STRPTIME
|
||||
#cmakedefine HAVE_SYS_SDT_H
|
||||
#cmakedefine HAVE_SYS_UTSNAME_H
|
||||
#cmakedefine HAVE_SYS_WAIT_H
|
||||
#cmakedefine HAVE_TERMIOS_H
|
||||
#cmakedefine HAVE_UTIME
|
||||
#cmakedefine HAVE_UTIME_H
|
||||
#cmakedefine HAVE_UTIMES
|
||||
#cmakedefine HAVE_WORKING_LIBINTL
|
||||
#cmakedefine HAVE_WSL
|
||||
#cmakedefine UNIX
|
||||
#cmakedefine CASE_INSENSITIVE_FILENAME
|
||||
#cmakedefine USE_FNAME_CASE
|
||||
#cmakedefine HAVE_SYS_UIO_H
|
||||
#ifdef HAVE_SYS_UIO_H
|
||||
@ -54,6 +62,7 @@
|
||||
#cmakedefine FEAT_TUI
|
||||
|
||||
#ifndef UNIT_TESTING
|
||||
#cmakedefine HAVE_JEMALLOC
|
||||
#cmakedefine LOG_LIST_ACTIONS
|
||||
#endif
|
||||
|
||||
@ -62,7 +71,5 @@
|
||||
#define ENDIAN_INCLUDE_FILE <@ENDIAN_INCLUDE_FILE@>
|
||||
|
||||
#cmakedefine HAVE_EXECINFO_BACKTRACE
|
||||
#cmakedefine HAVE_BUILTIN_ADD_OVERFLOW
|
||||
#cmakedefine HAVE_WIMPLICIT_FALLTHROUGH_FLAG
|
||||
|
||||
#endif // AUTO_CONFIG_H
|
||||
|
@ -3,6 +3,5 @@
|
||||
#include "${PROJECT_SOURCE_DIR}/src/nvim/vim.h"
|
||||
char *default_vim_dir = "${CMAKE_INSTALL_FULL_DATAROOTDIR}/nvim";
|
||||
char *default_vimruntime_dir = "";
|
||||
char *default_lib_dir = "${CMAKE_INSTALL_FULL_LIBDIR}/nvim";
|
||||
char_u *compiled_user = (char_u *)"${USERNAME}";
|
||||
char_u *compiled_sys = (char_u *)"${HOSTNAME}";
|
||||
|
@ -5,11 +5,7 @@
|
||||
#define NVIM_VERSION_MINOR @NVIM_VERSION_MINOR@
|
||||
#define NVIM_VERSION_PATCH @NVIM_VERSION_PATCH@
|
||||
#define NVIM_VERSION_PRERELEASE "@NVIM_VERSION_PRERELEASE@"
|
||||
|
||||
#cmakedefine NVIM_VERSION_MEDIUM "@NVIM_VERSION_MEDIUM@"
|
||||
#ifndef NVIM_VERSION_MEDIUM
|
||||
# include "auto/versiondef_git.h"
|
||||
#endif
|
||||
|
||||
#define NVIM_API_LEVEL @NVIM_API_LEVEL@
|
||||
#define NVIM_API_LEVEL_COMPAT @NVIM_API_LEVEL_COMPAT@
|
||||
|
43
contrib/flake.lock
generated
43
contrib/flake.lock
generated
@ -1,43 +0,0 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1610051610,
|
||||
"narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1613226215,
|
||||
"narHash": "sha256-3rA5cGIrBHD6yeKhNhsF7/t461ww25oJY8KyBb0IhjU=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ff96a0fa5635770390b184ae74debea75c3fd534",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
@ -1,112 +0,0 @@
|
||||
{
|
||||
description = "Neovim flake";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
{
|
||||
overlay = final: prev:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${prev.system};
|
||||
in
|
||||
rec {
|
||||
neovim = pkgs.neovim-unwrapped.overrideAttrs (oa: {
|
||||
version = "master";
|
||||
src = ../.;
|
||||
|
||||
buildInputs = oa.buildInputs ++ ([
|
||||
pkgs.tree-sitter
|
||||
]);
|
||||
|
||||
cmakeFlags = oa.cmakeFlags ++ [
|
||||
"-DUSE_BUNDLED=OFF"
|
||||
];
|
||||
});
|
||||
|
||||
# a development binary to help debug issues
|
||||
neovim-debug = let
|
||||
stdenv = pkgs.stdenvAdapters.keepDebugInfo (if pkgs.stdenv.isLinux then pkgs.llvmPackages_latest.stdenv else pkgs.stdenv);
|
||||
in
|
||||
pkgs.enableDebugging ((neovim.override {
|
||||
lua = pkgs.enableDebugging pkgs.luajit;
|
||||
inherit stdenv;
|
||||
}).overrideAttrs (oa: {
|
||||
cmakeBuildType = "Debug";
|
||||
cmakeFlags = oa.cmakeFlags ++ [
|
||||
"-DMIN_LOG_LEVEL=0"
|
||||
];
|
||||
|
||||
disallowedReferences = [];
|
||||
}));
|
||||
|
||||
# for neovim developers, builds a slow binary
|
||||
# huge closure size but aims at covering all scripts
|
||||
# brings development tools as well
|
||||
neovim-developer =
|
||||
let
|
||||
lib = nixpkgs.lib;
|
||||
pythonEnv = pkgs.python3.withPackages(ps: [
|
||||
ps.msgpack
|
||||
ps.flake8 # for 'make pylint'
|
||||
]);
|
||||
luacheck = pkgs.luaPackages.luacheck;
|
||||
in
|
||||
(neovim-debug.override ({ doCheck = pkgs.stdenv.isLinux; })).overrideAttrs (oa: {
|
||||
cmakeFlags = oa.cmakeFlags ++ [
|
||||
"-DLUACHECK_PRG=${luacheck}/bin/luacheck"
|
||||
"-DMIN_LOG_LEVEL=0"
|
||||
"-DENABLE_LTO=OFF"
|
||||
"-DUSE_BUNDLED=OFF"
|
||||
] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [
|
||||
# https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
|
||||
# https://clang.llvm.org/docs/AddressSanitizer.html#symbolizing-the-reports
|
||||
"-DCLANG_ASAN_UBSAN=ON"
|
||||
];
|
||||
|
||||
nativeBuildInputs = oa.nativeBuildInputs ++ (with pkgs; [
|
||||
pythonEnv
|
||||
include-what-you-use # for scripts/check-includes.py
|
||||
jq # jq for scripts/vim-patch.sh -r
|
||||
shellcheck # for `make shlint`
|
||||
doxygen # for script/gen_vimdoc.py
|
||||
clang-tools # for clangd to find the correct headers
|
||||
]);
|
||||
|
||||
shellHook = oa.shellHook + ''
|
||||
export NVIM_PYTHON_LOG_LEVEL=DEBUG
|
||||
export NVIM_LOG_FILE=/tmp/nvim.log
|
||||
|
||||
export ASAN_OPTIONS="log_path=./test.log:abort_on_error=1"
|
||||
export UBSAN_OPTIONS=print_stacktrace=1
|
||||
'';
|
||||
});
|
||||
};
|
||||
} //
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
overlays = [ self.overlay ];
|
||||
inherit system;
|
||||
};
|
||||
in
|
||||
rec {
|
||||
|
||||
packages = with pkgs; {
|
||||
inherit neovim neovim-debug neovim-developer;
|
||||
};
|
||||
|
||||
defaultPackage = pkgs.neovim;
|
||||
|
||||
apps = {
|
||||
nvim = flake-utils.lib.mkApp { drv = pkgs.neovim; name = "nvim"; };
|
||||
nvim-debug = flake-utils.lib.mkApp { drv = pkgs.neovim-debug; name = "nvim"; };
|
||||
};
|
||||
|
||||
defaultApp = apps.nvim;
|
||||
|
||||
devShell = pkgs.neovim-developer;
|
||||
});
|
||||
}
|
@ -26,13 +26,13 @@ def get_color_code(bg, color_num):
|
||||
prefix += 1
|
||||
color_num %= 8
|
||||
else:
|
||||
prefix = '48;5;' if bg else '38;5;'
|
||||
prefix = '48;5;' if bg else '38;5;'
|
||||
return '\x1b[{0}{1}m'.format(prefix, color_num)
|
||||
|
||||
|
||||
def highlight(attrs):
|
||||
fg, bg = [int(attrs['foreground']), int(attrs['background'])]
|
||||
rv = [SGR0] # start with sgr0
|
||||
rv = [SGR0] # start with sgr0
|
||||
if fg != -1:
|
||||
rv.append(get_color_code(False, fg))
|
||||
if bg != -1:
|
||||
|
@ -7,8 +7,9 @@
|
||||
# These CFLAGS can be used in addition to those specified in CMakeLists.txt:
|
||||
# CMAKE_EXTRA_FLAGS="-DCMAKE_C_FLAGS=-ftrapv -Wlogical-op"
|
||||
|
||||
# To turn compiler warnings into errors:
|
||||
# CMAKE_EXTRA_FLAGS += "-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -Werror"
|
||||
# By default, the jemalloc family of memory allocation functions are used.
|
||||
# Uncomment the following to instead use libc memory allocation functions.
|
||||
# CMAKE_EXTRA_FLAGS += -DENABLE_JEMALLOC=OFF
|
||||
|
||||
# Sets the build type; defaults to Debug. Valid values:
|
||||
#
|
||||
@ -25,12 +26,6 @@
|
||||
#
|
||||
# CMAKE_BUILD_TYPE := Debug
|
||||
|
||||
# With non-Debug builds interprocedural optimization (IPO) (which includes
|
||||
# link-time optimization (LTO)) is enabled by default, which causes the link
|
||||
# step to take a significant amout of time, which is relevant when building
|
||||
# often. You can disable it explicitly:
|
||||
# CMAKE_EXTRA_FLAGS += -DENABLE_LTO=OFF
|
||||
|
||||
# Log levels: 0 (DEBUG), 1 (INFO), 2 (WARNING), 3 (ERROR)
|
||||
# Default is 1 (INFO) unless CMAKE_BUILD_TYPE is Release or RelWithDebInfo.
|
||||
# CMAKE_EXTRA_FLAGS += -DMIN_LOG_LEVEL=1
|
||||
@ -41,6 +36,7 @@
|
||||
# them.
|
||||
#
|
||||
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_BUSTED=OFF
|
||||
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_JEMALLOC=OFF
|
||||
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LIBTERMKEY=OFF
|
||||
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LIBUV=OFF
|
||||
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LIBVTERM=OFF
|
||||
@ -48,12 +44,23 @@
|
||||
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LUAROCKS=OFF
|
||||
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_MSGPACK=OFF
|
||||
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_UNIBILIUM=OFF
|
||||
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_UTF8PROC=OFF
|
||||
#
|
||||
# Or disable all bundled dependencies at once.
|
||||
#
|
||||
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED=OFF
|
||||
|
||||
# By default, bundled libraries are statically linked to nvim.
|
||||
# This has no effect for non-bundled deps, which are always dynamically linked.
|
||||
# Uncomment these entries to instead use dynamic linking.
|
||||
#
|
||||
# CMAKE_EXTRA_FLAGS += -DLIBTERMKEY_USE_STATIC=OFF
|
||||
# CMAKE_EXTRA_FLAGS += -DLIBUNIBILIUM_USE_STATIC=OFF
|
||||
# CMAKE_EXTRA_FLAGS += -DLIBUV_USE_STATIC=OFF
|
||||
# CMAKE_EXTRA_FLAGS += -DLIBVTERM_USE_STATIC=OFF
|
||||
# CMAKE_EXTRA_FLAGS += -DLUAJIT_USE_STATIC=OFF
|
||||
# CMAKE_EXTRA_FLAGS += -DMSGPACK_USE_STATIC=OFF
|
||||
#
|
||||
#
|
||||
# .DEFAULT_GOAL := nvim
|
||||
#
|
||||
# Run doxygen over the source code.
|
||||
|
18
man/nvim.1
18
man/nvim.1
@ -56,7 +56,6 @@ Reads text from standard input until
|
||||
.Dv EOF ,
|
||||
then opens a buffer with that text.
|
||||
User input is read from standard error, which should be a terminal.
|
||||
.El
|
||||
.Sh OPTIONS
|
||||
.Bl -tag -width Fl
|
||||
.It Fl t Ar tag
|
||||
@ -89,14 +88,10 @@ Ex mode, reading stdin as Ex commands.
|
||||
Ex mode, reading stdin as text.
|
||||
.Ic :help Ex-mode
|
||||
.It Fl es
|
||||
Silent (non-interactive) Ex mode, reading stdin as Ex commands.
|
||||
Useful for scripting because it does NOT start a UI, unlike
|
||||
.Fl e .
|
||||
Silent/batch mode, reading stdin as Ex commands.
|
||||
.Ic :help silent-mode
|
||||
.It Fl \&Es
|
||||
Silent (non-interactive) Ex mode, reading stdin as text.
|
||||
Useful for scripting because it does NOT start a UI, unlike
|
||||
.Fl E .
|
||||
Silent/batch mode, reading stdin as text.
|
||||
.Ic :help silent-mode
|
||||
.It Fl d
|
||||
Diff mode.
|
||||
@ -113,6 +108,9 @@ associated with a file.
|
||||
To overwrite a file, add an exclamation mark to the relevant Ex command, such as
|
||||
.Ic :w! .
|
||||
.Ic ":help 'readonly'"
|
||||
.It Fl Z
|
||||
Restricted mode.
|
||||
Disable commands that make use of an external shell.
|
||||
.It Fl m
|
||||
Resets the 'write' option, to disable file modifications.
|
||||
Writing to a file is disabled, but buffers can still be modified.
|
||||
@ -200,8 +198,6 @@ do not read or write a ShaDa file.
|
||||
Skip loading plugins.
|
||||
Implied by
|
||||
.Cm -u NONE .
|
||||
.It Fl -clean
|
||||
Skip loading plugins and shada (viminfo) file.
|
||||
.It Fl o Ns Op Ar N
|
||||
Open
|
||||
.Ar N
|
||||
@ -327,7 +323,7 @@ Print version information and exit.
|
||||
.Sh ENVIRONMENT
|
||||
.Bl -tag -width Fl
|
||||
.It Ev NVIM_LOG_FILE
|
||||
Low-level log file, usually found at ~/.cache/nvim/log.
|
||||
Low-level log file, usually found at ~/.local/share/nvim/log.
|
||||
:help $NVIM_LOG_FILE
|
||||
.It Ev VIM
|
||||
Used to locate user files, such as init.vim.
|
||||
@ -375,7 +371,7 @@ See also
|
||||
System-global
|
||||
.Nm
|
||||
configuration file.
|
||||
.It Pa $VIM
|
||||
.It Pa /usr/local/share/nvim
|
||||
System-global
|
||||
.Nm
|
||||
runtime directory.
|
||||
|
@ -29,16 +29,21 @@ foreach(PACKAGE ${PACKAGES})
|
||||
file(GLOB "${PACKNAME}_DOC_FILES" ${PACKAGE}/doc/*.txt)
|
||||
if(${PACKNAME}_DOC_FILES)
|
||||
file(MAKE_DIRECTORY ${GENERATED_PACKAGE_DIR}/${PACKNAME})
|
||||
add_custom_command(OUTPUT "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags"
|
||||
add_custom_target("${PACKNAME}-tags"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${PACKAGE} ${GENERATED_PACKAGE_DIR}/${PACKNAME}
|
||||
COMMAND "${PROJECT_BINARY_DIR}/bin/nvim"
|
||||
-u NONE -i NONE -e --headless -c "helptags doc" -c quit
|
||||
DEPENDS
|
||||
nvim
|
||||
nvim_runtime_deps
|
||||
WORKING_DIRECTORY "${GENERATED_PACKAGE_DIR}/${PACKNAME}"
|
||||
)
|
||||
add_dependencies(${PACKNAME}-tags nvim_runtime_deps)
|
||||
|
||||
add_custom_command(OUTPUT "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags"
|
||||
DEPENDS
|
||||
"${PACKNAME}-tags"
|
||||
)
|
||||
|
||||
set("${PACKNAME}_DOC_NAMES")
|
||||
foreach(DF "${${PACKNAME}_DOC_FILES}")
|
||||
@ -62,7 +67,7 @@ foreach(DF ${DOCFILES})
|
||||
list(APPEND BUILDDOCFILES ${GENERATED_RUNTIME_DIR}/doc/${F})
|
||||
endforeach()
|
||||
|
||||
add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
|
||||
add_custom_target(helptags
|
||||
COMMAND ${CMAKE_COMMAND} -E remove doc/*
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${PROJECT_SOURCE_DIR}/runtime/doc doc
|
||||
@ -70,15 +75,19 @@ add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
|
||||
-u NONE -i NONE -e --headless -c "helptags ++t doc" -c quit
|
||||
DEPENDS
|
||||
nvim
|
||||
nvim_runtime_deps
|
||||
WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}"
|
||||
)
|
||||
add_dependencies(helptags nvim_runtime_deps)
|
||||
|
||||
add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
|
||||
DEPENDS
|
||||
helptags
|
||||
)
|
||||
|
||||
add_custom_target(doc_html
|
||||
COMMAND make html
|
||||
DEPENDS
|
||||
${GENERATED_HELP_TAGS}
|
||||
helptags
|
||||
WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}/doc"
|
||||
)
|
||||
|
||||
@ -111,7 +120,7 @@ if(NOT APPLE)
|
||||
|
||||
install_helper(
|
||||
FILES ${CMAKE_CURRENT_SOURCE_DIR}/nvim.png
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps)
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pixmaps)
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE RUNTIME_PROGRAMS
|
||||
|
@ -1,12 +1,8 @@
|
||||
" Author: Antony Lee <anntzer.lee@gmail.com>
|
||||
" Description: Helper functions for reStructuredText syntax folding
|
||||
" Last Modified: 2018-12-29
|
||||
" Last Modified: 2018-01-07
|
||||
|
||||
function s:CacheRstFold()
|
||||
if !g:rst_fold_enabled
|
||||
return
|
||||
endif
|
||||
|
||||
let closure = {'header_types': {}, 'max_level': 0, 'levels': {}}
|
||||
function closure.Process(match) dict
|
||||
let curline = getcurpos()[1]
|
||||
@ -24,18 +20,12 @@ function s:CacheRstFold()
|
||||
let self.levels[curline] = self.header_types[key]
|
||||
endfunction
|
||||
let save_cursor = getcurpos()
|
||||
let save_mark = getpos("'[")
|
||||
silent keeppatterns %s/\v^%(%(([=`:.'"~^_*+#-])\1+\n)?.{1,2}\n([=`:.'"~^_*+#-])\2+)|%(%(([=`:.''"~^_*+#-])\3{2,}\n)?.{3,}\n([=`:.''"~^_*+#-])\4{2,})$/\=closure.Process(submatch(0))/gn
|
||||
call setpos('.', save_cursor)
|
||||
call setpos("'[", save_mark)
|
||||
let b:RstFoldCache = closure.levels
|
||||
endfunction
|
||||
|
||||
function RstFold#GetRstFold()
|
||||
if !g:rst_fold_enabled
|
||||
return
|
||||
endif
|
||||
|
||||
if !has_key(b:, 'RstFoldCache')
|
||||
call s:CacheRstFold()
|
||||
endif
|
||||
@ -47,10 +37,6 @@ function RstFold#GetRstFold()
|
||||
endfunction
|
||||
|
||||
function RstFold#GetRstFoldText()
|
||||
if !g:rst_fold_enabled
|
||||
return
|
||||
endif
|
||||
|
||||
if !has_key(b:, 'RstFoldCache')
|
||||
call s:CacheRstFold()
|
||||
endif
|
||||
|
@ -1,13 +1,13 @@
|
||||
" Vim completion script
|
||||
" Language: C
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2020 Nov 14
|
||||
" Last Change: 2018 Aug 20
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" This function is used for the 'omnifunc' option.
|
||||
func ccomplete#Complete(findstart, base)
|
||||
function! ccomplete#Complete(findstart, base)
|
||||
if a:findstart
|
||||
" Locate the start of the item, including ".", "->" and "[...]".
|
||||
let line = getline('.')
|
||||
@ -244,7 +244,7 @@ func ccomplete#Complete(findstart, base)
|
||||
return map(res, 's:Tagline2item(v:val, brackets)')
|
||||
endfunc
|
||||
|
||||
func s:GetAddition(line, match, memarg, bracket)
|
||||
function! s:GetAddition(line, match, memarg, bracket)
|
||||
" Guess if the item is an array.
|
||||
if a:bracket && match(a:line, a:match . '\s*\[') > 0
|
||||
return '['
|
||||
@ -260,13 +260,13 @@ func s:GetAddition(line, match, memarg, bracket)
|
||||
endif
|
||||
endif
|
||||
return ''
|
||||
endfunc
|
||||
endfunction
|
||||
|
||||
" Turn the tag info "val" into an item for completion.
|
||||
" "val" is is an item in the list returned by taglist().
|
||||
" If it is a variable we may add "." or "->". Don't do it for other types,
|
||||
" such as a typedef, by not including the info that s:GetAddition() uses.
|
||||
func s:Tag2item(val)
|
||||
function! s:Tag2item(val)
|
||||
let res = {'match': a:val['name']}
|
||||
|
||||
let res['extra'] = s:Tagcmd2extra(a:val['cmd'], a:val['name'], a:val['filename'])
|
||||
@ -289,10 +289,10 @@ func s:Tag2item(val)
|
||||
endif
|
||||
|
||||
return res
|
||||
endfunc
|
||||
endfunction
|
||||
|
||||
" Use all the items in dictionary for the "info" entry.
|
||||
func s:Dict2info(dict)
|
||||
function! s:Dict2info(dict)
|
||||
let info = ''
|
||||
for k in sort(keys(a:dict))
|
||||
let info .= k . repeat(' ', 10 - len(k))
|
||||
@ -307,7 +307,7 @@ func s:Dict2info(dict)
|
||||
endfunc
|
||||
|
||||
" Parse a tag line and return a dictionary with items like taglist()
|
||||
func s:ParseTagline(line)
|
||||
function! s:ParseTagline(line)
|
||||
let l = split(a:line, "\t")
|
||||
let d = {}
|
||||
if len(l) >= 3
|
||||
@ -334,12 +334,12 @@ func s:ParseTagline(line)
|
||||
endif
|
||||
|
||||
return d
|
||||
endfunc
|
||||
endfunction
|
||||
|
||||
" Turn a match item "val" into an item for completion.
|
||||
" "val['match']" is the matching item.
|
||||
" "val['tagline']" is the tagline in which the last part was found.
|
||||
func s:Tagline2item(val, brackets)
|
||||
function! s:Tagline2item(val, brackets)
|
||||
let line = a:val['tagline']
|
||||
let add = s:GetAddition(line, a:val['match'], [a:val], a:brackets == '')
|
||||
let res = {'word': a:val['match'] . a:brackets . add }
|
||||
@ -377,10 +377,10 @@ func s:Tagline2item(val, brackets)
|
||||
let res['menu'] = s:Tagcmd2extra(s, a:val['match'], matchstr(line, '[^\t]*\t\zs[^\t]*\ze\t'))
|
||||
endif
|
||||
return res
|
||||
endfunc
|
||||
endfunction
|
||||
|
||||
" Turn a command from a tag line to something that is useful in the menu
|
||||
func s:Tagcmd2extra(cmd, name, fname)
|
||||
function! s:Tagcmd2extra(cmd, name, fname)
|
||||
if a:cmd =~ '^/^'
|
||||
" The command is a search command, useful to see what it is.
|
||||
let x = matchstr(a:cmd, '^/^\s*\zs.*\ze$/')
|
||||
@ -395,13 +395,13 @@ func s:Tagcmd2extra(cmd, name, fname)
|
||||
let x = a:cmd . ' - ' . a:fname
|
||||
endif
|
||||
return x
|
||||
endfunc
|
||||
endfunction
|
||||
|
||||
" Find composing type in "lead" and match items[0] with it.
|
||||
" Repeat this recursively for items[1], if it's there.
|
||||
" When resolving typedefs "depth" is used to avoid infinite recursion.
|
||||
" Return the list of matches.
|
||||
func s:Nextitem(lead, items, depth, all)
|
||||
function! s:Nextitem(lead, items, depth, all)
|
||||
|
||||
" Use the text up to the variable name and split it in tokens.
|
||||
let tokens = split(a:lead, '\s\+\|\<')
|
||||
@ -485,7 +485,7 @@ func s:Nextitem(lead, items, depth, all)
|
||||
endfor
|
||||
|
||||
return res
|
||||
endfunc
|
||||
endfunction
|
||||
|
||||
|
||||
" Search for members of structure "typename" in tags files.
|
||||
@ -493,7 +493,7 @@ endfunc
|
||||
" Each match is a dictionary with "match" and "tagline" entries.
|
||||
" When "all" is non-zero find all, otherwise just return 1 if there is any
|
||||
" member.
|
||||
func s:StructMembers(typename, items, all)
|
||||
function! s:StructMembers(typename, items, all)
|
||||
" Todo: What about local structures?
|
||||
let fnames = join(map(tagfiles(), 'escape(v:val, " \\#%")'))
|
||||
if fnames == ''
|
||||
@ -586,12 +586,12 @@ func s:StructMembers(typename, items, all)
|
||||
|
||||
" Failed to find anything.
|
||||
return []
|
||||
endfunc
|
||||
endfunction
|
||||
|
||||
" For matching members, find matches for following items.
|
||||
" When "all" is non-zero find all, otherwise just return 1 if there is any
|
||||
" member.
|
||||
func s:SearchMembers(matches, items, all)
|
||||
function! s:SearchMembers(matches, items, all)
|
||||
let res = []
|
||||
for i in range(len(a:matches))
|
||||
let typename = ''
|
||||
@ -635,5 +635,3 @@ endfunc
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: noet sw=2 sts=2
|
||||
|
File diff suppressed because one or more lines are too long
@ -25,7 +25,7 @@ function decada#Unit_Name () dict " {{{1
|
||||
" Convert filename into acs unit:
|
||||
" 1: remove the file extenstion.
|
||||
" 2: replace all double '_' or '-' with an dot (which denotes a separate)
|
||||
" 3: remove a trailing '_' (which denotes a specification)
|
||||
" 3: remove a trailing '_' (wich denotes a specification)
|
||||
return substitute (substitute (expand ("%:t:r"), '__\|-', ".", "g"), '_$', "", '')
|
||||
endfunction decada#Unit_Name " }}}1
|
||||
|
||||
|
68
runtime/autoload/dist/ft.vim
vendored
68
runtime/autoload/dist/ft.vim
vendored
@ -1,7 +1,7 @@
|
||||
" Vim functions for file type detection
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2020 Aug 17
|
||||
" Last Change: 2017 Dec 05
|
||||
|
||||
" These functions are moved here from runtime/filetype.vim to make startup
|
||||
" faster.
|
||||
@ -126,7 +126,7 @@ endfunc
|
||||
" This function checks if one of the first ten lines start with a '@'. In
|
||||
" that case it is probably a change file.
|
||||
" If the first line starts with # or ! it's probably a ch file.
|
||||
" If a line has "main", "include", "//" or "/*" it's probably ch.
|
||||
" If a line has "main", "include", "//" ir "/*" it's probably ch.
|
||||
" Otherwise CHILL is assumed.
|
||||
func dist#ft#FTchange()
|
||||
let lnum = 1
|
||||
@ -172,17 +172,6 @@ func dist#ft#FTent()
|
||||
setf dtd
|
||||
endfunc
|
||||
|
||||
func dist#ft#ExCheck()
|
||||
let lines = getline(1, min([line("$"), 100]))
|
||||
if exists('g:filetype_euphoria')
|
||||
exe 'setf ' . g:filetype_euphoria
|
||||
elseif match(lines, '^--\|^ifdef\>\|^include\>') > -1
|
||||
setf euphoria3
|
||||
else
|
||||
setf elixir
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func dist#ft#EuphoriaCheck()
|
||||
if exists('g:filetype_euphoria')
|
||||
exe 'setf ' . g:filetype_euphoria
|
||||
@ -208,7 +197,7 @@ func dist#ft#FTe()
|
||||
exe 'setf ' . g:filetype_euphoria
|
||||
else
|
||||
let n = 1
|
||||
while n < 100 && n <= line("$")
|
||||
while n < 100 && n < line("$")
|
||||
if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$"
|
||||
setf specman
|
||||
return
|
||||
@ -222,7 +211,7 @@ endfunc
|
||||
" Distinguish between HTML, XHTML and Django
|
||||
func dist#ft#FThtml()
|
||||
let n = 1
|
||||
while n < 10 && n <= line("$")
|
||||
while n < 10 && n < line("$")
|
||||
if getline(n) =~ '\<DTD\s\+XHTML\s'
|
||||
setf xhtml
|
||||
return
|
||||
@ -233,13 +222,13 @@ func dist#ft#FThtml()
|
||||
endif
|
||||
let n = n + 1
|
||||
endwhile
|
||||
setf FALLBACK html
|
||||
setf html
|
||||
endfunc
|
||||
|
||||
" Distinguish between standard IDL and MS-IDL
|
||||
func dist#ft#FTidl()
|
||||
let n = 1
|
||||
while n < 50 && n <= line("$")
|
||||
while n < 50 && n < line("$")
|
||||
if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"'
|
||||
setf msidl
|
||||
return
|
||||
@ -309,7 +298,7 @@ endfunc
|
||||
|
||||
func dist#ft#FTmms()
|
||||
let n = 1
|
||||
while n < 20
|
||||
while n < 10
|
||||
let line = getline(n)
|
||||
if line =~ '^\s*\(%\|//\)' || line =~ '^\*'
|
||||
setf mmix
|
||||
@ -336,7 +325,7 @@ endfunc
|
||||
|
||||
func dist#ft#FTmm()
|
||||
let n = 1
|
||||
while n < 20
|
||||
while n < 10
|
||||
let line = getline(n)
|
||||
if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\)'
|
||||
setf objcpp
|
||||
@ -373,10 +362,6 @@ func dist#ft#FTinc()
|
||||
setf aspvbs
|
||||
elseif lines =~ "<?"
|
||||
setf php
|
||||
" Pascal supports // comments but they're vary rarely used for file
|
||||
" headers so assume POV-Ray
|
||||
elseif lines =~ '^\s*\%({\|(\*\)' || lines =~? s:ft_pascal_keywords
|
||||
setf pascal
|
||||
else
|
||||
call dist#ft#FTasmsyntax()
|
||||
if exists("b:asmsyntax")
|
||||
@ -423,9 +408,6 @@ func dist#ft#FTprogress_asm()
|
||||
setf progress
|
||||
endfunc
|
||||
|
||||
let s:ft_pascal_comments = '^\s*\%({\|(\*\|//\)'
|
||||
let s:ft_pascal_keywords = '^\s*\%(program\|unit\|library\|uses\|begin\|procedure\|function\|const\|type\|var\)\>'
|
||||
|
||||
func dist#ft#FTprogress_pascal()
|
||||
if exists("g:filetype_p")
|
||||
exe "setf " . g:filetype_p
|
||||
@ -437,7 +419,8 @@ func dist#ft#FTprogress_pascal()
|
||||
let lnum = 1
|
||||
while lnum <= 10 && lnum < line('$')
|
||||
let line = getline(lnum)
|
||||
if line =~ s:ft_pascal_comments || line =~? s:ft_pascal_keywords
|
||||
if line =~ '^\s*\(program\|unit\|procedure\|function\|const\|type\|var\)\>'
|
||||
\ || line =~ '^\s*{' || line =~ '^\s*(\*'
|
||||
setf pascal
|
||||
return
|
||||
elseif line !~ '^\s*$' || line =~ '^/\*'
|
||||
@ -450,19 +433,6 @@ func dist#ft#FTprogress_pascal()
|
||||
setf progress
|
||||
endfunc
|
||||
|
||||
func dist#ft#FTpp()
|
||||
if exists("g:filetype_pp")
|
||||
exe "setf " . g:filetype_pp
|
||||
else
|
||||
let line = getline(nextnonblank(1))
|
||||
if line =~ s:ft_pascal_comments || line =~? s:ft_pascal_keywords
|
||||
setf pascal
|
||||
else
|
||||
setf puppet
|
||||
endif
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func dist#ft#FTr()
|
||||
let max = line("$") > 50 ? 50 : line("$")
|
||||
|
||||
@ -514,10 +484,6 @@ endfunc
|
||||
|
||||
" Called from filetype.vim and scripts.vim.
|
||||
func dist#ft#SetFileTypeSH(name)
|
||||
if did_filetype()
|
||||
" Filetype was already detected
|
||||
return
|
||||
endif
|
||||
if expand("<amatch>") =~ g:ft_ignore_pat
|
||||
return
|
||||
endif
|
||||
@ -565,10 +531,6 @@ endfunc
|
||||
" as used for Tcl.
|
||||
" Also called from scripts.vim, thus can't be local to this script.
|
||||
func dist#ft#SetFileTypeShell(name)
|
||||
if did_filetype()
|
||||
" Filetype was already detected
|
||||
return
|
||||
endif
|
||||
if expand("<amatch>") =~ g:ft_ignore_pat
|
||||
return
|
||||
endif
|
||||
@ -589,10 +551,6 @@ func dist#ft#SetFileTypeShell(name)
|
||||
endfunc
|
||||
|
||||
func dist#ft#CSH()
|
||||
if did_filetype()
|
||||
" Filetype was already detected
|
||||
return
|
||||
endif
|
||||
if exists("g:filetype_csh")
|
||||
call dist#ft#SetFileTypeShell(g:filetype_csh)
|
||||
elseif &shell =~ "tcsh"
|
||||
@ -605,7 +563,7 @@ endfunc
|
||||
let s:ft_rules_udev_rules_pattern = '^\s*\cudev_rules\s*=\s*"\([^"]\{-1,}\)/*".*'
|
||||
func dist#ft#FTRules()
|
||||
let path = expand('<amatch>:p')
|
||||
if path =~ '/\(etc/udev/\%(rules\.d/\)\=.*\.rules\|\%(usr/\)\=lib/udev/\%(rules\.d/\)\=.*\.rules\)$'
|
||||
if path =~ '^/\(etc/udev/\%(rules\.d/\)\=.*\.rules\|lib/udev/\%(rules\.d/\)\=.*\.rules\)$'
|
||||
setf udevrules
|
||||
return
|
||||
endif
|
||||
@ -729,7 +687,7 @@ endfunc
|
||||
|
||||
func dist#ft#FTxml()
|
||||
let n = 1
|
||||
while n < 100 && n <= line("$")
|
||||
while n < 100 && n < line("$")
|
||||
let line = getline(n)
|
||||
" DocBook 4 or DocBook 5.
|
||||
let is_docbook4 = line =~ '<!DOCTYPE.*DocBook'
|
||||
@ -755,7 +713,7 @@ endfunc
|
||||
|
||||
func dist#ft#FTy()
|
||||
let n = 1
|
||||
while n < 100 && n <= line("$")
|
||||
while n < 100 && n < line("$")
|
||||
let line = getline(n)
|
||||
if line =~ '^\s*%'
|
||||
setf yacc
|
||||
|
@ -2,7 +2,7 @@
|
||||
" Language: Haskell
|
||||
" Maintainer: Daniel Campoverde <alx@sillybytes.net>
|
||||
" URL: https://github.com/alx741/haskellcomplete.vim
|
||||
" Last Change: 2019 May 14
|
||||
" Last Change: 2018 Aug 26
|
||||
|
||||
" Usage: setlocal omnifunc=haskellcomplete#Complete
|
||||
|
||||
@ -63,7 +63,6 @@ function! haskellcomplete#Complete(findstart, base)
|
||||
call add(l:matches, extension)
|
||||
endif
|
||||
endfor
|
||||
let b:completingLangExtension = 0
|
||||
return l:matches
|
||||
endif
|
||||
|
||||
@ -79,7 +78,6 @@ function! haskellcomplete#Complete(findstart, base)
|
||||
call add(l:matches, flag)
|
||||
endif
|
||||
endfor
|
||||
let b:completingOptionsGHC = 0
|
||||
return l:matches
|
||||
endif
|
||||
|
||||
@ -95,7 +93,6 @@ function! haskellcomplete#Complete(findstart, base)
|
||||
call add(l:matches, module)
|
||||
endif
|
||||
endfor
|
||||
let b:completingModule = 0
|
||||
return l:matches
|
||||
endif
|
||||
|
||||
|
@ -30,7 +30,7 @@ function! health#check(plugin_names) abort
|
||||
\ : s:to_fn_names(a:plugin_names)
|
||||
|
||||
tabnew
|
||||
setlocal wrap breakindent linebreak
|
||||
setlocal wrap breakindent
|
||||
setlocal filetype=markdown
|
||||
setlocal conceallevel=2 concealcursor=nc
|
||||
setlocal keywordprg=:help
|
||||
|
@ -8,7 +8,7 @@ function! s:check_config() abort
|
||||
if !filereadable(vimrc)
|
||||
let ok = v:false
|
||||
let has_vim = filereadable(expand('~/.vimrc'))
|
||||
call health#report_warn((-1 == getfsize(vimrc) ? 'Missing' : 'Unreadable').' user config file: '.vimrc,
|
||||
call health#report_warn('Missing user config file: '.vimrc,
|
||||
\[ has_vim ? ':help nvim-from-vim' : ':help init.vim' ])
|
||||
endif
|
||||
|
||||
@ -25,15 +25,6 @@ function! s:check_config() abort
|
||||
\ 'https://github.com/neovim/neovim/wiki/Following-HEAD#20170402' ])
|
||||
endif
|
||||
|
||||
if v:ctype ==# 'C'
|
||||
let ok = v:false
|
||||
call health#report_error('Locale does not support UTF-8. Unicode characters may not display correctly.'
|
||||
\ .printf("\n$LANG=%s $LC_ALL=%s $LC_CTYPE=%s", $LANG, $LC_ALL, $LC_CTYPE),
|
||||
\ [ 'If using tmux, try the -u option.',
|
||||
\ 'Ensure that your terminal/shell/tmux/etc inherits the environment, or set $LANG explicitly.' ,
|
||||
\ 'Configure your system locale.' ])
|
||||
endif
|
||||
|
||||
if &paste
|
||||
let ok = v:false
|
||||
call health#report_error("'paste' is enabled. This option is only for pasting text.\nIt should not be set in your config.",
|
||||
@ -41,29 +32,6 @@ function! s:check_config() abort
|
||||
\ 'Check `:verbose set paste?` to see if a plugin or script set the option.', ])
|
||||
endif
|
||||
|
||||
let writeable = v:true
|
||||
let shadafile = empty(&shada) ? &shada : substitute(matchstr(
|
||||
\ split(&shada, ',')[-1], '^n.\+'), '^n', '', '')
|
||||
let shadafile = empty(&shadafile) ? empty(shadafile) ?
|
||||
\ stdpath('data').'/shada/main.shada' : expand(shadafile)
|
||||
\ : &shadafile ==# 'NONE' ? '' : &shadafile
|
||||
if !empty(shadafile) && empty(glob(shadafile))
|
||||
" Since this may be the first time neovim has been run, we will try to
|
||||
" create a shada file
|
||||
try
|
||||
wshada
|
||||
catch /.*/
|
||||
let writeable = v:false
|
||||
endtry
|
||||
endif
|
||||
if !writeable || (!empty(shadafile) &&
|
||||
\ (!filereadable(shadafile) || !filewritable(shadafile)))
|
||||
let ok = v:false
|
||||
call health#report_error('shada file is not '.
|
||||
\ ((!writeable || filereadable(shadafile)) ?
|
||||
\ 'writeable' : 'readable').":\n".shadafile)
|
||||
endif
|
||||
|
||||
if ok
|
||||
call health#report_ok('no issues found')
|
||||
endif
|
||||
@ -140,31 +108,12 @@ function! s:check_performance() abort
|
||||
else
|
||||
call health#report_info(buildtype)
|
||||
call health#report_warn(
|
||||
\ 'Non-optimized '.(has('debug')?'(DEBUG) ':'').'build. Nvim will be slower.',
|
||||
\ 'Non-optimized build-type. Nvim will be slower.',
|
||||
\ ['Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.',
|
||||
\ s:suggest_faq])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:get_tmux_option(option) abort
|
||||
let cmd = 'tmux show-option -qvg '.a:option " try global scope
|
||||
let out = system(cmd)
|
||||
let val = substitute(out, '\v(\s|\r|\n)', '', 'g')
|
||||
if v:shell_error
|
||||
call health#report_error('command failed: '.cmd."\n".out)
|
||||
return 'error'
|
||||
elseif empty(val)
|
||||
let cmd = 'tmux show-option -qvgs '.a:option " try session scope
|
||||
let out = system(cmd)
|
||||
let val = substitute(out, '\v(\s|\r|\n)', '', 'g')
|
||||
if v:shell_error
|
||||
call health#report_error('command failed: '.cmd."\n".out)
|
||||
return 'error'
|
||||
endif
|
||||
endif
|
||||
return val
|
||||
endfunction
|
||||
|
||||
function! s:check_tmux() abort
|
||||
if empty($TMUX) || !executable('tmux')
|
||||
return
|
||||
@ -172,31 +121,20 @@ function! s:check_tmux() abort
|
||||
call health#report_start('tmux')
|
||||
|
||||
" check escape-time
|
||||
let suggestions = ["set escape-time in ~/.tmux.conf:\nset-option -sg escape-time 10",
|
||||
let suggestions = ["Set escape-time in ~/.tmux.conf:\nset-option -sg escape-time 10",
|
||||
\ s:suggest_faq]
|
||||
let tmux_esc_time = s:get_tmux_option('escape-time')
|
||||
if tmux_esc_time !=# 'error'
|
||||
if empty(tmux_esc_time)
|
||||
call health#report_error('`escape-time` is not set', suggestions)
|
||||
elseif tmux_esc_time > 300
|
||||
call health#report_error(
|
||||
\ '`escape-time` ('.tmux_esc_time.') is higher than 300ms', suggestions)
|
||||
else
|
||||
call health#report_ok('escape-time: '.tmux_esc_time)
|
||||
endif
|
||||
endif
|
||||
|
||||
" check focus-events
|
||||
let suggestions = ["(tmux 1.9+ only) Set `focus-events` in ~/.tmux.conf:\nset-option -g focus-events on"]
|
||||
let tmux_focus_events = s:get_tmux_option('focus-events')
|
||||
call health#report_info('Checking stuff')
|
||||
if tmux_focus_events !=# 'error'
|
||||
if empty(tmux_focus_events) || tmux_focus_events !=# 'on'
|
||||
call health#report_warn(
|
||||
\ "`focus-events` is not enabled. |'autoread'| may not work.", suggestions)
|
||||
else
|
||||
call health#report_ok('focus-events: '.tmux_focus_events)
|
||||
endif
|
||||
let cmd = 'tmux show-option -qvgs escape-time'
|
||||
let out = system(cmd)
|
||||
let tmux_esc_time = substitute(out, '\v(\s|\r|\n)', '', 'g')
|
||||
if v:shell_error
|
||||
call health#report_error('command failed: '.cmd."\n".out)
|
||||
elseif empty(tmux_esc_time)
|
||||
call health#report_error('escape-time is not set', suggestions)
|
||||
elseif tmux_esc_time > 300
|
||||
call health#report_error(
|
||||
\ 'escape-time ('.tmux_esc_time.') is higher than 300ms', suggestions)
|
||||
else
|
||||
call health#report_ok('escape-time: '.tmux_esc_time.'ms')
|
||||
endif
|
||||
|
||||
" check default-terminal and $TERM
|
||||
@ -223,17 +161,6 @@ function! s:check_tmux() abort
|
||||
\ ["Set default-terminal in ~/.tmux.conf:\nset-option -g default-terminal \"screen-256color\"",
|
||||
\ s:suggest_faq])
|
||||
endif
|
||||
|
||||
" check for RGB capabilities
|
||||
let info = system('tmux server-info')
|
||||
let has_tc = stridx(info, " Tc: (flag) true") != -1
|
||||
let has_rgb = stridx(info, " RGB: (flag) true") != -1
|
||||
if !has_tc && !has_rgb
|
||||
call health#report_warn(
|
||||
\ "Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.",
|
||||
\ ["Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:\nset-option -sa terminal-overrides ',XXX:RGB'",
|
||||
\ "For older tmux versions use this instead:\nset-option -ga terminal-overrides ',XXX:Tc'"])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:check_terminal() abort
|
||||
@ -247,16 +174,12 @@ function! s:check_terminal() abort
|
||||
let kdch1_entry = matchstr(out, 'key_dc=[^,[:space:]]*')
|
||||
|
||||
if v:shell_error
|
||||
\ && (!has('win32')
|
||||
\ || empty(matchstr(out,
|
||||
\ 'infocmp: couldn''t open terminfo file .\+'
|
||||
\ ..'\%(conemu\|vtpcon\|win32con\)')))
|
||||
call health#report_error('command failed: '.cmd."\n".out)
|
||||
else
|
||||
call health#report_info('key_backspace (kbs) terminfo entry: '
|
||||
\ .(empty(kbs_entry) ? '? (not found)' : kbs_entry))
|
||||
\ .(empty(kbs_entry) ? '? (not found)' : kbs_entry))
|
||||
call health#report_info('key_dc (kdch1) terminfo entry: '
|
||||
\ .(empty(kbs_entry) ? '? (not found)' : kdch1_entry))
|
||||
\ .(empty(kbs_entry) ? '? (not found)' : kdch1_entry))
|
||||
endif
|
||||
for env_var in ['XTERM_VERSION', 'VTE_VERSION', 'TERM_PROGRAM', 'COLORTERM', 'SSH_TTY']
|
||||
if exists('$'.env_var)
|
||||
|
@ -38,10 +38,9 @@ endfunction
|
||||
" Handler for s:system() function.
|
||||
function! s:system_handler(jobid, data, event) dict abort
|
||||
if a:event ==# 'stderr'
|
||||
if self.add_stderr_to_output
|
||||
let self.stderr .= join(a:data, '')
|
||||
if !self.ignore_stderr
|
||||
let self.output .= join(a:data, '')
|
||||
else
|
||||
let self.stderr .= join(a:data, '')
|
||||
endif
|
||||
elseif a:event ==# 'stdout'
|
||||
let self.output .= join(a:data, '')
|
||||
@ -65,7 +64,7 @@ function! s:system(cmd, ...) abort
|
||||
let stdin = a:0 ? a:1 : ''
|
||||
let ignore_error = a:0 > 2 ? a:3 : 0
|
||||
let opts = {
|
||||
\ 'add_stderr_to_output': a:0 > 1 ? a:2 : 0,
|
||||
\ 'ignore_stderr': a:0 > 1 ? a:2 : 0,
|
||||
\ 'output': '',
|
||||
\ 'stderr': '',
|
||||
\ 'on_stdout': function('s:system_handler'),
|
||||
@ -90,15 +89,8 @@ function! s:system(cmd, ...) abort
|
||||
call health#report_error(printf('Command timed out: %s', s:shellify(a:cmd)))
|
||||
call jobstop(jobid)
|
||||
elseif s:shell_error != 0 && !ignore_error
|
||||
let emsg = printf("Command error (job=%d, exit code %d): `%s` (in %s)",
|
||||
\ jobid, s:shell_error, s:shellify(a:cmd), string(getcwd()))
|
||||
if !empty(opts.output)
|
||||
let emsg .= "\noutput: " . opts.output
|
||||
end
|
||||
if !empty(opts.stderr)
|
||||
let emsg .= "\nstderr: " . opts.stderr
|
||||
end
|
||||
call health#report_error(emsg)
|
||||
call health#report_error(printf("Command error (job=%d, exit code %d): `%s` (in %s)\nOutput: %s\nStderr: %s",
|
||||
\ jobid, s:shell_error, s:shellify(a:cmd), string(getcwd()), opts.output, opts.stderr))
|
||||
endif
|
||||
|
||||
return opts.output
|
||||
@ -114,8 +106,7 @@ endfunction
|
||||
|
||||
" Fetch the contents of a URL.
|
||||
function! s:download(url) abort
|
||||
let has_curl = executable('curl')
|
||||
if has_curl && system(['curl', '-V']) =~# 'Protocols:.*https'
|
||||
if executable('curl')
|
||||
let rv = s:system(['curl', '-sL', a:url], '', 1, 1)
|
||||
return s:shell_error ? 'curl error with '.a:url.': '.s:shell_error : rv
|
||||
elseif executable('python')
|
||||
@ -133,9 +124,7 @@ function! s:download(url) abort
|
||||
\ ? 'python urllib.request error: '.s:shell_error
|
||||
\ : rv
|
||||
endif
|
||||
return 'missing `curl` '
|
||||
\ .(has_curl ? '(with HTTPS support) ' : '')
|
||||
\ .'and `python`, cannot make web request'
|
||||
return 'missing `curl` and `python`, cannot make pypi request'
|
||||
endfunction
|
||||
|
||||
" Check for clipboard tools.
|
||||
@ -163,7 +152,7 @@ function! s:check_clipboard() abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Get the latest Nvim Python client (pynvim) version from PyPI.
|
||||
" Get the latest Neovim Python client (pynvim) version from PyPI.
|
||||
function! s:latest_pypi_version() abort
|
||||
let pypi_version = 'unable to get pypi response'
|
||||
let pypi_response = s:download('https://pypi.python.org/pypi/pynvim/json')
|
||||
@ -180,7 +169,7 @@ endfunction
|
||||
|
||||
" Get version information using the specified interpreter. The interpreter is
|
||||
" used directly in case breaking changes were introduced since the last time
|
||||
" Nvim's Python client was updated.
|
||||
" Neovim's Python client was updated.
|
||||
"
|
||||
" Returns: [
|
||||
" {python executable version},
|
||||
@ -202,8 +191,7 @@ function! s:version_info(python) abort
|
||||
|
||||
let nvim_path = s:trim(s:system([
|
||||
\ a:python, '-c',
|
||||
\ 'import sys; ' .
|
||||
\ 'sys.path = list(filter(lambda x: x != "", sys.path)); ' .
|
||||
\ 'import sys; sys.path.remove(""); ' .
|
||||
\ 'import neovim; print(neovim.__file__)']))
|
||||
if s:shell_error || empty(nvim_path)
|
||||
return [python_version, 'unable to load neovim Python module', pypi_version,
|
||||
@ -224,7 +212,7 @@ function! s:version_info(python) abort
|
||||
\ 'print("{}.{}.{}{}".format(v.major, v.minor, v.patch, v.prerelease))'],
|
||||
\ '', 1, 1)
|
||||
if empty(nvim_version)
|
||||
let nvim_version = 'unable to find pynvim module version'
|
||||
let nvim_version = 'unable to find neovim Python module version'
|
||||
let base = fnamemodify(nvim_path, ':h')
|
||||
let metas = glob(base.'-*/METADATA', 1, 1)
|
||||
\ + glob(base.'-*/PKG-INFO', 1, 1)
|
||||
@ -266,22 +254,6 @@ function! s:check_bin(bin) abort
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
" Check "loaded" var for given a:provider.
|
||||
" Returns 1 if the caller should return (skip checks).
|
||||
function! s:disabled_via_loaded_var(provider) abort
|
||||
let loaded_var = 'g:loaded_'.a:provider.'_provider'
|
||||
if exists(loaded_var) && !exists('*provider#'.a:provider.'#Call')
|
||||
let v = eval(loaded_var)
|
||||
if 0 is v
|
||||
call health#report_info('Disabled ('.loaded_var.'='.v.').')
|
||||
return 1
|
||||
else
|
||||
call health#report_info('Disabled ('.loaded_var.'='.v.'). This might be due to some previous error.')
|
||||
endif
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! s:check_python(version) abort
|
||||
call health#report_start('Python ' . a:version . ' provider (optional)')
|
||||
|
||||
@ -289,10 +261,11 @@ function! s:check_python(version) abort
|
||||
let python_exe = ''
|
||||
let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : ''
|
||||
let host_prog_var = pyname.'_host_prog'
|
||||
let loaded_var = 'g:loaded_'.pyname.'_provider'
|
||||
let python_multiple = []
|
||||
|
||||
if s:disabled_via_loaded_var(pyname)
|
||||
return
|
||||
if exists(loaded_var) && !exists('*provider#'.pyname.'#Call')
|
||||
call health#report_info('Disabled ('.loaded_var.'='.eval(loaded_var).'). This might be due to some previous error.')
|
||||
endif
|
||||
|
||||
let [pyenv, pyenv_root] = s:check_for_pyenv()
|
||||
@ -310,7 +283,7 @@ function! s:check_python(version) abort
|
||||
let python_exe = pyname
|
||||
endif
|
||||
|
||||
" No Python executable could `import neovim`, or host_prog_var was used.
|
||||
" No Python executable could `import neovim`.
|
||||
if !empty(pythonx_errors)
|
||||
call health#report_error('Python provider error:', pythonx_errors)
|
||||
|
||||
@ -363,7 +336,7 @@ function! s:check_python(version) abort
|
||||
\ && !empty(pyenv_root) && resolve(python_exe) !~# '^'.pyenv_root.'/'
|
||||
call health#report_warn('pyenv is not set up optimally.', [
|
||||
\ printf('Create a virtualenv specifically '
|
||||
\ . 'for Nvim using pyenv, and set `g:%s`. This will avoid '
|
||||
\ . 'for Neovim using pyenv, and set `g:%s`. This will avoid '
|
||||
\ . 'the need to install the pynvim module in each '
|
||||
\ . 'version/virtualenv.', host_prog_var)
|
||||
\ ])
|
||||
@ -377,7 +350,7 @@ function! s:check_python(version) abort
|
||||
if resolve(python_exe) !~# '^'.venv_root.'/'
|
||||
call health#report_warn('Your virtualenv is not set up optimally.', [
|
||||
\ printf('Create a virtualenv specifically '
|
||||
\ . 'for Nvim and use `g:%s`. This will avoid '
|
||||
\ . 'for Neovim and use `g:%s`. This will avoid '
|
||||
\ . 'the need to install the pynvim module in each '
|
||||
\ . 'virtualenv.', host_prog_var)
|
||||
\ ])
|
||||
@ -392,6 +365,18 @@ function! s:check_python(version) abort
|
||||
let python_exe = ''
|
||||
endif
|
||||
|
||||
" Check if $VIRTUAL_ENV is valid.
|
||||
if exists('$VIRTUAL_ENV') && !empty(python_exe)
|
||||
if $VIRTUAL_ENV ==# matchstr(python_exe, '^\V'.$VIRTUAL_ENV)
|
||||
call health#report_info('$VIRTUAL_ENV matches executable')
|
||||
else
|
||||
call health#report_warn(
|
||||
\ '$VIRTUAL_ENV exists but appears to be inactive. '
|
||||
\ . 'This could lead to unexpected results.',
|
||||
\ [ 'If you are using Zsh, see: http://vi.stackexchange.com/a/7654' ])
|
||||
endif
|
||||
endif
|
||||
|
||||
" Diagnostic output
|
||||
call health#report_info('Executable: ' . (empty(python_exe) ? 'Not found' : python_exe))
|
||||
if len(python_multiple)
|
||||
@ -400,6 +385,8 @@ function! s:check_python(version) abort
|
||||
endfor
|
||||
endif
|
||||
|
||||
let pip = 'pip' . (a:version == 2 ? '' : '3')
|
||||
|
||||
if empty(python_exe)
|
||||
" No Python executable can import 'neovim'. Check if any Python executable
|
||||
" can import 'pynvim'. If so, that Python failed to import 'neovim' as
|
||||
@ -411,9 +398,9 @@ function! s:check_python(version) abort
|
||||
\ 'Detected pip upgrade failure: Python executable can import "pynvim" but '
|
||||
\ . 'not "neovim": '. pynvim_exe,
|
||||
\ "Use that Python version to reinstall \"pynvim\" and optionally \"neovim\".\n"
|
||||
\ . pynvim_exe ." -m pip uninstall pynvim neovim\n"
|
||||
\ . pynvim_exe ." -m pip install pynvim\n"
|
||||
\ . pynvim_exe ." -m pip install neovim # only if needed by third-party software")
|
||||
\ . pip ." uninstall pynvim neovim\n"
|
||||
\ . pip ." install pynvim\n"
|
||||
\ . pip ." install neovim # only if needed by third-party software")
|
||||
endif
|
||||
else
|
||||
let [pyversion, current, latest, status] = s:version_info(python_exe)
|
||||
@ -423,6 +410,10 @@ function! s:check_python(version) abort
|
||||
\ ' This could lead to confusing error messages.')
|
||||
endif
|
||||
|
||||
if a:version == 3 && str2float(pyversion) < 3.3
|
||||
call health#report_warn('Python 3.3+ is recommended.')
|
||||
endif
|
||||
|
||||
call health#report_info('Python version: ' . pyversion)
|
||||
|
||||
if s:is_bad_response(status)
|
||||
@ -434,7 +425,7 @@ function! s:check_python(version) abort
|
||||
if s:is_bad_response(current)
|
||||
call health#report_error(
|
||||
\ "pynvim is not installed.\nError: ".current,
|
||||
\ ['Run in shell: '. python_exe .' -m pip install pynvim'])
|
||||
\ ['Run in shell: '. pip .' install pynvim'])
|
||||
endif
|
||||
|
||||
if s:is_bad_response(latest)
|
||||
@ -479,83 +470,12 @@ function! s:check_for_pyenv() abort
|
||||
return [pyenv_path, pyenv_root]
|
||||
endfunction
|
||||
|
||||
" Resolves Python executable path by invoking and checking `sys.executable`.
|
||||
function! s:python_exepath(invocation) abort
|
||||
return s:normalize_path(system(fnameescape(a:invocation)
|
||||
\ . ' -c "import sys; sys.stdout.write(sys.executable)"'))
|
||||
endfunction
|
||||
|
||||
" Checks that $VIRTUAL_ENV Python executables are found at front of $PATH in
|
||||
" Nvim and subshells.
|
||||
function! s:check_virtualenv() abort
|
||||
call health#report_start('Python virtualenv')
|
||||
if !exists('$VIRTUAL_ENV')
|
||||
call health#report_ok('no $VIRTUAL_ENV')
|
||||
return
|
||||
endif
|
||||
let errors = []
|
||||
" Keep hints as dict keys in order to discard duplicates.
|
||||
let hints = {}
|
||||
" The virtualenv should contain some Python executables, and those
|
||||
" executables should be first both on Nvim's $PATH and the $PATH of
|
||||
" subshells launched from Nvim.
|
||||
let bin_dir = has('win32') ? '/Scripts' : '/bin'
|
||||
let venv_bins = glob($VIRTUAL_ENV . bin_dir . '/python*', v:true, v:true)
|
||||
" XXX: Remove irrelevant executables found in bin/.
|
||||
let venv_bins = filter(venv_bins, 'v:val !~# "python-config"')
|
||||
if len(venv_bins)
|
||||
for venv_bin in venv_bins
|
||||
let venv_bin = s:normalize_path(venv_bin)
|
||||
let py_bin_basename = fnamemodify(venv_bin, ':t')
|
||||
let nvim_py_bin = s:python_exepath(exepath(py_bin_basename))
|
||||
let subshell_py_bin = s:python_exepath(py_bin_basename)
|
||||
if venv_bin !=# nvim_py_bin
|
||||
call add(errors, '$PATH yields this '.py_bin_basename.' executable: '.nvim_py_bin)
|
||||
let hint = '$PATH ambiguities arise if the virtualenv is not '
|
||||
\.'properly activated prior to launching Nvim. Close Nvim, activate the virtualenv, '
|
||||
\.'check that invoking Python from the command line launches the correct one, '
|
||||
\.'then relaunch Nvim.'
|
||||
let hints[hint] = v:true
|
||||
endif
|
||||
if venv_bin !=# subshell_py_bin
|
||||
call add(errors, '$PATH in subshells yields this '
|
||||
\.py_bin_basename . ' executable: '.subshell_py_bin)
|
||||
let hint = '$PATH ambiguities in subshells typically are '
|
||||
\.'caused by your shell config overriding the $PATH previously set by the '
|
||||
\.'virtualenv. Either prevent them from doing so, or use this workaround: '
|
||||
\.'https://vi.stackexchange.com/a/7654'
|
||||
let hints[hint] = v:true
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
call add(errors, 'no Python executables found in the virtualenv '.bin_dir.' directory.')
|
||||
endif
|
||||
|
||||
let msg = '$VIRTUAL_ENV is set to: '.$VIRTUAL_ENV
|
||||
if len(errors)
|
||||
if len(venv_bins)
|
||||
let msg .= "\nAnd its ".bin_dir.' directory contains: '
|
||||
\.join(map(venv_bins, "fnamemodify(v:val, ':t')"), ', ')
|
||||
endif
|
||||
let conj = "\nBut "
|
||||
for error in errors
|
||||
let msg .= conj.error
|
||||
let conj = "\nAnd "
|
||||
endfor
|
||||
let msg .= "\nSo invoking Python may lead to unexpected results."
|
||||
call health#report_warn(msg, keys(hints))
|
||||
else
|
||||
call health#report_info(msg)
|
||||
call health#report_info('Python version: '
|
||||
\.system('python -c "import platform, sys; sys.stdout.write(platform.python_version())"'))
|
||||
call health#report_ok('$VIRTUAL_ENV provides :!python.')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:check_ruby() abort
|
||||
call health#report_start('Ruby provider (optional)')
|
||||
|
||||
if s:disabled_via_loaded_var('ruby')
|
||||
let loaded_var = 'g:loaded_ruby_provider'
|
||||
if exists(loaded_var) && !exists('*provider#ruby#Call')
|
||||
call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var))
|
||||
return
|
||||
endif
|
||||
|
||||
@ -567,7 +487,7 @@ function! s:check_ruby() abort
|
||||
endif
|
||||
call health#report_info('Ruby: '. s:system('ruby -v'))
|
||||
|
||||
let [host, err] = provider#ruby#Detect()
|
||||
let host = provider#ruby#Detect()
|
||||
if empty(host)
|
||||
call health#report_warn('`neovim-ruby-host` not found.',
|
||||
\ ['Run `gem install neovim` to ensure the neovim RubyGem is installed.',
|
||||
@ -578,7 +498,7 @@ function! s:check_ruby() abort
|
||||
endif
|
||||
call health#report_info('Host: '. host)
|
||||
|
||||
let latest_gem_cmd = has('win32') ? 'cmd /c gem list -ra "^^neovim$"' : 'gem list -ra ^neovim$'
|
||||
let latest_gem_cmd = has('win32') ? 'cmd /c gem list -ra ^^neovim$' : 'gem list -ra ^neovim$'
|
||||
let latest_gem = s:system(split(latest_gem_cmd))
|
||||
if s:shell_error || empty(latest_gem)
|
||||
call health#report_error('Failed to run: '. latest_gem_cmd,
|
||||
@ -586,7 +506,7 @@ function! s:check_ruby() abort
|
||||
\ 'Are you behind a firewall or proxy?'])
|
||||
return
|
||||
endif
|
||||
let latest_gem = get(split(latest_gem, 'neovim (\|, \|)$' ), 0, 'not found')
|
||||
let latest_gem = get(split(latest_gem, 'neovim (\|, \|)$' ), 1, 'not found')
|
||||
|
||||
let current_gem_cmd = host .' --version'
|
||||
let current_gem = s:system(current_gem_cmd)
|
||||
@ -609,7 +529,9 @@ endfunction
|
||||
function! s:check_node() abort
|
||||
call health#report_start('Node.js provider (optional)')
|
||||
|
||||
if s:disabled_via_loaded_var('node')
|
||||
let loaded_var = 'g:loaded_node_provider'
|
||||
if exists(loaded_var) && !exists('*provider#node#Call')
|
||||
call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var))
|
||||
return
|
||||
endif
|
||||
|
||||
@ -621,8 +543,8 @@ function! s:check_node() abort
|
||||
endif
|
||||
let node_v = get(split(s:system('node -v'), "\n"), 0, '')
|
||||
call health#report_info('Node.js: '. node_v)
|
||||
if s:shell_error || s:version_cmp(node_v[1:], '6.0.0') < 0
|
||||
call health#report_warn('Nvim node.js host does not support '.node_v)
|
||||
if !s:shell_error && s:version_cmp(node_v[1:], '6.0.0') < 0
|
||||
call health#report_warn('Neovim node.js host does not support '.node_v)
|
||||
" Skip further checks, they are nonsense if nodejs is too old.
|
||||
return
|
||||
endif
|
||||
@ -630,19 +552,16 @@ function! s:check_node() abort
|
||||
call health#report_warn('node.js on this system does not support --inspect-brk so $NVIM_NODE_HOST_DEBUG is ignored.')
|
||||
endif
|
||||
|
||||
let [host, err] = provider#node#Detect()
|
||||
let host = provider#node#Detect()
|
||||
if empty(host)
|
||||
call health#report_warn('Missing "neovim" npm (or yarn) package.',
|
||||
\ ['Run in shell: npm install -g neovim',
|
||||
\ 'Run in shell (if you use yarn): yarn global add neovim'])
|
||||
return
|
||||
endif
|
||||
call health#report_info('Nvim node.js host: '. host)
|
||||
call health#report_info('Neovim node.js host: '. host)
|
||||
|
||||
let manager = executable('npm') ? 'npm' : 'yarn'
|
||||
let latest_npm_cmd = has('win32') ?
|
||||
\ 'cmd /c '. manager .' info neovim --json' :
|
||||
\ manager .' info neovim --json'
|
||||
let latest_npm_cmd = has('win32') ? 'cmd /c npm info neovim --json' : 'npm info neovim --json'
|
||||
let latest_npm = s:system(split(latest_npm_cmd))
|
||||
if s:shell_error || empty(latest_npm)
|
||||
call health#report_error('Failed to run: '. latest_npm_cmd,
|
||||
@ -650,12 +569,14 @@ function! s:check_node() abort
|
||||
\ 'Are you behind a firewall or proxy?'])
|
||||
return
|
||||
endif
|
||||
try
|
||||
let pkg_data = json_decode(latest_npm)
|
||||
catch /E474/
|
||||
return 'error: '.latest_npm
|
||||
endtry
|
||||
let latest_npm = get(get(pkg_data, 'dist-tags', {}), 'latest', 'unable to parse')
|
||||
if !empty(latest_npm)
|
||||
try
|
||||
let pkg_data = json_decode(latest_npm)
|
||||
catch /E474/
|
||||
return 'error: '.latest_npm
|
||||
endtry
|
||||
let latest_npm = get(get(pkg_data, 'dist-tags', {}), 'latest', 'unable to parse')
|
||||
endif
|
||||
|
||||
let current_npm_cmd = ['node', host, '--version']
|
||||
let current_npm = s:system(current_npm_cmd)
|
||||
@ -669,92 +590,16 @@ function! s:check_node() abort
|
||||
call health#report_warn(
|
||||
\ printf('Package "neovim" is out-of-date. Installed: %s, latest: %s',
|
||||
\ current_npm, latest_npm),
|
||||
\ ['Run in shell: npm install -g neovim',
|
||||
\ 'Run in shell (if you use yarn): yarn global add neovim'])
|
||||
\ ['Run in shell: npm install -g neovim'])
|
||||
else
|
||||
call health#report_ok('Latest "neovim" npm/yarn package is installed: '. current_npm)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:check_perl() abort
|
||||
call health#report_start('Perl provider (optional)')
|
||||
|
||||
if s:disabled_via_loaded_var('perl')
|
||||
return
|
||||
endif
|
||||
|
||||
let [perl_exec, perl_errors] = provider#perl#Detect()
|
||||
if empty(perl_exec)
|
||||
if !empty(perl_errors)
|
||||
call health#report_error('perl provider error:', perl_errors)
|
||||
else
|
||||
call health#report_warn('No usable perl executable found')
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
call health#report_info('perl executable: '. perl_exec)
|
||||
|
||||
" we cannot use cpanm that is on the path, as it may not be for the perl
|
||||
" set with g:perl_host_prog
|
||||
call s:system([perl_exec, '-W', '-MApp::cpanminus', '-e', ''])
|
||||
if s:shell_error
|
||||
return [perl_exec, '"App::cpanminus" module is not installed']
|
||||
endif
|
||||
|
||||
let latest_cpan_cmd = [perl_exec,
|
||||
\ '-MApp::cpanminus::fatscript', '-e',
|
||||
\ 'my $app = App::cpanminus::script->new;
|
||||
\ $app->parse_options ("--info", "-q", "Neovim::Ext");
|
||||
\ exit $app->doit']
|
||||
|
||||
let latest_cpan = s:system(latest_cpan_cmd)
|
||||
if s:shell_error || empty(latest_cpan)
|
||||
call health#report_error('Failed to run: '. latest_cpan_cmd,
|
||||
\ ["Make sure you're connected to the internet.",
|
||||
\ 'Are you behind a firewall or proxy?'])
|
||||
return
|
||||
elseif latest_cpan[0] ==# '!'
|
||||
let cpanm_errs = split(latest_cpan, '!')
|
||||
if cpanm_errs[0] =~# "Can't write to "
|
||||
call health#report_warn(cpanm_errs[0], cpanm_errs[1:-2])
|
||||
" Last line is the package info
|
||||
let latest_cpan = cpanm_errs[-1]
|
||||
else
|
||||
call health#report_error('Unknown warning from command: ' . latest_cpan_cmd, cpanm_errs)
|
||||
return
|
||||
endif
|
||||
endif
|
||||
let latest_cpan = matchstr(latest_cpan, '\(\.\?\d\)\+')
|
||||
if empty(latest_cpan)
|
||||
call health#report_error('Cannot parse version number from cpanm output: ' . latest_cpan)
|
||||
return
|
||||
endif
|
||||
|
||||
let current_cpan_cmd = [perl_exec, '-W', '-MNeovim::Ext', '-e', 'print $Neovim::Ext::VERSION']
|
||||
let current_cpan = s:system(current_cpan_cmd)
|
||||
if s:shell_error
|
||||
call health#report_error('Failed to run: '. string(current_cpan_cmd),
|
||||
\ ['Report this issue with the output of: ', string(current_cpan_cmd)])
|
||||
return
|
||||
endif
|
||||
|
||||
if s:version_cmp(current_cpan, latest_cpan) == -1
|
||||
call health#report_warn(
|
||||
\ printf('Module "Neovim::Ext" is out-of-date. Installed: %s, latest: %s',
|
||||
\ current_cpan, latest_cpan),
|
||||
\ ['Run in shell: cpanm -n Neovim::Ext'])
|
||||
else
|
||||
call health#report_ok('Latest "Neovim::Ext" cpan module is installed: '. current_cpan)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! health#provider#check() abort
|
||||
call s:check_clipboard()
|
||||
call s:check_python(2)
|
||||
call s:check_python(3)
|
||||
call s:check_virtualenv()
|
||||
call s:check_ruby()
|
||||
call s:check_node()
|
||||
call s:check_perl()
|
||||
endfunction
|
||||
|
@ -1,5 +0,0 @@
|
||||
function! health#treesitter#check() abort
|
||||
call health#report_start('Checking treesitter configuration')
|
||||
lua require 'vim.treesitter.health'.check_health()
|
||||
endfunction
|
||||
|
@ -1,7 +1,7 @@
|
||||
" Vim completion script
|
||||
" Language: HTML and XHTML
|
||||
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
|
||||
" Last Change: 2019 Sep 27
|
||||
" Last Change: 2014 Jun 20
|
||||
|
||||
" Distinguish between HTML versions.
|
||||
" To use with other HTML versions add another "elseif" condition to match
|
||||
@ -245,8 +245,7 @@ function! htmlcomplete#CompleteTags(findstart, base)
|
||||
" If context contains white space it is attribute.
|
||||
" It can be also value of attribute.
|
||||
" We have to get first word to offer proper completions
|
||||
if context =~ '^\s*$'
|
||||
" empty or whitespace line
|
||||
if context == ''
|
||||
let tag = ''
|
||||
else
|
||||
let tag = split(context)[0]
|
||||
|
@ -1,9 +1,7 @@
|
||||
" Vim completion script
|
||||
" Language: Java Script
|
||||
" Maintainer: Jay Sitter (jay@jaysitter.com)
|
||||
" URL: https://github.com/jsit/javascriptcomplete.vim/
|
||||
" Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
|
||||
" Last Change: 2020 Jul 30
|
||||
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
|
||||
" Last Change: 2017 Mar 04
|
||||
|
||||
function! javascriptcomplete#CompleteJS(findstart, base)
|
||||
if a:findstart
|
||||
@ -156,30 +154,12 @@ function! javascriptcomplete#CompleteJS(findstart, base)
|
||||
\ 'text', 'vLink']
|
||||
let bodys = bodyprop
|
||||
" Document - document.
|
||||
let docuprop = ['anchors', 'body', 'characterSet', 'doctype',
|
||||
\ 'documentElement', 'documentURI', 'embeds', 'fonts', 'forms',
|
||||
\ 'head', 'hidden', 'images', 'implementation', 'lastStyleSheetSet',
|
||||
\ 'links', 'plugins', 'preferredStyleSheetSet', 'scripts',
|
||||
\ 'scrollingElement', 'selectedStyleSheetSet', 'styleSheetSets',
|
||||
\ 'timeline', 'visibilityState', 'cookie', 'defaultView',
|
||||
\ 'designMode', 'dir', 'domain', 'lastModified', 'location',
|
||||
\ 'readyState', 'referrer', 'title', 'URL', 'activeElement',
|
||||
\ 'fullscreenElement', 'styleSheets']
|
||||
let documeth = ['adoptNode', 'close', 'createAttribute',
|
||||
\ 'createAttributeNS', 'createCDATASection', 'createComment',
|
||||
\ 'createDocumentFragment', 'createElement', 'createElementNS',
|
||||
\ 'createEvent', 'createExpression', 'createNSResolver',
|
||||
\ 'createNodeIterator', 'createProcessingInstruction', 'createRange',
|
||||
\ 'createTextNode', 'createTouchList', 'createTreeWalker',
|
||||
\ 'enableStyleSheetsForSet', 'evaluate', 'focus', 'getElementById',
|
||||
\ 'getElementById', 'getElementsByClassName', 'getElementsByName',
|
||||
\ 'getElementsByTagName', 'getElementsByTagNameNS',
|
||||
\ 'hasStorageAccess', 'importNode', 'onClick', 'onDblClick',
|
||||
\ 'onFocus', 'onKeyDown', 'onKeyPress', 'onKeyUp', 'onMouseDown',
|
||||
\ 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp',
|
||||
\ 'onResize', 'open', 'querySelector', 'querySelectorAll',
|
||||
\ 'requestStorageAccess', 'write', 'writeln']
|
||||
|
||||
let docuprop = ['anchors', 'applets', 'childNodes', 'embeds', 'forms', 'images', 'links', 'stylesheets',
|
||||
\ 'body', 'cookie', 'documentElement', 'domain', 'lastModified', 'referrer', 'title', 'URL']
|
||||
let documeth = ['close', 'createAttribute', 'createElement', 'createTextNode', 'focus', 'getElementById',
|
||||
\ 'getElementsByName', 'getElementsByTagName', 'open', 'write', 'writeln',
|
||||
\ 'onClick', 'onDblClick', 'onFocus', 'onKeyDown', 'onKeyPress', 'onKeyUp',
|
||||
\ 'onMouseDown', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onResize']
|
||||
call map(documeth, 'v:val."("')
|
||||
let docuxprop = ['attributes', 'childNodes', 'doctype', 'documentElement', 'firstChild',
|
||||
\ 'implementation', 'namespaceURI', 'nextSibling', 'nodeName', 'nodeType',
|
||||
@ -388,11 +368,9 @@ function! javascriptcomplete#CompleteJS(findstart, base)
|
||||
let xdomelemprop = ['attributes', 'childNodes', 'firstChild', 'lastChild',
|
||||
\ 'namespaceURI', 'nextSibling', 'nodeName', 'nodeType', 'nodeValue',
|
||||
\ 'ownerDocument', 'parentNode', 'prefix', 'previousSibling', 'tagName']
|
||||
let xdomelemmeth = ['appendChild', 'addEventListener', 'cloneNode',
|
||||
\ 'dispatchEvent', 'getAttribute', 'getAttributeNode',
|
||||
\ 'getElementsByTagName', 'hasChildNodes', 'insertBefore',
|
||||
\ 'normalize', 'removeAttribute', 'removeAttributeNode',
|
||||
\ 'removeChild', 'removeEventListener', 'replaceChild',
|
||||
let xdomelemmeth = ['appendChild', 'cloneNode', 'getAttribute', 'getAttributeNode',
|
||||
\ 'getElementsByTagName', 'hasChildNodes', 'insertBefore', 'normalize',
|
||||
\ 'removeAttribute', 'removeAttributeNode', 'removeChild', 'replaceChild',
|
||||
\ 'setAttribute', 'setAttributeNode']
|
||||
call map(xdomelemmeth, 'v:val."("')
|
||||
let xdomelems = xdomelemprop + xdomelemmeth
|
||||
|
@ -1,4 +1,4 @@
|
||||
" Maintainer: Anmol Sethi <hi@nhooyr.io>
|
||||
" Maintainer: Anmol Sethi <anmol@aubble.com>
|
||||
|
||||
if exists('s:loaded_man')
|
||||
finish
|
||||
@ -7,18 +7,32 @@ let s:loaded_man = 1
|
||||
|
||||
let s:find_arg = '-w'
|
||||
let s:localfile_arg = v:true " Always use -l if possible. #6683
|
||||
let s:section_arg = '-S'
|
||||
let s:section_arg = '-s'
|
||||
|
||||
function! man#init() abort
|
||||
function! s:init_section_flag()
|
||||
call system(['env', 'MANPAGER=cat', 'man', s:section_arg, '1', 'man'])
|
||||
if v:shell_error
|
||||
let s:section_arg = '-S'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:init() abort
|
||||
call s:init_section_flag()
|
||||
" TODO(nhooyr): Does `man -l` on SunOS list searched directories?
|
||||
try
|
||||
if !has('win32') && $OSTYPE !~? 'cygwin\|linux' && system('uname -s') =~? 'SunOS' && system('uname -r') =~# '^5'
|
||||
let s:find_arg = '-l'
|
||||
endif
|
||||
" Check for -l support.
|
||||
call s:get_page(s:get_path('', 'man'))
|
||||
catch /E145:/
|
||||
" Ignore the error in restricted mode
|
||||
catch /command error .*/
|
||||
let s:localfile_arg = v:false
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! man#open_page(count, mods, ...) abort
|
||||
function! man#open_page(count, count1, mods, ...) abort
|
||||
if a:0 > 2
|
||||
call s:error('too many arguments')
|
||||
return
|
||||
@ -38,38 +52,51 @@ function! man#open_page(count, mods, ...) abort
|
||||
let ref = a:2.'('.a:1.')'
|
||||
endif
|
||||
try
|
||||
let [sect, name] = s:extract_sect_and_name_ref(ref)
|
||||
if a:count >= 0
|
||||
let [sect, name] = man#extract_sect_and_name_ref(ref)
|
||||
if a:count ==# a:count1
|
||||
" v:count defaults to 0 which is a valid section, and v:count1 defaults to
|
||||
" 1, also a valid section. If they are equal, count explicitly set.
|
||||
let sect = string(a:count)
|
||||
endif
|
||||
let path = s:verify_exists(sect, name)
|
||||
let [sect, name] = s:extract_sect_and_name_path(path)
|
||||
let [sect, name, path] = s:verify_exists(sect, name)
|
||||
catch
|
||||
call s:error(v:exception)
|
||||
return
|
||||
endtry
|
||||
|
||||
let [l:buf, l:save_tfu] = [bufnr(), &tagfunc]
|
||||
call s:push_tag()
|
||||
let bufname = 'man://'.name.(empty(sect)?'':'('.sect.')')
|
||||
|
||||
try
|
||||
setlocal tagfunc=man#goto_tag
|
||||
let l:target = l:name . '(' . l:sect . ')'
|
||||
set eventignore+=BufReadCmd
|
||||
if a:mods !~# 'tab' && s:find_man()
|
||||
execute 'silent keepalt tag' l:target
|
||||
execute 'silent keepalt edit' fnameescape(bufname)
|
||||
else
|
||||
execute 'silent keepalt' a:mods 'stag' l:target
|
||||
execute 'silent keepalt' a:mods 'split' fnameescape(bufname)
|
||||
endif
|
||||
finally
|
||||
call setbufvar(l:buf, '&tagfunc', l:save_tfu)
|
||||
set eventignore-=BufReadCmd
|
||||
endtry
|
||||
|
||||
try
|
||||
let page = s:get_page(path)
|
||||
catch
|
||||
if a:mods =~# 'tab' || !s:find_man()
|
||||
" a new window was opened
|
||||
close
|
||||
endif
|
||||
call s:error(v:exception)
|
||||
return
|
||||
endtry
|
||||
|
||||
let b:man_sect = sect
|
||||
call s:put_page(page)
|
||||
endfunction
|
||||
|
||||
function! man#read_page(ref) abort
|
||||
try
|
||||
let [sect, name] = s:extract_sect_and_name_ref(a:ref)
|
||||
let path = s:verify_exists(sect, name)
|
||||
let [sect, name] = s:extract_sect_and_name_path(path)
|
||||
let [sect, name] = man#extract_sect_and_name_ref(a:ref)
|
||||
let [sect, name, path] = s:verify_exists(sect, name)
|
||||
let page = s:get_page(path)
|
||||
catch
|
||||
call s:error(v:exception)
|
||||
@ -123,9 +150,8 @@ endfunction
|
||||
|
||||
function! s:get_page(path) abort
|
||||
" Disable hard-wrap by using a big $MANWIDTH (max 1000 on some systems #9065).
|
||||
" Soft-wrap: ftplugin/man.vim sets wrap/breakindent/….
|
||||
" Hard-wrap: driven by `man`.
|
||||
let manwidth = !get(g:, 'man_hardwrap', 1) ? 999 : (empty($MANWIDTH) ? winwidth(0) : $MANWIDTH)
|
||||
" We use soft wrap: ftplugin/man.vim sets wrap/breakindent/….
|
||||
let manwidth = 999
|
||||
" Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db).
|
||||
" http://comments.gmane.org/gmane.editors.vim.devel/29085
|
||||
" Set MAN_KEEP_FORMATTING so Debian man doesn't discard backspaces.
|
||||
@ -136,7 +162,6 @@ endfunction
|
||||
function! s:put_page(page) abort
|
||||
setlocal modifiable
|
||||
setlocal noreadonly
|
||||
setlocal noswapfile
|
||||
silent keepjumps %delete _
|
||||
silent put =a:page
|
||||
while getline(1) =~# '^\s*$'
|
||||
@ -178,7 +203,7 @@ endfunction
|
||||
|
||||
" attempt to extract the name and sect out of 'name(sect)'
|
||||
" otherwise just return the largest string of valid characters in ref
|
||||
function! s:extract_sect_and_name_ref(ref) abort
|
||||
function! man#extract_sect_and_name_ref(ref) abort
|
||||
if a:ref[0] ==# '-' " try ':Man -pandoc' with this disabled.
|
||||
throw 'manpage name cannot start with ''-'''
|
||||
endif
|
||||
@ -188,7 +213,7 @@ function! s:extract_sect_and_name_ref(ref) abort
|
||||
if empty(name)
|
||||
throw 'manpage reference cannot contain only parentheses'
|
||||
endif
|
||||
return ['', name]
|
||||
return [get(b:, 'man_default_sects', ''), name]
|
||||
endif
|
||||
let left = split(ref, '(')
|
||||
" see ':Man 3X curses' on why tolower.
|
||||
@ -211,62 +236,42 @@ function! s:get_path(sect, name) abort
|
||||
return substitute(get(split(s:system(['man', s:find_arg, s:section_arg, a:sect, a:name])), 0, ''), '\n\+$', '', '')
|
||||
endfunction
|
||||
|
||||
" s:verify_exists attempts to find the path to a manpage
|
||||
" based on the passed section and name.
|
||||
"
|
||||
" 1. If the passed section is empty, b:man_default_sects is used.
|
||||
" 2. If manpage could not be found with the given sect and name,
|
||||
" then another attempt is made with b:man_default_sects.
|
||||
" 3. If it still could not be found, then we try again without a section.
|
||||
" 4. If still not found but $MANSECT is set, then we try again with $MANSECT
|
||||
" unset.
|
||||
"
|
||||
" This function is careful to avoid duplicating a search if a previous
|
||||
" step has already done it. i.e if we use b:man_default_sects in step 1,
|
||||
" then we don't do it again in step 2.
|
||||
function! s:verify_exists(sect, name) abort
|
||||
let sect = a:sect
|
||||
if empty(sect)
|
||||
let sect = get(b:, 'man_default_sects', '')
|
||||
endif
|
||||
|
||||
try
|
||||
return s:get_path(sect, a:name)
|
||||
let path = s:get_path(a:sect, a:name)
|
||||
catch /^command error (/
|
||||
try
|
||||
let path = s:get_path(get(b:, 'man_default_sects', ''), a:name)
|
||||
catch /^command error (/
|
||||
let path = s:get_path('', a:name)
|
||||
endtry
|
||||
endtry
|
||||
|
||||
if !empty(get(b:, 'man_default_sects', '')) && sect !=# b:man_default_sects
|
||||
try
|
||||
return s:get_path(b:man_default_sects, a:name)
|
||||
catch /^command error (/
|
||||
endtry
|
||||
endif
|
||||
|
||||
if !empty(sect)
|
||||
try
|
||||
return s:get_path('', a:name)
|
||||
catch /^command error (/
|
||||
endtry
|
||||
endif
|
||||
|
||||
if !empty($MANSECT)
|
||||
try
|
||||
let MANSECT = $MANSECT
|
||||
call setenv('MANSECT', v:null)
|
||||
return s:get_path('', a:name)
|
||||
catch /^command error (/
|
||||
finally
|
||||
call setenv('MANSECT', MANSECT)
|
||||
endtry
|
||||
endif
|
||||
|
||||
throw 'no manual entry for ' . a:name
|
||||
" Extract the section from the path, because sometimes the actual section is
|
||||
" more specific than what we provided to `man` (try `:Man 3 App::CLI`).
|
||||
" Also on linux, name seems to be case-insensitive. So for `:Man PRIntf`, we
|
||||
" still want the name of the buffer to be 'printf'.
|
||||
return s:extract_sect_and_name_path(path) + [path]
|
||||
endfunction
|
||||
|
||||
" Extracts the name/section from the 'path/name.sect', because sometimes the actual section is
|
||||
" more specific than what we provided to `man` (try `:Man 3 App::CLI`).
|
||||
" Also on linux, name seems to be case-insensitive. So for `:Man PRIntf`, we
|
||||
" still want the name of the buffer to be 'printf'.
|
||||
let s:tag_stack = []
|
||||
|
||||
function! s:push_tag() abort
|
||||
let s:tag_stack += [{
|
||||
\ 'buf': bufnr('%'),
|
||||
\ 'lnum': line('.'),
|
||||
\ 'col': col('.'),
|
||||
\ }]
|
||||
endfunction
|
||||
|
||||
function! man#pop_tag() abort
|
||||
if !empty(s:tag_stack)
|
||||
let tag = remove(s:tag_stack, -1)
|
||||
execute 'silent' tag['buf'].'buffer'
|
||||
call cursor(tag['lnum'], tag['col'])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" extracts the name and sect out of 'path/name.sect'
|
||||
function! s:extract_sect_and_name_path(path) abort
|
||||
let tail = fnamemodify(a:path, ':t')
|
||||
if a:path =~# '\.\%([glx]z\|bz2\|lzma\|Z\)$' " valid extensions
|
||||
@ -278,16 +283,20 @@ function! s:extract_sect_and_name_path(path) abort
|
||||
endfunction
|
||||
|
||||
function! s:find_man() abort
|
||||
let l:win = 1
|
||||
while l:win <= winnr('$')
|
||||
let l:buf = winbufnr(l:win)
|
||||
if getbufvar(l:buf, '&filetype', '') ==# 'man'
|
||||
execute l:win.'wincmd w'
|
||||
if &filetype ==# 'man'
|
||||
return 1
|
||||
elseif winnr('$') ==# 1
|
||||
return 0
|
||||
endif
|
||||
let thiswin = winnr()
|
||||
while 1
|
||||
wincmd w
|
||||
if &filetype ==# 'man'
|
||||
return 1
|
||||
elseif thiswin ==# winnr()
|
||||
return 0
|
||||
endif
|
||||
let l:win += 1
|
||||
endwhile
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! s:error(msg) abort
|
||||
@ -297,7 +306,7 @@ function! s:error(msg) abort
|
||||
echohl None
|
||||
endfunction
|
||||
|
||||
" see s:extract_sect_and_name_ref on why tolower(sect)
|
||||
" see man#extract_sect_and_name_ref on why tolower(sect)
|
||||
function! man#complete(arg_lead, cmd_line, cursor_pos) abort
|
||||
let args = split(a:cmd_line)
|
||||
let cmd_offset = index(args, 'Man')
|
||||
@ -350,35 +359,14 @@ function! man#complete(arg_lead, cmd_line, cursor_pos) abort
|
||||
return s:complete(sect, sect, name)
|
||||
endfunction
|
||||
|
||||
function! s:get_paths(sect, name, do_fallback) abort
|
||||
" callers must try-catch this, as some `man` implementations don't support `s:find_arg`
|
||||
function! s:complete(sect, psect, name) abort
|
||||
try
|
||||
let mandirs = join(split(s:system(['man', s:find_arg]), ':\|\n'), ',')
|
||||
let paths = globpath(mandirs, 'man?/'.a:name.'*.'.a:sect.'*', 0, 1)
|
||||
try
|
||||
" Prioritize the result from verify_exists as it obeys b:man_default_sects.
|
||||
let first = s:verify_exists(a:sect, a:name)
|
||||
let paths = filter(paths, 'v:val !=# first')
|
||||
let paths = [first] + paths
|
||||
catch
|
||||
endtry
|
||||
return paths
|
||||
catch
|
||||
if !a:do_fallback
|
||||
throw v:exception
|
||||
endif
|
||||
|
||||
" Fallback to a single path, with the page we're trying to find.
|
||||
try
|
||||
return [s:verify_exists(a:sect, a:name)]
|
||||
catch
|
||||
return []
|
||||
endtry
|
||||
call s:error(v:exception)
|
||||
return
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! s:complete(sect, psect, name) abort
|
||||
let pages = s:get_paths(a:sect, a:name, v:false)
|
||||
let pages = globpath(mandirs,'man?/'.a:name.'*.'.a:sect.'*', 0, 1)
|
||||
" We remove duplicates in case the same manpage in different languages was found.
|
||||
return uniq(sort(map(pages, 's:format_candidate(v:val, a:psect)'), 'i'))
|
||||
endfunction
|
||||
@ -398,10 +386,6 @@ function! s:format_candidate(path, psect) abort
|
||||
endfunction
|
||||
|
||||
function! man#init_pager() abort
|
||||
" https://github.com/neovim/neovim/issues/6828
|
||||
let og_modifiable = &modifiable
|
||||
setlocal modifiable
|
||||
|
||||
if getline(1) =~# '^\s*$'
|
||||
silent keepjumps 1delete _
|
||||
else
|
||||
@ -412,43 +396,13 @@ function! man#init_pager() abort
|
||||
" know the correct casing, cf. `man glDrawArraysInstanced`).
|
||||
let ref = substitute(matchstr(getline(1), '^[^)]\+)'), ' ', '_', 'g')
|
||||
try
|
||||
let b:man_sect = s:extract_sect_and_name_ref(ref)[0]
|
||||
let b:man_sect = man#extract_sect_and_name_ref(ref)[0]
|
||||
catch
|
||||
let b:man_sect = ''
|
||||
endtry
|
||||
if -1 == match(bufname('%'), 'man:\/\/') " Avoid duplicate buffers, E95.
|
||||
execute 'silent file man://'.tolower(fnameescape(ref))
|
||||
endif
|
||||
|
||||
let &l:modifiable = og_modifiable
|
||||
endfunction
|
||||
|
||||
function! man#goto_tag(pattern, flags, info) abort
|
||||
let [l:sect, l:name] = s:extract_sect_and_name_ref(a:pattern)
|
||||
|
||||
let l:paths = s:get_paths(l:sect, l:name, v:true)
|
||||
let l:structured = []
|
||||
|
||||
for l:path in l:paths
|
||||
let [l:sect, l:name] = s:extract_sect_and_name_path(l:path)
|
||||
let l:structured += [{
|
||||
\ 'name': l:name,
|
||||
\ 'title': l:name . '(' . l:sect . ')'
|
||||
\ }]
|
||||
endfor
|
||||
|
||||
if &cscopetag
|
||||
" return only a single entry so we work well with :cstag (#11675)
|
||||
let l:structured = l:structured[:0]
|
||||
endif
|
||||
|
||||
return map(l:structured, {
|
||||
\ _, entry -> {
|
||||
\ 'name': entry.name,
|
||||
\ 'filename': 'man://' . entry.title,
|
||||
\ 'cmd': '1'
|
||||
\ }
|
||||
\ })
|
||||
endfunction
|
||||
|
||||
call man#init()
|
||||
call s:init()
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,8 @@
|
||||
" netrwFileHandlers: contains various extension-based file handlers for
|
||||
" netrw's browsers' x command ("eXecute launcher")
|
||||
" Author: Charles E. Campbell
|
||||
" Date: Sep 18, 2020
|
||||
" Version: 11
|
||||
" Date: May 03, 2013
|
||||
" Version: 11b ASTRO-ONLY
|
||||
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
@ -20,7 +20,7 @@
|
||||
if exists("g:loaded_netrwFileHandlers") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_netrwFileHandlers= "v11"
|
||||
let g:loaded_netrwFileHandlers= "v11b"
|
||||
if v:version < 702
|
||||
echohl WarningMsg
|
||||
echo "***warning*** this version of netrwFileHandlers needs vim 7.2"
|
||||
|
@ -1,7 +1,7 @@
|
||||
" netrwSettings.vim: makes netrw settings simpler
|
||||
" Date: Nov 09, 2016
|
||||
" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
|
||||
" Version: 16
|
||||
" Date: Dec 30, 2014
|
||||
" Maintainer: Charles E Campbell <drchipNOSPAM at campbellfamily dot biz>
|
||||
" Version: 15
|
||||
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
@ -19,7 +19,7 @@
|
||||
if exists("g:loaded_netrwSettings") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_netrwSettings = "v16"
|
||||
let g:loaded_netrwSettings = "v15"
|
||||
if v:version < 700
|
||||
echohl WarningMsg
|
||||
echo "***warning*** this version of netrwSettings needs vim 7.0"
|
||||
@ -154,13 +154,9 @@ fun! netrwSettings#NetrwSettings()
|
||||
put = 'let g:netrw_list_hide = '.g:netrw_list_hide
|
||||
put = 'let g:netrw_liststyle = '.g:netrw_liststyle
|
||||
put = 'let g:netrw_localcopycmd = '.g:netrw_localcopycmd
|
||||
put = 'let g:netrw_localcopycmdopt = '.g:netrw_localcopycmdopt
|
||||
put = 'let g:netrw_localmkdir = '.g:netrw_localmkdir
|
||||
put = 'let g:netrw_localmkdiropt = '.g:netrw_localmkdiropt
|
||||
put = 'let g:netrw_localmovecmd = '.g:netrw_localmovecmd
|
||||
put = 'let g:netrw_localmovecmdopt = '.g:netrw_localmovecmdopt
|
||||
put = 'let g:netrw_localrmdir = '.g:netrw_localrmdir
|
||||
put = 'let g:netrw_localrmdiropt = '.g:netrw_localrmdiropt
|
||||
put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen
|
||||
put = 'let g:netrw_menu = '.g:netrw_menu
|
||||
put = 'let g:netrw_mousemaps = '.g:netrw_mousemaps
|
||||
|
@ -18,5 +18,61 @@
|
||||
" holder be liable for any damages resulting from the use
|
||||
" of this software.
|
||||
function! netrw_gitignore#Hide(...)
|
||||
return substitute(substitute(system('git ls-files --other --ignored --exclude-standard --directory'), '\n', ',', 'g'), ',$', '', '')
|
||||
let additional_files = a:000
|
||||
|
||||
let default_files = ['.gitignore', '.git/info/exclude']
|
||||
|
||||
" get existing global/system gitignore files
|
||||
let global_gitignore = expand(substitute(system("git config --global core.excludesfile"), '\n', '', 'g'))
|
||||
if global_gitignore !=# ''
|
||||
let default_files = add(default_files, global_gitignore)
|
||||
endif
|
||||
let system_gitignore = expand(substitute(system("git config --system core.excludesfile"), '\n', '', 'g'))
|
||||
if system_gitignore !=# ''
|
||||
let default_files = add(default_files, system_gitignore)
|
||||
endif
|
||||
|
||||
" append additional files if given as function arguments
|
||||
if additional_files !=# []
|
||||
let files = extend(default_files, additional_files)
|
||||
else
|
||||
let files = default_files
|
||||
endif
|
||||
|
||||
" keep only existing/readable files
|
||||
let gitignore_files = []
|
||||
for file in files
|
||||
if filereadable(file)
|
||||
let gitignore_files = add(gitignore_files, file)
|
||||
endif
|
||||
endfor
|
||||
|
||||
" get contents of gitignore patterns from those files
|
||||
let gitignore_lines = []
|
||||
for file in gitignore_files
|
||||
for line in readfile(file)
|
||||
" filter empty lines and comments
|
||||
if line !~# '^#' && line !~# '^$'
|
||||
let gitignore_lines = add(gitignore_lines, line)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
" convert gitignore patterns to Netrw/Vim regex patterns
|
||||
let escaped_lines = []
|
||||
for line in gitignore_lines
|
||||
let escaped = line
|
||||
let escaped = substitute(escaped, '\*\*', '*', 'g')
|
||||
let escaped = substitute(escaped, '\.', '\\.', 'g')
|
||||
let escaped = substitute(escaped, '\$', '\\$', 'g')
|
||||
let escaped = substitute(escaped, '*', '.*', 'g')
|
||||
" correction: dot, dollar and asterisks chars shouldn't be escaped when
|
||||
" within regex matching groups.
|
||||
let escaped = substitute(escaped, '\(\[[^]]*\)\zs\\\.', '\.', 'g')
|
||||
let escaped = substitute(escaped, '\(\[[^]]*\)\zs\\\$', '\$', 'g')
|
||||
let escaped = substitute(escaped, '\(\[[^]]*\)\zs\.\*', '*', 'g')
|
||||
let escaped_lines = add(escaped_lines, escaped)
|
||||
endfor
|
||||
|
||||
return join(escaped_lines, ',')
|
||||
endfunction
|
||||
|
@ -1,25 +1,35 @@
|
||||
" Vim support file to help with paste mappings and menus
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2019 Jan 27
|
||||
" Last Change: 2017 Aug 30
|
||||
|
||||
" Define the string to use for items that are present both in Edit, Popup and
|
||||
" Toolbar menu. Also used in mswin.vim and macmap.vim.
|
||||
|
||||
let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"}
|
||||
let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n']
|
||||
let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP"
|
||||
" Pasting blockwise and linewise selections is not possible in Insert and
|
||||
" Visual mode without the +virtualedit feature. They are pasted as if they
|
||||
" were characterwise instead. Add to that some tricks to leave the cursor in
|
||||
" the right position, also for "gi".
|
||||
if has("virtualedit")
|
||||
let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"}
|
||||
let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n']
|
||||
let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP"
|
||||
|
||||
func! paste#Paste()
|
||||
let ove = &ve
|
||||
set ve=all
|
||||
normal! `^
|
||||
if @+ != ''
|
||||
normal! "+gP
|
||||
endif
|
||||
let c = col(".")
|
||||
normal! i
|
||||
if col(".") < c " compensate for i<ESC> moving the cursor left
|
||||
normal! l
|
||||
endif
|
||||
let &ve = ove
|
||||
endfunc
|
||||
func! paste#Paste()
|
||||
let ove = &ve
|
||||
set ve=all
|
||||
normal! `^
|
||||
if @+ != ''
|
||||
normal! "+gP
|
||||
endif
|
||||
let c = col(".")
|
||||
normal! i
|
||||
if col(".") < c " compensate for i<ESC> moving the cursor left
|
||||
normal! l
|
||||
endif
|
||||
let &ve = ove
|
||||
endfunc
|
||||
else
|
||||
let paste#paste_cmd = {'n': "\"=@+.'xy'<CR>gPFx\"_2x"}
|
||||
let paste#paste_cmd['v'] = '"-c<Esc>gix<Esc>' . paste#paste_cmd['n'] . '"_x'
|
||||
let paste#paste_cmd['i'] = 'x<Esc>' . paste#paste_cmd['n'] . '"_s'
|
||||
endif
|
||||
|
@ -3,11 +3,8 @@
|
||||
" Start the provider and perform a 'poll' request
|
||||
"
|
||||
" Returns a valid channel on success
|
||||
function! provider#Poll(argv, orig_name, log_env, ...) abort
|
||||
function! provider#Poll(argv, orig_name, log_env) abort
|
||||
let job = {'rpc': v:true, 'stderr_buffered': v:true}
|
||||
if a:0
|
||||
let job = extend(job, a:1)
|
||||
endif
|
||||
try
|
||||
let channel_id = jobstart(a:argv, job)
|
||||
if channel_id > 0 && rpcrequest(channel_id, 'poll') ==# 'ok'
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user