Skip to content
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

not found: object play #38

Open
mglee72 opened this issue Mar 25, 2021 · 0 comments
Open

not found: object play #38

mglee72 opened this issue Mar 25, 2021 · 0 comments

Comments

@mglee72
Copy link

mglee72 commented Mar 25, 2021

My Workspace (identical to the README):

# update version as needed
rules_twirl_version = "9ac789845e3a481fe520af57bd47a4261edb684f"
http_archive(
  name = "io_bazel_rules_twirl",
  sha256 = "b1698a2a59b76dc9df233314c2a1ca8cee4a0477665cff5eafd36f92057b2044",
  strip_prefix = "rules_twirl-{}".format(rules_twirl_version),
  type = "zip",
  url = "https://github.com/lucidsoftware/rules_twirl/archive/{}.zip".format(rules_twirl_version),
)

RULES_JVM_EXTERNAL_TAG = "3.3"
http_archive(
    name = "rules_jvm_external",
    sha256 = "d85951a92c0908c80bd8551002d66cb23c3434409c814179c0ff026b53544dab",
    strip_prefix = "rules_jvm_external-{}".format(RULES_JVM_EXTERNAL_TAG),
    type = "zip",
    url = "https://github.com/bazelbuild/rules_jvm_external/archive/{}.zip".format(RULES_JVM_EXTERNAL_TAG),
)

load("@io_bazel_rules_twirl//:workspace.bzl", "twirl_repositories")
twirl_repositories()
load("@twirl//:defs.bzl", twirl_pinned_maven_install = "pinned_maven_install")
twirl_pinned_maven_install()

My BUILD:

load("@io_bazel_rules_twirl//twirl:twirl.bzl", "twirl_templates")


twirl_templates(
  name = "twirl-templates",
  source_directory = "templates",
  include_play_imports = True,
  srcs = glob(["templates/**/*.scala.html"])
    + glob(["templates/**/*.scala.xml"])
    + glob(["templates/**/*.scala.js"])
    + glob(["templates/**/*.scala.txt"]),
)

scala_binary(
  name = "test-main",
  srcs = glob(["Main.scala"]) + [":twirl-templates"],
  main_class = "com.foo.bar.Main",
  deps = []
)

My HTML named templates/foo.scala.html (no arg):

<html>
  <body>
    <p>Hello World</p>
  </body>
</html>>

And I'm getting

/templates/foo.html.scala:4: error: not found: object play
import play.twirl.api._

and similar issues with resolving play.
I don't have play embedded in our bazel, I'm mostly trying to use twirl as a stand alone codegen. Is there a step I'm missing?

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

1 participant