Skip to content

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

Closed
refack wants to merge 1 commit into
nodejs:masterfrom
refack:icudata-refactor
Closed

icu-generic.gyp refactor - merge similar actions#12218
refack wants to merge 1 commit into
nodejs:masterfrom
refack:icudata-refactor

Conversation

@refack

Copy link
Copy Markdown
Contributor

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-botnodejs-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
refackforce-pushed the icudata-refactor branch 3 times, most recently from 53ff842 to e1e34c0CompareApril 6, 2017 03:09
@refackrefack changed the title icu-generic.gyp refactoricu-generic.gyp refactor - merge similar actionsApr 6, 2017
@refack

Copy link
Copy Markdown
ContributorAuthor

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

@Trott

Trott commented Apr 6, 2017

Copy link
Copy Markdown
Member

@refack
refackforce-pushed the icudata-refactor branch 3 times, most recently from 0c5478e to 2670dffCompareApril 7, 2017 04:13
@refack

refack commented Apr 7, 2017

Copy link
Copy Markdown
ContributorAuthor

Refactored parameter selection completely
Ready for another CI...

@Trott

Trott commented Apr 7, 2017

Copy link
Copy Markdown
Member

@bnoordhuisbnoordhuis left a comment

Copy link
Copy Markdown
Member

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?

Comment threadconfigure Outdated

Copy link
Copy Markdown
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.

@refackrefackApr 7, 2017

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

Comment threadconfigure Outdated

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

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

refack commented Apr 7, 2017

Copy link
Copy Markdown
ContributorAuthor

@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

refack commented Apr 7, 2017

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
Member

(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
Copy Markdown
ContributorAuthor

(called squash! refactor code for readability or something)

Good tip. Next time.

@srl295

srl295 commented Apr 8, 2017 via email

Copy link
Copy Markdown
Member

@refack

Copy link
Copy Markdown
ContributorAuthor

Nononono. Icu_data_file is used client side!!

who is the client?

@refack

Copy link
Copy Markdown
ContributorAuthor

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

srl295 commented Apr 8, 2017 via email

Copy link
Copy Markdown
Member

@refack

Copy link
Copy Markdown
ContributorAuthor

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

srl295 commented Apr 9, 2017 via email

Copy link
Copy Markdown
Member

@refack

Copy link
Copy Markdown
ContributorAuthor

@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
Copy Markdown
Member

@refack Are you still working on this?

@refack

Copy link
Copy Markdown
ContributorAuthor

@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
Copy Markdown
ContributorAuthor

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 )

@refackrefack mentioned this pull request May 30, 2017
6 tasks
@refack

Copy link
Copy Markdown
ContributorAuthor

Cross-Ref: #7254

@refack

Copy link
Copy Markdown
ContributorAuthor

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

@refackrefack mentioned this pull request Jul 19, 2017
@BridgeAR

Copy link
Copy Markdown
Member

Ping

@refack

Copy link
Copy Markdown
ContributorAuthor

Closing in favor of a better idea.

@refackrefack closed this Aug 30, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

buildIssues and PRs related to build files or the CI.i18n-apiIssues and PRs related to the i18n implementation.toolsIssues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@refack@Trott@gibfahn@srl295@bnoordhuis@BridgeAR@nodejs-github-bot