17
17
18
18
import lombok .extern .slf4j .Slf4j ;
19
19
import org .openrewrite .ExecutionContext ;
20
- import org .openrewrite .maven .MavenExecutionContextView ;
21
20
import org .openrewrite .maven .cache .*;
22
21
import org .openrewrite .maven .utilities .MavenArtifactDownloader ;
23
22
import org .openrewrite .tree .ParsingEventListener ;
34
33
import org .springframework .sbm .parsers .events .RewriteParsingEventListenerAdapter ;
35
34
import org .springframework .sbm .parsers .maven .*;
36
35
import org .springframework .sbm .project .resource .SbmApplicationProperties ;
37
- import org .springframework .sbm .scopes .ProjectMetadata ;
38
36
import org .springframework .sbm .scopes .ScanScope ;
39
37
40
38
import java .io .PrintWriter ;
41
39
import java .io .StringWriter ;
42
40
import java .nio .file .Path ;
43
- import java .nio .file .Paths ;
44
41
import java .util .function .Consumer ;
45
42
46
43
52
49
@ Slf4j
53
50
@ AutoConfiguration (after = {ScopeConfiguration .class })
54
51
@ EnableConfigurationProperties ({ParserProperties .class , SbmApplicationProperties .class })
55
- @ Import ({ScanScope .class , ScopeConfiguration .class })
52
+ @ Import ({ScanScope .class , ScopeConfiguration .class , RewriteParserMavenConfiguration . class })
56
53
public class RewriteParserConfiguration {
57
54
58
- @ Bean
59
- MavenPasswordDecrypter mavenPasswordDecrypter () {
60
- return new MavenPasswordDecrypter ();
61
- }
62
-
63
- @ Bean
64
- MavenProvenanceMarkerFactory mavenProvenanceMarkerFactory () {
65
- return new MavenProvenanceMarkerFactory ();
66
- }
67
-
68
55
@ Bean
69
56
ProvenanceMarkerFactory provenanceMarkerFactory (MavenProvenanceMarkerFactory mavenPovenanceMarkerFactory ) {
70
57
return new ProvenanceMarkerFactory (mavenPovenanceMarkerFactory );
@@ -76,38 +63,19 @@ JavaParserBuilder javaParserBuilder() {
76
63
return new JavaParserBuilder ();
77
64
}
78
65
79
- @ Bean
80
- BuildFileParser buildFileParser () {
81
- return new BuildFileParser ();
82
- }
83
-
84
-
85
- @ Bean
86
- @ ConditionalOnMissingBean (MavenArtifactCache .class )
87
- MavenArtifactCache mavenArtifactCache () {
88
- return new LocalMavenArtifactCache (Paths .get (System .getProperty ("user.home" ), ".m2" , "repository" )).orElse (
89
- new LocalMavenArtifactCache (Paths .get (System .getProperty ("user.home" ), ".rewrite" , "cache" , "artifacts" ))
90
- );
91
- }
92
-
93
66
@ Bean
94
67
Consumer <Throwable > artifactDownloaderErrorConsumer () {
95
68
return (t ) -> {throw new RuntimeException (t );};
96
69
}
97
70
98
71
@ Bean
99
- RewriteMavenArtifactDownloader artifactDownloader (MavenArtifactCache mavenArtifactCache , ProjectMetadata projectMetadata , Consumer <Throwable > artifactDownloaderErrorConsumer ) {
100
- return new RewriteMavenArtifactDownloader (mavenArtifactCache , projectMetadata .getMavenSettings (), artifactDownloaderErrorConsumer );
101
- }
102
-
103
- @ Bean
104
- ModuleParser helperWithoutAGoodName () {
72
+ ModuleParser moduleParser () {
105
73
return new ModuleParser ();
106
74
}
107
75
108
76
@ Bean
109
- MavenModuleParser mavenModuleParser (ParserProperties parserPropeties , ModuleParser moduleParser ) {
110
- return new MavenModuleParser (parserPropeties , moduleParser );
77
+ MavenModuleParser mavenModuleParser (ParserProperties parserProperties , ModuleParser moduleParser ) {
78
+ return new MavenModuleParser (parserProperties , moduleParser );
111
79
}
112
80
113
81
@ Bean
0 commit comments