This is an automated email from the ASF dual-hosted git repository.
mariofusco pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-drools.git
The following commit(s) were added to refs/heads/main by this push:
new 7707c221dd Fix split package + add script to detect them (#6308)
7707c221dd is described below
commit 7707c221dd010fe20404f2a4f3aa36fb758f928e
Author: Mario Fusco <[email protected]>
AuthorDate: Tue Apr 15 09:14:45 2025 +0200
Fix split package + add script to detect them (#6308)
* Fix split package + add script to detect them
* add headers
---
.github/workflows/split-package-detection.yml | 62 +++++++++++++++
check-split-packages.sh | 87 ++++++++++++++++++++++
.../org/drools/core/reteoo/ObjectTypeNodeId.java | 0
3 files changed, 149 insertions(+)
diff --git a/.github/workflows/split-package-detection.yml
b/.github/workflows/split-package-detection.yml
new file mode 100644
index 0000000000..4a4085067a
--- /dev/null
+++ b/.github/workflows/split-package-detection.yml
@@ -0,0 +1,62 @@
+#
+# 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.
+#
+
+# This workflow will build a Java project with Maven
+# For more information see:
https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
+name: Split Package Detection
+
+on:
+ push:
+ branches: [ main, master ]
+ pull_request:
+ branches: [ main, master ]
+ # Optional: Run manually from the Actions tab
+ workflow_dispatch:
+
+jobs:
+ check-split-packages:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up JDK
+ uses: actions/setup-java@v4
+ with:
+ distribution: 'temurin'
+ java-version: '21'
+
+ - name: Build with Maven
+ run: mvn package -Dquickly
+
+ - name: Make script executable
+ run: chmod +x ./check-split-packages.sh
+
+ - name: Run split package detection
+ run: ./check-split-packages.sh
+
+ - name: Upload results as artifact if failure
+ if: failure()
+ uses: actions/upload-artifact@v4
+ with:
+ name: split-package-report
+ path: |
+ check-split-packages.sh
+ # You could save the output to a file and include that too
diff --git a/check-split-packages.sh b/check-split-packages.sh
new file mode 100755
index 0000000000..a3193b7c6f
--- /dev/null
+++ b/check-split-packages.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+# 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.
+
+# Usage: ./check-split-packages.sh /path/to/your/root/dir
+ROOT_DIR="${1:-.}" # default to current dir if no argument passed
+
+# Use process substitution instead of pipes to avoid subshell issues
+declare -A package_map
+declare -A seen
+declare -A last_conflict_jar # Track the last conflicting jar for each package
+
+echo "🔍 Scanning all JARs under: $ROOT_DIR (excluding test JARs)"
+
+# Get all JAR files first, excluding test JARs
+jar_files=()
+while IFS= read -r jar; do
+ # Skip JAR files ending with "-tests.jar"
+ if [[ "$jar" != *"-test"* && "$jar" != *"-cli-"* && "$jar" != *"original-"*
&& "$jar" != *"-bootstrap-"* ]]; then
+ jar_files+=("$jar")
+ fi
+done < <(find "$ROOT_DIR" -type f -name "*.jar")
+
+echo "Found ${#jar_files[@]} non-test JAR files to analyze"
+
+# Process each JAR file
+for jar in "${jar_files[@]}"; do
+ jarname=$(realpath "$jar")
+ jarbasename=$(basename "$jarname") # Get just the filename without path
+ tmpdir=$(mktemp -d)
+ unzip -qq "$jar" -d "$tmpdir"
+
+ # Get all class files
+ class_files=()
+ while IFS= read -r classfile; do
+ class_files+=("$classfile")
+ done < <(find "$tmpdir" -type f -name "*.class")
+
+ # Process each class file
+ for classfile in "${class_files[@]}"; do
+ pkg=$(dirname "${classfile#$tmpdir/}" | tr '/' '.')
+ [[ "$pkg" == "." ]] && continue # skip default package
+
+ if [ -n "${package_map[$pkg]}" ]; then
+ if [ "${package_map[$pkg]}" != "$jarbasename" ]; then
+ if [[ -z "${seen[$pkg]}" ]]; then
+ # First time seeing this conflict
+ echo "🚨 Split package detected: $pkg"
+ echo " ↳ in: ${package_map[$pkg]}"
+ echo " ↳ and: $jarbasename"
+ seen[$pkg]=1
+ last_conflict_jar[$pkg]="$jarbasename"
+ elif [[ "${last_conflict_jar[$pkg]}" != "$jarbasename" ]]; then
+ # New jar with same conflict
+ echo " ↳ also in: $jarbasename"
+ last_conflict_jar[$pkg]="$jarbasename"
+ fi
+ # If it's the same jar as last time, we don't print anything
+ fi
+ else
+ package_map[$pkg]=$jarbasename;
+ fi
+ done
+
+ rm -rf "$tmpdir"
+done
+
+if [[ ${#seen[@]} -eq 0 ]]; then
+ echo "✅ No split packages found!"
+else
+ echo "❌ Split packages detected — please fix before modularizing."
+ exit 1
+fi
diff --git
a/drools-base/src/main/java/org/drools/core/reteoo/ObjectTypeNodeId.java
b/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeNodeId.java
similarity index 100%
rename from
drools-base/src/main/java/org/drools/core/reteoo/ObjectTypeNodeId.java
rename to drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeNodeId.java
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]