build-ctags.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. # Copyright 2013 The Chromium Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. if [[ a"`ctags --version | head -1 | grep \"^Exuberant Ctags\"`" == "a" ]]; then
  6. cat <<EOF
  7. You must be using Exuberant Ctags, not just standard GNU ctags. If you are on
  8. Debian or a related flavor of Linux, you may want to try running
  9. apt-get install exuberant-ctags.
  10. EOF
  11. exit
  12. fi
  13. CHROME_SRC_DIR="$PWD"
  14. fail() {
  15. echo "Failed to create ctags for $1"
  16. exit 1
  17. }
  18. ctags_cmd() {
  19. echo "ctags --languages=C++ $1 --exclude=.git -R -f .tmp_tags"
  20. }
  21. build_dir() {
  22. local extraexcludes=""
  23. if [[ a"$1" == "a--extra-excludes" ]]; then
  24. extraexcludes="--exclude=third_party --exclude=build --exclude=out"
  25. shift
  26. fi
  27. cd "$CHROME_SRC_DIR/$1" || fail $1
  28. # Redirect error messages so they aren't seen because they are almost always
  29. # errors about components that you just happen to have not built (NaCl, for
  30. # example).
  31. $(ctags_cmd "$extraexcludes") 2> /dev/null || fail $1
  32. mv -f .tmp_tags tags
  33. }
  34. # We always build the top level but leave all submodules as optional.
  35. build_dir --extra-excludes "" "top level"
  36. # Build any other directies that are listed on the command line.
  37. for dir in $@; do
  38. build_dir "$1"
  39. shift
  40. done