4545
4646/**
4747 * Maven Goal for Rascal Tutor Documentation compilation. The input is a list of
48- * Rascal source folders, and course folders, and the output is for each module
48+ * Rascal source folders, and course folders, and the output is for each module
4949 * a markdown file and for each markdown file in a source course an output markdown
5050 * file. The compiler also copies images from source to a target assets folder.
5151 * Also a list of errors and warnings is printed on stderr.
@@ -131,10 +131,6 @@ public class CompileRascalDocumentation extends AbstractMojo
131131 @ Parameter (defaultValue = "${session}" , required = true , readonly = true )
132132 private MavenSession session ;
133133
134- private Evaluator makeEvaluator (OutputStream err , OutputStream out ) throws URISyntaxException , FactTypeUseException , IOException {
135- return MojoUtils .makeEvaluator (getLog (), session , err , out , MAIN_COMPILER_SEARCH_PATH , MAIN_COMPILER_MODULE );
136- }
137-
138134 public void execute () throws MojoExecutionException {
139135 try {
140136 ISourceLocation binLoc = URIUtil .getChildLocation (MojoUtils .location (bin ), "docs" );
@@ -164,18 +160,18 @@ public void execute() throws MojoExecutionException {
164160 }
165161
166162 PathConfig pcfg = new PathConfig (srcLocs , libLocs , binLoc , ignoredLocs , generatedSourcesLoc , Collections .emptyList ());
167-
163+
168164 getLog ().info ("Paths have been configured: " + pcfg );
169165
170166 URIResolverRegistry .getInstance ().registerLogical (
171167 new ProjectURIResolver (
172168 MojoUtils .location (
173- project .getBasedir ().getCanonicalFile ().toString ()),
169+ project .getBasedir ().getCanonicalFile ().toString ()),
174170 project .getName ()
175171 )
176172 );
177173
178- Evaluator eval = makeEvaluator (System . err , System . out );
174+ Evaluator eval = MojoUtils . makeEvaluator (getLog (), session , MAIN_COMPILER_SEARCH_PATH , MAIN_COMPILER_MODULE );
179175 IList messages = runCompiler (eval .getMonitor (), eval , pcfg );
180176
181177 getLog ().info ("Tutor is done, reporting errors now." );
@@ -191,7 +187,7 @@ public void execute() throws MojoExecutionException {
191187 getLog ().error (e .getLocation () + ": " + e .getMessage ());
192188 getLog ().error (e .getTrace ().toString ());
193189 throw new MojoExecutionException (UNEXPECTED_ERROR , e );
194- }
190+ }
195191 }
196192
197193 private List <ISourceLocation > collectClasspath () throws URISyntaxException {
@@ -228,6 +224,16 @@ private List<ISourceLocation> collectClasspath() throws URISyntaxException {
228224 getLog ().info ("Current project does not have a dependency on org.rascalmpl:rascal" );
229225 }
230226
227+ return builder ;
228+ }
229+
230+ private List <ISourceLocation > collectPluginClasspath () throws URISyntaxException {
231+ List <ISourceLocation > builder = new LinkedList <>();
232+
233+ builder .add (MojoUtils .location (IValue .class .getProtectionDomain ().getCodeSource ().getLocation ().getPath ()));
234+ builder .add (MojoUtils .location (Evaluator .class .getProtectionDomain ().getCodeSource ().getLocation ().getPath ()));
235+
236+
231237 return builder ;
232238 }
233239
@@ -247,7 +253,7 @@ private IList runCompiler(IRascalMonitor monitor, IEvaluator<Result<IValue>> eva
247253 if (issues != null ) {
248254 pc = pc .asWithKeywordParameters ().setParameter ("issues" , MojoUtils .location (issues ));
249255 }
250-
256+
251257 pc = pc .asWithKeywordParameters ().setParameter ("license" , MojoUtils .location (licenseFile ));
252258 pc = pc .asWithKeywordParameters ().setParameter ("funding" , MojoUtils .location (funding ));
253259 pc = pc .asWithKeywordParameters ().setParameter ("citation" , MojoUtils .location (citation ));
@@ -257,13 +263,8 @@ private IList runCompiler(IRascalMonitor monitor, IEvaluator<Result<IValue>> eva
257263 return (IList ) eval .call (monitor , "compile" , pc );
258264 }
259265 finally {
260- try {
261- eval .getStdErr ().flush ();
262- eval .getStdOut ().flush ();
263- }
264- catch (IOException ignored ) {
265- // this is ok
266- }
266+ eval .getErrorPrinter ().flush ();
267+ eval .getOutPrinter ().flush ();
267268 }
268269 }
269270
0 commit comments