Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(624)

Issue 601353002: Add support for "else if" in gyp conditions (Closed)

Created:
6 years, 2 months ago by Shezan Baig (Bloomberg)
Modified:
6 years, 1 month ago
Reviewers:
bradnelson, scottmg
CC:
gyp-developer_googlegroups.com
Visibility:
Public.

Description

Add support for "else if" in gyp conditions Right now, a gyp condition consists of exactly two or three parts: [cond_expr, true_dict] [cond_expr, true_dict, false_dict] This means if we want to have an "else if" condition, it needs to be inside a nested 'conditions' list inside the false_dict. This leads to unnecessarily deep levels of nesting in gyp files. This commit makes it so that if the 'false_dict' is not a dict, then we will treat it as another cond_expr. We keep looping like this until we find a false_dict, or until we reach the end of the list. This means we can now have conditions that look like this: [cond_expr1, true_dict1, cond_expr2, true_dict2, false_dict] or: [cond_expr1, true_dict1, cond_expr2, true_dict2, cond_expr3, true_dict3] BUG= R=scottmg@chromium.org Committed: https://code.google.com/p/gyp/source/detail?r=2004

Patch Set 1 #

Total comments: 6

Patch Set 2 : Rebase #

Patch Set 3 : Add some validation #

Patch Set 4 : Better tests #

Unified diffs Side-by-side diffs Delta from patch set Stats (+190 lines, -7 lines) Patch
M pylib/gyp/input.py View 1 2 3 2 chunks +31 lines, -7 lines 0 comments Download
A test/conditions/elseif/elseif.gyp View 1 2 3 1 chunk +43 lines, -0 lines 0 comments Download
A test/conditions/elseif/elseif_bad1.gyp View 1 2 3 1 chunk +20 lines, -0 lines 0 comments Download
A test/conditions/elseif/elseif_bad2.gyp View 1 2 3 1 chunk +22 lines, -0 lines 0 comments Download
A test/conditions/elseif/elseif_bad3.gyp View 1 2 3 1 chunk +23 lines, -0 lines 0 comments Download
A test/conditions/elseif/elseif_conditions.gypi View 1 2 3 1 chunk +15 lines, -0 lines 0 comments Download
A test/conditions/elseif/gyptest_elseif.py View 1 2 3 1 chunk +33 lines, -0 lines 0 comments Download
A + test/conditions/elseif/program.cc View 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 18 (4 generated)
Shezan Baig (Bloomberg)
Hi Brad, I think Mark is busy right now. Do you have time to look ...
6 years, 2 months ago (2014-09-25 18:52:50 UTC) #2
Shezan Baig (Bloomberg)
Hi, is anyone available to review this input.py change? Thanks!
6 years, 1 month ago (2014-11-14 16:58:27 UTC) #3
scottmg
https://codereview.chromium.org/601353002/diff/1/pylib/gyp/input.py File pylib/gyp/input.py (right): https://codereview.chromium.org/601353002/diff/1/pylib/gyp/input.py#newcode1049 pylib/gyp/input.py:1049: while result == None and i < len(condition): what ...
6 years, 1 month ago (2014-11-14 17:09:44 UTC) #5
Shezan Baig (Bloomberg)
Thanks for the review! I'll work on getting those additional validations in. https://codereview.chromium.org/601353002/diff/1/pylib/gyp/input.py File pylib/gyp/input.py ...
6 years, 1 month ago (2014-11-14 17:25:44 UTC) #6
Dirk Pranke
On 2014/11/14 17:25:44, Shezan Baig (Bloomberg) wrote: > Thanks for the review! I'll work on ...
6 years, 1 month ago (2014-11-14 23:07:18 UTC) #7
Shezan Baig (Bloomberg)
On 2014/11/14 23:07:18, Dirk Pranke wrote: > > This is true. In our code, we've ...
6 years, 1 month ago (2014-11-14 23:17:01 UTC) #8
Shezan Baig (Bloomberg)
I've uploaded a new patch with some additional validation
6 years, 1 month ago (2014-11-18 16:16:56 UTC) #9
scottmg
On 2014/11/18 16:16:56, Shezan Baig (Bloomberg) wrote: > I've uploaded a new patch with some ...
6 years, 1 month ago (2014-11-18 16:29:36 UTC) #10
Shezan Baig (Bloomberg)
On 2014/11/18 16:29:36, scottmg wrote: > Could you add a test for these error cases ...
6 years, 1 month ago (2014-11-18 17:30:36 UTC) #11
scottmg
lgtm
6 years, 1 month ago (2014-11-18 17:43:46 UTC) #12
Shezan Baig (Bloomberg)
Hmm, I'm getting the following error when I run 'git cl dcommit'. Not sure what ...
6 years, 1 month ago (2014-11-18 18:53:46 UTC) #13
Mark Mentovai
“git pull -r” first to rebase atop all upstream changes.
6 years, 1 month ago (2014-11-18 18:55:26 UTC) #15
Shezan Baig (Bloomberg)
On 2014/11/18 18:55:26, Mark Mentovai wrote: > “git pull -r” first to rebase atop all ...
6 years, 1 month ago (2014-11-18 19:03:24 UTC) #17
Shezan Baig (Bloomberg)
6 years, 1 month ago (2014-11-18 20:08:35 UTC) #18
Message was sent while issue was closed.
Committed patchset #4 (id:60001) manually as 2004 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698