Skip to content

Commit c9ff71b

Browse files
committed
Create temp dir for outputs by default
1 parent 3a407eb commit c9ff71b

File tree

3 files changed

+32
-26
lines changed

3 files changed

+32
-26
lines changed

build.sc

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import $ivy.`com.goyeau::mill-scalafix::0.4.0`
44
import $file.playwrightVersion // used to cache in GHA
55

66
import io.github.quafadas.millSite._
7-
import mill._, scalalib._, publish._
7+
import mill._, scalalib._, publish._, scalanativelib._
88
import mill.scalalib.scalafmt.ScalafmtModule
99
import de.tobiasroeser.mill.vcs.version._
1010

@@ -14,8 +14,9 @@ trait FormatFix extends ScalafmtModule with ScalafixModule{
1414
override def scalacOptions: Target[Seq[String]] = super.scalacOptions() ++ Seq("-Wunused:all")
1515
}
1616

17-
object project extends ScalaModule with PublishModule with FormatFix {
17+
object project extends ScalaModule with PublishModule with FormatFix /*with ScalaNativeModule*/ {
1818
def scalaVersion = "3.4.2"
19+
1920
def ivyDeps = super.ivyDeps() ++ Seq(
2021
ivy"org.http4s::http4s-ember-server::0.23.26",
2122
ivy"org.http4s::http4s-ember-client::0.23.26",
@@ -59,6 +60,26 @@ object project extends ScalaModule with PublishModule with FormatFix {
5960
)
6061
)
6162
}
62-
63+
//def scalaNativeVersion = "0.4.17" // aspirational :-)
6364

6465
}
66+
67+
// SN deps which aren't yet there.
68+
/**
69+
1 targets failed
70+
project.resolvedIvyDeps
71+
Resolution failed for 2 modules:
72+
--------------------------------------------
73+
com.outr:scribe-cats_native0.4_3:3.13.5
74+
not found: /Users/simon/.ivy2/local/com.outr/scribe-cats_native0.4_3/3.13.5/ivys/ivy.xml
75+
not found: https://repo1.maven.org/maven2/com/outr/scribe-cats_native0.4_3/3.13.5/scribe-cats_native0.4_3-3.13.5.pom
76+
io.circe:circe-yaml_native0.4_3:0.15.1
77+
not found: /Users/simon/.ivy2/local/io.circe/circe-yaml_native0.4_3/0.15.1/ivys/ivy.xml
78+
not found: https://repo1.maven.org/maven2/io/circe/circe-yaml_native0.4_3/0.15.1/circe-yaml_native0.4_3-0.15.1.pom
79+
80+
--------------------------------------------
81+
82+
For additional information on library dependencies, see the docs at
83+
https://mill-build.com/mill/Library_Dependencies.html
84+
85+
**/

project/src/live.server.scala

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// write a basic http4s server
2-
31
import scala.concurrent.duration.*
42

53
import org.http4s.*
@@ -70,12 +68,6 @@ object LiveServer
7068
.withShutdownTimeout(10.milli)
7169
.build
7270

73-
// override def main: Opts[IO[ExitCode]] =
74-
// (showProcessesOpts orElse buildOpts).map {
75-
// case ShowProcesses(all) => ???
76-
// case BuildImage(dockerFile, path) => ???
77-
// }
78-
7971
val logLevelOpt: Opts[String] = Opts
8072
.option[String]("log-level", help = "The log level. info, debug, error, trace)")
8173
.withDefault("info")
@@ -103,8 +95,13 @@ object LiveServer
10395
.validate("The project directory should be a fully qualified directory")(s => os.isDir(os.Path(s)))
10496

10597
val outDirOpt = Opts
106-
.option[String]("out-dir", "Where the compiled JS will be compiled to - e.g. c:/temp/helloScalaJS/.out")
107-
.withDefault((os.pwd / ".out").toString())
98+
.option[String](
99+
"out-dir",
100+
"Where the compiled JS will be compiled to - e.g. c:/temp/helloScalaJS/.out. If no file is given, a temporary directory is created."
101+
)
102+
.withDefault(
103+
os.temp.dir().toString()
104+
)
108105
.validate("Must be a directory")(s => os.isDir(os.Path(s)))
109106

110107
val stylesDirOpt = Opts
@@ -155,8 +152,7 @@ object LiveServer
155152
val indexHtmlTemplateOpt: Opts[Option[String]] = Opts
156153
.option[String](
157154
"path-to-index-html-template",
158-
"a path to a file which contains the index.html template you want to use. \n" +
159-
"The file _MUST_ have the EXACT string <script __REPLACE_WITH_MODULE_HEADERS__\\> in the header tag/>"
155+
"a path to a file which contains the index.html template you want to use."
160156
)
161157
.validate(
162158
"index.html must be a file, with a .html extension, and must contain <head> </head> and <body> </body> tags"

project/test/src/liveServer.test.scala

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class PlaywrightTest extends munit.FunSuite:
4242
// create a temp folder
4343
val tempDir = os.temp.dir()
4444
// create a file in the folder
45-
os.makeDir.all(outDir(tempDir))
4645
os.makeDir.all(styleDir(tempDir))
4746
os.write.over(tempDir / "hello.scala", helloWorldCode("Hello"))
4847
os.write.over(styleDir(tempDir) / "index.less", "")
@@ -67,8 +66,6 @@ class PlaywrightTest extends munit.FunSuite:
6766
"scala-cli",
6867
"--project-dir",
6968
testDir.toString,
70-
"--out-dir",
71-
outDir(testDir).toString,
7269
"--styles-dir",
7370
styleDir(testDir).toString,
7471
"--port",
@@ -103,8 +100,6 @@ class PlaywrightTest extends munit.FunSuite:
103100
"scala-cli",
104101
"--project-dir",
105102
testDir.toString,
106-
"--out-dir",
107-
outDir(testDir).toString,
108103
"--styles-dir",
109104
styleDir(testDir).toString,
110105
"--port",
@@ -146,8 +141,6 @@ class PlaywrightTest extends munit.FunSuite:
146141
"scala-cli",
147142
"--project-dir",
148143
testDir.toString,
149-
"--out-dir",
150-
outDir(testDir).toString,
151144
"--styles-dir",
152145
styleDir(testDir).toString,
153146
"--port",
@@ -180,8 +173,6 @@ class PlaywrightTest extends munit.FunSuite:
180173
"scala-cli",
181174
"--project-dir",
182175
testDir.toString,
183-
"--out-dir",
184-
outDir(testDir).toString,
185176
"--port",
186177
thisTestPort.toString
187178
)
@@ -206,8 +197,6 @@ class PlaywrightTest extends munit.FunSuite:
206197
"scala-cli",
207198
"--project-dir",
208199
testDir.toString,
209-
"--out-dir",
210-
outDir(testDir).toString,
211200
"--port",
212201
thisTestPort.toString,
213202
"--styles-dir",

0 commit comments

Comments
 (0)