forked from higherkindness/rules_scala
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from lucidsoftware/more-worker-updates
Sends verbosity from the worker protocol to the worker, enables Java toolchain multiplex sandboxing, and fixes the launcher to work with multiplex sandboxing
- Loading branch information
Showing
20 changed files
with
157 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
load("@rules_scala_annex//rules:scala.bzl", "scala_binary") | ||
load("verbosity_spec_worker_run.bzl", "verbosity_spec_worker_run") | ||
|
||
scala_binary( | ||
name = "verbosity-spec-worker", | ||
srcs = [ | ||
"RunnerThatPrintsVerbosity.scala", | ||
], | ||
scala = "//scala:2_13", | ||
tags = ["manual"], | ||
deps = [ | ||
"@rules_scala_annex//src/main/scala/higherkindness/rules_scala/common/sandbox", | ||
"@rules_scala_annex//src/main/scala/higherkindness/rules_scala/common/worker", | ||
], | ||
) | ||
|
||
verbosity_spec_worker_run( | ||
name = "verbosity-spec-target", | ||
verbosity_spec_worker = ":verbosity-spec-worker", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package anx.cancellation | ||
|
||
import higherkindness.rules_scala.common.worker.WorkerMain | ||
import higherkindness.rules_scala.common.sandbox.SandboxUtil | ||
|
||
import java.io.{InputStream, PrintStream} | ||
import java.nio.file.{Files, Path, Paths} | ||
|
||
object RunnerThatPrintsVerbosity extends WorkerMain[Unit] { | ||
override def init(args: Option[Array[String]]): Unit = () | ||
override def work(ctx: Unit, args: Array[String], out: PrintStream, workDir: Path, verbosity: Int): Unit = { | ||
out.println(s"Verbosity: ${verbosity}") | ||
Files.createFile(SandboxUtil.getSandboxPath(workDir, Paths.get(args(0)))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash -e | ||
. "$(dirname "$0")"/../common.sh | ||
|
||
# We use modify_execution_info, nouse_action_cache, and bazel shutdown here | ||
# in order to prevent the disk cache, skyframe cache, and persistent action cache | ||
# from being used for the verbosity spec worker actions and thus getting the | ||
# verbosity we want getting printed. The alternative is to bazel clean, which | ||
# takes much longer. | ||
bazel shutdown | ||
bazel build --modify_execution_info="VerbositySpecWorkerRun=+no-cache" --nouse_action_cache :verbosity-spec-target |& grep -q "Verbosity: 0" | ||
bazel shutdown | ||
bazel build --modify_execution_info="VerbositySpecWorkerRun=+no-cache" --nouse_action_cache --worker_verbose :verbosity-spec-target |& grep -q "Verbosity: 10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
def _impl(ctx): | ||
foo_file = ctx.actions.declare_file("foo.txt") | ||
outputs = [foo_file] | ||
|
||
args = ctx.actions.args() | ||
args.add(foo_file) | ||
args.set_param_file_format("multiline") | ||
args.use_param_file("@%s", use_always = True) | ||
|
||
ctx.actions.run( | ||
outputs = outputs, | ||
arguments = [args], | ||
mnemonic = "VerbositySpecWorkerRun", | ||
execution_requirements = { | ||
"supports-multiplex-workers": "1", | ||
"supports-workers": "1", | ||
"supports-multiplex-sandboxing": "1", | ||
"supports-worker-cancellation": "1", | ||
}, | ||
progress_message = "Running verbosity spec worker %{label}", | ||
executable = ctx.executable.verbosity_spec_worker, | ||
) | ||
|
||
return [ | ||
DefaultInfo(files = depset(outputs)), | ||
] | ||
|
||
verbosity_spec_worker_run = rule( | ||
implementation = _impl, | ||
doc = "Runs a worker that prints the verbosity level it received from the work request", | ||
attrs = { | ||
"verbosity_spec_worker": attr.label( | ||
executable = True, | ||
cfg = "host", | ||
allow_files = True, | ||
default = Label(":verbosity-spec-worker"), | ||
), | ||
}, | ||
) |