Pleiades / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

ClosureBuilder fails with NamespaceNotFoundError: Namespace "goog.i18n.bidi.Dir" never provided #604

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

- What steps will reproduce the problem?

1. Install the environment (see "What version of the product are you using? On 
what operating system?" below).
2. Follow tutorial "Using ClosureBuilder" at 
https://developers.google.com/closure/library/docs/closurebuilder up to step 
"Calculating dependencies".
3. Execute 
"D:\Projekt\PhpStorm\ClosureTest>closure-library\closure\bin\build\closurebuilde
r.py -root=closure-library\ --root=myproject\ --namespace="myproject.start"" 
from the windows command prompt (change "D:\Projekt\PhpStorm\ClosureTest" 
according to your installation)

- What is the expected output? What do you see instead?

The result should be similar to what is described in the tutorial, i.e. 

closure-library/closure/bin/build/closurebuilder.py: Scanning paths...
closure-library/closure/bin/build/closurebuilder.py: 596 sources scanned.
closure-library/closure/bin/build/closurebuilder.py: Building dependency tree..
closure-library/closure/goog/base.js
closure-library/closure/goog/debug/error.js
closure-library/closure/goog/string/string.js
closure-library/closure/goog/asserts/asserts.js
closure-library/closure/goog/array/array.js
closure-library/closure/goog/dom/classes.js
closure-library/closure/goog/object/object.js
closure-library/closure/goog/dom/tagname.js
closure-library/closure/goog/useragent/useragent.js
closure-library/closure/goog/math/size.js
closure-library/closure/goog/math/coordinate.js
closure-library/closure/goog/dom/dom.js
myproject/start.js

but I get

D:\Projekt\PhpStorm\ClosureTest>closure-library\closure\bin\build\closurebuilder
.py --root=closure-library\ --root=myproject\ --namespace="myproject.start"
D:\Projekt\PhpStorm\ClosureTest\closure-library\closure\bin\build\closurebuilder
.py: Scanning paths...
D:\Projekt\PhpStorm\ClosureTest\closure-library\closure\bin\build\closurebuilder
.py: 934 sources scanned.
D:\Projekt\PhpStorm\ClosureTest\closure-library\closure\bin\build\closurebuilder
.py: Building dependency tree..
Traceback (most recent call last):
  File "D:\Projekt\PhpStorm\ClosureTest\closure-library\closure\bin\build\closurebuilder.py", line 262, in <module>
    main()
  File "D:\Projekt\PhpStorm\ClosureTest\closure-library\closure\bin\build\closurebuilder.py", line 211, in main
    tree = depstree.DepsTree(sources)
  File "D:\Projekt\PhpStorm\ClosureTest\closure-library\closure\bin\build\depstree.py", line 56, in __init__
    raise NamespaceNotFoundError(require, source)
depstree.NamespaceNotFoundError: Namespace "goog.i18n.bidi.Dir" never provided. 
Required in Source closure-library\closure\goog\soy\data.js

(If you get a UnicodeDecodeError instead, see issue 603 for a solution that 
worked for me - so far ...)

Line 

goog.require('goog.i18n.bidi.Dir');

in closure-library\closure\goog\soy\data.js should be changed to

goog.require('goog.i18n.bidi');

(See attached file). The only reference to goog.i18n.bidi I found in 
closure-library\closure\goog\soy\data.js is the following:

/**
 * The content's direction; null if unknown and thus to be estimated when
 * necessary.
 * @type {?goog.i18n.bidi.Dir}
 */
goog.soy.data.SanitizedContent.prototype.contentDir = null;

Since an enum 'Dir' 

/**
 * Directionality enum.
 * @enum {number}
 */
goog.i18n.bidi.Dir = {
  RTL: -1,
  UNKNOWN: 0,
  LTR: 1
};

is defined in closure-library\closure\goog\i18n\bidi.js, which provides 
namespace 'goog.i18n.bidi'

/**
 * Namespace for bidi supporting functions.
 */
goog.provide('goog.i18n.bidi');

I think / hope that enum was meant and thus my solution is correct. At least 
for me it seems to work:

D:\Projekt\PhpStorm\ClosureTest>closure-library\closure\bin\build\closurebuilder
.py --root=closure-library\ --root=myproject\ --namespace="myproject.start"
D:\Projekt\PhpStorm\ClosureTest\closure-library\closure\bin\build\closurebuilder
.py: Scanning paths...
D:\Projekt\PhpStorm\ClosureTest\closure-library\closure\bin\build\closurebuilder
.py: 934 sources scanned.
D:\Projekt\PhpStorm\ClosureTest\closure-library\closure\bin\build\closurebuilder
.py: Building dependency tree..
closure-library\closure\goog\base.js
closure-library\closure\goog\math\size.js
closure-library\closure\goog\string\string.js
closure-library\closure\goog\debug\error.js
closure-library\closure\goog\dom\nodetype.js
closure-library\closure\goog\asserts\asserts.js
closure-library\closure\goog\array\array.js
closure-library\closure\goog\math\math.js
closure-library\closure\goog\math\coordinate.js
closure-library\closure\goog\useragent\useragent.js
closure-library\closure\goog\dom\tagname.js
closure-library\closure\goog\object\object.js
closure-library\closure\goog\dom\classes.js
closure-library\closure\goog\dom\browserfeature.js
closure-library\closure\goog\functions\functions.js
closure-library\closure\goog\dom\dom.js
myproject\start.js

Hallelujah!

- What version of the product are you using? On what operating system?

I am running Windows 7 on a 64bit MacBook Pro. I downloaded newest (as of 
11/10/2013) Closure Library (closure-library-20130212-95c19e7f0f5f.zip) and 
installed newest Python for Windows (python-3.3.2.amd64.msi).

- Please provide any additional information below.

- Note: we cannot accept patches without the contributor license agreement
being signed. See http://code.google.com/p/closure-
library/wiki/Contributors for more info.

Original issue reported on code.google.com by m...@jochenscharr.de on 10 Nov 2013 at 8:27

Attachments:

GoogleCodeExporter commented 8 years ago
Sorry, what I said in 

- What version of the product are you using? On what operating system?

was wrong. I am not working with downloaded version 
closure-library-20130212-95c19e7f0f5f.zip, but a clone of the current Closure 
Library version (http://code.google.com/p/closure-library/), created using git. 
The rest is correct.

Original comment by m...@jochenscharr.de on 10 Nov 2013 at 10:48

GoogleCodeExporter commented 8 years ago
What's wrong with a clone of the current Closure Library using git?

Original comment by chamnapc...@gmail.com on 8 Jul 2014 at 3:08