File tree Expand file tree Collapse file tree 4 files changed +11
-11
lines changed
build/src/main/scala/scala/build
directives/src/main/scala/scala/build/preprocessing/directives
options/src/main/scala/scala/build/options Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -866,6 +866,8 @@ object Build {
866
866
if (options.useBuildServer.getOrElse(true )) None
867
867
else releaseFlag(options, compilerJvmVersionOpt, logger).map(_.toString)
868
868
869
+ val hardcodedSource = options.generateSource
870
+
869
871
val scalaCompilerParamsOpt = artifacts.scalaOpt match {
870
872
case Some (scalaArtifacts) =>
871
873
val params = value(options.scalaParams).getOrElse {
@@ -1014,7 +1016,8 @@ object Build {
1014
1016
resourceDirs = sources.resourceDirs,
1015
1017
scope = scope,
1016
1018
javaHomeOpt = Option (options.javaHomeLocation().value),
1017
- javacOptions = javacOptions
1019
+ javacOptions = javacOptions,
1020
+ generateSource = hardcodedSource
1018
1021
)
1019
1022
project
1020
1023
}
Original file line number Diff line number Diff line change @@ -28,7 +28,8 @@ final case class Project(
28
28
resourceDirs : Seq [os.Path ],
29
29
javaHomeOpt : Option [os.Path ],
30
30
scope : Scope ,
31
- javacOptions : List [String ]
31
+ javacOptions : List [String ],
32
+ generateSource : Option [Boolean ]
32
33
) {
33
34
34
35
import Project ._
@@ -53,8 +54,6 @@ final case class Project(
53
54
54
55
val sourceGen : BloopConfig .SourceGenerator = {
55
56
val command = " /Users/kiki/Kerja/scala-cli/testing-a/source-generator.py"
56
-
57
-
58
57
val sourceGlobs = BloopConfig .SourcesGlobs (
59
58
(os.root / " Users" / " kiki" / " Kerja" / " scala-cli" / " testing-a" / " generator-inputs" ).toNIO,
60
59
None ,
@@ -86,7 +85,7 @@ final case class Project(
86
85
`scala` = scalaConfigOpt,
87
86
java = Some (BloopConfig .Java (javacOptions)),
88
87
resolution = resolution,
89
- sourceGenerators = Some (List (sourceGen))
88
+ sourceGenerators = if (generateSource.getOrElse( false )) Some (List (sourceGen)) else None
90
89
)
91
90
}
92
91
Original file line number Diff line number Diff line change @@ -6,18 +6,15 @@ import scala.build.options.BuildOptions
6
6
import scala .cli .commands .SpecificationLevel
7
7
8
8
@ DirectiveExamples (" //> using generator" )
9
- @ DirectiveUsage (
10
- " //> using generator" ,
11
- " `//> using generator`"
12
- )
9
+ @ DirectiveUsage (" //> using generator" , " `//> using generator`" )
13
10
@ DirectiveDescription (" Generate code using Source Generator" )
14
11
@ DirectiveLevel (SpecificationLevel .EXPERIMENTAL )
15
12
final case class SourceGenerator (
16
13
placeHolderGenerator : Boolean = false
17
14
) extends HasBuildOptions {
18
15
def buildOptions : Either [BuildException , BuildOptions ] = {
19
16
val buildOpt = BuildOptions (
20
- useBuildServer = Some (true )
17
+ generateSource = Some (placeHolderGenerator )
21
18
)
22
19
Right (buildOpt)
23
20
}
Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ final case class BuildOptions(
46
46
testOptions : TestOptions = TestOptions (),
47
47
notForBloopOptions : PostBuildOptions = PostBuildOptions (),
48
48
sourceGeneratorOptions : SourceGeneratorOptions = SourceGeneratorOptions (),
49
- useBuildServer : Option [Boolean ] = None
49
+ useBuildServer : Option [Boolean ] = None ,
50
+ generateSource : Option [Boolean ] = None
50
51
) {
51
52
52
53
import BuildOptions .JavaHomeInfo
You can’t perform that action at this time.
0 commit comments