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 {
861861 if (options.useBuildServer.getOrElse(true )) None
862862 else releaseFlag(options, compilerJvmVersionOpt, logger).map(_.toString)
863863
864+ val hardcodedSource = options.generateSource
865+
864866 val scalaCompilerParamsOpt = artifacts.scalaOpt match {
865867 case Some (scalaArtifacts) =>
866868 val params = value(options.scalaParams).getOrElse {
@@ -1009,7 +1011,8 @@ object Build {
10091011 resourceDirs = sources.resourceDirs,
10101012 scope = scope,
10111013 javaHomeOpt = Option (options.javaHomeLocation().value),
1012- javacOptions = javacOptions
1014+ javacOptions = javacOptions,
1015+ generateSource = hardcodedSource
10131016 )
10141017 project
10151018 }
Original file line number Diff line number Diff line change @@ -28,7 +28,8 @@ final case class Project(
2828 resourceDirs : Seq [os.Path ],
2929 javaHomeOpt : Option [os.Path ],
3030 scope : Scope ,
31- javacOptions : List [String ]
31+ javacOptions : List [String ],
32+ generateSource : Option [Boolean ]
3233) {
3334
3435 import Project ._
@@ -53,8 +54,6 @@ final case class Project(
5354
5455 val sourceGen : BloopConfig .SourceGenerator = {
5556 val command = " /Users/kiki/Kerja/scala-cli/testing-a/source-generator.py"
56-
57-
5857 val sourceGlobs = BloopConfig .SourcesGlobs (
5958 (os.root / " Users" / " kiki" / " Kerja" / " scala-cli" / " testing-a" / " generator-inputs" ).toNIO,
6059 None ,
@@ -86,7 +85,7 @@ final case class Project(
8685 `scala` = scalaConfigOpt,
8786 java = Some (BloopConfig .Java (javacOptions)),
8887 resolution = resolution,
89- sourceGenerators = Some (List (sourceGen))
88+ sourceGenerators = if (generateSource.getOrElse( false )) Some (List (sourceGen)) else None
9089 )
9190 }
9291
Original file line number Diff line number Diff line change @@ -6,18 +6,15 @@ import scala.build.options.BuildOptions
66import scala .cli .commands .SpecificationLevel
77
88@ DirectiveExamples (" //> using generator" )
9- @ DirectiveUsage (
10- " //> using generator" ,
11- " `//> using generator`"
12- )
9+ @ DirectiveUsage (" //> using generator" , " `//> using generator`" )
1310@ DirectiveDescription (" Generate code using Source Generator" )
1411@ DirectiveLevel (SpecificationLevel .EXPERIMENTAL )
1512final case class SourceGenerator (
1613 placeHolderGenerator : Boolean = false
1714) extends HasBuildOptions {
1815 def buildOptions : Either [BuildException , BuildOptions ] = {
1916 val buildOpt = BuildOptions (
20- useBuildServer = Some (true )
17+ generateSource = Some (placeHolderGenerator )
2118 )
2219 Right (buildOpt)
2320 }
Original file line number Diff line number Diff line change @@ -45,7 +45,8 @@ final case class BuildOptions(
4545 testOptions : TestOptions = TestOptions (),
4646 notForBloopOptions : PostBuildOptions = PostBuildOptions (),
4747 sourceGeneratorOptions : SourceGeneratorOptions = SourceGeneratorOptions (),
48- useBuildServer : Option [Boolean ] = None
48+ useBuildServer : Option [Boolean ] = None ,
49+ generateSource : Option [Boolean ] = None
4950) {
5051
5152 import BuildOptions .JavaHomeInfo
You can’t perform that action at this time.
0 commit comments