Skip to content

Commit 7a2c15e

Browse files
committed
Rename ModuleInputs to Module
1 parent 69efe31 commit 7a2c15e

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)
@@ -166,24 +166,24 @@ object Build {
166166
}
167167

168168
final case class Failed(
169-
inputs: ModuleInputs,
170-
options: BuildOptions,
171-
scope: Scope,
172-
sources: Sources,
173-
artifacts: Artifacts,
174-
project: Project,
175-
diagnostics: Option[Seq[(Either[String, os.Path], bsp4j.Diagnostic)]]
169+
inputs: Module,
170+
options: BuildOptions,
171+
scope: Scope,
172+
sources: Sources,
173+
artifacts: Artifacts,
174+
project: Project,
175+
diagnostics: Option[Seq[(Either[String, os.Path], bsp4j.Diagnostic)]]
176176
) extends Build {
177177
def success: Boolean = false
178178
def successfulOpt: None.type = None
179179
def outputOpt: None.type = None
180180
}
181181

182182
final case class Cancelled(
183-
inputs: ModuleInputs,
184-
options: BuildOptions,
185-
scope: Scope,
186-
reason: String
183+
inputs: Module,
184+
options: BuildOptions,
185+
scope: Scope,
186+
reason: String
187187
) extends Build {
188188
def success: Boolean = false
189189
def successfulOpt: None.type = None
@@ -195,10 +195,10 @@ object Build {
195195
* Using only the command-line options not the ones from the sources.
196196
*/
197197
def updateInputs(
198-
inputs: ModuleInputs,
199-
options: BuildOptions,
200-
testOptions: Option[BuildOptions] = None
201-
): ModuleInputs = {
198+
inputs: Module,
199+
options: BuildOptions,
200+
testOptions: Option[BuildOptions] = None
201+
): Module = {
202202

203203
// If some options are manually overridden, append a hash of the options to the project name
204204
// Using options, not options0 - only the command-line options are taken into account. No hash is
@@ -215,7 +215,7 @@ object Build {
215215
}
216216

217217
private def allInputs(
218-
inputs: ModuleInputs,
218+
inputs: Module,
219219
options: BuildOptions,
220220
logger: Logger
221221
)(using ScalaCliInvokeData) =
@@ -232,9 +232,8 @@ object Build {
232232
)
233233

234234
private def build(
235-
inputs: ModuleInputs,
236-
crossSources: CrossSources,
237-
options: BuildOptions,
235+
inputs: Module,
236+
crossSources: CrossSources,options: BuildOptions,
238237
logger: Logger,
239238
buildClient: BloopBuildClient,
240239
compiler: ScalaCompiler,
@@ -247,7 +246,7 @@ object Build {
247246
val sharedOptions = crossSources.sharedOptions(options)
248247
val crossOptions = sharedOptions.crossOptions
249248

250-
def doPostProcess(build: Build, inputs: ModuleInputs, scope: Scope): Unit = build match {
249+
def doPostProcess(build: Build, inputs: Module, scope: Scope): Unit = build match {
251250
case build: Build.Successful =>
252251
for (sv <- build.project.scalaCompiler.map(_.scalaVersion))
253252
postProcess(
@@ -426,17 +425,17 @@ object Build {
426425
}
427426

428427
private def build(
429-
inputs: ModuleInputs,
430-
sources: Sources,
431-
generatedSources: Seq[GeneratedSource],
432-
options: BuildOptions,
433-
scope: Scope,
434-
logger: Logger,
435-
buildClient: BloopBuildClient,
436-
compiler: ScalaCompiler,
437-
buildTests: Boolean,
438-
partial: Option[Boolean],
439-
actionableDiagnostics: Option[Boolean]
428+
inputs: Module,
429+
sources: Sources,
430+
generatedSources: Seq[GeneratedSource],
431+
options: BuildOptions,
432+
scope: Scope,
433+
logger: Logger,
434+
buildClient: BloopBuildClient,
435+
compiler: ScalaCompiler,
436+
buildTests: Boolean,
437+
partial: Option[Boolean],
438+
actionableDiagnostics: Option[Boolean]
440439
)(using ScalaCliInvokeData): Either[BuildException, Build] = either {
441440

442441
val build0 = value {
@@ -498,9 +497,9 @@ object Build {
498497
root / Constants.workspaceDirName / projectName.name / s"resources-${scope.name}"
499498

500499
def scalaNativeSupported(
501-
options: BuildOptions,
502-
inputs: ModuleInputs,
503-
logger: Logger
500+
options: BuildOptions,
501+
inputs: Module,
502+
logger: Logger
504503
): Either[BuildException, Option[ScalaNativeCompatibilityError]] =
505504
either {
506505
val scalaParamsOpt = value(options.scalaParams)
@@ -557,7 +556,7 @@ object Build {
557556
}
558557

559558
def build(
560-
inputs: ModuleInputs,
559+
inputs: Module,
561560
options: BuildOptions,
562561
compilerMaker: ScalaCompilerMaker,
563562
docCompilerMakerOpt: Option[ScalaCompilerMaker],
@@ -637,16 +636,16 @@ object Build {
637636
}
638637

639638
def watch(
640-
inputs: ModuleInputs,
641-
options: BuildOptions,
642-
compilerMaker: ScalaCompilerMaker,
643-
docCompilerMakerOpt: Option[ScalaCompilerMaker],
644-
logger: Logger,
645-
crossBuilds: Boolean,
646-
buildTests: Boolean,
647-
partial: Option[Boolean],
648-
actionableDiagnostics: Option[Boolean],
649-
postAction: () => Unit = () => ()
639+
inputs: Module,
640+
options: BuildOptions,
641+
compilerMaker: ScalaCompilerMaker,
642+
docCompilerMakerOpt: Option[ScalaCompilerMaker],
643+
logger: Logger,
644+
crossBuilds: Boolean,
645+
buildTests: Boolean,
646+
partial: Option[Boolean],
647+
actionableDiagnostics: Option[Boolean],
648+
postAction: () => Unit = () => ()
650649
)(action: Either[BuildException, Builds] => Unit)(using ScalaCliInvokeData): Watcher = {
651650

652651
val buildClient = BloopBuildClient.create(
@@ -841,15 +840,15 @@ object Build {
841840
* a bloop [[Project]]
842841
*/
843842
def buildProject(
844-
inputs: ModuleInputs,
845-
sources: Sources,
846-
generatedSources: Seq[GeneratedSource],
847-
options: BuildOptions,
848-
compilerJvmVersionOpt: Option[Positioned[Int]],
849-
scope: Scope,
850-
logger: Logger,
851-
artifacts: Artifacts,
852-
maybeRecoverOnError: BuildException => Option[BuildException] = e => Some(e)
843+
inputs: Module,
844+
sources: Sources,
845+
generatedSources: Seq[GeneratedSource],
846+
options: BuildOptions,
847+
compilerJvmVersionOpt: Option[Positioned[Int]],
848+
scope: Scope,
849+
logger: Logger,
850+
artifacts: Artifacts,
851+
maybeRecoverOnError: BuildException => Option[BuildException] = e => Some(e)
853852
): Either[BuildException, Project] = either {
854853

855854
val allSources = sources.paths.map(_._1) ++ generatedSources.map(_.generated)
@@ -1033,16 +1032,16 @@ object Build {
10331032
}
10341033

10351034
def prepareBuild(
1036-
inputs: ModuleInputs,
1037-
sources: Sources,
1038-
generatedSources: Seq[GeneratedSource],
1039-
options: BuildOptions,
1040-
compilerJvmVersionOpt: Option[Positioned[Int]],
1041-
scope: Scope,
1042-
compiler: ScalaCompiler,
1043-
logger: Logger,
1044-
buildClient: BloopBuildClient,
1045-
maybeRecoverOnError: BuildException => Option[BuildException] = e => Some(e)
1035+
inputs: Module,
1036+
sources: Sources,
1037+
generatedSources: Seq[GeneratedSource],
1038+
options: BuildOptions,
1039+
compilerJvmVersionOpt: Option[Positioned[Int]],
1040+
scope: Scope,
1041+
compiler: ScalaCompiler,
1042+
logger: Logger,
1043+
buildClient: BloopBuildClient,
1044+
maybeRecoverOnError: BuildException => Option[BuildException] = e => Some(e)
10461045
): Either[BuildException, (os.Path, Option[ScalaParameters], Artifacts, Project, Boolean)] =
10471046
either {
10481047

@@ -1114,15 +1113,15 @@ object Build {
11141113
}
11151114

11161115
def buildOnce(
1117-
inputs: ModuleInputs,
1118-
sources: Sources,
1119-
generatedSources: Seq[GeneratedSource],
1120-
options: BuildOptions,
1121-
scope: Scope,
1122-
logger: Logger,
1123-
buildClient: BloopBuildClient,
1124-
compiler: ScalaCompiler,
1125-
partialOpt: Option[Boolean]
1116+
inputs: Module,
1117+
sources: Sources,
1118+
generatedSources: Seq[GeneratedSource],
1119+
options: BuildOptions,
1120+
scope: Scope,
1121+
logger: Logger,
1122+
buildClient: BloopBuildClient,
1123+
compiler: ScalaCompiler,
1124+
partialOpt: Option[Boolean]
11261125
): Either[BuildException, Build] = either {
11271126

11281127
if (options.platform.value == Platform.Native)
@@ -1284,14 +1283,14 @@ object Build {
12841283
else path.toString
12851284

12861285
private def jmhBuild(
1287-
inputs: ModuleInputs,
1288-
build: Build.Successful,
1289-
logger: Logger,
1290-
javaCommand: String,
1291-
buildClient: BloopBuildClient,
1292-
compiler: ScalaCompiler,
1293-
buildTests: Boolean,
1294-
actionableDiagnostics: Option[Boolean]
1286+
inputs: Module,
1287+
build: Build.Successful,
1288+
logger: Logger,
1289+
javaCommand: String,
1290+
buildClient: BloopBuildClient,
1291+
compiler: ScalaCompiler,
1292+
buildTests: Boolean,
1293+
actionableDiagnostics: Option[Boolean]
12951294
)(using ScalaCliInvokeData): Either[BuildException, Option[Build]] = either {
12961295
val jmhProjectName = inputs.projectName.name + "_jmh"
12971296
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)