diff options
Diffstat (limited to '')
-rw-r--r-- | data/.coveragerc.in | 25 | ||||
-rw-r--r-- | data/com.mesonbuild.install.policy | 22 | ||||
-rw-r--r-- | data/macros.meson | 45 | ||||
-rw-r--r-- | data/schema.xsd | 96 | ||||
-rw-r--r-- | data/shell-completions/bash/meson | 492 | ||||
-rw-r--r-- | data/shell-completions/zsh/_meson | 425 | ||||
-rw-r--r-- | data/syntax-highlighting/vim/README | 4 | ||||
-rw-r--r-- | data/syntax-highlighting/vim/ftdetect/meson.vim | 3 | ||||
-rw-r--r-- | data/syntax-highlighting/vim/ftplugin/meson.vim | 39 | ||||
-rw-r--r-- | data/syntax-highlighting/vim/indent/meson.vim | 183 | ||||
-rw-r--r-- | data/syntax-highlighting/vim/syntax/meson.vim | 162 | ||||
-rw-r--r-- | data/test.schema.json | 179 |
12 files changed, 1675 insertions, 0 deletions
diff --git a/data/.coveragerc.in b/data/.coveragerc.in new file mode 100644 index 0000000..328e13c --- /dev/null +++ b/data/.coveragerc.in @@ -0,0 +1,25 @@ +[run] +branch = True +parallel = True +concurrency = multiprocessing +data_file = @ROOT@/.coverage/coverage +source = @ROOT@/mesonbuild/ + +[report] +exclude_lines = + if T.TYPE_CHECKING: + +[paths] +mesonbuild = + mesonbuild/ + __w/meson/meson/mesonbuild/ + @ROOT@/mesonbuild/ + +[html] +directory = @ROOT@/.coverage/html + +[xml] +output = @ROOT@/.coverage/coverage.xml + +[json] +output = @ROOT@/.coverage/coverage.json diff --git a/data/com.mesonbuild.install.policy b/data/com.mesonbuild.install.policy new file mode 100644 index 0000000..65bf3ef --- /dev/null +++ b/data/com.mesonbuild.install.policy @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD polkit Policy Configuration 1.0//EN" +"http://www.freedesktop.org/software/polkit/policyconfig-1.dtd"> +<policyconfig> + + <vendor>The Meson Build System</vendor> + <vendor_url>https://github.com/mesonbuild/meson</vendor_url> + + <action id="com.mesonbuild.install.run"> + <description>Install the given project via Meson</description> + <message>Authentication is required to install this project</message> + <icon_name>preferences-system</icon_name> + <defaults> + <allow_any>no</allow_any> + <allow_inactive>no</allow_inactive> + <allow_active>auth_admin_keep</allow_active> + </defaults> + <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/python3</annotate> + <annotate key="org.freedesktop.policykit.exec.argv1">/usr/bin/meson</annotate> + </action> + +</policyconfig> diff --git a/data/macros.meson b/data/macros.meson new file mode 100644 index 0000000..f5e3a15 --- /dev/null +++ b/data/macros.meson @@ -0,0 +1,45 @@ +%__meson %{_bindir}/meson +%__meson_wrap_mode nodownload +%__meson_auto_features enabled + +%meson \ + %set_build_flags \ + %{shrink:%{__meson} setup \ + --buildtype=plain \ + --prefix=%{_prefix} \ + --libdir=%{_libdir} \ + --libexecdir=%{_libexecdir} \ + --bindir=%{_bindir} \ + --sbindir=%{_sbindir} \ + --includedir=%{_includedir} \ + --datadir=%{_datadir} \ + --mandir=%{_mandir} \ + --infodir=%{_infodir} \ + --localedir=%{_datadir}/locale \ + --sysconfdir=%{_sysconfdir} \ + --localstatedir=%{_localstatedir} \ + --sharedstatedir=%{_sharedstatedir} \ + --wrap-mode=%{__meson_wrap_mode} \ + --auto-features=%{__meson_auto_features} \ + %{_vpath_srcdir} %{_vpath_builddir} \ + %{nil}} + +%meson_build \ + %{shrink:%{__meson} compile \ + -C %{_vpath_builddir} \ + -j %{_smp_build_ncpus} \ + --verbose \ + %{nil}} + +%meson_install \ + %{shrink:DESTDIR=%{buildroot} %{__meson} install \ + -C %{_vpath_builddir} \ + --no-rebuild \ + %{nil}} + +%meson_test \ + %{shrink:%{__meson} test \ + -C %{_vpath_builddir} \ + --num-processes %{_smp_build_ncpus} \ + --print-errorlogs \ + %{nil}} diff --git a/data/schema.xsd b/data/schema.xsd new file mode 100644 index 0000000..58c6bfd --- /dev/null +++ b/data/schema.xsd @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- from https://svn.jenkins-ci.org/trunk/hudson/dtkit/dtkit-format/dtkit-junit-model/src/main/resources/com/thalesgroup/dtkit/junit/model/xsd/junit-4.xsd --> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xs:element name="failure"> + <xs:complexType mixed="true"> + <xs:attribute name="type" type="xs:string" use="optional"/> + <xs:attribute name="message" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + + <xs:element name="error"> + <xs:complexType mixed="true"> + <xs:attribute name="type" type="xs:string" use="optional"/> + <xs:attribute name="message" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + + <xs:element name="properties"> + <xs:complexType> + <xs:sequence> + <xs:element ref="property" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="property"> + <xs:complexType> + <xs:attribute name="name" type="xs:string" use="required"/> + <xs:attribute name="value" type="xs:string" use="required"/> + </xs:complexType> + </xs:element> + + <xs:element name="skipped"> + <xs:complexType mixed="true"> + <xs:attribute name="message" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + + <xs:element name="system-err" type="xs:string"/> + <xs:element name="system-out" type="xs:string"/> + + <xs:element name="testcase"> + <xs:complexType> + <xs:sequence> + <xs:element ref="skipped" minOccurs="0" maxOccurs="1"/> + <xs:element ref="error" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="failure" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="system-out" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="system-err" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute name="name" type="xs:string" use="required"/> + <xs:attribute name="assertions" type="xs:string" use="optional"/> + <xs:attribute name="time" type="xs:string" use="optional"/> + <xs:attribute name="classname" type="xs:string" use="optional"/> + <xs:attribute name="status" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + + <xs:element name="testsuite"> + <xs:complexType> + <xs:sequence> + <xs:element ref="properties" minOccurs="0" maxOccurs="1"/> + <xs:element ref="testcase" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="system-out" minOccurs="0" maxOccurs="1"/> + <xs:element ref="system-err" minOccurs="0" maxOccurs="1"/> + </xs:sequence> + <xs:attribute name="name" type="xs:string" use="required"/> + <xs:attribute name="tests" type="xs:string" use="required"/> + <xs:attribute name="failures" type="xs:string" use="optional"/> + <xs:attribute name="errors" type="xs:string" use="optional"/> + <xs:attribute name="time" type="xs:string" use="optional"/> + <xs:attribute name="disabled" type="xs:string" use="optional"/> + <xs:attribute name="skipped" type="xs:string" use="optional"/> + <xs:attribute name="timestamp" type="xs:string" use="optional"/> + <xs:attribute name="hostname" type="xs:string" use="optional"/> + <xs:attribute name="id" type="xs:string" use="optional"/> + <xs:attribute name="package" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + + <xs:element name="testsuites"> + <xs:complexType> + <xs:sequence> + <xs:element ref="testsuite" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute name="name" type="xs:string" use="optional"/> + <xs:attribute name="time" type="xs:string" use="optional"/> + <xs:attribute name="tests" type="xs:string" use="optional"/> + <xs:attribute name="failures" type="xs:string" use="optional"/> + <xs:attribute name="disabled" type="xs:string" use="optional"/> + <xs:attribute name="errors" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + +</xs:schema> diff --git a/data/shell-completions/bash/meson b/data/shell-completions/bash/meson new file mode 100644 index 0000000..4357a3f --- /dev/null +++ b/data/shell-completions/bash/meson @@ -0,0 +1,492 @@ +_meson() { + command="${COMP_WORDS[1]}" + meson_subcommands=( + setup + configure + dist + install + introspect + init + test + wrap + subprojects + help + rewrite + compile + devenv + env2mfile + ) + + if [[ " ${meson_subcommands[*]} " =~ " ${command} " ]]; then + _meson-$command "${COMP_WORDS[@]:1}" + else + _meson-setup "${COMP_WORDS[@]}" + fi +} && +complete -F _meson meson + +_meson_complete_option() { + option_string=$1 + + if [[ $# -eq 2 ]] && ! [[ "$option_string" == *=* ]]; then + option_string="$option_string=$2" + fi + + if [[ "$option_string" == *=* ]]; then + _meson_complete_option_value "$option_string" + else + _meson_complete_option_name "$option_string" + fi +} + +_meson_complete_option_name() { + option=$1 + options=($(python3 -c 'import sys, json +for option in json.load(sys.stdin): + print(option["name"]) +' <<< "$(_meson_get_options)")) + compopt -o nospace + COMPREPLY=($(compgen -W '${options[@]}' -S= -- "$option")) +} + +_meson_complete_option_value() { + cur=$1 + option_name=${cur%%=*} + option_value=${cur#*=} + + if _meson_complete_filedir "$option_name" "$option_value"; then + return + fi + +# TODO: support all the option types + options=($(python3 -c 'import sys, json +for option in json.load(sys.stdin): + if option["name"] != "'$option_name'": + continue + choices = [] + if option["type"] == "boolean": + choices.append("true") + choices.append("false") + elif option["type"] == "combo": + for choice in option["choices"]: + choices.append(choice) + for choice in choices: + if choice.startswith("'$cur'"): + print(choice) +' <<< "$(_meson_get_options)")) + COMPREPLY=("${options[@]}") +} + +_meson_get_options() { + local options + for builddir in "${COMP_WORDS[@]}"; do + if [ -d "$builddir" ]; then + break + fi + builddir=. + done + options=$(meson introspect "$builddir" --buildoptions 2>/dev/null) && + echo "$options" || + echo '[]' +} + +_meson_complete_filedir() { + _filedir_in() { + pushd "$1" &>/dev/null + local COMPREPLY=() + _filedir + echo "${COMPREPLY[@]}" + popd &>/dev/null + } + + option=$1 + cur=$2 + case $option in + prefix |\ + libdir |\ + libexecdir |\ + bindir |\ + sbindir |\ + includedir |\ + datadir |\ + mandir |\ + infodir |\ + localedir |\ + sysconfdir |\ + localstatedir |\ + sharedstatedir) + _filedir -d + ;; + cross-file) + _filedir + COMPREPLY+=($(_filedir_in "$XDG_DATA_DIRS"/meson/cross)) + COMPREPLY+=($(_filedir_in /usr/local/share/meson/cross)) + COMPREPLY+=($(_filedir_in /usr/share/meson/cross)) + COMPREPLY+=($(_filedir_in "$XDG_DATA_HOME"/meson/cross)) + COMPREPLY+=($(_filedir_in ~/.local/share/meson/cross)) + ;; + *) + return 1;; + esac + return 0 +} + +_meson-setup() { + + shortopts=( + h + D + v + ) + + longopts=( + help + prefix + libdir + libexecdir + bindir + sbindir + includedir + datadir + mandir + infodir + localedir + sysconfdir + localstatedir + sharedstatedir + backend + buildtype + strip + unity + werror + layout + default-library + warnlevel + stdsplit + errorlogs + cross-file + version + wrap-mode + ) + + local cur prev + if _get_comp_words_by_ref cur prev &>/dev/null && + [ "${prev:0:2}" = '--' ] && _meson_complete_option "${prev:2}" "$cur"; then + return + elif _get_comp_words_by_ref cur prev &>/dev/null && + [ "${prev:0:1}" = '-' ] && [ "${prev:1:2}" != '-' ] && _meson_complete_option "${prev:1}"; then + return + elif _get_comp_words_by_ref -n '=' cur prev &>/dev/null; then + if [ $prev == -D ]; then + _meson_complete_option "$cur" + return + fi + else + cur="${COMP_WORDS[COMP_CWORD]}" + fi + + if [[ "$cur" == "--"* ]]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}")) + elif [[ "$cur" == "-"* ]]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}")) + COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}' -- "${cur:1}")) + else + _filedir -d + if [ -z "$cur" ]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}')) + COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}')) + fi + + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY+=($(compgen -W "${meson_subcommands[*]}" -- "$cur")) + fi + fi +} + +_meson-configure() { + + shortopts=( + h + D + ) + + longopts=( + help + clearcache + ) + + local cur prev + if _get_comp_words_by_ref -n '=' cur prev &>/dev/null; then + if [ $prev == -D ]; then + _meson_complete_option "$cur" + return + fi + else + cur="${COMP_WORDS[COMP_CWORD]}" + fi + + if [[ "$cur" == "--"* ]]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}")) + elif [[ "$cur" == "-"* ]]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}")) + COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}' -- "${cur:1}")) + else + for dir in "${COMP_WORDS[@]}"; do + if [ -d "$dir" ]; then + break + fi + dir=. + done + if [ ! -d "$dir/meson-private" ]; then + _filedir -d + fi + + if [ -z "$cur" ]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}')) + COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}')) + fi + fi +} + +_meson-dist() { + : TODO +} + +_meson-install() { + : TODO +} + +_meson-introspect() { + shortopts=( + h + ) + + longopts=( + targets + installed + buildsystem-files + buildoptions + tests + benchmarks + dependencies + projectinfo + ) + + local cur prev + if ! _get_comp_words_by_ref cur prev &>/dev/null; then + cur="${COMP_WORDS[COMP_CWORD]}" + fi + + if [[ "$cur" == "--"* ]]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}")) + elif [[ "$cur" == "-"* ]]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}")) + COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}' -- "${cur:1}")) + else + for dir in "${COMP_WORDS[@]}"; do + if [ -d "$dir" ]; then + break + fi + dir=. + done + if [ ! -d "$dir/meson-private" ]; then + _filedir -d + fi + + if [ -z "$cur" ]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}')) + COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}')) + fi + fi +} + +_meson-init() { + shortopts=( + h + C + n + e + e + d + l + b + f + ) + + longopts=( + help + name + executable + deps + language + builddir + force + type + version + ) + + if [[ "$cur" == "--"* ]]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}")) + elif [[ "$cur" == "-"* && ${#cur} -gt 1 ]]; then + COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}' -- "${cur:1}")) + else + if [ -z "$cur" ]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}')) + COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}')) + fi + fi + +} + +_meson-test() { + shortopts=( + q + v + t + C + ) + + longopts=( + quiet + verbose + timeout-multiplier + repeat + no-rebuild + gdb + list + wrapper --wrap + no-suite + suite + no-stdsplit + print-errorlogs + benchmark + logbase + num-processes + setup + test-args + ) + + local cur prev + if _get_comp_words_by_ref -n ':' cur prev &>/dev/null; then + case $prev in + --repeat) + # number, can't be completed + return + ;; + --wrapper) + _command_offset $COMP_CWORD + return + ;; + -C) + _filedir -d + return + ;; + --suite | --no-suite) + for i in "${!COMP_WORDS[@]}"; do + opt="${COMP_WORDS[i]}" + dir="${COMP_WORDS[i+1]}" + case "$opt" in + -C) + break + ;; + esac + dir=. + done + suites=($(python3 -c 'import sys, json; +for test in json.load(sys.stdin): + for suite in test["suite"]: + print(suite) + ' <<< "$(meson introspect "$dir" --tests)")) +# TODO + COMPREPLY+=($(compgen -W "${suites[*]}" -- "$cur")) + return + ;; + --logbase) + # free string, can't be completed + return + ;; + --num-processes) + # number, can't be completed + return + ;; + -t | --timeout-multiplier) + # number, can't be completed + return + ;; + --setup) + # TODO + return + ;; + --test-args) + return + ;; + esac + else + cur="${COMP_WORDS[COMP_CWORD]}" + fi + + if [[ "$cur" == "--"* ]]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}")) + elif [[ "$cur" == "-"* && ${#cur} -gt 1 ]]; then + COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}' -- "${cur:1}")) + else + for dir in "${COMP_WORDS[@]}"; do + if [ -d "$dir" ]; then + break + fi + dir=. + done + if [ ! -d "$dir/meson-private" ]; then + _filedir -d + fi + + for i in "${!COMP_WORDS[@]}"; do + opt="${COMP_WORDS[i]}" + dir="${COMP_WORDS[i+1]}" + case "$opt" in + -C) + break + ;; + esac + dir=. + done + tests=($(python3 -c 'import sys, json; +for test in json.load(sys.stdin): + print(test["name"]) +' <<< "$(meson introspect "$dir" --tests)")) + COMPREPLY+=($(compgen -W "${tests[*]}" -- "$cur")) + + if [ -z "$cur" ]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}")) + COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}' -- "${cur:1}")) + fi + fi +} + +_meson-wrap() { + : TODO +} + +_meson-subprojects() { + : TODO +} + +_meson-help() { + : # Nothing to do +} + +_meson-rewrite() { + : TODO +} + +_meson-compile() { + : TODO +} + +_meson-devenv() { + : TODO +} + +_meson-env2mfile() { + : TODO +} diff --git a/data/shell-completions/zsh/_meson b/data/shell-completions/zsh/_meson new file mode 100644 index 0000000..18b7b62 --- /dev/null +++ b/data/shell-completions/zsh/_meson @@ -0,0 +1,425 @@ +#compdef meson + +# vim:ts=2 sw=2 + +# Copyright (c) 2017 Arseny Maslennikov +# All rights reserved. Individual authors, whether or not +# specifically named, retain copyright in all changes; in what follows, they +# are referred to as `the Meson development team'. This is for convenience +# only and this body has no legal status. This file is distributed under +# the following licence. +# +# Permission is hereby granted, without written agreement and without +# licence or royalty fees, to use, copy, modify, and distribute this +# software and to distribute modified versions of this software for any +# purpose, provided that the above copyright notice and the following +# two paragraphs appear in all copies of this software. +# +# In no event shall the Meson development team be liable to any party for +# direct, indirect, special, incidental, or consequential damages arising out +# of the use of this software and its documentation, even if the Meson +# development team have been advised of the possibility of such damage. +# +# The Meson development team specifically disclaim any warranties, including, +# but not limited to, the implied warranties of merchantability and fitness +# for a particular purpose. The software provided hereunder is on an "as is" +# basis, and the Meson development team have no obligation to provide +# maintenance, support, updates, enhancements, or modifications. + +local curcontext="$curcontext" state line +local -i ret + +local __meson_backends="(ninja xcode ${(j. .)${:-vs{,2010,2015,2017}}})" +local __meson_build_types="(plain debug debugoptimized minsize release)" +local __meson_wrap_modes="(WrapMode.{default,nofallback,nodownload,forcefallback})" +local __meson_dist_formats=("xztar" "gztar" "zip") +local __meson_cd='-C[change into this directory before running]:target dir:_directories' +local -a __meson_common=( + '--prefix=[installation prefix]: :_directories' + '--bindir=[executable directory]: :_directories' + '--datadir=[data file directory]: :_directories' + '--includedir=[header file directory]: :_directories' + '--infodir=[info page directory]: :_directories' + '--libdir=[library directory]: :_directories' + '--libexecdir=[library executable directory]: :_directories' + '--localedir=[locale data directory]: :_directories' + '--localstatedir=[local state data directory]: :_directories' + '--mandir=[manual page directory]: :_directories' + '--sbindir=[system executable directory]: :_directories' + '--sharedstatedir=[arch-independent data directory]: :_directories' + '--sysconfdir=[system configuration directory]: :_directories' + '--auto-features=[default value for auto features]:auto features types:(auto disabled enabled)' + '--backend=[backend to use]:Meson backend:'"$__meson_backends" + '--buildtype=[build type to use]:Meson build type:'"$__meson_build_types" + '--debug[turn on building with debug]' + '--default-library=[default library type]:default library type:(shared static both)' + '--errorlogs[prints the logs from failing tests]' + '--install-umask=[default umask for permissions of all installed files]' + '--layout=[build directory layout]:build directory layout:(flat mirror)' + '--optimization=[optimization level for compiled targets]:optimization:(0 g 1 2 3 s)' + '--stdsplit=[split stdout and stderr in test logs]' + '--strip[strip targets on install]' + '--unity=[unity builds on/off]:whether to do unity builds:(on off subprojects)' + '--warnlevel=[compiler warning level]:compiler warning level:warning level:(1 2 3)' + '--werror[treat warnings as errors]' + '--wrap-mode=[special wrap mode]:wrap mode:'"$__meson_wrap_modes" + '--force-fallback-for=[force fallback for listed subprojects]' + '--pkg-config-path=[extra paths for HOST pkg-config to search]:paths:_dir_list -s ,' + '--build.pkg-config-path=[extra paths for BUILD pkg-config to search]:paths:_dir_list -s ,' + '--cmake-prefix-path=[extra prefixes for HOST cmake to search]:paths:_dir_list -s ,' + '--build.cmake-prefix-path=[extra prefix for BUILD cmake to search]:paths:_dir_list -s ,' +) + +local -a meson_commands=( +'configure:configure a project' +'dist:generate release archive' +'init:create a new project' +'install:install one more more targets' +'introspect:query project properties' +'setup:set up a build directory' +'test:run tests' +'wrap:manage source dependencies' +'subprojects:manage subprojects' +'compile:Build the project' +) + +(( $+functions[__meson_is_build_dir] )) || __meson_is_build_dir() { + local mpd="${1:-$PWD}/meson-private" + [[ -f "$mpd/build.dat" && -f "$mpd/coredata.dat" ]] + return $? +} + +# TODO: implement build option completion +(( $+functions[__meson_build_options] )) || __meson_build_options() {} + +# `meson introspect` currently can provide that information in JSON. +# We can: +# 1) pipe its output to python3 -m json.tool | grep "$alovelyregex" | cut <...> +# 2) teach mintro.py to use a different output format +# (or perhaps just to select the fields printed) + +(( $+functions[__meson_test_names] )) || __meson_test_names() { + local rtests + if rtests="$(_call_program meson meson test ${opt_args[-C]:+-C "$opt_args[-C]"} --list)"; + then + local -a tests=(${(@f)rtests}) + _describe -t "tests" "Meson tests" tests + else + _message -r "current working directory is not a build directory" + _message -r 'use -C $build_dir or cd $build_dir' + fi +} + +(( $+functions[__meson_wrap_names] )) || __meson_wrap_names() { + local rwraps + rwraps="$(_call_program meson meson wrap list)" + local -a wraps=(${(@f)rwraps}) + _describe -t wraps "Meson wraps" wraps +} + +(( $+functions[__meson_installed_wraps] )) || __meson_installed_wraps() { + local rwraps + if rwraps="$(ls subprojects/ | grep '\.wrap$' | cut -d . -f 1)"; then + local -a wraps=(${(@f)rwraps}) + _describe -t wraps "Meson wraps" wraps + fi +} + +(( $+functions[_meson_commands] )) || _meson_commands() { + _describe -t commands "Meson subcommands" meson_commands +} + +(( $+functions[_meson-setup] )) || _meson-setup() { + local firstd secondd + if [[ -f "meson.build" ]]; then + # if there's no second argument on the command line + # cwd will implicitly be substituted: + # - as the source directory if it has a file with the name "meson.build"; + # - as the build directory otherwise + # more info in mesonbuild/mesonmain.py + firstd="build" + secondd="source" + else + firstd="source" + secondd="build" + fi + + _arguments \ + '*-D-[set the value of a build option]:build option:__meson_build_options' \ + '--cross-file=[cross-compilation environment description]:cross file:_files' \ + '--native-file=[build machine compilation environment description]:native file:_files' \ + '--clearcache[clear cached state]' \ + '--fatal-meson-warnings=[exit when any meson warnings are encountered]' \ + '(-v --version)'{'-v','--version'}'[print the meson version and exit]' \ + '--reconfigure=[re-run build configuration]' \ + '--wipe=[delete saved state and restart using saved command line options]' \ + ":$firstd directory:_directories" \ + "::$secondd directory:_directories" \ + "${(@)__meson_common}" +} + +(( $+functions[_meson-configure] )) || _meson-configure() { + local curcontext="$curcontext" + # TODO: implement 'mesonconf @file' + local -a specs=( + '*-D-[set the value of a build option]:build option:__meson_build_options' + '::build directory:_directories' + ) + + _arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ + "${(@)specs}" \ + "${(@)__meson_common}" +} + +(( $+functions[_meson-test] )) || _meson-test() { + local curcontext="$curcontext" + + # TODO: complete test suites + local -a specs=( + '--repeat[number of times to run the tests]:number of times to repeat: ' + '--no-rebuild[do not rebuild before running tests]' + '--gdb[run tests under gdb]' + '--gdb-path=[program to run for gdb (can be wrapper or compaitble program)]:program:_path_commands' + '--list[list available tests]' + '(--wrapper --wrap)'{'--wrapper=','--wrap='}'[wrapper to run tests with]:wrapper program:_path_commands' + "$__meson_cd" + '(--suite)--no-suite[do not run tests from this suite]:test suite: ' + '(--no-suite)--suite[only run tests from this suite]:test suite: ' + '--no-stdsplit[do not split stderr and stdout in logs]' + '--print-errorlogs[print logs for failing tests]' + '--benchmark[run benchmarks instead of tests]' + '--logbase[base name for log file]:filename: ' + '--num-processes[how many threads to use]:number of processes: ' + '(--verbose -v)'{'--verbose','-v'}'[do not redirect stdout and stderr]' + '(--quiet -q)'{'--quiet','-q'}'[produce less output to the terminal]' + '(--timeout-multiplier -t)'{'--timeout-multiplier','-t'}'[a multiplier for test timeouts]:Python floating-point number: ' + '--setup[which test setup to use]:test setup: ' + '--test-args[arguments to pass to the tests]: : ' + '*:Meson tests:__meson_test_names' + ) + + _arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ + "${(@)specs}" +} + +(( $+functions[_meson-install] )) || _meson-install() { + local curcontext="$curcontext" + local -a specs=( + "$__meson_cd" + '--no-rebuild[Do not rebuild before installing]' + '--only-changed[Do not overwrite files that are older than the copied file]' + '--quiet[Do not print every file that was installed]' + ) +_arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ + "${(@)specs}" +} + +(( $+functions[_meson-introspect] )) || _meson-introspect() { + local curcontext="$curcontext" + local -a specs=( + '--ast[dump the ASK of the meson file]' + '--benchmarks[list all benchmarks]' + '--buildoptions[list all build options]' + '--buildsystem-files[list files that belong to the build system]' + '--dependencies[list external dependencies]' + '--installed[list all installed files and directories]' + '--projectinfo[show project information]' + '--targets[list top level targets]' + '--tests[list all unit tests]' + '--backend=[backend to use]:Meson backend:'"$__meson_backends" + '::build directory:_directories' + ) +_arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ + "${(@)specs}" +} + +(( $+functions[_meson-init] )) || _meson-init() { + local curcontext="$curcontext" + local -a specs=( + "$__meson_cd" + '(-n --name)'{'-n','--name'}'=[the name of the project (defaults to directory name)]' + '(-e --executable)'{'-e','--executable'}'=[the name of the executable target to create (defaults to project name)]' + '(-d --deps)'{'-d','--deps'}'=[comma separated list of dependencies]' + '(-l --language)'{'-l','--language'}'=[comma separated list of languages (autodetected based on sources if unset)]:languages:_values , (c cpp cs cuda d fortran java objc objcpp rust)' + '(-b --build)'{'-b','--build'}'[build the project immediately after generation]' + '--builddir=[directory for building]:directory:_directories' + '(-f --force)'{'-f','--force'}'[overwrite any existing files and directories]' + '(-t --type)'{'-t','--type'}'=[project type, defaults to executable]:type:(executable library)' + '(-v --version)'{'-v','--version'}'[print the meson version and exit]' + ) +_arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ + "${(@)specs}" +} + +(( $+functions[_meson-wrap] )) || _meson-wrap() { + local -a commands=( + 'list:list all available wraps' + 'search:search the db by name' + 'install:install the specified project' + 'update:Update a project to its newest available version' + 'info:Show info about a wrap' + 'status:Show the status of your subprojects' + ) + + if (( CURRENT == 2 )); then + _describe -t commands "Meson wrap subcommands" commands + else + local curcontext="$curcontext" + cmd="${${commands[(r)$words[2]:*]%%:*}}" + if (( $#cmd )); then + if [[ $cmd == status ]]; then + _message "no options" + elif [[ $cmd == "list" ]]; then + _arguments '*:meson wraps' + elif [[ $cmd == "search" ]]; then + _arguments '*:meson wraps' + elif [[ $cmd == "install" ]]; then + _arguments '*:meson wraps:__meson_wrap_names' + elif [[ $cmd == "update" ]]; then + _arguments '*:meson wraps:__meson_installed_wraps' + elif [[ $cmd == "info" ]]; then + _arguments '*:meson wraps:__meson_wrap_name' + elif [[ $cmd == "status" ]]; then + _arguments '*:' + elif [[ $cmd == "promote" ]]; then + # TODO: how do you figure out what wraps are provided by subprojects if + # they haven't been fetched yet? + _arguments '*:' + fi + else + _message "unknown meson wrap command: $words[2]" + fi + fi + +} + +(( $+functions[_meson-dist] )) || _meson-dist() { + local curcontext="$curcontext" + local -a specs=( + '--allow-dirty[Allow even when repository contains uncommitted changes]' + '--formats=[comma separated list of archive types to create]:archive formats:_values -s , format '"$__meson_dist_formats" + '--include-subprojects[Include source code of subprojects that have been used for the build]' + '--no-tests[Do not build and test generated packages]' + "$__meson_cd" + ) +_arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ + "${(@)specs}" +} + +(( $+functions[_meson-subprojects-update] )) || _meson-subprojects-update() { + local curcontext="$curcontext" + local -a specs=( + "--rebase[rebase your branch on top of wrap's revision (git only)]" + '--sourcedir=[path to source directory]:_directories' + '*:subprojects:__meson_installed_wraps' + ) +_arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ + "${(@)specs}" +} + +(( $+functions[_meson-subprojects-checkout] )) || _meson-subprojects-checkout() { + local curcontext="$curcontext" + local -a specs=( + '-b[create a new branch]' + '--sourcedir=[path to source directory]:_directories' + # FIXME: this doesn't work exactly right, but I can't figure it out + ':branch name' + '*:subprojects:__meson_installed_wraps' + ) +_arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ + "${(@)specs}" +} + +(( $+functions[_meson-subprojects-download] )) || _meson-subprojects-download() { + local curcontext="$curcontext" + local -a specs=( + '--sourcedir=[path to source directory]:_directories' + ) +_arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ + "${(@)specs}" +} + +(( $+functions[_meson-subprojects-foreach] )) || _meson-subprojects-foreach() { + local curcontext="$curcontext" + local -a specs=( + '--sourcedir=[path to source directory]:_directories' + '*:command:_command_names -e' + ) +_arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ + "${(@)specs}" +} + +(( $+functions[_meson-subprojects] )) || _meson-subprojects() { + local -a commands=( + 'update:update all subprojects from wrap files' + 'checkout:checkout a branch (git only)' + 'download:ensure subprojects are fetched, even if not in use. Already downloaded subprojects are not modified.' + 'foreach:execute a command in each subproject directory' + ) + + if (( CURRENT == 2 )); then + _describe -t commands "Meson subproject subcommands" commands + else + local curcontext="$curcontext" + cmd="${${commands[(r)$words[2]:*]%%:*}}" + if (( $#cmd )); then + if [[ $cmd == status ]]; then + _message "no options" + else + _meson-subprojects-$cmd + fi + else + _message "unknown meson subproject command: $words[2]" + fi + fi + +} + +(( $+functions[_meson-compile] )) || _meson-compile() { + local curcontext="$curcontext" + local -a specs=( + "$__meson_cd" + '--clean[Clean the build directory]' + '(-j --jobs)'{'-j','--jobs'}'=[the number fo work jobs to run (if supported)]:_guard "[0-9]#" "number of jobs"' + '(-l --load-averate)'{'-l','--load-average'}'=[the system load average to try to maintain (if supported)]:_guard "[0-9]#" "load average"' + '(-v --verbose)'{'-v','--verbose'}'[Show more output]' + '--ninja-args=[Arguments to pass to ninja (only when using ninja)]' + '--vs-args=[Arguments to pass to vs (only when using msbuild)]' + ) +_arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ + "${(@)specs}" +} + +if [[ $service != meson ]]; then + _call_function ret _$service + return ret +fi + +_arguments -C -R \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ + '(: -)'{'--version','-v'}'[show version information and quit]' \ + '(-): :_meson_commands' \ + '*:: :->post-command' \ +# +ret=$? + +[[ $ret = 300 ]] && case "$state" in + post-command) + service="meson-$words[1]" + curcontext=${curcontext%:*:*}:$service: + _call_function ret _$service + ;; +esac + +return ret diff --git a/data/syntax-highlighting/vim/README b/data/syntax-highlighting/vim/README new file mode 100644 index 0000000..95188fc --- /dev/null +++ b/data/syntax-highlighting/vim/README @@ -0,0 +1,4 @@ +ftdetect sets the filetype +ftplugin sets Meson indentation rules +indent does Meson indentation +syntax does Meson syntax highlighting diff --git a/data/syntax-highlighting/vim/ftdetect/meson.vim b/data/syntax-highlighting/vim/ftdetect/meson.vim new file mode 100644 index 0000000..3233c58 --- /dev/null +++ b/data/syntax-highlighting/vim/ftdetect/meson.vim @@ -0,0 +1,3 @@ +au BufNewFile,BufRead meson.build set filetype=meson +au BufNewFile,BufRead meson_options.txt set filetype=meson +au BufNewFile,BufRead *.wrap set filetype=dosini diff --git a/data/syntax-highlighting/vim/ftplugin/meson.vim b/data/syntax-highlighting/vim/ftplugin/meson.vim new file mode 100644 index 0000000..1ce9a03 --- /dev/null +++ b/data/syntax-highlighting/vim/ftplugin/meson.vim @@ -0,0 +1,39 @@ +" Vim filetype plugin file +" Language: meson +" License: VIM License +" Maintainer: Liam Beguin <liambeguin@gmail.com> +" Original Author: Laurent Pinchart <laurent.pinchart@ideasonboard.com> +" Last Change: 2018 Nov 27 + +if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 +let s:keepcpo= &cpo +set cpo&vim + +setlocal commentstring=#\ %s +setlocal comments=:# +setlocal formatoptions+=croql formatoptions-=t + +let b:undo_ftplugin = "setl com< cms< fo<" + +if get(g:, "meson_recommended_style", 1) + setlocal expandtab + setlocal shiftwidth=2 + setlocal softtabstop=2 + let b:undo_ftplugin .= " | setl et< sts< sw<" +endif + +if exists("loaded_matchit") && !exists("b:match_words") + let b:match_words = '\<if\>:\<elif\>:\<else\>:\<endif\>,' . + \ '\<foreach\>:\<break\>:\<continue\>:\<endforeach\>' + let b:undo_ftplugin .= " | unlet! b:match_words" +endif + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "Meson Build Files (meson.build)\tmeson.build\n" . + \ "All Files (*.*)\t*.*\n" + let b:undo_ftplugin .= " | unlet! b:browsefilter" +endif + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/data/syntax-highlighting/vim/indent/meson.vim b/data/syntax-highlighting/vim/indent/meson.vim new file mode 100644 index 0000000..57bea13 --- /dev/null +++ b/data/syntax-highlighting/vim/indent/meson.vim @@ -0,0 +1,183 @@ +" Vim indent file +" Language: Meson +" License: VIM License +" Maintainer: Nirbheek Chauhan <nirbheek.chauhan@gmail.com> +" Liam Beguin <liambeguin@gmail.com> +" Original Authors: David Bustos <bustos@caltech.edu> +" Bram Moolenaar <Bram@vim.org> +" Last Change: 2015 Feb 23 + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +" Some preliminary settings +setlocal nolisp " Make sure lisp indenting doesn't supersede us +setlocal autoindent " indentexpr isn't much help otherwise + +setlocal indentexpr=GetMesonIndent(v:lnum) +setlocal indentkeys+==elif,=else,=endforeach,=endif,0) + +let b:undo_indent = "setl ai< inde< indk< lisp<" + +" Only define the function once. +if exists("*GetMesonIndent") + finish +endif +let s:keepcpo= &cpo +set cpo&vim + +" Come here when loading the script the first time. + +let s:maxoff = 50 " maximum number of lines to look backwards for () + +function GetMesonIndent(lnum) + echom getline(line(".")) + + " If this line is explicitly joined: If the previous line was also joined, + " line it up with that one, otherwise add two 'shiftwidth' + if getline(a:lnum - 1) =~ '\\$' + if a:lnum > 1 && getline(a:lnum - 2) =~ '\\$' + return indent(a:lnum - 1) + endif + return indent(a:lnum - 1) + (exists("g:mesonindent_continue") ? eval(g:mesonindent_continue) : (shiftwidth() * 2)) + endif + + " If the start of the line is in a string don't change the indent. + if has('syntax_items') + \ && synIDattr(synID(a:lnum, 1, 1), "name") =~ "String$" + return -1 + endif + + " Search backwards for the previous non-empty line. + let plnum = prevnonblank(v:lnum - 1) + + if plnum == 0 + " This is the first non-empty line, use zero indent. + return 0 + endif + + " If the previous line is inside parenthesis, use the indent of the starting + " line. + " Trick: use the non-existing "dummy" variable to break out of the loop when + " going too far back. + call cursor(plnum, 1) + let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW', + \ "line('.') < " . (plnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|Todo\\|String\\)$'") + if parlnum > 0 + let plindent = indent(parlnum) + let plnumstart = parlnum + else + let plindent = indent(plnum) + let plnumstart = plnum + endif + + + " When inside parenthesis: If at the first line below the parenthesis add + " a 'shiftwidth', otherwise same as previous line. + " i = (a + " + b + " + c) + call cursor(a:lnum, 1) + let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', + \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|Todo\\|String\\)$'") + if p > 0 + if p == plnum + " When the start is inside parenthesis, only indent one 'shiftwidth'. + let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', + \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|Todo\\|String\\)$'") + if pp > 0 + return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth()) + endif + return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : shiftwidth()) + endif + if plnumstart == p + return indent(plnum) + endif + return plindent + endif + + + " Get the line and remove a trailing comment. + " Use syntax highlighting attributes when possible. + let pline = getline(plnum) + let pline_len = strlen(pline) + if has('syntax_items') + " If the last character in the line is a comment, do a binary search for + " the start of the comment. synID() is slow, a linear search would take + " too long on a long line. + if synIDattr(synID(plnum, pline_len, 1), "name") =~ "\\(Comment\\|Todo\\)$" + let min = 1 + let max = pline_len + while min < max + let col = (min + max) / 2 + if synIDattr(synID(plnum, col, 1), "name") =~ "\\(Comment\\|Todo\\)$" + let max = col + else + let min = col + 1 + endif + endwhile + let pline = strpart(pline, 0, min - 1) + endif + else + let col = 0 + while col < pline_len + if pline[col] == '#' + let pline = strpart(pline, 0, col) + break + endif + let col = col + 1 + endwhile + endif + + " If the previous line ended the conditional/loop + if getline(plnum) =~ '^\s*\(endif\|endforeach\)\>\s*' + " Maintain indent + return -1 + endif + + " If the previous line ended with a builtin, indent this line + if pline =~ '^\s*\(foreach\|if\|else\|elif\)\>\s*' + return plindent + shiftwidth() + endif + + " If the current line begins with a header keyword, deindent + if getline(a:lnum) =~ '^\s*\(else\|elif\|endif\|endforeach\)' + + " Unless the previous line was a one-liner + if getline(plnumstart) =~ '^\s*\(foreach\|if\)\>\s*' + return plindent + endif + + " Or the user has already dedented + if indent(a:lnum) <= plindent - shiftwidth() + return -1 + endif + + return plindent - shiftwidth() + endif + + " When after a () construct we probably want to go back to the start line. + " a = (b + " + c) + " here + if parlnum > 0 + return plindent + endif + + return -1 + +endfunction + +let &cpo = s:keepcpo +unlet s:keepcpo + +" vim:sw=2 diff --git a/data/syntax-highlighting/vim/syntax/meson.vim b/data/syntax-highlighting/vim/syntax/meson.vim new file mode 100644 index 0000000..3b858bd --- /dev/null +++ b/data/syntax-highlighting/vim/syntax/meson.vim @@ -0,0 +1,162 @@ +" Vim syntax file +" Language: Meson +" License: VIM License +" Maintainer: Nirbheek Chauhan <nirbheek.chauhan@gmail.com> +" Liam Beguin <liambeguin@gmail.com> +" Last Change: 2021 Aug 16 +" Credits: Zvezdan Petkovic <zpetkovic@acm.org> +" Neil Schemenauer <nas@meson.ca> +" Dmitry Vasiliev +" +" This version is copied and edited from python.vim +" It's very basic, and doesn't do many things I'd like it to +" For instance, it should show errors for syntax that is valid in +" Python but not in Meson. +" +" Optional highlighting can be controlled using these variables. +" +" let meson_space_error_highlight = 1 +" + +if exists("b:current_syntax") + finish +endif + +" We need nocompatible mode in order to continue lines with backslashes. +" Original setting will be restored. +let s:cpo_save = &cpo +set cpo&vim + +" http://mesonbuild.com/Syntax.html +syn keyword mesonConditional elif else if endif +syn keyword mesonRepeat foreach endforeach +syn keyword mesonOperator and not or in +syn keyword mesonStatement continue break + +syn match mesonComment "#.*$" contains=mesonTodo,@Spell +syn keyword mesonTodo FIXME NOTE NOTES TODO XXX contained + +" Strings can either be single quoted or triple counted across multiple lines, +" but always with a ' +syn region mesonString + \ start="\z('\)" end="\z1" skip="\\\\\|\\\z1" + \ contains=mesonEscape,@Spell +syn region mesonString + \ start="\z('''\)" end="\z1" keepend + \ contains=mesonEscape,mesonSpaceError,@Spell + +syn match mesonEscape "\\[abfnrtv'\\]" contained +syn match mesonEscape "\\\o\{1,3}" contained +syn match mesonEscape "\\x\x\{2}" contained +syn match mesonEscape "\%(\\u\x\{4}\|\\U\x\{8}\)" contained +" Meson allows case-insensitive Unicode IDs: http://www.unicode.org/charts/ +syn match mesonEscape "\\N{\a\+\%(\s\a\+\)*}" contained +syn match mesonEscape "\\$" + +" Meson only supports integer numbers +" http://mesonbuild.com/Syntax.html#numbers +syn match mesonNumber "\<\d\+\>" +syn match mesonNumber "\<0x\x\+\>" +syn match mesonNumber "\<0o\o\+\>" + +" booleans +syn keyword mesonBoolean false true + +" Built-in functions +syn keyword mesonBuiltin + \ add_global_arguments + \ add_global_link_arguments + \ add_languages + \ add_project_arguments + \ add_project_dependencies + \ add_project_link_arguments + \ add_test_setup + \ alias_target + \ assert + \ benchmark + \ both_libraries + \ build_machine + \ build_target + \ configuration_data + \ configure_file + \ custom_target + \ declare_dependency + \ dependency + \ disabler + \ environment + \ error + \ executable + \ files + \ find_library + \ find_program + \ generator + \ get_option + \ get_variable + \ gettext + \ host_machine + \ import + \ include_directories + \ install_data + \ install_headers + \ install_man + \ install_subdir + \ install_symlink + \ install_emptydir + \ is_disabler + \ is_variable + \ jar + \ join_paths + \ library + \ meson + \ message + \ option + \ project + \ run_command + \ run_target + \ set_variable + \ shared_library + \ shared_module + \ static_library + \ structured_sources + \ subdir + \ subdir_done + \ subproject + \ summary + \ target_machine + \ test + \ unset_variable + \ vcs_tag + \ warning + \ range + \ debug + +if exists("meson_space_error_highlight") + " trailing whitespace + syn match mesonSpaceError display excludenl "\s\+$" + " mixed tabs and spaces + syn match mesonSpaceError display " \+\t" + syn match mesonSpaceError display "\t\+ " +endif + +" The default highlight links. Can be overridden later. +hi def link mesonStatement Statement +hi def link mesonConditional Conditional +hi def link mesonRepeat Repeat +hi def link mesonOperator Operator +hi def link mesonComment Comment +hi def link mesonTodo Todo +hi def link mesonString String +hi def link mesonEscape Special +hi def link mesonNumber Number +hi def link mesonBuiltin Function +hi def link mesonBoolean Boolean +if exists("meson_space_error_higlight") + hi def link mesonSpaceError Error +endif + +let b:current_syntax = "meson" + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim:set sw=2 sts=2 ts=8 noet: diff --git a/data/test.schema.json b/data/test.schema.json new file mode 100644 index 0000000..a809388 --- /dev/null +++ b/data/test.schema.json @@ -0,0 +1,179 @@ +{ + "type": "object", + "additionalProperties": false, + "properties": { + "env": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "installed": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "file": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "file", + "python_file", + "dir", + "exe", + "shared_lib", + "python_lib", + "pdb", + "implib", + "py_implib", + "implibempty", + "expr" + ] + }, + "platform": { + "type": "string", + "enum": [ + "msvc", + "gcc", + "cygwin", + "!cygwin" + ] + }, + "version": { + "type": "string" + }, + "language": { + "type": "string" + } + }, + "required": [ + "file", + "type" + ] + } + }, + "matrix": { + "type": "object", + "properties": { + "options": { + "additionalProperties": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "val": { + "type": ["string", "boolean", "null", "array"], + "items": { + "type": "string" + } + }, + "compilers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "skip_on_env": { + "type": "array", + "items": { + "type": "string" + } + }, + "skip_on_jobname": { + "type": "array", + "items": { + "type": "string" + } + }, + "skip_on_os": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "val" + ] + } + }, + "exclude": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": ["string", "boolean", "array"], + "items": { + "type": "string" + } + } + } + } + } + } + }, + "do_not_set_opts": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "libdir", + "prefix" + ] + } + }, + "tools": { + "type": "object" + }, + "stdout": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "line": { + "type": "string" + }, + "match": { + "type": "string", + "enum": [ + "literal", + "re" + ] + }, + "count": { + "type": "integer" + }, + "comment": { + "type": "string" + } + }, + "required": [ + "line" + ] + } + }, + "skip_on_env": { + "type": "array", + "items": { + "type": "string" + } + }, + "skip_on_jobname": { + "type": "array", + "items": { + "type": "string" + } + }, + "skip_on_os": { + "type": "array", + "items": { + "type": "string" + } + } + } +} |