From 46d399ca877208f7bfe8091fb3c103ac81c90d19 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Thu, 7 May 2026 16:01:59 +0200 Subject: [PATCH 1/2] chore: conditionally enable OpenRewrite FQCN shortening in CI Instead of always running OpenRewrite (which quadruples build time), detect FQCNs in the diff and only enable -Prewrite when needed. Co-Authored-By: Claude Opus 4.6 (1M context) --- etc/scripts/regen.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/etc/scripts/regen.sh b/etc/scripts/regen.sh index 5f4b75f2a69b0..302a90b678559 100755 --- a/etc/scripts/regen.sh +++ b/etc/scripts/regen.sh @@ -21,6 +21,31 @@ set -e # Move to top directory cd `dirname "$0"`/../.. +# Conditionally enable OpenRewrite FQCN shortening only when needed. +# We diff HEAD~1 vs HEAD to check for FQCNs in the changeset. +# For PR builds, actions/checkout creates a merge commit whose first parent (HEAD~1) +# is the base branch tip, so the diff covers all PR changes. +# For main builds, HEAD~1 is the previous (squash-merged) commit. +# We only need --deepen=1 (depth 1 -> 2) since we compare adjacent commits, +# not a merge-base (which would require deeper history). +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 && \ + git diff HEAD~1 HEAD -- '*.java' ':!*/src/generated/*' \ + | grep '^+[^+]' \ + | grep -v '^+ *import ' \ + | grep -v '^+ *package ' \ + | grep -v '^+ *//' \ + | grep -v '^+ *\*' \ + | grep -qE '[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)+\.[A-Z]'; then + MAVEN_EXTRA_ARGS="${MAVEN_EXTRA_ARGS} -Prewrite" + echo "FQCNs detected in diff, enabling OpenRewrite (-Prewrite)" +else + echo "No FQCNs detected in diff, skipping OpenRewrite" +fi + # Force clean git clean -fdx rm -Rf **/src/generated/ From 0756a34af0762a1d042a62c52442e79d754b0407 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Thu, 7 May 2026 17:40:10 +0200 Subject: [PATCH 2/2] test: FQCN change to validate OpenRewrite is triggered MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DO NOT MERGE — test PR to measure build time with OpenRewrite enabled. --- .../camel-api/src/main/java/org/apache/camel/CamelContext.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/camel-api/src/main/java/org/apache/camel/CamelContext.java b/core/camel-api/src/main/java/org/apache/camel/CamelContext.java index 46700aa307513..41ce6008ebc08 100644 --- a/core/camel-api/src/main/java/org/apache/camel/CamelContext.java +++ b/core/camel-api/src/main/java/org/apache/camel/CamelContext.java @@ -85,6 +85,9 @@ */ public interface CamelContext extends CamelContextLifecycle, RuntimeConfiguration { + // TEST: this line SHOULD trigger OpenRewrite FQCN detection + java.util.List testFqcnDetection = null; + /** * Gets the {@link ExtendedCamelContext} that contains the extension points for internal context APIs. These APIs * are intended for internal usage within Camel and end-users should avoid using them.