Cannot recompile demo.js

133 views
Skip to first unread message

Jack O'Connor

unread,
Nov 23, 2021, 9:26:17 AM11/23/21
to libphonenumber-discuss
Hi there,

I've been following the instructions in the libphonenumber/javascript/README.md (using the latest versions of all packages), and I have closure-compiler compiled, but when I run:

ant -f javascript/build.xml compile-demo

I get the following error:

[exec] Unknown diagnostic group: 'undefinedNames'

If I remove the "undefinedNames" line from the libphonenumber/javascript/build.xml, then when I run the build command again I get 75 deprecation warnings "JSC_DEPRECATED_PROP_REASON", but it builds successfully. Then when I run demo-compiled.html in the browser, I see the following JS console error which breaks the page:

Uncaught Error: No tests found in given test case: Phone Number Parser Demo. By default, the test runner fails if a test case has no tests. To modify this behavior, see goog.testing.TestRunner's setStrict() method, or G_testRunner.setStrict()

Versions:
libphonenumber v8.12.37
closure-compiler v20211107
closure-library v20211107
closure-linter v2.3.19
python-gflags 3.1.2

Any thoughts would be really appreciated 🙏 thank you

Jack

unread,
Nov 25, 2021, 7:00:14 AM11/25/21
to libphonenumber-discuss
Just to clarify, I have also tried the recommended versions of closure-compiler (v20140407) and closure-library (v20190415) as mentioned in the readme. In this case when I run the compile-demo build task, I get the same error:


[exec] Unknown diagnostic group: 'undefinedNames'

But this time if I remove the "undefinedNames" line from the libphonenumber/javascript/build.xml, and run the build again, I get 120 errors, mostly saying "references a namespace which was not required by this file" - I'll paste a few below:

compile-demo:
     [exec] /Users/jack/workspace/libphonenumber/libphonenumber/javascript/../../closure-library/closure/goog/base.js:47:14: WARNING - [JSC_PARSE_ERROR] Parse error. unknown @suppress parameter: newCheckTypes
     [exec]   47|  * @suppress {newCheckTypes}
     [exec]                     ^
     [exec] 
     [exec] /Users/jack/workspace/libphonenumber/libphonenumber/javascript/../../closure-library/closure/goog/dom/dom.js:1017:15: ERROR - [JSC_MISSING_REQUIRE_TYPE_IN_PROVIDES_FILE] 'goog.string.Const' references a namespace which was not required by this file.
     [exec] Please add a goog.requireType.
     [exec]   1017|  * @param {...!goog.string.Const} var_args The HTML strings to concatenate then
     [exec]                        ^^^^^^^^^^^^^^^^^
     [exec] 
     [exec] /Users/jack/workspace/libphonenumber/libphonenumber/javascript/../../closure-library/closure/goog/dom/dom.js:1022:64: ERROR - [JSC_MISSING_REQUIRE_IN_PROVIDES_FILE] 'goog.string.Const' references a namespace which was not required by this file.
     [exec] Please add a goog.require.
     [exec]   1022|   var stringArray = goog.array.map(arguments, goog.string.Const.unwrap);
     [exec]                                                                         ^^^^^^
     [exec] 
     [exec] /Users/jack/workspace/libphonenumber/libphonenumber/javascript/../../closure-library/closure/goog/dom/dom.js:1026:32: ERROR - [JSC_MISSING_REQUIRE_IN_PROVIDES_FILE] 'goog.string.Const' references a namespace which was not required by this file.
     [exec] Please add a goog.require.
     [exec]   1026|               goog.string.Const.from(
     [exec]                                         ^^^^
     [exec] 

... (truncated for brevity) ...

Can anyone tell me what versions of closure-compiler and closure-library work with the latest version of libphonenumber (v8.12.37)? Or is there something wrong with my setup perhaps?

Thanks so much for any pointers :)

penm...@google.com

unread,
Nov 29, 2021, 8:21:24 AM11/29/21
to libphonenumber-discuss

Hi,

We were able to build demo at
- closure-api: v20201006.
- closure-compiler: v20210302

Have not checked at the versions you mentioned.
Possibly you are still referring to the newer binaries
as undefinedNames is removed?

The ones ant refers is the closure code checkedout in the
root folder where libphonenumber is checkedout.

Jack

unread,
Nov 29, 2021, 10:41:00 AM11/29/21
to libphonenumber-discuss
Amazing, if I revert to those versions of closure-compiler and closure-library then the build works again! Thank you so much.

For posterity, here are all of the versions that worked for me:
libphonenumber v8.12.38
closure-compiler v20210302
closure-library v20201006
closure-linter v2.3.19
python-gflags 3.1.2

I still get 38 warnings about JSC_DEPRECATED_PROP_REASON, but it builds and the demo page works fine.

I've submitted a PR to update the recommended versions in the readme: https://github.com/google/libphonenumber/pull/2702

Thanks again.
Reply all
Reply to author
Forward
0 new messages