Skip to content

Commit

Permalink
incremental builds are enabled again by taking care of $ prefix of al…
Browse files Browse the repository at this point in the history
…l .tpl files
  • Loading branch information
jurgenvinju committed Mar 27, 2024
1 parent eeb022c commit baaccd3
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/main/java/org/rascalmpl/maven/CompileRascalMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping;
import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
import org.rascalmpl.debug.IRascalMonitor;
import org.rascalmpl.exceptions.Throw;
Expand Down Expand Up @@ -534,7 +535,23 @@ private List<IList> splitTodoList(IList todoList, List<String> parallelPreList,
private IList getTodoList(ISourceLocation binLoc, List<ISourceLocation> srcLocs, List<ISourceLocation> ignoredLocs)
throws InclusionScanException, URISyntaxException {
StaleSourceScanner scanner = new StaleSourceScanner(100);
scanner.addSourceMapping(new SuffixMapping(".rsc", ".tpl"));
scanner.addSourceMapping(new SourceMapping() {

@Override
public Set<File> getTargetFiles(File targetDir, String source) throws InclusionScanException {
File file = new File(source);
String name = file.getName();

if (name.endsWith(".rsc")) {
return Set.of(
new File(targetDir, new File(file.getParentFile(), "$" + name.substring(0, name.length() - ".rsc".length()) + ".tpl").getPath())
);
}
else {
return Set.of();
}
}
});

// TODO: currently the compiler nests all files in a /rascal root
// It will stop doing that once the root library files have been moved into rascal::
Expand Down

0 comments on commit baaccd3

Please sign in to comment.