Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ mvnd.zip*
backlog
.claude
.omc
.oss-ai-helper-rules
.oss-ai-helper-rules
.rewrite-enabled
18 changes: 18 additions & 0 deletions etc/scripts/regen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ cd `dirname "$0"`/../..
git clean -fdx
rm -Rf **/src/generated/

# Enable OpenRewrite only for modules with changed Java files.
# Maven's file-activated profile (<exists>.rewrite-enabled</exists>) checks
# per-module, so OpenRewrite runs only where needed — no -Prewrite flag required.
# We only need --deepen=1 (depth 1 -> 2) since we compare adjacent commits:
# for PRs, HEAD~1 is the base branch tip (first parent of the merge commit);
# for main builds, HEAD~1 is the previous squash-merged commit.
if ! git rev-parse HEAD~1 >/dev/null 2>&1; then
git fetch --deepen=1 --quiet 2>/dev/null || true
fi

if git rev-parse HEAD~1 >/dev/null 2>&1; then
git diff HEAD~1 HEAD --name-only -- '*.java' ':!*/src/generated/*' \
| sed 's|/src/.*||' | sort -u \
| while read module; do
[ -d "$module" ] && touch "$module/.rewrite-enabled"
done
fi

# Regenerate everything
if ./mvnw --batch-mode -Pregen -DskipTests ${MAVEN_EXTRA_ARGS} install >> build.log 2>&1; then
echo "✅ mvn -Pregen succeeded."
Expand Down
5 changes: 5 additions & 0 deletions parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4183,6 +4183,11 @@

<profile>
<id>rewrite</id>
<activation>
<file>
<exists>.rewrite-enabled</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@
${maven.multiModuleProjectDirectory}/buildingtools/src/main/resources/header.txt
</header>
<excludes>
<exclude>**/.rewrite-enabled</exclude>
<exclude>release.properties</exclude>
<exclude>**/pom.xml.tag</exclude>
<exclude>**/pom.xml.releaseBackup</exclude>
Expand Down
Loading