-
Notifications
You must be signed in to change notification settings - Fork 278
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
Require JavaInfo on deps, move scrooge srcjar to srcs #523
Changes from all commits
564e1bc
ad920a0
8d63397
90dcb05
d1a3d5e
4dc2edd
2a78628
eb50d82
026fdb7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -457,12 +457,7 @@ def _collect_runtime_jars(dep_targets): | |
runtime_jars = [] | ||
|
||
for dep_target in dep_targets: | ||
if JavaInfo in dep_target: | ||
runtime_jars.append(dep_target[JavaInfo].transitive_runtime_jars) | ||
else: | ||
# support http_file pointed at a jar. http_jar uses ijar, | ||
# which breaks scala macros | ||
runtime_jars.append(filter_not_sources(dep_target.files)) | ||
runtime_jars.append(dep_target[JavaInfo].transitive_runtime_jars) | ||
|
||
return runtime_jars | ||
|
||
|
@@ -562,7 +557,9 @@ def _lib(ctx, non_macro_lib): | |
# this information through. extra_information allows passing | ||
# this information through, and it is up to the new_targets | ||
# to filter and make sense of this information. | ||
extra_information=_collect_extra_information(ctx.attr.deps), | ||
# unfortunately, we need to see this for scrooge and protobuf to work, | ||
# but those are generating srcjar, so they should really come in via srcs | ||
extra_information=_collect_extra_information(ctx.attr.deps + ctx.attr.srcs), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’m sorry but I don’t understand this. Where does scroog euse this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. search for all the extra information in the file. For instance: https://github.com/bazelbuild/rules_scala/blob/master/twitter_scrooge/twitter_scrooge.bzl#L85 Really this is something that should be replaced with #510 but that is staged behind a few layers of tech debt removal (a supported skylark function to compile scala and get a JavaInfo, and a toolchain that sets up all the things we need for scala so we don't have to copy-paste the scala setup for the ctx). |
||
jars_to_labels = jars.jars2labels, | ||
) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
java_binary( | ||
java_library( | ||
name = "runner", | ||
srcs = ["Runner.java"], | ||
visibility = ["//visibility:public"], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
|
||
|
||
# this is used by a sh_test to test that a string is NOT | ||
# found in a file. This is used for instance to check if | ||
# stray jars are not making it onto the classpath | ||
|
||
if grep -q $1 $2 ; then | ||
echo "ERROR: found $1" | ||
exit 1 | ||
else | ||
exit 0 | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -289,12 +289,11 @@ def scrooge_scala_library(name, | |
with_finagle = with_finagle, | ||
) | ||
|
||
# deps from macro invocation would come via srcjar | ||
# however, retained to make dependency analysis via aspects easier | ||
scala_library( | ||
name = name, | ||
srcs = [srcjar], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this work? i think the scala_library rule is restricted to only allow actual files in the srcs not targets? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (or does it intelligently realize the output file?... interesting) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it does use the output file here. We could be more precise and just list the output filename. That might actually solve the problem.... Maybe by putting the whole target we are sucking up all the deps. |
||
deps = deps + remote_jars + [ | ||
srcjar, "//external:io_bazel_rules_scala/dependency/thrift/libthrift", | ||
"//external:io_bazel_rules_scala/dependency/thrift/libthrift", | ||
"//external:io_bazel_rules_scala/dependency/thrift/scrooge_core" | ||
], | ||
exports = deps + remote_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.
Why keep the “if”? I think you can require the divider on the signature of the attribute and so throw all of the conditionals away
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.
because scrooge puts everything in the deps sadly... we want to fix it, but one step at a time.
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.
scrooge macro puts all the thrift dependencies on the deps. :( we need #510