Merge #4878 'build: always regenerate help tags'

This commit is contained in:
Justin M. Keyes 2016-06-07 01:57:04 -04:00
commit d966018466
7 changed files with 36 additions and 125 deletions

15
.gitignore vendored
View File

@ -42,27 +42,12 @@ tags
# luarocks, not added as a subtree because of the large number of blobs
/third-party/luarocks
# luajit files
/third-party/luajit/src/host/buildvm
/third-party/luajit/src/host/buildvm_arch.h
/third-party/luajit/src/host/minilua
/third-party/luajit/src/jit/vmdef.lua
/third-party/luajit/src/libluajit.a
/third-party/luajit/src/lj_bcdef.h
/third-party/luajit/src/lj_ffdef.h
/third-party/luajit/src/lj_folddef.h
/third-party/luajit/src/lj_libdef.h
/third-party/luajit/src/lj_recdef.h
/third-party/luajit/src/lj_vm.s
/third-party/luajit/src/luajit
# local make targets
local.mk
# runtime/doc
/runtime/doc/*.html
/runtime/doc/tags.ref
/runtime/doc/doctags
/runtime/doc/errors.log
# clint errors, generated by `make lint`

View File

@ -85,10 +85,10 @@ endif
mkdir -p build
touch $@
oldtest: | nvim tags
oldtest: | nvim helptags
+$(SINGLE_MAKE) -C src/nvim/testdir $(MAKEOVERRIDES)
tags: | nvim
helptags: | nvim
+$(BUILD_CMD) -C build runtime/doc/tags
functionaltest: | nvim

View File

@ -31,7 +31,7 @@ add_custom_command(OUTPUT copy_docfiles
${PROJECT_SOURCE_DIR}/runtime/doc ${GENERATED_RUNTIME_DIR}/doc
)
add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
add_custom_target(helptags
COMMAND "${PROJECT_BINARY_DIR}/bin/nvim"
-u NONE
-i NONE
@ -45,6 +45,18 @@ add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}/doc"
)
add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
DEPENDS
helptags
)
add_custom_target(doc_html
COMMAND make html
DEPENDS
${GENERATED_HELP_TAGS}
WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}/doc"
)
add_custom_target(
runtime ALL
DEPENDS

View File

@ -6,32 +6,14 @@
AWK = awk
# Set to $(VIMTARGET) when executed from src/Makefile.
VIMEXE = vim
DOCS = $(wildcard *.txt)
HTMLS = $(DOCS:.txt=.html)
.SUFFIXES:
.SUFFIXES: .c .o .txt .html
all: tags html
# Use Vim to generate the tags file. Can only be used when Vim has been
# compiled and installed. Supports multiple languages.
vimtags: $(DOCS)
$(VIMEXE) -u NONE -es -c "helptags ++t ." -c quit
# Use "doctags" to generate the tags file. Only works for English!
tags: doctags $(DOCS)
./doctags $(DOCS) | LANG=C LC_ALL=C sort >tags
uniq -d -2 tags
doctags: doctags.c
$(CC) doctags.c -o doctags
# Awk version of .txt to .html conversion.
html: noerrors tags $(HTMLS)
html: noerrors $(HTMLS)
@if test -f errors.log; then cat errors.log; fi
noerrors:
@ -54,5 +36,5 @@ tags.ref tags.html: tags
$(AWK) -f maketags.awk tags >tags.html
clean:
-rm -f doctags *.html tags.ref $(HTMLS) errors.log
-rm -f *.html tags.ref $(HTMLS) errors.log

View File

@ -1,83 +0,0 @@
/* vim:set ts=4 sw=4:
* this program makes a tags file for vim_ref.txt
*
* Usage: doctags vim_ref.txt vim_win.txt ... >tags
*
* A tag in this context is an identifier between stars, e.g. *c_files*
*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#define LINELEN 200
int
main(argc, argv)
int argc;
char **argv;
{
char line[LINELEN];
char *p1, *p2;
char *p;
FILE *fd;
if (argc <= 1)
{
fprintf(stderr, "Usage: doctags docfile ... >tags\n");
exit(1);
}
printf("help-tags\ttags\t1\n");
while (--argc > 0)
{
++argv;
fd = fopen(argv[0], "r");
if (fd == NULL)
{
fprintf(stderr, "Unable to open %s for reading\n", argv[0]);
continue;
}
while (fgets(line, LINELEN, fd) != NULL)
{
p1 = strchr(line, '*'); /* find first '*' */
while (p1 != NULL)
{
p2 = strchr(p1 + 1, '*'); /* find second '*' */
if (p2 != NULL && p2 > p1 + 1) /* skip "*" and "**" */
{
for (p = p1 + 1; p < p2; ++p)
if (*p == ' ' || *p == '\t' || *p == '|')
break;
/*
* Only accept a *tag* when it consists of valid
* characters, there is white space before it and is
* followed by a white character or end-of-line.
*/
if (p == p2
&& (p1 == line || p1[-1] == ' ' || p1[-1] == '\t')
&& (strchr(" \t\n\r", p[1]) != NULL
|| p[1] == '\0'))
{
*p2 = '\0';
++p1;
printf("%s\t%s\t/*", p1, argv[0]);
while (*p1)
{
/* insert backslash before '\\' and '/' */
if (*p1 == '\\' || *p1 == '/')
putchar('\\');
putchar(*p1);
++p1;
}
printf("*\n");
p2 = strchr(p2 + 1, '*'); /* find next '*' */
}
}
p1 = p2;
}
}
fclose(fd);
}
return 0;
}

View File

@ -345,10 +345,18 @@ local function rmdir(path)
end
for file in lfs.dir(path) do
if file ~= '.' and file ~= '..' then
local ret, err = os.remove(path..'/'..file)
if not ret then
error('os.remove: '..err)
return nil
local abspath = path..'/'..file
if lfs.attributes(abspath, 'mode') == 'directory' then
local ret = rmdir(abspath) -- recurse
if not ret then
return nil
end
else
local ret, err = os.remove(abspath)
if not ret then
error('os.remove: '..err)
return nil
end
end
end
end

View File

@ -12,6 +12,13 @@ local function expected_empty()
end
describe('expand file name', function()
after_each(function()
helpers.rmdir('Xdir1')
helpers.rmdir('Xdir2')
helpers.rmdir('Xdir3')
helpers.rmdir('Xdir4')
end)
before_each(function()
clear()