Skip to content

Commit

Permalink
automated project-root resolution added
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-skrodzka committed Oct 28, 2024
1 parent 3a750fd commit 4c23373
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions deps/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ scala_binary(
srcs = ["//deps/src:deps"],
args = [
"--project-root=.",
"--scala-version=3.5.1-RC1", #TODO
"--scala-version=3.5.2", #TODO
],
main_class = "rules_scala3.deps.src.Deps",
resources = ["//deps/src/templates:jar_artifact_callback"],
Expand All @@ -16,4 +16,4 @@ scala_binary(
"@annex_deps//:org_scala_sbt_librarymanagement_core_3",
"@annex_deps//:org_scala_sbt_librarymanagement_coursier_3",
],
)
)
7 changes: 6 additions & 1 deletion deps/src/Vars.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ object Vars:
help('h', "help").text("Prints this usage text"),
opt[File]('r', "project-root")
.required()
.action((value, vars) => vars.copy(projectRoot = value))
.action((value, vars) => {
val resolvedPath = value.getPath match
case "." => new File(sys.env.getOrElse("BUILD_WORKSPACE_DIRECTORY", ".")).getAbsoluteFile
case _ => value.getAbsoluteFile
vars.copy(projectRoot = resolvedPath)
})
.text("The ABSOLUTE path to the root of the bazel repo"),
opt[String]('s', "scala-version")
.required()
Expand Down

0 comments on commit 4c23373

Please sign in to comment.