Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

icu-generic.gyp refactor - merge similar actions #12218

Closed
wants to merge 1 commit into from

Conversation

refack
Copy link
Contributor

@refack refack commented Apr 4, 2017

Spin off of #11217

After we exorcise the voodoo, it's time to merge some very similar duplicated code
(After @bnoordhuis's observation, the trim and code-gen actions were parameterized and merged)

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows [commit guidelines][]
Affected core subsystem(s)

build, intl

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. i18n-api Issues and PRs related to the i18n implementation. tools Issues and PRs related to the tools directory. labels Apr 4, 2017
@refack refack force-pushed the icudata-refactor branch 3 times, most recently from 53ff842 to e1e34c0 Compare April 6, 2017 03:09
@refack refack changed the title icu-generic.gyp refactor icu-generic.gyp refactor - merge similar actions Apr 6, 2017
@refack
Copy link
Contributor Author

refack commented Apr 6, 2017

@nodejs/collaborators whomever can CI this, please. I think is finally ready.

@Trott
Copy link
Member

Trott commented Apr 6, 2017

@refack refack force-pushed the icudata-refactor branch 3 times, most recently from 0c5478e to 2670dff Compare April 7, 2017 04:13
@refack
Copy link
Contributor Author

refack commented Apr 7, 2017

Refactored parameter selection completely
Ready for another CI...

@Trott
Copy link
Member

Trott commented Apr 7, 2017

Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks much more complicated than I would have thought necessary. Why is that?

configure Outdated
@@ -1033,6 +1033,7 @@ def glob_to_var(dir_base, dir_sub, patch_dir):
return list

def configure_intl(o):
config_vars = o['variables']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces a lot of churn for no good reason. Please don't do that, no reviewer likes a noisy diff.

Copy link
Contributor Author

@refack refack Apr 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😛😛😛😛😛😛😛😛😛😛😛😛

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that, it was the "old me", that tried to be cheeky.
Anyway I reverted, as requested.

@refack
Copy link
Contributor Author

refack commented Apr 7, 2017

CI: https://ci.nodejs.org/job/node-test-pull-request/7259/

YAAAAAASSSSSSSS

configure Outdated
# this is the input '.dat' file to use .. icudt*.dat
# may be little-endian if from a icu-project.org tarball
o['variables']['icu_data_in'] = icu_data_in
# this is the icudt*.dat file which node will be using (platform endianness)
o['variables']['icu_data_file'] = icu_data_file
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'icu_data_file' is not used anywhere anymore so I ☠️ed it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it's back

@refack
Copy link
Contributor Author

refack commented Apr 7, 2017

@bnoordhuis reduced churn (although I personally like "churn" if it's towards a cleaner code)

This looks much more complicated than I would have thought necessary. Why is that?

I took me too long because I assumed the 4 paths (win +/- small +/-) had more in common then what turned out. I now assume they just diverged over the years. For instance we need to repack for endiness only on non-windows. and genccode can only output .c files on non-windows, while it can directly compile to an .o file on windows.
IMHO the simplest/robust way was to parameterize the tasks, and set the parameters in a 4 clause condition. That way I was able to make the output to be as close as I could to the "baseline"

@refack
Copy link
Contributor Author

refack commented Apr 7, 2017

Also

'action': [ 'python', 'icutrim.py', '-P', '<(PRODUCT_DIR)/.', # '.' suffix is a workaround against GYP assumptions :(
                '-D', '<(icu_data_in)', '-T', '<(icudata_trim_temp)',
                '--delete-tmp', ...

took some time to figure out since

  1. I had to fight GYP not to make a mess of arguments that end with \
  2. Then I realized --delete-tmp deletes the whole content of the directory -T points to before it operates, so we need a special <(icudata_trim_temp) directory and then copy the files back to where other actions can see them.
  3. Also that the .gyp file is in tools/icu while the code is in deps/icu-small makes the whole thing cumbersome for a human to reason about.

P.S. I can put some of these comment it the code. Have put them in...

@gibfahn
Copy link
Member

gibfahn commented Apr 7, 2017

(although I personally like "churn" if it's towards a cleaner code)

Me too. If you're doing that you can do it as a separate commit (called squash! refactor code for readability or something), then reviewers can look at the other changes separately, and it can be squashed before merging.

@refack
Copy link
Contributor Author

refack commented Apr 7, 2017

(called squash! refactor code for readability or something)

Good tip. Next time.

@srl295
Copy link
Member

srl295 commented Apr 8, 2017 via email

@refack
Copy link
Contributor Author

refack commented Apr 8, 2017

Nononono. Icu_data_file is used client side!!

who is the client?

@refack
Copy link
Contributor Author

refack commented Apr 8, 2017

Nononono. Icu_data_file is used client side!!

@srl295 like native addons?
If it's used anywhere I'll use it in icu-generic.gyp to actually set the name of the output 🤔...

@srl295
Copy link
Member

srl295 commented Apr 8, 2017 via email

@refack
Copy link
Contributor Author

refack commented Apr 8, 2017

Add on packages.. use it to find the file. Please leave the variables in the hash.. sorry it's complex we can hash it out if you want. Thanks for trying to simplify

Got you! so I'll use it in icu-generic.gyp to actually set the name of the output 👍

@srl295
Copy link
Member

srl295 commented Apr 9, 2017 via email

@refack
Copy link
Contributor Author

refack commented Apr 9, 2017

@srl295 tell me more about it, I don't get it. That file is not vendored by node-gyp for example...

also tweak `configure` around icu config
@bnoordhuis
Copy link
Member

@refack Are you still working on this?

@refack
Copy link
Contributor Author

refack commented May 15, 2017

@bnoordhuis It's stable.
I tried to address your comment with some comments in the code.
IMHO this can land.
Next step is to do what you did in #12231 and move all the logic to a .py file.

@refack
Copy link
Contributor Author

refack commented May 15, 2017

New CI: https://ci.nodejs.org/job/node-test-commit/9893/

P.S. since it's just a .gyp instead of trying to review the code, I can provide the before and after output variations (±windows × ±icu-small × make/msvs/ninja) for comparison ( react with 👍 If you want it )

@refack refack mentioned this pull request May 30, 2017
6 tasks
@refack
Copy link
Contributor Author

refack commented May 30, 2017

Cross-Ref: #7254

@refack
Copy link
Contributor Author

refack commented Jun 13, 2017

@srl295 I see you're around.
Does it make sense to preprocess icudata and commit the processed files (trimmed/full * LE/BE)?

@refack refack mentioned this pull request Jul 19, 2017
@BridgeAR
Copy link
Member

Ping

@refack
Copy link
Contributor Author

refack commented Aug 30, 2017

Closing in favor of a better idea.

@refack refack closed this Aug 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. i18n-api Issues and PRs related to the i18n implementation. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants