-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Expand file tree
/
Copy pathregen.sh
More file actions
executable file
·62 lines (55 loc) · 2.25 KB
/
Copy pathregen.sh
File metadata and controls
executable file
·62 lines (55 loc) · 2.25 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
set -e
# Move to top directory
cd `dirname "$0"`/../..
# Force clean
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."
else
echo "❌ mvn -Pregen failed. Last 50 lines of build.log:"
tail -n 50 build.log
exit 1
fi
# One additional pass to get the info for the 'others' jars
if ./mvnw --batch-mode ${MAVEN_EXTRA_ARGS} install -f catalog/camel-catalog >> build.log 2>&1; then
echo "✅ mvn install for camel-catalog succeeded."
else
echo "❌ mvn install for camel-catalog failed. Last 50 lines of build.log:"
tail -n 50 build.log
exit 1
fi