@@ -37,6 +37,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
37
37
package io .avaje .prism .internal ;
38
38
39
39
import static java .util .function .Predicate .not ;
40
+ import static java .util .stream .Collectors .joining ;
40
41
import static io .avaje .prism .internal .APContext .isAssignable ;
41
42
42
43
import java .io .IOException ;
@@ -53,6 +54,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
53
54
import java .util .List ;
54
55
import java .util .Map ;
55
56
import java .util .Map .Entry ;
57
+ import java .util .stream .Stream ;
56
58
import java .util .Optional ;
57
59
import java .util .Set ;
58
60
@@ -120,7 +122,18 @@ public synchronized void init(ProcessingEnvironment env) {
120
122
try {
121
123
122
124
var file = APContext .getBuildResource ("avaje-processors.txt" );
123
- Files .writeString (file , "avaje-prism-core\n " , StandardOpenOption .CREATE , StandardOpenOption .APPEND );
125
+ var addition = new StringBuilder ();
126
+ //if file exists, dedup and append current processor
127
+ if (file .toFile ().exists ()) {
128
+ var result =
129
+ Stream .concat (Files .lines (file ), Stream .of ("avaje-prism-core" ))
130
+ .distinct ()
131
+ .collect (joining ("\n " ));
132
+ addition .append (result );
133
+ } else {
134
+ addition .append ("avaje-prism-core" );
135
+ }
136
+ Files .writeString (file , addition .toString (), StandardOpenOption .CREATE , StandardOpenOption .WRITE );
124
137
} catch (IOException e ) {
125
138
// not an issue worth failing over
126
139
}
0 commit comments