@@ -534,12 +534,11 @@ public void save(
534534 attachOutputs (project , state , buildStartTime );
535535 }
536536
537- final List <org .apache .maven .artifact .Artifact > attachedArtifacts = project .getAttachedArtifacts () != null
538- ? project .getAttachedArtifacts ()
539- : Collections .emptyList ();
537+ final List <org .apache .maven .artifact .Artifact > attachedArtifacts =
538+ project .getAttachedArtifacts () != null ? project .getAttachedArtifacts () : Collections .emptyList ();
540539 final List <Artifact > attachedArtifactDtos = artifactDtos (attachedArtifacts , algorithm , project , state );
541- final Artifact projectArtifactDto = hasPackagePhase ? artifactDto ( project . getArtifact (), algorithm , project , state )
542- : null ;
540+ final Artifact projectArtifactDto =
541+ hasPackagePhase ? artifactDto ( project . getArtifact (), algorithm , project , state ) : null ;
543542
544543 // CRITICAL: Don't create incomplete cache entries!
545544 // Only save cache entry if we have SOMETHING useful to restore.
@@ -576,7 +575,8 @@ public void save(
576575 }
577576 for (org .apache .maven .artifact .Artifact attachedArtifact : attachedArtifacts ) {
578577 if (attachedArtifact .getFile () != null ) {
579- boolean storeArtifact = isOutputArtifact (attachedArtifact .getFile ().getName ());
578+ boolean storeArtifact =
579+ isOutputArtifact (attachedArtifact .getFile ().getName ());
580580 if (storeArtifact ) {
581581 localCache .saveArtifactFile (cacheResult , attachedArtifact );
582582 } else {
@@ -662,7 +662,9 @@ public void produceDiffReport(CacheResult cacheResult, Build build) {
662662 }
663663
664664 private List <Artifact > artifactDtos (
665- List <org .apache .maven .artifact .Artifact > attachedArtifacts , HashAlgorithm digest , MavenProject project ,
665+ List <org .apache .maven .artifact .Artifact > attachedArtifacts ,
666+ HashAlgorithm digest ,
667+ MavenProject project ,
666668 ProjectCacheState state )
667669 throws IOException {
668670 List <Artifact > result = new ArrayList <>();
@@ -676,7 +678,9 @@ && isOutputArtifact(attachedArtifact.getFile().getName())) {
676678 }
677679
678680 private Artifact artifactDto (
679- org .apache .maven .artifact .Artifact projectArtifact , HashAlgorithm algorithm , MavenProject project ,
681+ org .apache .maven .artifact .Artifact projectArtifact ,
682+ HashAlgorithm algorithm ,
683+ MavenProject project ,
680684 ProjectCacheState state )
681685 throws IOException {
682686 final Artifact dto = DtoUtils .createDto (projectArtifact );
@@ -940,15 +944,29 @@ private void restoreGeneratedSources(Artifact artifact, Path artifactFilePath, M
940944 }
941945
942946 // TODO: move to config
943- public void attachGeneratedSources (MavenProject project , ProjectCacheState state , long buildStartTime ) throws IOException {
947+ public void attachGeneratedSources (MavenProject project , ProjectCacheState state , long buildStartTime )
948+ throws IOException {
944949 final Path targetDir = Paths .get (project .getBuild ().getDirectory ());
945950
946951 final Path generatedSourcesDir = targetDir .resolve ("generated-sources" );
947- attachDirIfNotEmpty (generatedSourcesDir , targetDir , project , state , OutputType .GENERATED_SOURCE , DEFAULT_FILE_GLOB , buildStartTime );
952+ attachDirIfNotEmpty (
953+ generatedSourcesDir ,
954+ targetDir ,
955+ project ,
956+ state ,
957+ OutputType .GENERATED_SOURCE ,
958+ DEFAULT_FILE_GLOB ,
959+ buildStartTime );
948960
949961 final Path generatedTestSourcesDir = targetDir .resolve ("generated-test-sources" );
950962 attachDirIfNotEmpty (
951- generatedTestSourcesDir , targetDir , project , state , OutputType .GENERATED_SOURCE , DEFAULT_FILE_GLOB , buildStartTime );
963+ generatedTestSourcesDir ,
964+ targetDir ,
965+ project ,
966+ state ,
967+ OutputType .GENERATED_SOURCE ,
968+ DEFAULT_FILE_GLOB ,
969+ buildStartTime );
952970
953971 Set <String > sourceRoots = new TreeSet <>();
954972 if (project .getCompileSourceRoots () != null ) {
@@ -964,7 +982,14 @@ public void attachGeneratedSources(MavenProject project, ProjectCacheState state
964982 && sourceRootPath .startsWith (targetDir )
965983 && !(sourceRootPath .startsWith (generatedSourcesDir )
966984 || sourceRootPath .startsWith (generatedTestSourcesDir ))) { // dir within target
967- attachDirIfNotEmpty (sourceRootPath , targetDir , project , state , OutputType .GENERATED_SOURCE , DEFAULT_FILE_GLOB , buildStartTime );
985+ attachDirIfNotEmpty (
986+ sourceRootPath ,
987+ targetDir ,
988+ project ,
989+ state ,
990+ OutputType .GENERATED_SOURCE ,
991+ DEFAULT_FILE_GLOB ,
992+ buildStartTime );
968993 }
969994 }
970995 }
@@ -975,7 +1000,8 @@ private void attachOutputs(MavenProject project, ProjectCacheState state, long b
9751000 final Path targetDir = Paths .get (project .getBuild ().getDirectory ());
9761001 final Path outputDir = targetDir .resolve (dir .getValue ());
9771002 if (isPathInsideProject (project , outputDir )) {
978- attachDirIfNotEmpty (outputDir , targetDir , project , state , OutputType .EXTRA_OUTPUT , dir .getGlob (), buildStartTime );
1003+ attachDirIfNotEmpty (
1004+ outputDir , targetDir , project , state , OutputType .EXTRA_OUTPUT , dir .getGlob (), buildStartTime );
9791005 } else {
9801006 LOGGER .warn ("Outside project output candidate directory discarded ({})" , outputDir .normalize ());
9811007 }
0 commit comments