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 @@ -861,6 +861,8 @@ object Build {
861
861
if (options.useBuildServer.getOrElse(true )) None
862
862
else releaseFlag(options, compilerJvmVersionOpt, logger).map(_.toString)
863
863
864
+ val hardcodedSource = options.generateSource
865
+
864
866
val scalaCompilerParamsOpt = artifacts.scalaOpt match {
865
867
case Some (scalaArtifacts) =>
866
868
val params = value(options.scalaParams).getOrElse {
@@ -1009,7 +1011,8 @@ object Build {
1009
1011
resourceDirs = sources.resourceDirs,
1010
1012
scope = scope,
1011
1013
javaHomeOpt = Option (options.javaHomeLocation().value),
1012
- javacOptions = javacOptions
1014
+ javacOptions = javacOptions,
1015
+ generateSource = hardcodedSource
1013
1016
)
1014
1017
project
1015
1018
}
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 @@ -45,7 +45,8 @@ final case class BuildOptions(
45
45
testOptions : TestOptions = TestOptions (),
46
46
notForBloopOptions : PostBuildOptions = PostBuildOptions (),
47
47
sourceGeneratorOptions : SourceGeneratorOptions = SourceGeneratorOptions (),
48
- useBuildServer : Option [Boolean ] = None
48
+ useBuildServer : Option [Boolean ] = None ,
49
+ generateSource : Option [Boolean ] = None
49
50
) {
50
51
51
52
import BuildOptions .JavaHomeInfo
You can’t perform that action at this time.
0 commit comments