@@ -36,20 +36,17 @@ final case class SourceGenerator(
36
36
inputDirectory : DirectiveValueParser .WithScopePath [Option [Positioned [String ]]] =
37
37
DirectiveValueParser .WithScopePath .empty(None ),
38
38
glob : Option [Positioned [String ]] = None ,
39
- commandProcessor : DirectiveValueParser .WithScopePath [Option [Positioned [String ]]] =
40
- DirectiveValueParser .WithScopePath .empty(None ),
41
39
) extends HasBuildOptions {
42
40
def buildOptions : Either [BuildException , BuildOptions ] =
43
41
// println(s"ScopePath of Scripts: ${scripts.scopePath}")
44
42
// println(s"Values of Scripts: ${scripts.value(0).value}")
45
43
// println(s"Values of InputDir: ${inputDirectory.value}")
46
- SourceGenerator .buildOptions(testy, scripts)
44
+ SourceGenerator .buildOptions(scripts)
47
45
}
48
46
49
47
object SourceGenerator {
50
48
val handler : DirectiveHandler [SourceGenerator ] = DirectiveHandler .derive
51
49
def buildOptions (
52
- sourceGenerator : DirectiveValueParser .WithScopePath [List [Positioned [String ]]],
53
50
scripts : DirectiveValueParser .WithScopePath [List [Positioned [String ]]]
54
51
): Either [BuildException , BuildOptions ] = {
55
52
val proc = UsingDirectivesProcessor ()
@@ -84,18 +81,25 @@ object SourceGenerator {
84
81
}
85
82
}
86
83
87
- val strictDirectives = scriptConvert
88
- .map(modify(_))
89
- .map(_.take(3 ))
84
+ val componentKeyword = Seq (" inputDirectory" , " glob" )
85
+ val strictDirectives = scriptConvert.map(modify(_))
90
86
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
+ )
93
92
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
+ )
97
102
}
98
- println(directive.size)
99
103
100
104
// val sourceGenValue = sourceGenerator.value
101
105
// sourceGenValue
@@ -107,9 +111,10 @@ object SourceGenerator {
107
111
// SourceGeneratorOptions(generatorConfig = configs)
108
112
// )
109
113
// }
110
-
111
114
// directive.map { f => println(f)}
112
115
113
- Right (BuildOptions (sourceGeneratorOptions = SourceGeneratorOptions (generatorConfig = directive)))
116
+ Right (BuildOptions (sourceGeneratorOptions =
117
+ SourceGeneratorOptions (generatorConfig = directive)
118
+ ))
114
119
}
115
120
}
0 commit comments