Skip to content

Fix issue with empty args and workers #245

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

Merged
merged 2 commits into from
Jul 9, 2017
Merged

Fix issue with empty args and workers #245

merged 2 commits into from
Jul 9, 2017

Conversation

johnynek
Copy link
Contributor

@johnynek johnynek commented Jul 6, 2017

when workers are enabled, it seems empty lines are removed from the arguments list. This PR makes sure to always have 1 line per arg (by padding with a leading _ which is discarded).

This is actually currently a blocker for us. I would love to have better tests around this (that exercise everything with and without workers, but I don't want to try to shave that yak before we get this build issue unblocked).

@johnynek
Copy link
Contributor Author

johnynek commented Jul 6, 2017

added #246

Copy link
Contributor

@ittaiz ittaiz left a comment

Choose a reason for hiding this comment

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

Hey, two really small comments

@@ -140,7 +140,7 @@ def _gen_scrooge_srcjar_impl(ctx):
# in order to generate code) have targets which will compile them.
_assert_set_is_subset(only_transitive_thrift_srcs, transitive_owned_srcs)

path_content = "\n".join([_colon_paths(ps) for ps in [immediate_thrift_srcs, only_transitive_thrift_srcs, remote_jars, external_jars]])
path_content = "\n".join(["_" + _colon_paths(ps) for ps in [immediate_thrift_srcs, only_transitive_thrift_srcs, remote_jars, external_jars]])
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you extract this into a constant with a clear name? Something like PaddingToPreserverAruent or PaddingToSeparateArgumentToOwnLine? Names are different once I'm really not sure I got the point well enough...

@@ -41,7 +41,7 @@ class ScroogeGenerator extends Processor {

def processRequest(args: java.util.List[String]) {
def getIdx(i: Int): List[String] =
if (args.size > i) args.get(i).split(':').toList.filter(_.nonEmpty)
if (args.size > i) args.get(i).drop(1).split(':').toList.filter(_.nonEmpty)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we extract 1 into a constant as well to express why we're dropping it? Something like .drop(PaddingCharacterUsedForArgumentPreservation)
I know the names are long but honestly I fear this will cryptic code really fast

@johnynek
Copy link
Contributor Author

johnynek commented Jul 6, 2017 via email

@ittaiz
Copy link
Contributor

ittaiz commented Jul 6, 2017

LGTM. I'd wait for green just to be on the safe side. Going to a company party so you can merge when you want :)

@johnynek
Copy link
Contributor Author

johnynek commented Jul 6, 2017

@ittaiz thanks for the review, sir!

@ittaiz ittaiz merged commit 0113d17 into master Jul 9, 2017
@ittaiz ittaiz deleted the oscar/fix-scrooge branch October 22, 2017 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants