Skip to content

Commit 1efd1ee

Browse files
committed
Rename ModuleInputs to Module
1 parent 0f909b5 commit 1efd1ee

39 files changed

+287
-288
lines changed

modules/build/src/main/scala/scala/build/Build.scala

Lines changed: 92 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import scala.util.control.NonFatal
3030
import scala.util.{Properties, Try}
3131

3232
trait Build {
33-
def inputs: ModuleInputs
33+
def inputs: Module
3434
def options: BuildOptions
3535
def scope: Scope
3636
def outputOpt: Option[os.Path]
@@ -43,17 +43,17 @@ trait Build {
4343
object Build {
4444

4545
final case class Successful(
46-
inputs: ModuleInputs,
47-
options: BuildOptions,
48-
scalaParams: Option[ScalaParameters],
49-
scope: Scope,
50-
sources: Sources,
51-
artifacts: Artifacts,
52-
project: Project,
53-
output: os.Path,
54-
diagnostics: Option[Seq[(Either[String, os.Path], bsp4j.Diagnostic)]],
55-
generatedSources: Seq[GeneratedSource],
56-
isPartial: Boolean
46+
inputs: Module,
47+
options: BuildOptions,
48+
scalaParams: Option[ScalaParameters],
49+
scope: Scope,
50+
sources: Sources,
51+
artifacts: Artifacts,
52+
project: Project,
53+
output: os.Path,
54+
diagnostics: Option[Seq[(Either[String, os.Path], bsp4j.Diagnostic)]],
55+
generatedSources: Seq[GeneratedSource],
56+
isPartial: Boolean
5757
) extends Build {
5858
def success: Boolean = true
5959
def successfulOpt: Some[this.type] = Some(this)
@@ -171,24 +171,24 @@ object Build {
171171
}
172172

173173
final case class Failed(
174-
inputs: ModuleInputs,
175-
options: BuildOptions,
176-
scope: Scope,
177-
sources: Sources,
178-
artifacts: Artifacts,
179-
project: Project,
180-
diagnostics: Option[Seq[(Either[String, os.Path], bsp4j.Diagnostic)]]
174+
inputs: Module,
175+
options: BuildOptions,
176+
scope: Scope,
177+
sources: Sources,
178+
artifacts: Artifacts,
179+
project: Project,
180+
diagnostics: Option[Seq[(Either[String, os.Path], bsp4j.Diagnostic)]]
181181
) extends Build {
182182
def success: Boolean = false
183183
def successfulOpt: None.type = None
184184
def outputOpt: None.type = None
185185
}
186186

187187
final case class Cancelled(
188-
inputs: ModuleInputs,
189-
options: BuildOptions,
190-
scope: Scope,
191-
reason: String
188+
inputs: Module,
189+
options: BuildOptions,
190+
scope: Scope,
191+
reason: String
192192
) extends Build {
193193
def success: Boolean = false
194194
def successfulOpt: None.type = None
@@ -200,10 +200,10 @@ object Build {
200200
* Using only the command-line options not the ones from the sources.
201201
*/
202202
def updateInputs(
203-
inputs: ModuleInputs,
204-
options: BuildOptions,
205-
testOptions: Option[BuildOptions] = None
206-
): ModuleInputs = {
203+
inputs: Module,
204+
options: BuildOptions,
205+
testOptions: Option[BuildOptions] = None
206+
): Module = {
207207

208208
// If some options are manually overridden, append a hash of the options to the project name
209209
// Using options, not options0 - only the command-line options are taken into account. No hash is
@@ -220,7 +220,7 @@ object Build {
220220
}
221221

222222
private def allInputs(
223-
inputs: ModuleInputs,
223+
inputs: Module,
224224
options: BuildOptions,
225225
logger: Logger
226226
)(using ScalaCliInvokeData) =
@@ -237,9 +237,8 @@ object Build {
237237
)
238238

239239
private def build(
240-
inputs: ModuleInputs,
241-
crossSources: CrossSources,
242-
options: BuildOptions,
240+
inputs: Module,
241+
crossSources: CrossSources,options: BuildOptions,
243242
logger: Logger,
244243
buildClient: BloopBuildClient,
245244
compiler: ScalaCompiler,
@@ -252,7 +251,7 @@ object Build {
252251
val sharedOptions = crossSources.sharedOptions(options)
253252
val crossOptions = sharedOptions.crossOptions
254253

255-
def doPostProcess(build: Build, inputs: ModuleInputs, scope: Scope): Unit = build match {
254+
def doPostProcess(build: Build, inputs: Module, scope: Scope): Unit = build match {
256255
case build: Build.Successful =>
257256
for (sv <- build.project.scalaCompiler.map(_.scalaVersion))
258257
postProcess(
@@ -431,17 +430,17 @@ object Build {
431430
}
432431

433432
private def build(
434-
inputs: ModuleInputs,
435-
sources: Sources,
436-
generatedSources: Seq[GeneratedSource],
437-
options: BuildOptions,
438-
scope: Scope,
439-
logger: Logger,
440-
buildClient: BloopBuildClient,
441-
compiler: ScalaCompiler,
442-
buildTests: Boolean,
443-
partial: Option[Boolean],
444-
actionableDiagnostics: Option[Boolean]
433+
inputs: Module,
434+
sources: Sources,
435+
generatedSources: Seq[GeneratedSource],
436+
options: BuildOptions,
437+
scope: Scope,
438+
logger: Logger,
439+
buildClient: BloopBuildClient,
440+
compiler: ScalaCompiler,
441+
buildTests: Boolean,
442+
partial: Option[Boolean],
443+
actionableDiagnostics: Option[Boolean]
445444
)(using ScalaCliInvokeData): Either[BuildException, Build] = either {
446445

447446
val build0 = value {
@@ -503,9 +502,9 @@ object Build {
503502
root / Constants.workspaceDirName / projectName.name / s"resources-${scope.name}"
504503

505504
def scalaNativeSupported(
506-
options: BuildOptions,
507-
inputs: ModuleInputs,
508-
logger: Logger
505+
options: BuildOptions,
506+
inputs: Module,
507+
logger: Logger
509508
): Either[BuildException, Option[ScalaNativeCompatibilityError]] =
510509
either {
511510
val scalaParamsOpt = value(options.scalaParams)
@@ -562,7 +561,7 @@ object Build {
562561
}
563562

564563
def build(
565-
inputs: ModuleInputs,
564+
inputs: Module,
566565
options: BuildOptions,
567566
compilerMaker: ScalaCompilerMaker,
568567
docCompilerMakerOpt: Option[ScalaCompilerMaker],
@@ -642,16 +641,16 @@ object Build {
642641
}
643642

644643
def watch(
645-
inputs: ModuleInputs,
646-
options: BuildOptions,
647-
compilerMaker: ScalaCompilerMaker,
648-
docCompilerMakerOpt: Option[ScalaCompilerMaker],
649-
logger: Logger,
650-
crossBuilds: Boolean,
651-
buildTests: Boolean,
652-
partial: Option[Boolean],
653-
actionableDiagnostics: Option[Boolean],
654-
postAction: () => Unit = () => ()
644+
inputs: Module,
645+
options: BuildOptions,
646+
compilerMaker: ScalaCompilerMaker,
647+
docCompilerMakerOpt: Option[ScalaCompilerMaker],
648+
logger: Logger,
649+
crossBuilds: Boolean,
650+
buildTests: Boolean,
651+
partial: Option[Boolean],
652+
actionableDiagnostics: Option[Boolean],
653+
postAction: () => Unit = () => ()
655654
)(action: Either[BuildException, Builds] => Unit)(using ScalaCliInvokeData): Watcher = {
656655

657656
val buildClient = BloopBuildClient.create(
@@ -846,15 +845,15 @@ object Build {
846845
* a bloop [[Project]]
847846
*/
848847
def buildProject(
849-
inputs: ModuleInputs,
850-
sources: Sources,
851-
generatedSources: Seq[GeneratedSource],
852-
options: BuildOptions,
853-
compilerJvmVersionOpt: Option[Positioned[Int]],
854-
scope: Scope,
855-
logger: Logger,
856-
artifacts: Artifacts,
857-
maybeRecoverOnError: BuildException => Option[BuildException] = e => Some(e)
848+
inputs: Module,
849+
sources: Sources,
850+
generatedSources: Seq[GeneratedSource],
851+
options: BuildOptions,
852+
compilerJvmVersionOpt: Option[Positioned[Int]],
853+
scope: Scope,
854+
logger: Logger,
855+
artifacts: Artifacts,
856+
maybeRecoverOnError: BuildException => Option[BuildException] = e => Some(e)
858857
): Either[BuildException, Project] = either {
859858

860859
val allSources = sources.paths.map(_._1) ++ generatedSources.map(_.generated)
@@ -1038,16 +1037,16 @@ object Build {
10381037
}
10391038

10401039
def prepareBuild(
1041-
inputs: ModuleInputs,
1042-
sources: Sources,
1043-
generatedSources: Seq[GeneratedSource],
1044-
options: BuildOptions,
1045-
compilerJvmVersionOpt: Option[Positioned[Int]],
1046-
scope: Scope,
1047-
compiler: ScalaCompiler,
1048-
logger: Logger,
1049-
buildClient: BloopBuildClient,
1050-
maybeRecoverOnError: BuildException => Option[BuildException] = e => Some(e)
1040+
inputs: Module,
1041+
sources: Sources,
1042+
generatedSources: Seq[GeneratedSource],
1043+
options: BuildOptions,
1044+
compilerJvmVersionOpt: Option[Positioned[Int]],
1045+
scope: Scope,
1046+
compiler: ScalaCompiler,
1047+
logger: Logger,
1048+
buildClient: BloopBuildClient,
1049+
maybeRecoverOnError: BuildException => Option[BuildException] = e => Some(e)
10511050
): Either[BuildException, (os.Path, Option[ScalaParameters], Artifacts, Project, Boolean)] =
10521051
either {
10531052

@@ -1119,15 +1118,15 @@ object Build {
11191118
}
11201119

11211120
def buildOnce(
1122-
inputs: ModuleInputs,
1123-
sources: Sources,
1124-
generatedSources: Seq[GeneratedSource],
1125-
options: BuildOptions,
1126-
scope: Scope,
1127-
logger: Logger,
1128-
buildClient: BloopBuildClient,
1129-
compiler: ScalaCompiler,
1130-
partialOpt: Option[Boolean]
1121+
inputs: Module,
1122+
sources: Sources,
1123+
generatedSources: Seq[GeneratedSource],
1124+
options: BuildOptions,
1125+
scope: Scope,
1126+
logger: Logger,
1127+
buildClient: BloopBuildClient,
1128+
compiler: ScalaCompiler,
1129+
partialOpt: Option[Boolean]
11311130
): Either[BuildException, Build] = either {
11321131

11331132
if (options.platform.value == Platform.Native)
@@ -1289,14 +1288,14 @@ object Build {
12891288
else path.toString
12901289

12911290
private def jmhBuild(
1292-
inputs: ModuleInputs,
1293-
build: Build.Successful,
1294-
logger: Logger,
1295-
javaCommand: String,
1296-
buildClient: BloopBuildClient,
1297-
compiler: ScalaCompiler,
1298-
buildTests: Boolean,
1299-
actionableDiagnostics: Option[Boolean]
1291+
inputs: Module,
1292+
build: Build.Successful,
1293+
logger: Logger,
1294+
javaCommand: String,
1295+
buildClient: BloopBuildClient,
1296+
compiler: ScalaCompiler,
1297+
buildTests: Boolean,
1298+
actionableDiagnostics: Option[Boolean]
13001299
)(using ScalaCliInvokeData): Either[BuildException, Option[Build]] = either {
13011300
val jmhProjectName = inputs.projectName.name + "_jmh"
13021301
val jmhOutputDir = inputs.workspace / Constants.workspaceDirName / jmhProjectName

modules/build/src/main/scala/scala/build/CrossSources.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ final case class CrossSources(
140140

141141
object CrossSources {
142142

143-
private def withinTestSubDirectory(p: ScopePath, inputs: ModuleInputs): Boolean =
143+
private def withinTestSubDirectory(p: ScopePath, inputs: Module): Boolean =
144144
p.root.exists { path =>
145145
val fullPath = path / p.subPath
146146
inputs.elements.exists {
@@ -156,13 +156,13 @@ object CrossSources {
156156
* a CrossSources and Inputs which contains element processed from using directives
157157
*/
158158
def forModuleInputs(
159-
inputs: ModuleInputs,
160-
preprocessors: Seq[Preprocessor],
161-
logger: Logger,
162-
suppressWarningOptions: SuppressWarningOptions,
163-
exclude: Seq[Positioned[String]] = Nil,
164-
maybeRecoverOnError: BuildException => Option[BuildException] = e => Some(e)
165-
)(using ScalaCliInvokeData): Either[BuildException, (CrossSources, ModuleInputs)] = either {
159+
inputs: Module,
160+
preprocessors: Seq[Preprocessor],
161+
logger: Logger,
162+
suppressWarningOptions: SuppressWarningOptions,
163+
exclude: Seq[Positioned[String]] = Nil,
164+
maybeRecoverOnError: BuildException => Option[BuildException] = e => Some(e)
165+
)(using ScalaCliInvokeData): Either[BuildException, (CrossSources, Module)] = either {
166166

167167
def preprocessSources(elems: Seq[SingleElement])
168168
: Either[BuildException, Seq[PreprocessedSource]] =
@@ -379,8 +379,8 @@ object CrossSources {
379379
* the resource directories that should be added to the classpath
380380
*/
381381
private def resolveResourceDirs(
382-
allInputs: ModuleInputs,
383-
preprocessedSources: Seq[PreprocessedSource]
382+
allInputs: Module,
383+
preprocessedSources: Seq[PreprocessedSource]
384384
): Seq[WithBuildRequirements[os.Path]] = {
385385
val fromInputs = allInputs.elements
386386
.collect { case r: ResourceDirectory => WithBuildRequirements(BuildRequirements(), r.path) }

modules/build/src/main/scala/scala/build/Sources.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import coursier.util.Task
66
import java.nio.charset.StandardCharsets
77

88
import scala.build.info.BuildInfo
9-
import scala.build.input.ModuleInputs
9+
import scala.build.input.Module
1010
import scala.build.internal.{CodeWrapper, WrapperParams}
1111
import scala.build.options.{BuildOptions, Scope}
1212
import scala.build.preprocessing.*
@@ -19,7 +19,7 @@ final case class Sources(
1919
buildOptions: BuildOptions
2020
) {
2121

22-
def withVirtualDir(inputs: ModuleInputs, scope: Scope, options: BuildOptions): Sources = {
22+
def withVirtualDir(inputs: Module, scope: Scope, options: BuildOptions): Sources = {
2323

2424
val srcRootPath = inputs.generatedSrcRoot(scope)
2525
val resourceDirs0 = options.classPathOptions.resourcesVirtualDir.map { path =>

modules/build/src/main/scala/scala/build/bsp/BloopSession.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import java.util.concurrent.atomic.AtomicReference
66

77
import scala.build.Build
88
import scala.build.compiler.BloopCompiler
9-
import scala.build.input.{ModuleInputs, OnDisk, SingleFile, Virtual, compose}
9+
import scala.build.input.{Module, OnDisk, SingleFile, Virtual, compose}
1010

1111
final class BloopSession(
1212
val inputs: compose.Inputs,

modules/build/src/main/scala/scala/build/bsp/Bsp.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package scala.build.bsp
33
import java.io.{InputStream, OutputStream}
44

55
import scala.build.errors.BuildException
6-
import scala.build.input.{ModuleInputs, ScalaCliInvokeData, compose}
6+
import scala.build.input.{Module, ScalaCliInvokeData, compose}
77
import scala.concurrent.Future
88

99
trait Bsp {

0 commit comments

Comments
 (0)