Skip to content

'io_bazel_rules_scala/dependency/thrift/scrooge_core' not declared in package 'external' #302

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

Open
emaxerrno opened this issue Oct 12, 2017 · 11 comments

Comments

@emaxerrno
Copy link

BUILD

load("@io_bazel_rules_scala//thrift:thrift.bzl", "thrift_library")

load("@io_bazel_rules_scala//twitter_scrooge:twitter_scrooge.bzl",
     "scrooge_scala_library")

thrift_library(
    name="jvm_thrift",
    srcs=[
        "common.thrift",
         ....
    ])

scrooge_scala_library(
    name="test_scrooge",
    deps=[":jvm_thrift"],
    visibility=["//visibility:public"])

WORKSPACE

rules_scala_version = "0bac7fe86fdde1cfba3bb2c8a04de5e12de47bcd"  # update this as needed
http_archive(
    name="io_bazel_rules_scala",
    url="https://github.com/bazelbuild/rules_scala/archive/%s.zip" %
    rules_scala_version,
    type="zip",
    strip_prefix="rules_scala-%s" % rules_scala_version)

load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories")
scala_repositories()


Errors I'm getting

ERROR: /Users/agallego/...../BUILD:19:1: no such target '//external:io_bazel_rules_scala/dependency/thrift/scrooge_core': target 'io_bazel_rules_scala/dependency/thrift/scrooge_core' not declared in package 'external' defined by /Users/agallego/...../WORKSPACE and referenced by '//concord/thrift:test_scrooge'.

@emaxerrno
Copy link
Author

I tried downgrading and changin the version of the rules to multiple tags, including both release versions but no cigar. Right now i'musing th latest master as you can see.

@emaxerrno
Copy link
Author

Just upgraded to bazel 0.6.1 to test it out too.

Here is the error i'm getting.

ERROR: /private/var/tmp/_bazel_agallego/e1cc4c0e84fbdec5856b2432269800cf/external/io_bazel_rules_scala/src/scala/io/bazel/rules_scala/scrooge_support/BUILD:16:1: no such target '//external:io_bazel_rules_scala/dependency/thrift/scrooge_generator': target 'io_bazel_rules_scala/dependency/thrift/scrooge_generator' not declared in package 'external' defined by /Users/agallego/workspace/.../WORKSPACE and referenced by '@io_bazel_rules_scala//src/scala/io/bazel/rules_scala/scrooge_support:focused_zip_importer'.

@emaxerrno
Copy link
Author

it says I'll have to have a referenced 'external' on my workspace.

@johnynek
Copy link
Contributor

looks like you are not loading the needed jars:

https://github.com/bazelbuild/rules_scala/blob/master/twitter_scrooge/twitter_scrooge.bzl#L10

you need to put twitter_scrooge() in your workspace. We probably need to improve the documentation.

Send a PR to the README maybe that would have helped you?

@johnynek
Copy link
Contributor

by the way, we manually set up the jars when we want to set up other versions.

@emaxerrno
Copy link
Author

oh Awesome, still new to bazel. Do i just use your bazel-deps proj on scrooge?

This worked! will submit a PR. though with_finagle=True fails. Missing dep.

@johnynek
Copy link
Contributor

I guess we don't have a test for with_finagle in the repo. That's a shame.

bazel-deps is what we use and then use our own bind statements in the workspace to set up the particular deps instead of twitter_scrooge(). There are still some rough edges with setup and documentation. Thanks for wading through them.

@emaxerrno
Copy link
Author

I've tried a few combinations of the these bazel-deps to get it to compile - at this point, scrooge_generator is generating code as i see compilation errors.

bazel-deps: dependencies.yml

com.twitter:
    finatra-thrift:
      lang: scala
      version: "2.9.0"
    finatra-http:
      lang: scala
      version: "2.9.0"
    scrooge-core:
      lang: scala
      version: "4.20.0"
    scrooge-generator:
      lang: scala
      version: "4.20.0"
    finagle-core:
      lang: scala
      version: "7.1.0"
    finagle-stats:
      lang: scala
      version: "7.1.0"
    util-collection:
      lang: scala
      version: "7.1.0"
    util-core:
      lang: scala
      version: "7.1.0"
    bijection-scrooge:
      lang: scala
      version: "0.9.2"

my bindings:

bind(
    name='io_bazel_rules_scala/dependency/thrift/libthrift',
    actual='@org_apache_thrift_libthrift//jar')
bind(
    name='io_bazel_rules_scala/dependency/thrift/scrooge_core',
    actual='@com_twitter_scrooge_core_2_11//jar')
bind(
    name='io_bazel_rules_scala/dependency/thrift/scrooge_generator',
    actual='@com_twitter_scrooge_generator_2_11//jar')
bind(
    name='io_bazel_rules_scala/dependency/thrift/util_core',
    actual='@com_twitter_util_core_2_11//jar')
bind(
    name='io_bazel_rules_scala/dependency/thrift/util_logging',
    actual='@com_twitter_util_logging_2_11//jar')

target

scrooge_scala_library(
    name="test_scrooge",
    deps=[
        ":test_jvm_thrift",
        "//3rdparty/jvm/com/twitter:scrooge_core",
        "//3rdparty/jvm/com/twitter:finagle_stats",
        "//3rdparty/jvm/com/twitter:finagle_core",
        "//3rdparty/jvm/com/twitter:finagle_thrift",
        "//3rdparty/jvm/com/twitter:util_core"
    ],
    with_finagle=True,
    visibility=["//visibility:public"])

compilation errors

It can't find the finagle_stats which is obvi there.

bazel-out/local-fastbuild/bin/concord/thrift/gen_concord/tmp2959407523442130907/.../tf/scheduling/SchedulerService$FinagleService.scala:125: error: not found: type Counter
    requestsCounter: Counter,

am I missing a bind ?

Thanks!

@emaxerrno
Copy link
Author

emaxerrno commented Oct 18, 2017

so this works.

scrooge_scala_library(
    name="xxx_scrooge",
    deps=[
        ":xxxx_dependency_thrift",

        "//3rdparty/jvm/com/twitter:scrooge_core",
        "//3rdparty/jvm/com/twitter:finagle_thrift",
        "//3rdparty/jvm/com/twitter:finagle_zipkin",
        "//3rdparty/jvm/com/twitter:finagle_core",
        "//3rdparty/jvm/com/twitter:finagle_stats",
        "//3rdparty/jvm/com/twitter:finagle_http",
        "//3rdparty/jvm/com/twitter:finagle_base_http",
        "//3rdparty/jvm/com/twitter:inject_core",
        "//3rdparty/jvm/com/twitter:inject_app",
        "//3rdparty/jvm/com/twitter:inject_utils",
        "//3rdparty/jvm/com/twitter:inject_server",
        "//3rdparty/jvm/com/twitter:inject_modules",
        "//3rdparty/jvm/com/twitter:inject_thrift",
        "//3rdparty/jvm/com/twitter:util_core",
        "//3rdparty/jvm/com/twitter:util_app",
        "//3rdparty/jvm/com/twitter:util_stats",

        "//3rdparty/jvm/org/apache/thrift:libthrift",



    ],
    with_finagle=True,
    visibility=["//visibility:public"])


The MAIN caveat was to use libthrift 0.8.0

@emaxerrno
Copy link
Author

I'm going to prune deps until it compiles w/ the fewest deps, but wanted to put it here in case is helpful to someone else and while i wait for approval to submit pr from the comany.

@johnynek
Copy link
Contributor

johnynek commented Oct 18, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants