Travis | Stardoc |
---|---|
Stardoc |
rules_play_routes
compiles Play Framework routes files templates to Scala, so they can be used with rules_scala
.
For more information about the Play Framework, see the Play documentation.
Create a file called at the top of your repository named WORKSPACE
and add the following snippet to it.
# update version as needed
rules_play_routes_version = "cba8a4383d81e6519730ba2b0203f74fd2c9b765"
http_archive(
name = "io_bazel_rules_play_routes",
url = "https://github.com/lucidsoftware/rules_play_routes/archive/%s.zip"%rules_play_routes_version,
type = "zip",
strip_prefix= "rules_play_routes-%s" % rules_play_routes_version
)
This installs rules_play_routes
to your WORKSPACE
at the specified commit. Update the commit as needed.
http://lucidsoftware.github.io/rules_play_routes/
Stardoc is replacing Skydoc and is currently under development. Doc is likely going to look funny for a while.
Stardoc is automatically updated on build merged into the master branch. To update the documentation, please submit a pull request. The doc will be updated when it is merged.
The Stardoc site for rules_play_routes
is deployed from the gh-pages
branch. That branch is deployed with each build of the master branch.
The play_routes
rule compiles Play routes files to a source jar that can be used with the rules_scala
rules. For example,
play_routes(
name = "play-routes",
srcs = ["conf/routes"] + glob(["conf/*.routes"]),
include_play_imports = True,
generate_reverse_router = True,
routes_imports = [...],
)
scala_binary(
name = "foo-service",
srcs = glob(["app/**/*.scala"]) + [":play-routes"],
main_class = "foo.server.RunServer",
deps = [...]
)
)
See the Stardoc documentation for the full list of options for play_routes
.
play_routes
can be used with rules_twirl
to run a Play Framework Service. For example
twirl_templates(
name = "twirl-templates",
source_directory = "app",
include_play_imports = True,
srcs = glob(["app/**/*.scala.html"])
+ glob(["app/**/*.scala.xml"])
+ glob(["app/**/*.scala.js"])
+ glob(["app/**/*.scala.txt"]),
additional_imports = [...],
)
play_routes(
name = "play-routes",
srcs = ["conf/routes"] + glob(["conf/*.routes"]),
include_play_imports = True,
generate_reverse_router = True,
routes_imports = [...],
)
scala_binary(
name = "foo-service",
srcs = glob(["app/**/*.scala"]) + [":twirl-templates", ":play-routes"],
visibility = ["//visibility:public"],
main_class = "play.core.server.ProdServerStart",
resources = ["conf/logback.xml"] + glob(["conf/resources/**/*"]),
resource_strip_prefix = native.package_name(),
classpath_resources = ["conf/application.conf"],
jvm_flags = [
"-Dhttp.port=9000",
"-Dapplication.name=foo-service",
],
deps = [...],
)
This project consists of the Play routes Bazel rules and a command line Play routes compiler compiler. The command line compiler can be built with
bazel build //play-routes-compiler
It can be run with
bazel run //play-routes-compiler
All tests can be run using
test/run_all_tests.sh
They can also be run using
bazel test //test/...
The CI config in tools/bazel.rc
and other options in .bazelrc.travis
are used during CI builds.
Skylint is run during CI builds. To run it locally use
tools/skylint.sh