Skip to content

Commit

Permalink
Merge pull request #42 from lucidsoftware/jvm-external-ugprade
Browse files Browse the repository at this point in the history
Upgrade rules_jvm_external
  • Loading branch information
jjudd authored Sep 20, 2023
2 parents 04449e9 + 6a658a6 commit 299de4f
Show file tree
Hide file tree
Showing 14 changed files with 1,027 additions and 956 deletions.
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ startup --expand_configs_in_place

common:ci --color=yes

# At least until https://github.com/lucidsoftware/rules_scala/pull/40 is merged
common --incompatible_java_common_parameters=false

build:ci --verbose_failures
build:ci --sandbox_debug
build:ci --spawn_strategy=standalone
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bazelbuild/3.3.0
bazelbuild/6.3.2
10 changes: 4 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ jobs:
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
strategy:
matrix:
os: [ubuntu-18.04, macos-10.15]
bazel_version: [bazelbuild/3.2.0, bazelbuild/3.3.0]
os: [ubuntu-20.04]
bazel_version: [bazelbuild/5.4.0, bazelbuild/6.3.2]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- run: npm install -g @bazel/bazelisk
- uses: actions/checkout@v3
- run: cat .bazelrc.ci >> .bazelrc
- run: ./scripts/skylint.sh
- run: ./scripts/lint.sh
- run: ./test/run_all_tests.sh ci
- run: ./scripts/gen-docs.sh && git diff --exit-code docs/
- run: bazel shutdown
3 changes: 3 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")

buildifier(name = "buildifier")
120 changes: 89 additions & 31 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,119 +3,177 @@ workspace(name = "io_bazel_rules_twirl")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# rules_jvm_external
RULES_JVM_EXTERNAL_TAG = "4.2"
RULES_JVM_EXTERNAL_TAG = "5.3"

http_archive(
name = "rules_jvm_external",
sha256 = "cd1a77b7b02e8e008439ca76fd34f5b07aecb8c752961f9640dea15e9e5ba1ca",
sha256 = "6cc8444b20307113a62b676846c29ff018402fd4c7097fcd6d0a0fd5f2e86429",
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(":workspace.bzl", "twirl_repositories")

twirl_repositories()

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

twirl_pinned_maven_install()

load(":test_workspace.bzl", "twirl_test_repositories")

twirl_test_repositories()

load("@twirl_test//:defs.bzl", twirl_test_pinned_maven_install = "pinned_maven_install")

twirl_test_pinned_maven_install()

# Skylib
skylib_version = "1.0.2" # update this as needed
skylib_version = "1.4.2" # update this as needed

http_archive(
name = "bazel_skylib",
sha256 = "64ad2728ccdd2044216e4cec7815918b7bb3bb28c95b7e9d951f9d4eccb07625",
sha256 = "0fa67483ecf6a7c62b892b6f0d68aa4135586478077f0f97c4fbf39201648cf4",
strip_prefix = "bazel-skylib-{}".format(skylib_version),
type = "zip",
url = "https://github.com/bazelbuild/bazel-skylib/archive/{}.zip".format(skylib_version),
)

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

# rules_nodejs
# To use the JavaScript version of Sass, we need to first install nodejs
rules_nodejs_version = "1.4.1"
rules_nodejs_version = "5.3.0"

http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "6ea46cb994e349ceb255ec8340370883813cac825e6157770a15f11874d232d2",
sha256 = "322b2ecebd564586f5ccdd645833d7a2ecae2db554886e4435c3d02bdf2ecdf4",
strip_prefix = "rules_nodejs-{}".format(rules_nodejs_version),
type = "zip",
url = "https://github.com/bazelbuild/rules_nodejs/archive/{}.zip".format(rules_nodejs_version),
)

load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")

build_bazel_rules_nodejs_dependencies()

load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories")
node_repositories(package_json = [])

node_repositories()

# rules_sass
rules_sass_version = "1.26.2" # update this as needed
rules_sass_version = "1.67.0" # update this as needed

http_archive(
name = "io_bazel_rules_sass",
sha256 = "a31026741e4af6f1e5bcc9cce23db0549ecdea6270c8919da09110886102eb8e",
sha256 = "b29eb037568be386f7d4976fd160fefac98e0e26e3056e55f0d3eba2a0afb874",
strip_prefix = "rules_sass-{}".format(rules_sass_version),
type = "zip",
url = "https://github.com/bazelbuild/rules_sass/archive/{}.zip".format(rules_sass_version),
)
load("@io_bazel_rules_sass//:package.bzl", "rules_sass_dependencies")
rules_sass_dependencies()

load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")

sass_repositories()


rules_pkg_version = "0.9.1"
http_archive(
name = "rules_pkg",
sha256 = "8f9ee2dc10c1ae514ee599a8b42ed99fa262b757058f65ad3c384289ff70c4b8",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/{0}/rules_pkg-{0}.tar.gz".format(rules_pkg_version),
"https://github.com/bazelbuild/rules_pkg/releases/download/{0}/rules_pkg-{0}.tar.gz".format(rules_pkg_version),
],
)
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
rules_pkg_dependencies()

