@@ -36,20 +36,17 @@ final case class SourceGenerator(
3636 inputDirectory : DirectiveValueParser .WithScopePath [Option [Positioned [String ]]] =
3737 DirectiveValueParser .WithScopePath .empty(None ),
3838 glob : Option [Positioned [String ]] = None ,
39- commandProcessor : DirectiveValueParser .WithScopePath [Option [Positioned [String ]]] =
40- DirectiveValueParser .WithScopePath .empty(None ),
4139) extends HasBuildOptions {
4240 def buildOptions : Either [BuildException , BuildOptions ] =
4341 // println(s"ScopePath of Scripts: ${scripts.scopePath}")
4442 // println(s"Values of Scripts: ${scripts.value(0).value}")
4543 // println(s"Values of InputDir: ${inputDirectory.value}")
46- SourceGenerator .buildOptions(testy, scripts)
44+ SourceGenerator .buildOptions(scripts)
4745}
4846
4947object SourceGenerator {
5048 val handler : DirectiveHandler [SourceGenerator ] = DirectiveHandler .derive
5149 def buildOptions (
52- sourceGenerator : DirectiveValueParser .WithScopePath [List [Positioned [String ]]],
5350 scripts : DirectiveValueParser .WithScopePath [List [Positioned [String ]]]
5451 ): Either [BuildException , BuildOptions ] = {
5552 val proc = UsingDirectivesProcessor ()
@@ -84,18 +81,25 @@ object SourceGenerator {
8481 }
8582 }
8683
87- val strictDirectives = scriptConvert
88- .map(modify(_))
89- .map(_.take(3 ))
84+ val componentKeyword = Seq (" inputDirectory" , " glob" )
85+ val strictDirectives = scriptConvert.map(modify(_))
9086
91- // println(scripts.scopePath.subPath)
92- // strictDirectives.map(f => f.map(w => println(w)))
87+ val generatorComponents = strictDirectives.map(directiveSeq =>
88+ directiveSeq.filter(rawDirective =>
89+ componentKeyword.exists(keyword => rawDirective.key.contains(keyword))
90+ )
91+ )
9392
94- val directive = strictDirectives.collect {
95- case Seq (inputDir, glob, processor) =>
96- GeneratorConfig (inputDir.values.mkString, List (glob.values.mkString), processor.values.mkString.split(" " ).toList,scripts.scopePath.subPath)
93+ // generatorComponents.map(f => f.map(g => println(g.values)))
94+ val directive = generatorComponents.collect {
95+ case Seq (inputDir, glob) =>
96+ GeneratorConfig (
97+ inputDir.values.mkString,
98+ List (glob.values.mkString),
99+ scripts.value(0 ).value,
100+ scripts.scopePath.subPath
101+ )
97102 }
98- println(directive.size)
99103
100104 // val sourceGenValue = sourceGenerator.value
101105 // sourceGenValue
@@ -107,9 +111,10 @@ object SourceGenerator {
107111 // SourceGeneratorOptions(generatorConfig = configs)
108112 // )
109113 // }
110-
111114 // directive.map { f => println(f)}
112115
113- Right (BuildOptions (sourceGeneratorOptions = SourceGeneratorOptions (generatorConfig = directive)))
116+ Right (BuildOptions (sourceGeneratorOptions =
117+ SourceGeneratorOptions (generatorConfig = directive)
118+ ))
114119 }
115120}
0 commit comments