@@ -20,6 +20,7 @@ NC='\033[0m'
2020SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
2121PY_BINDINGS_DIR=" $( cd " ${SCRIPT_DIR} /.." && pwd) "
2222DIST_DIR=" $PY_BINDINGS_DIR /dist"
23+ JAR_EXCLUSIONS_FILE=" $SCRIPT_DIR /jar_exclusions.txt"
2324
2425# Parameters
2526PLATFORM=" ${1:- } "
@@ -37,6 +38,39 @@ echo -e "${CYAN}π¨ Native build for platform: ${YELLOW}${PLATFORM}${NC}"
3738echo -e " ${CYAN} π¦ Package: ${YELLOW}${PACKAGE_NAME}${NC} "
3839echo -e " ${CYAN} π ArcadeDB tag: ${YELLOW}${ARCADEDB_TAG}${NC} "
3940
41+ count_jars () {
42+ find " $1 " -maxdepth 1 -name " *.jar" -type f | wc -l | awk ' {print $1}'
43+ }
44+
45+ apply_jar_exclusions () {
46+ local jars_dir=" $1 "
47+ local exclusions_file=" $2 "
48+ local pattern
49+ local jar_path
50+
51+ if [[ ! -f " $exclusions_file " ]]; then
52+ echo -e " ${RED} β JAR exclusion file not found: ${exclusions_file}${NC} "
53+ exit 1
54+ fi
55+
56+ echo -e " ${CYAN} ποΈ Removing excluded JARs...${NC} "
57+ echo -e " ${CYAN} π JAR count before exclusion: ${YELLOW} $( count_jars " $jars_dir " ) ${NC} "
58+
59+ while IFS= read -r pattern; do
60+ if [[ -z " $pattern " ]] || [[ " ${pattern# \# } " != " $pattern " ]]; then
61+ continue
62+ fi
63+
64+ while IFS= read -r jar_path; do
65+ [[ -n " $jar_path " ]] || continue
66+ echo -e " - Removing: ${jar_path} "
67+ rm -f " $jar_path "
68+ done < <( find " $jars_dir " -maxdepth 1 -name " $pattern " -type f)
69+ done < " $exclusions_file "
70+
71+ echo -e " ${CYAN} π JAR count after exclusion: ${YELLOW} $( count_jars " $jars_dir " ) ${NC} "
72+ }
73+
4074# Check for Java (needed for jlink and JPype build)
4175if ! command -v java & > /dev/null; then
4276 echo -e " ${RED} β Java not found${NC} "
122156 echo -e " ${GREEN} β
JARs downloaded to: $JARS_DIR ${NC} "
123157fi
124158
159+ # Always filter excluded jars, even when reusing an existing jars directory from a prior build.
160+ apply_jar_exclusions " $JARS_DIR " " $JAR_EXCLUSIONS_FILE "
161+
125162# Step 2: Build minimal JRE with jlink
126163echo -e " ${CYAN} π¨ Building minimal JRE with jlink...${NC} "
127164
@@ -182,7 +219,7 @@ echo -e "${GREEN}β
JRE built${NC}"
182219JRE_SIZE=$( du -sh " $PY_BINDINGS_DIR /temp_jre" | cut -f1)
183220echo -e " ${CYAN} π JRE size: ${YELLOW}${JRE_SIZE}${NC} "
184221
185- # Step 3: Copy JRE to package (JARs already filtered and in place from artifact )
222+ # Step 3: Copy JRE to package (JARs already filtered in place)
186223echo -e " ${CYAN} π¦ Preparing package...${NC} "
187224
188225# Build and copy JRE
0 commit comments