Skip to content

Commit 8afc9bb

Browse files
committed
Rewrite community-build to indent
1 parent b949156 commit 8afc9bb

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

community-build/src/scala/dotty/communitybuild/projects.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,14 @@ final case class SbtCommunityProject(
111111
sbtDocCommand: String = null,
112112
scalacOptions: List[String] = SbtCommunityProject.scalacOptions,
113113
requiresExperimental: Boolean = false,
114+
rewriteToIndent: Boolean = true,
114115
) extends CommunityProject:
115116
override val binaryName: String = "sbt"
116117

117118
private def scalacOptionsString: String =
118-
scalacOptions.map("\"" + _ + "\"").mkString("List(", ",", ")")
119+
((if rewriteToIndent then Seq("-indent", "-rewrite") else Seq.empty) ++ scalacOptions)
120+
.map("\"" + _ + "\"")
121+
.mkString("List(", ",", ")")
119122

120123
private val baseCommand =
121124
"clean; set Global/logLevel := Level.Error; set Global/updateOptions ~= (_.withLatestSnapshots(false)); "
@@ -290,7 +293,8 @@ object projects:
290293
// Problem parsing scalatest.dotty/target/scala-3.0.0-M2/src_managed/main/org/scalatest/concurrent/ConductorFixture.scala:[602..624..3843], documentation may not be generated.
291294
// dotty.tools.dotc.core.MissingType:
292295
dependencies = List(scalaXml),
293-
testOnlyDependencies = () => List(scalatestplusJunit, scalatestplusTestNG)
296+
testOnlyDependencies = () => List(scalatestplusJunit, scalatestplusTestNG),
297+
rewriteToIndent = false
294298
)
295299

296300
lazy val scalatestplusScalacheck = SbtCommunityProject(

compiler/src/dotty/tools/dotc/Run.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,12 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
394394
private var myCtx: Context | Null = rootContext(using ictx)
395395

396396
/** The context created for this run */
397-
given runContext[Dummy_so_its_a_def]: Context = myCtx.nn
397+
given runContext[Dummy_so_its_a_def]: Context =
398+
// if indent enabled, remove no-indent
399+
if myCtx.nn.settings.indent.value(using myCtx.nn) then
400+
myCtx.nn.fresh.setSetting(myCtx.nn.settings.noindent, false)
401+
else myCtx.nn
402+
398403
assert(runContext.runId <= Periods.MaxPossibleRunId)
399404
}
400405

0 commit comments

Comments
 (0)