Skip to content

Conversation

@kjin
Copy link
Contributor

@kjin kjin commented Apr 12, 2021

This changes the libphonenumber compile-* commands to use Closure Compiler instead of closurebuilder.py. closurebuilder.py is an old wrapper around Closure Compiler, and will be deleted from the Closure Library repository soon. It even emits a warning saying that Closure Compiler should be used directly instead.

No functional changes are expected.

@google-cla google-cla bot added the cla: yes For CLA bot label Apr 12, 2021
@kjin kjin force-pushed the no-closure-builder branch from 106893c to aa87cd6 Compare April 13, 2021 00:27
@penmetsaa
Copy link
Contributor

penmetsaa commented Apr 21, 2021

Hi,

Thanks much for the fixes. Could you please add require statements for these packages i18n.phonenumbers.PhoneNumberType and PhoneNumberFormat in file: phonenumberutil_test.js? We were unable to compile otherwise.

I am not sure if this is ramification of fix.
$ ant -f javascript/build.xml compile

 [exec] i18n/phonenumbers/phonenumberutil_test.js:3811:30: ERROR - [JSC_MISSING_REQUIRE_IN_PROVIDES_FILE] 'i18n.phonenumbers.PhoneNumberFormat' references a namespace which was not required by this file.

.
.

Also could you please make 'lint' target also work "ant -f javascript/build.xml lint"?
At javascript/build.xml:141, No such file error is popping up.

@kjin kjin force-pushed the no-closure-builder branch from aa87cd6 to 1063c50 Compare April 23, 2021 00:30
@kjin
Copy link
Contributor Author

kjin commented Apr 23, 2021

@penmetsaa Yep, I've fixed it! The compilation should succeed now.

@kjin
Copy link
Contributor Author

kjin commented Apr 23, 2021

As for the lint target not working, I can't repro it at the moment. I don't think I touched anything that would cause it to behave differently. Does it still work when you run the command on master?

@penmetsaa
Copy link
Contributor

Hi,

I have picked the latest updates from your fork, and getting below errors when try compiling demo and tests.

$ ant compile-demo
Buildfile: /usr/local/google/home/penmetsaa/github_lab/libphonenumber/javascript/build.xml
compile-demo:
[exec] i18n/phonenumbers/shortnumberinfo_test_BASE_1065575.js:32:0: ERROR - [JSC_MISSING_MODULE_OR_PROVIDE] Required namespace "i18n.phonenumbers.RegionCode" never defined.
[exec] 32| goog.require('i18n.phonenumbers.RegionCode');
[exec] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[exec]
[exec] 1 error(s), 0 warning(s)

$ ant compile-tests
Buildfile: /usr/local/google/home/penmetsaa/github_lab/libphonenumber/javascript/build.xml
nul:
devnull:
setnulldevice:
compile-tests:
[exec] i18n/phonenumbers/asyoutypeformatter_test.js:34:4: ERROR - [JSC_VAR_MULTIPLY_DECLARED_ERROR] Variable RegionCode declared more than once. First occurrence: i18n/phonenumbers/shortnumberinfo_test_BASE_1065575.js
[exec] 34| var RegionCode = i18n.phonenumbers.RegionCode;
[exec] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[exec]
[exec] 1 error(s), 0 warning(s)
BUILD FAILED
/usr/local/google/home/penmetsaa/github_lab/libphonenumber/javascript/build.xml:110: The following error occurred while executing this line:
/usr/local/google/home/penmetsaa/github_lab/libphonenumber/javascript/build.xml:22: exec returned: 1
Total time: 9 seconds

I am not clueless how this package i18n.phonenumbers.RegionCode is picked all these days; we deliberately do not want to load the one declared in i18n/phonenumbers/regioncodefortesting.js, as we want the live regionocode list. Presently we do not have JS experise who can look into this; please help.

@lint error,
Yes, I am am able to reproduce at the master branch as well. So not a ramification of present changes.

@kjin
Copy link
Contributor Author

kjin commented Apr 28, 2021

What is i18n/phonenumbers/shortnumberinfo_test_BASE_1065575.js? The errors seem to be reported for this file, but it doesn't seem to be part of the repo. Can you try removing it and compiling it again?

I am not clueless how this package i18n.phonenumbers.RegionCode is picked all these days; we deliberately do not want to load the one declared in i18n/phonenumbers/regioncodefortesting.js, as we want the live regionocode list.

I believe this file is still being excluded, at least in the demo. The ! in --js="!i18n/phonenumbers/regioncodefortesting.js" indicates that the file is excluded. So as far as I can tell, I don't think this is the cause.

@penmetsaa
Copy link
Contributor

True.. I have not realised that. Thanks much :)
We are good to go with this PR.

@penmetsaa penmetsaa self-requested a review April 28, 2021 17:28
@penmetsaa penmetsaa merged commit b67db9b into google:master Apr 28, 2021
@kjin
Copy link
Contributor Author

kjin commented Apr 28, 2021

Ok, thanks! :)

Anrufliste pushed a commit to Anrufliste/libphonenumber that referenced this pull request May 30, 2021
@kissifrot
Copy link

Hello @kjin , I'm just having a little question: which version of google closure compiler did you use to build the demo? The version I'm using (v20210601) adds eval() to the generated code which cause CSP errors when testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes For CLA bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants