diff --git a/Dockerfile b/Dockerfile index f332496..c7054fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM openjdk:11 RUN apt update RUN apt install -y make RUN mkdir /irk -RUN git clone https://github.com/propensive/dotty /irk/scala +RUN git clone https://github.com/lampepfl/dotty /irk/scala RUN mkdir -p /irk/bin RUN curl -Lo /irk/sbt.tgz https://github.com/sbt/sbt/releases/download/v1.6.1/sbt-1.6.1.tgz RUN tar xvf /irk/sbt.tgz -C /irk @@ -48,20 +48,20 @@ RUN cp -r /irk/one/mod/gesticulate/res/gesticulate /irk/bin/ RUN cd /irk && scala/bin/scalac \ -classpath bin \ + -Xmax-inlines 64 \ -language:experimental.fewerBraces \ -language:experimental.saferExceptions \ -language:experimental.erasedDefinitions \ -d bin \ - src/core/*.scala \ one/mod/acyclicity/src/core/*.scala \ one/mod/adversaria/src/core/*.scala \ one/mod/caesura/src/core/*.scala \ one/mod/cataract/src/core/*.scala \ one/mod/clairvoyant/src/css/*.scala \ - one/mod/clairvoyant/src/time/*.scala \ one/mod/clairvoyant/src/file/*.scala \ one/mod/clairvoyant/src/html/*.scala \ one/mod/clairvoyant/src/http/*.scala \ + one/mod/clairvoyant/src/time/*.scala \ one/mod/clairvoyant/src/uri/*.scala \ one/mod/contextual/src/core/*.scala \ one/mod/cosmopolite/src/core/*.scala \ @@ -75,30 +75,55 @@ RUN cd /irk && scala/bin/scalac \ one/mod/gossamer/src/core/*.scala \ one/mod/guillotine/src/core/*.scala \ one/mod/harlequin/src/core/*.scala \ - one/mod/honeycomb/src/core/*.scala \ one/mod/imperial/src/core/*.scala \ one/mod/iridescence/src/core/*.scala \ one/mod/jovian/src/core/*.scala \ one/mod/kaleidoscope/src/core/*.scala \ - one/mod/probably/src/core/*.scala \ one/mod/probably/src/cli/*.scala \ + one/mod/probably/src/core/*.scala \ one/mod/probably/src/tolerance/*.scala \ - one/mod/punctuation/src/core/*.scala \ - one/mod/punctuation/src/ansi/*.scala \ - one/mod/punctuation/src/html/*.scala \ - one/mod/profanity/src/java/**/*.java \ one/mod/profanity/src/core/*.scala \ + one/mod/profanity/src/java/**/*.java \ one/mod/rudiments/src/core/*.scala \ - one/mod/scintillate/src/uri/*.scala \ - one/mod/scintillate/src/core/*.scala \ - one/mod/scintillate/src/server/*.scala \ - one/mod/scintillate/src/servlet/*.scala \ one/mod/slalom/src/core/*.scala \ - one/mod/tarantula/src/core/*.scala \ one/mod/turbulence/src/core/*.scala \ one/mod/wisteria/src/core/*.scala \ one/mod/xylophone/src/core/*.scala +RUN cd /irk && scala/bin/scalac \ + -classpath bin \ + -Xmax-inlines 64 \ + -language:experimental.fewerBraces \ + -language:experimental.saferExceptions \ + -language:experimental.erasedDefinitions \ + -d bin \ + one/mod/honeycomb/src/core/*.scala + +RUN cd /irk && scala/bin/scalac \ + -classpath bin \ + -Xmax-inlines 64 \ + -language:experimental.fewerBraces \ + -language:experimental.saferExceptions \ + -language:experimental.erasedDefinitions \ + -d bin \ + one/mod/punctuation/src/ansi/*.scala \ + one/mod/punctuation/src/core/*.scala \ + one/mod/punctuation/src/html/*.scala \ + one/mod/scintillate/src/core/*.scala \ + one/mod/scintillate/src/server/*.scala \ + one/mod/scintillate/src/servlet/*.scala \ + one/mod/scintillate/src/uri/*.scala \ + one/mod/tarantula/src/core/*.scala + +RUN cd /irk && scala/bin/scalac \ + -classpath bin \ + -Xmax-inlines 64 \ + -language:experimental.fewerBraces \ + -language:experimental.saferExceptions \ + -language:experimental.erasedDefinitions \ + -d bin \ + src/core/*.scala + RUN unzip -q -o -d /irk/bin /irk/scala/dist/target/pack/lib/tasty-core*.jar RUN unzip -q -o -d /irk/bin /irk/scala/dist/target/pack/lib/compiler-interface*.jar RUN unzip -q -o -d /irk/bin /irk/scala/dist/target/pack/lib/scala-library*.jar diff --git a/build.irk b/build.irk index 3e60aa9..68e4b0f 100644 --- a/build.irk +++ b/build.irk @@ -1,5 +1,5 @@ { - "imports": ["../one/build.irk"], + "imports": ["one/build.irk"], "publishing": { "username": "propensive", "group": "com.propensive", @@ -25,7 +25,7 @@ "acyclicity/core", "jovian/core", "scintillate/core", "euphemism/core", "honeycomb/core", "exoskeleton/core", "clairvoyant/time", "imperial/core", "tarantula/core"], "sources": ["src/core"], - "version": "0.4.4", + "version": "0.5.0", "docs": ["doc"], "artifact": { "main": "irk.Irk", diff --git a/doc/.version b/doc/.version index 6f2743d..8f0916f 100644 --- a/doc/.version +++ b/doc/.version @@ -1 +1 @@ -0.4.4 +0.5.0 diff --git a/one b/one deleted file mode 160000 index 768d5ce..0000000 --- a/one +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 768d5ce1990572bfa49e7bef88d90e0a4710d101 diff --git a/src/core/compilation.scala b/src/core/compilation.scala index 0a66c85..05517d9 100644 --- a/src/core/compilation.scala +++ b/src/core/compilation.scala @@ -51,7 +51,8 @@ object Compiler: val ctx = initCtx.fresh setup(Array[String]("-d", out.fullname.s, "-deprecation", "-feature", "-Wunused:all", "-new-syntax", "-Yrequire-targetName", "-Ysafe-init", "-Yexplicit-nulls", - "-Ycheck-all-patmat", ""), ctx).map(_(1)).get + "-Xmax-inlines", "64", + "-Ycheck-all-patmat", "-classpath", classpathText.s, ""), ctx).map(_(1)).get def run(files: List[File], classpath: Text): List[Diagnostic] = val ctx = currentCtx.fresh @@ -64,10 +65,10 @@ object Compiler: val sources = files.to(List).map: file => PlainFile(Path(file.fullname.s)) - val run: Run = Scala3.newRun(using ctx2) cancel.future.andThen: _ => run.isCancelled = true + run.compile(sources) finish(Scala3, run)(using ctx2) reporter.errors.to(List) @@ -92,7 +93,9 @@ object Compiler: catch case err: Throwable => if !cancel.isCompleted then Out.println(StackTrace(err).ansi) + Compiler.synchronized: Scala3 = new dotty.tools.dotc.Compiler() + Result.Terminal(ansi"The compiler crashed") else Result.Aborted \ No newline at end of file diff --git a/src/core/irk.scala b/src/core/irk.scala index 6c788e5..81f7a2d 100644 --- a/src/core/irk.scala +++ b/src/core/irk.scala @@ -250,7 +250,9 @@ case class Step(path: File, publishing: Option[Publishing], name: Text, : Result = try val t0 = now() - classesDir.children.foreach(_.delete()) + classesDir.children.foreach: + case file: Unix.File => file.delete() + case dir: Unix.Directory => dir.delete() val cp = compileClasspath(build) val result = Compiler.compile(id, srcFiles.to(List), cp, classesDir, scriptFile, cancel) val time = now() - t0 diff --git a/src/core/main.scala b/src/core/main.scala index 2da44bc..302dd54 100644 --- a/src/core/main.scala +++ b/src/core/main.scala @@ -46,25 +46,33 @@ object Irk extends Daemon(): props.load(getClass.nn.getClassLoader.nn.getResourceAsStream("compiler.properties").nn) props.get("version.number").toString.show - def homeDir: Directory = Home() + def homeDir: Unix.Directory = Home() - def cacheDir: Directory = - try unsafely(Home.Cache[jovian.DiskPath]() / t"irk").directory(Ensure) + def cacheDir: Unix.Directory = + try + unsafely(Home.Cache[jovian.DiskPath]() / t"irk").directory(Ensure) match + case dir: Unix.Directory => dir catch case err: IoError => throw AppError(t"The user's cache directory could not be created", err) - def libDir: Directory = - try unsafely(Home.Cache[jovian.DiskPath]() / t"lib").directory(Ensure) + def libDir: Unix.Directory = + try + unsafely(cacheDir / t"lib").directory(Ensure) match + case dir: Unix.Directory => dir catch case err: IoError => throw AppError(t"The user's cache directory could not be created", err) - def tmpDir: Directory = - try unsafely(cacheDir / t"tmp").directory(Ensure) + def tmpDir: Unix.Directory = + try + unsafely(cacheDir / t"tmp").directory(Ensure) match + case dir: Unix.Directory => dir catch case err: IoError => throw AppError(t"The user's temporary directory could not be created", err) - def hashesDir: Directory = - try unsafely(cacheDir / t"hashes").directory(Ensure) + def hashesDir: Unix.Directory = + try + unsafely(cacheDir / t"hashes").directory(Ensure) match + case dir: Unix.Directory => dir catch case err: IoError => throw AppError(t"The user's cache directory could not be created", err) @@ -193,7 +201,9 @@ object Irk extends Daemon(): if path.exists() && seen.contains(digest) then readBuilds(build, seen, tail*) else if path.exists() then Out.println(ansi"Reading build file ${palette.File}(${path.relativeTo(build.pwd.path).get.show})") - val buildConfig = Json.parse(path.file().read[Text](1.mb)).as[BuildConfig] + val buildConfig = locally: + import unsafeExceptions.canThrowAny + Json.parse(path.file().read[Text](1.mb)).as[BuildConfig] buildConfig.gen(path, build, seen + digest, files*) else throw AppError(txt"""Build contains an import reference to a nonexistant build""")