# Skydoc
skydoc_version = "0.3.0" # update this as needed
skydoc_version = "0.3.0" # update this as needed

http_archive(
name = "io_bazel_skydoc",
sha256 = "8762a212cff5f81505a1632630edcfe9adce381479a50a03c968bd2fc217972d",
strip_prefix = "skydoc-{}".format(skydoc_version),
type = "zip",
url = "https://github.com/bazelbuild/skydoc/archive/{}.zip".format(skydoc_version),
)

load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories")

skydoc_repositories()

# For Skylint
# Once https://github.com/bazelbuild/bazel/issues/4086 is done, this should be
# much simpler
bazel_version = "0.27.0"
# buildifier
buildtools_version = "4.2.2"

http_archive(
name = "com_github_bazelbuild_buildtools",
sha256 = "ae34c344514e08c23e90da0e2d6cb700fcd28e80c02e23e4d5715dddcb42f7b3",
strip_prefix = "buildtools-{}".format(buildtools_version),
url = "https://github.com/bazelbuild/buildtools/archive/refs/tags/{}.tar.gz".format(buildtools_version),
)

# buildifier is written in Go and hence needs rules_go to be built.
# See https://github.com/bazelbuild/rules_go for the up to date setup instructions.
http_archive(
name = "io_bazel",
sha256 = "2d86797a5b96163b7f5e9cbb8f09cc919066e7ee0fe1a614b79680ae36a14ef3",
strip_prefix = "bazel-{}".format(bazel_version),
urls = ["https://github.com/bazelbuild/bazel/archive/{}.zip".format(bazel_version)],
name = "io_bazel_rules_go",
sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
],
)
# Also for Skylint. Comes from
# https://github.com/cgrushko/proto_library/blob/master/WORKSPACE
protobuf_version = "3.11.4"

load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies")

go_rules_dependencies()

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains")

go_register_toolchains(version = "1.20.3")

# Also for buildifier. Comes from
# https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md
protobuf_version = "3.19.4"

http_archive(
name = "com_google_protobuf",
sha256 = "9748c0d90e54ea09e5e75fb7fac16edce15d2028d4356f32211cfa3c0e956564",
sha256 = "3bd7828aa5af4b13b99c191e8b1e884ebfa9ad371b0ce264605d347f135d2568",
strip_prefix = "protobuf-{}".format(protobuf_version),
type = "zip",
url = "https://github.com/protocolbuffers/protobuf/archive/v{}.zip".format(protobuf_version),
url = "https://github.com/protocolbuffers/protobuf/archive/v{}.tar.gz".format(protobuf_version),
)

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

# higherkindness/rules_scala (used for tests only)
# TODO: Move tests into their own worskpace s.t. we don't need their dependenices here
rules_scala_annex_version = "ff423d8bdd0e5383f8f2c048ffd7704bb51a91bf" # update this as needed
rules_scala_annex_version = "938ffdc24fb25a58220aa650948761073f1dd83b"

http_archive(
name = "rules_scala_annex",
sha256 = "ae53e9ed5fecadc7baf4637b88109471602be73dda4e5ff6b4bf1767932703c0",
sha256 = "ae0cfd560a5238248d5f4c9fcde352e5dfc87cba5efd0b97e4c88ea839fd51b5",
strip_prefix = "rules_scala-{}".format(rules_scala_annex_version),
type = "zip",
url = "https://github.com/higherkindness/rules_scala/archive/{}.zip".format(rules_scala_annex_version),
url = "https://github.com/lucidsoftware/rules_scala/archive/{}.zip".format(rules_scala_annex_version),
)

bind(
name = "default_scala",
actual = "@rules_scala_annex//src/main/scala:zinc_2_12_10",
actual = "@rules_scala_annex//src/main/scala:zinc_2_13_11",
)

load("@rules_scala_annex//rules/scala:workspace.bzl", "scala_register_toolchains", "scala_repositories")

scala_repositories()

load("@annex//:defs.bzl", annex_pinned_maven_install = "pinned_maven_install")

annex_pinned_maven_install()

scala_register_toolchains()
8 changes: 4 additions & 4 deletions compiler-cli/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
java_binary(
name = "compiler-cli",
runtime_deps = ["@twirl//:com_lucidchart_twirl_compiler_cli"],
main_class = "rulestwirl.twirl.CommandLineTwirlTemplateCompiler",
visibility = ["//visibility:public"]
name = "compiler-cli",
main_class = "rulestwirl.twirl.CommandLineTwirlTemplateCompiler",
visibility = ["//visibility:public"],
runtime_deps = ["@twirl//:com_lucidchart_twirl_compiler_cli"],
)
4 changes: 4 additions & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

echo "Running buildifier"
bazel run //:buildifier -- -r --lint=warn "$(bazel info workspace)"
8 changes: 0 additions & 8 deletions scripts/skylint.sh

