From ef42fc3a3410412ceb918f322d5d2a9368cc7969 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Tue, 1 Jul 2014 18:30:14 +0000 Subject: [PATCH] ICU-10842 update dependencies. Also update tool and add emacs mode. X-SVN-Rev: 35977 --- .gitattributes | 1 + icu4c/source/test/depstest/dependencies.py | 10 ++++++--- icu4c/source/test/depstest/dependencies.txt | 22 ++++++++++++++++--- icu4c/source/test/depstest/depstest.py | 13 ++++++++--- .../test/depstest/icu-dependencies-mode.el | 21 ++++++++++++++++++ 5 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 icu4c/source/test/depstest/icu-dependencies-mode.el diff --git a/.gitattributes b/.gitattributes index a7405598779..161a33985c8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -143,6 +143,7 @@ icu4c/source/stubdata/stubdata.vcxproj -text icu4c/source/stubdata/stubdata.vcxproj.filters -text icu4c/source/test/cintltst/cintltst.vcxproj -text icu4c/source/test/cintltst/cintltst.vcxproj.filters -text +icu4c/source/test/depstest/icu-dependencies-mode.el -text icu4c/source/test/intltest/intltest.vcxproj -text icu4c/source/test/intltest/intltest.vcxproj.filters -text icu4c/source/test/intltest/scientificformathelpertest.cpp -text diff --git a/icu4c/source/test/depstest/dependencies.py b/icu4c/source/test/depstest/dependencies.py index 448f685c511..fb1fc2e3b10 100755 --- a/icu4c/source/test/depstest/dependencies.py +++ b/icu4c/source/test/depstest/dependencies.py @@ -1,7 +1,7 @@ #! /usr/bin/python # -*- coding: utf-8 -*- # -# Copyright (C) 2011, International Business Machines +# Copyright (C) 2011-2014, International Business Machines # Corporation and others. All Rights Reserved. # # file name: dependencies.py @@ -22,6 +22,7 @@ Attributes: The one "system_symbols" item and its groups have sets of "system_symbols" with standard-library system symbol names. libraries: Set of library names mentioned in the dependencies file. + file_to_item: Map from a symbol (ushoe.o) to library or group (shoesize) """ __author__ = "Markus W. Scherer" @@ -35,6 +36,7 @@ import sys files = set() items = {} libraries = set() +file_to_item = {} _line_number = 0 _groups_to_be_defined = set() @@ -85,6 +87,7 @@ def _ReadFiles(deps_file, item, library_name): sys.exit("Error:%d: file %s listed in multiple groups" % (_line_number, file_name)) files.add(file_name) item_files.add(file_name) + file_to_item[file_name] = item["name"] def _IsLibrary(item): return item and item["type"] == "library" @@ -151,7 +154,7 @@ def Load(): if name in items: sys.exit("Error:%d: library definition using duplicate name %s" % (_line_number, name)) libraries.add(name) - item = items[name] = {"type": "library"} + item = items[name] = {"type": "library", "name": name} line = _ReadFiles(deps_file, item, name) elif line.startswith("group: "): current_type = "group" @@ -164,6 +167,7 @@ def Load(): sys.exit("Error:%d: group definition using duplicate name %s" % (_line_number, name)) _groups_to_be_defined.remove(name) item = items[name] + item["name"] = name library_name = item.get("library") if library_name: line = _ReadFiles(deps_file, item, library_name) @@ -184,7 +188,7 @@ def Load(): current_type = "system_symbols" if current_type in items: sys.exit("Error:%d: duplicate entry for system_symbols" % _line_number) - item = items[current_type] = {"type": current_type} + item = items[current_type] = {"type": current_type, "name": current_type} line = _ReadSystemSymbols(deps_file, item) else: sys.exit("Syntax error:%d: %s" % (_line_number, line)) diff --git a/icu4c/source/test/depstest/dependencies.txt b/icu4c/source/test/depstest/dependencies.txt index 855016f25f4..52a4684179b 100644 --- a/icu4c/source/test/depstest/dependencies.txt +++ b/icu4c/source/test/depstest/dependencies.txt @@ -1,3 +1,4 @@ +# -*- icu-dependencies -*- # Copyright (C) 2011-2014, International Business Machines # Corporation and others. All Rights Reserved. # @@ -180,6 +181,7 @@ group: breakiterator uhash ustack utrie ucharstrie bytestrie normlzr # for dictbe.o, should switch to Normalizer2 + uvector32 # for dictbe.o group: unormcmp # unorm_compare() unormcmp.o @@ -337,7 +339,7 @@ group: unistr_cnv group: unistr_core unistr.o deps - ustrtrns appendable + ustrtrns appendable stringpiece group: uscript uscript.o # uscript_getCode() accepts a locale ID and loads its script code data @@ -718,7 +720,7 @@ group: appendable group: icuplug icuplug.o deps - platform + platform charstr group: ucol_swp ucol_swp.o @@ -819,7 +821,7 @@ group: collation deps bytestream normalizer2 resourcebundle service_registration ucharstrieiterator uiter ulist uset usetiter uvector32 uvector64 - uclean_i18n + uclean_i18n propname group: collation_builder # The CollationBaseDataBuilder is only called from genuca, and maybe from tests. @@ -847,6 +849,8 @@ group: formatting # decimalformat dcfmtsym.o decfmtst.o decimfmt.o decimalformatpattern.o compactdecimalformat.o numfmt.o numsys.o unumsys.o unum.o winnmfmt.o + # scientificformathelper - would depend on dcfmtsym, so would be circular. + scientificformathelper.o # rbnf nfrs.o nfrule.o nfsubs.o rbnf.o # measureformat @@ -872,8 +876,14 @@ group: formatting floating_point # sqrt() for astro.o trigonometry # for astro.o stdlib_qsort # for ucurr.o (which does not use ICU's uarrsort.o) + sharedbreakiterator # for reldatefmt.o uclean_i18n +group: sharedbreakiterator + sharedbreakiterator.o + deps + breakiterator + group: digitlist digitlst.o decContext.o decNumber.o deps @@ -926,10 +936,16 @@ group: translit formatting # for Transliterator::getDisplayName() uclean_i18n +# This is off by default, UCONFIG_NO_FILTERED_BREAK_ITERATION=0 +# so, you will see warnings: +#Info: group filteredbreakiterator does not need to depend on breakiterator +#Info: group filteredbreakiterator does not need to depend on ucharstriebuilder group: filteredbreakiterator filteredbrk.o deps breakiterator ucharstriebuilder + # depends on global new/delete and STL. Not recording these here. + # http://bugs.icu-project.org/trac/ticket/10990 group: universal_time_scale utmscale.o diff --git a/icu4c/source/test/depstest/depstest.py b/icu4c/source/test/depstest/depstest.py index bcc527b8e15..eae09f65245 100755 --- a/icu4c/source/test/depstest/depstest.py +++ b/icu4c/source/test/depstest/depstest.py @@ -1,7 +1,7 @@ #! /usr/bin/python # -*- coding: utf-8 -*- # -# Copyright (C) 2011, International Business Machines +# Copyright (C) 2011-2014, International Business Machines # Corporation and others. All Rights Reserved. # # file name: depstest.py @@ -127,8 +127,13 @@ def _Resolve(name, parents): for symbol in imports: for file_name in files: if symbol in _obj_files[file_name]["imports"]: - sys.stderr.write("Error: %s %s file %s imports %s but %s does not depend on %s\n" % - (item_type, name, file_name, symbol, name, _symbols_to_files.get(symbol))) + neededFile = _symbols_to_files.get(symbol) + if neededFile: + neededItem = "%s (for %s)" % (dependencies.file_to_item[neededFile], neededFile) + else: + neededItem = "(system symbol?)" + sys.stderr.write("Error: in %s %s: %s imports %s but %s does not depend on %s\n" % + (item_type, name, file_name, symbol, name, neededItem)) _return_value = 1 del parents[-1] return item @@ -183,6 +188,8 @@ def main(): print "Info: ignored symbols:\n%s" % sorted(_ignored_symbols) if not _return_value: print "OK: Specified and actual dependencies match." + else: + print "Error: There were errors, please fix them and re-run. Processing may have terminated abnormally." return _return_value if __name__ == "__main__": diff --git a/icu4c/source/test/depstest/icu-dependencies-mode.el b/icu4c/source/test/depstest/icu-dependencies-mode.el new file mode 100644 index 00000000000..26e539241b7 --- /dev/null +++ b/icu4c/source/test/depstest/icu-dependencies-mode.el @@ -0,0 +1,21 @@ +;; Copyright (c) 2014 IBM Corporation and others, all rights reserved +;; Thx: http://www.ergoemacs.org/emacs/elisp_syntax_coloring.html +;; Thx: http://repo.or.cz/w/emacs.git/blob/HEAD:/lisp/progmodes/sh-script.el +;; +;; load this with M-x eval-buffer +;; +;; TODO: .* + +(setq icuDepKeywords + '(("group:\\|system_symbols:\\|library:" . font-lock-function-name-face) + ("deps" . font-lock-constant-face) + ("#.*" . font-lock-comment-face) + ("[a-zA-Z0-9_]+\\.o" . font-lock-doc-face) + ) +) + +(define-derived-mode icu-dependencies-mode fundamental-mode + (setq font-lock-defaults '(icuDepKeywords)) + (setq mode-name "icu dependencies.txt") + (setq comment-start "# ") +) -- 2.40.0