AlexanderAshitkin commented on code in PR #178:
URL:
https://github.com/apache/maven-build-cache-extension/pull/178#discussion_r1738654358
##########
src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java:
##########
@@ -892,6 +892,18 @@ private void restoreGeneratedSources(Artifact artifact,
Path artifactFilePath, M
Files.createDirectories(outputDir);
}
CacheUtils.unzip(artifactFilePath, outputDir);
+ OutputType outputType =
OutputType.fromClassifier(artifact.getClassifier());
+ if (outputType != OutputType.GENERATED_SOURCE) {
+ return;
+ }
+ Path targetDir = Paths.get(project.getBuild().getDirectory());
+ if (outputDir.equals(targetDir.resolve("generated-sources"))
Review Comment:
It's possible that there are multiple generated source roots attached at
different levels. The best solution would be to add extra metadata to
accurately track and restore all the source roots. Alternatively, it's possible
to implement a convention-based restoration by matching the logic in
`CacheControllerImpl#attachGeneratedSources` to restore all the sources
associated with a `GENERATED_SOURCE` cache entry.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]