Question

I am new to gtags, and have a question. I have a big project, such as android AOSP, I want gtags to parse some folders, how can I achieve it with gtags? I searched and got solution:

  1. use -f option with gtags, it seems doesn't support folders

Is there any good idea that I can set the folders path and gtags only process those folders?

Was it helpful?

Solution

UPDATE: author of the question came up with a better solution in the comments. I'm adding it here so it's easier to find:

.. create tag file in the sub-directories I need, and add the directories to GTAGSLIBPATH when loading the project,


My answer:

You can limit what gtags indexes by adding list of files/directories to skip keyword in ~/.globalrc or /etc/gtags.conf. Here's a sample gtags.conf file.

The problem is that often global/gtags packages don't install gtags.conf (at least it's not there in global-5.7.1-2 on ubuntu 12.04), so you'll need to either get it from global source distribution, or use someone else's gtags.conf as a reference. For instance here.

Something like this should work. Note that leading / means from the top of the tree. Without it gtags will skip matching entries anywhere in the tree.:

common:\
    :skip=/skip-this-dir/,/lib/and-this/,/include/and-this-one-too/:

OTHER TIPS

The -f option is premised on find(1). Please try the followings.

$ find folder1 folder2 folder3 -type f -print | gtags -f -

or

$ find folder1 folder2 folder3 -type f -print >gtags.files
$ gtags

This is my bash function to get rid of files and paths including 'dummy' and 'win':

function gtagsupdate { 
find . -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" | grep -v dummy | grep -v win | gtags -f -
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top