-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.sh
executable file
·52 lines (40 loc) · 1.34 KB
/
cli.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
set -euo pipefail
DEFAULT_TOOTHPICK_CONFIG="./toothpick-examples/src/test/resources/.toothpick.conf"
test_runner_create_stage() {
export TOOTHPICK_CONFIG=${TOOTHPICK_CONFIG:-"${DEFAULT_TOOTHPICK_CONFIG}"}
local TEMP_FILE
TEMP_FILE=$(mktemp)
trap "rm -Rf ${TEMP_FILE}" EXIT
1>&2 sbt --client "runner/exportClasspathToFile \"${TEMP_FILE}\""
local RUNNER_CP
RUNNER_CP=$(cat "${TEMP_FILE}") || exit $?
1>&2 sbt --client "examples/Test/exportClasspathToFile \"${TEMP_FILE}\""
local TEST_CP
TEST_CP=$(cat "${TEMP_FILE}") || exit $?
exec java \
-classpath \
"${RUNNER_CP}" \
"-Dconfig.entry=${TOOTHPICK_CONFIG}" \
dev.toothpick.app.TpConsoleRunnerStageApp \
-- \
-classpath \
"$PWD/.dev-sdks/intellij-scala-runners/intellij-scala-runners.jar:${TEST_CP}" \
org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner
}
test_runner_run_stage() {
export TOOTHPICK_CONFIG=${TOOTHPICK_CONFIG:-"${DEFAULT_TOOTHPICK_CONFIG}"}
local TEMP_FILE
TEMP_FILE=$(mktemp)
trap "rm -Rf ${TEMP_FILE}" EXIT
1>&2 sbt --client "runner/exportClasspathToFile \"${TEMP_FILE}\""
local RUNNER_CP
RUNNER_CP=$(cat "${TEMP_FILE}") || exit $?
exec java \
-classpath \
"${RUNNER_CP}" \
"-Dconfig.entry=${TOOTHPICK_CONFIG}" \
dev.toothpick.app.TpConsoleRunnerApp \
"$@"
}
"$@"