You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sbm-support-rewrite/README.adoc
+109-33
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,37 @@
1
1
# sbm-support-rewrite
2
-
these components
3
2
4
3
The `sbm-support-rewrite` project provides Spring beans classes to parse a given project to an OpenRewrite abstract syntax tree (AST) which can then be used to run OpenRewrite recipes that were discovered on the classpath.
5
4
6
-
- `RewriteProjectParser` - parses a project to OpenRewrite's AST representation
7
-
- `RecipeDiscovery` - provides access to discovered recipes
5
+
## Components
6
+
The following components can be used to parse a project, run recipes and write changes back to the filesystem.
7
+
These components are provided as Spring beans and can be injected into other Spring beans that require them.
8
+
9
+
_Example: Inject RewriteProjectParser into your Spring bean_
10
+
[source,java]
11
+
....
12
+
@Autowired
13
+
RewriteProjectParser parser;
14
+
....
15
+
16
+
### ProjectScanner
17
+
Scan a given path to a list of resources using filter definitions provided as application properties.
18
+
19
+
### RewriteProjectParser
20
+
Parses a project to OpenRewrite's AST representation.
21
+
22
+
### RewriteExecutionContext
23
+
OpenRewrite's `ExecutionContext` gets initialized during parsing.
24
+
This `ExecutionContext` is required for some recipes and inner workings of OpenRewrite.
25
+
26
+
### RecipeDiscovery
27
+
Discover OpenRewrite recipes on classpath
28
+
29
+
### ProjectResourceSet
30
+
Abstraction of OpenRewrite SourceFiles that allows execution of recipes against the SourceFiles while
31
+
synchronizing changes with the underlying list of SourceFiles.
32
+
33
+
### ProjectResourceSetSerializer
34
+
Write back the in-memory changed SourceFiles from the ProjectResourceSet to the filesystem.
8
35
9
36
## Getting started
10
37
@@ -36,15 +63,13 @@ Then the dependency can be retrieved.
36
63
</dependency>
37
64
.....
38
65
39
-
### Parse a project
40
-
41
-
`RewriteProjectParser` is provided as Spring bean and can be injected into components.
66
+
### (Optional) Scan a project
67
+
`ProjectScanner` scans a given `Path` to a list of ``Resource``s.
68
+
It filters out resources and directories matching any of the ignore patterns in
69
+
`parser.ignoredPathPatterns`.
42
70
43
-
[source,java]
44
-
.....
45
-
@Autowired
46
-
private RewriteProjectParser parser;
47
-
.....
71
+
### Parse a project
72
+
`RewriteProjectParser` parses a project to OpenRewrite AST.
48
73
49
74
The provided `parse(Path)` method can be used to parse a project under a given `Path` to OpenRewrite AST.
0 commit comments