-
-
Notifications
You must be signed in to change notification settings - Fork 287
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
Conversation
added #246 |
There was a problem hiding this 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
twitter_scrooge/twitter_scrooge.bzl
Outdated
@@ -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]]) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
Sounds good. Will update and add links to the issue I filed on bazel.
…On Wed, Jul 5, 2017 at 18:08 Ittai Zeidman ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Hey, two really small comments
------------------------------
In twitter_scrooge/twitter_scrooge.bzl
<#245 (comment)>
:
> @@ -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]])
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...
------------------------------
In src/scala/scripts/TwitterScroogeGenerator.scala
<#245 (comment)>
:
> @@ -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)
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
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#245 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEJdq1MNQaW6h5hoQeh5tU6L5W9OLEkks5sLF24gaJpZM4OPFCs>
.
|
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 :) |
@ittaiz thanks for the review, sir! |
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).