Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
smparkes committed Jan 25, 2020
1 parent 45568f3 commit 7b5b3c1
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
32 changes: 30 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
workspace(name = "io_bazel_rules_scala")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

#####
# bazel-skylib 0.8.0 released 2019.03.20 (https://github.com/bazelbuild/bazel-skylib/releases/tag/0.8.0)
skylib_version = "0.8.0"

http_archive(
name = "bazel_skylib",
sha256 = "2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e",
type = "tar.gz",
url = "https://github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib.{}.tar.gz".format(skylib_version, skylib_version),
)

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

rules_jvm_external()

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

scala_configuration()

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

scala_repositories()
#####

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external")

Expand Down Expand Up @@ -131,9 +159,9 @@ local_repository(
path = "third_party/test/strip_resource_external_workspace",
)

load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_unused_deps_toolchains")
# load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_unused_deps_toolchains")

scala_register_unused_deps_toolchains()
# scala_register_unused_deps_toolchains()

register_toolchains("@io_bazel_rules_scala//test/proto:scalapb_toolchain")

Expand Down
8 changes: 8 additions & 0 deletions scala/scala_configuration.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ def scala_configuration():
)
scala_configuration.append(
"""
def versioned_file(file, version):
configuration = scala_version_configuration(version)
components = file.split(".")
components[0] = components[0] + "_{scala_mvn_version}"
glob_string = ".".join(components).format(**configuration)
array = (native.glob([glob_string]) + [file])[0:1]
return array
def scala_configured_string(string):
return string.format(**scala_configuration())
Expand Down
5 changes: 2 additions & 3 deletions src/java/io/bazel/rulesscala/scalac/BUILD.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ load(
"@io_bazel_rules_scala_configuration//:scala_configuration.bzl",
_scala_configuration = "scala_configuration",
_scala_version_configuration = "scala_version_configuration",
_versioned_file = "versioned_file",
)
load(
":jvm_export_toolchain.bzl",
Expand All @@ -23,9 +24,7 @@ def build():
"CompileOptions.java",
"Resource.java",
"ScalaCInvoker.java",
] + [
(native.glob(["ScalacProcessor_{scala_mvn_version}.java".format(**configuration)]) + ["ScalacProcessor.java"])[0],
],
] + _versioned_file("ScalacProcessor.java", version),
javacopts = [
"-source 1.8",
"-target 1.8",
Expand Down

0 comments on commit 7b5b3c1

Please sign in to comment.