This file was deleted.

82 changes: 41 additions & 41 deletions test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,54 @@ load("@rules_scala_annex//rules:scala.bzl", "scala_test")
load("//twirl:twirl.bzl", "twirl_templates")

twirl_templates(
name = "twirl-test-templates-basic",
visibility = ["//visibility:public"],
source_directory = "twirl-templates",
srcs = [
"twirl-templates/twirl/com/foo/views/hello.scala.html",
"twirl-templates/twirl/com/foo/views/hello.scala.txt",
"twirl-templates/twirl/com/foo/views/hello.scala.xml",
"twirl-templates/twirl/com/foo/views/hello.scala.js",
],
name = "twirl-test-templates-basic",
srcs = [
"twirl-templates/twirl/com/foo/views/hello.scala.html",
"twirl-templates/twirl/com/foo/views/hello.scala.js",
"twirl-templates/twirl/com/foo/views/hello.scala.txt",
"twirl-templates/twirl/com/foo/views/hello.scala.xml",
],
source_directory = "twirl-templates",
visibility = ["//visibility:public"],
)

twirl_templates(
name = "twirl-test-templates-additional-imports",
visibility = ["//visibility:public"],
source_directory = "twirl-templates",
srcs = [
"twirl-templates/twirl/com/foo/views/addImports.scala.txt",
],
additional_imports = ["rulestwirl.test.Person"],
name = "twirl-test-templates-additional-imports",
srcs = [
"twirl-templates/twirl/com/foo/views/addImports.scala.txt",
],
additional_imports = ["rulestwirl.test.Person"],
source_directory = "twirl-templates",
visibility = ["//visibility:public"],
)

twirl_templates(
name = "twirl-test-templates-custom-formatter",
visibility = ["//visibility:public"],
source_directory = "twirl-templates",
srcs = [
"twirl-templates/twirl/com/foo/views/customFormatter.scala.txt",
],
additional_imports = ["rulestwirl.test.Person"],
template_formats = {
"txt": "rulestwirl.test.StrangeTxtFormat"
},
name = "twirl-test-templates-custom-formatter",
srcs = [
"twirl-templates/twirl/com/foo/views/customFormatter.scala.txt",
],
additional_imports = ["rulestwirl.test.Person"],
source_directory = "twirl-templates",
template_formats = {
"txt": "rulestwirl.test.StrangeTxtFormat",
},
visibility = ["//visibility:public"],
)

scala_test(
name = "twirl-compiler-test",
srcs = [
"TwirlCompilerTest.scala",
"Person.scala",
"StrangeTxtFormatter.scala",
":twirl-test-templates-basic",
":twirl-test-templates-additional-imports",
":twirl-test-templates-custom-formatter",
],
deps = [
"@twirl_test//:com_typesafe_play_twirl_api_2_12",
"@twirl_test//:org_specs2_specs2_common_2_12",
"@twirl_test//:org_specs2_specs2_core_2_12",
"@twirl_test//:org_specs2_specs2_matcher_2_12",
],
name = "twirl-compiler-test",
srcs = [
"Person.scala",
"StrangeTxtFormatter.scala",
"TwirlCompilerTest.scala",
":twirl-test-templates-additional-imports",
":twirl-test-templates-basic",
":twirl-test-templates-custom-formatter",
],
deps = [
"@twirl_test//:com_typesafe_play_twirl_api_2_13",
"@twirl_test//:org_specs2_specs2_common_2_13",
"@twirl_test//:org_specs2_specs2_core_2_13",
"@twirl_test//:org_specs2_specs2_matcher_2_13",
],
)
8 changes: 4 additions & 4 deletions test_workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ def twirl_test_repositories():
maven_install(
name = "twirl_test",
artifacts = [
"com.typesafe.play:twirl-api_2.12:1.2.1",
"org.specs2:specs2-common_2.12:3.9.5",
"org.specs2:specs2-core_2.12:3.9.5",
"org.specs2:specs2-matcher_2.12:3.9.5",
"com.typesafe.play:twirl-api_2.13:1.6.1",
"org.specs2:specs2-common_2.13:4.20.2",
"org.specs2:specs2-core_2.13:4.20.2",
"org.specs2:specs2-matcher_2.13:4.20.2",
],
repositories = [
"https://repo.maven.apache.org/maven2",
Expand Down
5 changes: 3 additions & 2 deletions twirl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@io_bazel_skydoc//stardoc:stardoc.bzl", "stardoc")
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes")
load("@bazel_skylib//lib:paths.bzl", "paths")

[
Expand All @@ -20,7 +21,7 @@ load("@bazel_skylib//lib:paths.bzl", "paths")
pkg_tar(
name = "docs",
srcs = [paths.replace_extension(file, ".md").replace("/", "_") for file in glob(["**/*.bzl"])],
mode = "0644",
mode = "0644"
)

bzl_library(
Expand Down
Loading

0 comments on commit 299de4f

Please sign in to comment.