You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** A simple Scala compiler designed to handle scaladocs, Java projects & get `scalac` outputs.
9
+
*
10
+
* @paramdefaultJavaCommand
11
+
* the default `java` command to be used
12
+
* @paramdefaultJavaOptions
13
+
* the default jvm options to be used with the `java` command
14
+
* @paramscaladoc
15
+
* a flag for setting whether this compiler will handle scaladocs
16
+
*/
8
17
finalcaseclassSimpleScalaCompiler(
9
18
defaultJavaCommand: String,
10
19
defaultJavaOptions: Seq[String],
@@ -24,47 +33,164 @@ final case class SimpleScalaCompiler(
24
33
overridedefusesClassDir:Boolean=
25
34
!scaladoc
26
35
36
+
/** Run a synthetic (created in runtime) `scalac` as a JVM process with the specified parameters
37
+
*
38
+
* @parammainClass
39
+
* the main class of the synthetic Scala compiler
40
+
* @paramjavaHomeOpt
41
+
* Java home path (optional)
42
+
* @paramjavacOptions
43
+
* options to be passed for the Java compiler
44
+
* @paramscalacOptions
45
+
* options to be passed for the Scala compiler
46
+
* @paramclassPath
47
+
* class path to be passed to `scalac`
48
+
* @paramcompilerClassPath
49
+
* class path for the Scala compiler itself
50
+
* @paramsources
51
+
* sources to be passed when running `scalac` (optional)
52
+
* @paramoutputDir
53
+
* output directory for the compiler (optional)
54
+
* @paramcwd
55
+
* working directory for running the compiler
56
+
* @paramlogger
57
+
* logger
58
+
* @return
59
+
* compiler process exit code
60
+
*/
27
61
privatedefrunScalacLike(
28
-
project: Project,
29
62
mainClass: String,
30
-
outputDir: os.Path,
63
+
javaHomeOpt: Option[os.Path],
64
+
javacOptions: Seq[String],
65
+
scalacOptions: Seq[String],
66
+
classPath: Seq[os.Path],
67
+
compilerClassPath: Seq[os.Path],
68
+
sources: Seq[String],
69
+
outputDir: Option[os.Path],
70
+
cwd: os.Path,
31
71
logger: Logger
32
-
):Boolean= {
72
+
):Int= {
33
73
34
-
os.makeDir.all(outputDir)
74
+
outputDir.foreach(os.makeDir.all(_))
35
75
36
76
// initially adapted from https://github.com/VirtusLab/scala-cli/pull/103/files#diff-d13a7e6d602b8f84d9177e3138487872f0341d006accfe425886a561f029a9c3R120 and around
0 commit comments