forked from quarkusio/jbang-catalog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenrewriteinit.gradle
50 lines (44 loc) · 1.42 KB
/
openrewriteinit.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Script used to run Open Rewrite without having to modify the build.
// Based on https://docs.openrewrite.org/tutorials/running-rewrite-on-a-gradle-project-without-modifying-the-build
initscript {
repositories {
maven { url "https://plugins.gradle.org/m2" }
}
dependencies {
classpath("org.openrewrite:plugin:latest.release")
}
}
addListener(new BuildInfoPluginListener())
allprojects {
project.afterEvaluate {
if (!project.plugins.hasPlugin(org.openrewrite.gradle.RewritePlugin)) {
project.plugins.apply(org.openrewrite.gradle.RewritePlugin)
}
}
dependencies {
rewrite("org.openrewrite:rewrite-java")
}
rewrite {
configFile = project.getRootProject().file("%rewritefile%")
activeRecipe("io.quarkus.updates.core.quarkus30.Quarkus3")
plainTextMask("**/META-INF/services/**",
"**/*.txt",
"**/*.adoc",
"**/*.md",
"**/src/main/codestarts/**/*.java",
"**/src/test/resources/__snapshots__/**/*.java",
"**/*.kt")
}
}
class BuildInfoPluginListener extends BuildAdapter {
def void projectsLoaded(Gradle gradle) {
Project root = gradle.getRootProject()
if (!"buildSrc".equals(root.name)) {
root.allprojects {
apply {
apply plugin: org.openrewrite.gradle.RewritePlugin
}
}
}
}
}