Skip to content

Commit e00d540

Browse files
committed
feat: add function to prune Windows-only non-runtime JRE artifacts
1 parent d11f1a8 commit e00d540

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

bindings/python/scripts/build-native.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,28 @@ apply_jar_exclusions() {
7171
echo -e "${CYAN}📋 JAR count after exclusion: ${YELLOW}$(count_jars "$jars_dir")${NC}"
7272
}
7373

74+
prune_windows_jre_artifacts() {
75+
local jre_dir="$1"
76+
local removed_count=0
77+
local artifact_path
78+
79+
if [[ ! -d "$jre_dir" ]]; then
80+
echo -e "${RED}❌ JRE directory not found for Windows cleanup: ${jre_dir}${NC}"
81+
exit 1
82+
fi
83+
84+
echo -e "${CYAN}🧹 Pruning Windows-only non-runtime JRE artifacts...${NC}"
85+
86+
while IFS= read -r artifact_path; do
87+
[[ -n "$artifact_path" ]] || continue
88+
echo -e " - Removing: ${artifact_path}"
89+
rm -f "$artifact_path"
90+
removed_count=$((removed_count + 1))
91+
done < <(find "$jre_dir" -type f \( -iname "*.pdb" -o -iname "*.lib" -o -iname "*.map" \))
92+
93+
echo -e "${CYAN}📋 Removed Windows JRE artifacts: ${YELLOW}${removed_count}${NC}"
94+
}
95+
7496
# Check for Java (needed for jlink and JPype build)
7597
if ! command -v java &> /dev/null; then
7698
echo -e "${RED}❌ Java not found${NC}"
@@ -219,6 +241,12 @@ echo -e "${GREEN}✅ JRE built${NC}"
219241
JRE_SIZE=$(du -sh "$PY_BINDINGS_DIR/temp_jre" | cut -f1)
220242
echo -e "${CYAN}📊 JRE size: ${YELLOW}${JRE_SIZE}${NC}"
221243

244+
if [[ "$PLATFORM" == windows/* ]]; then
245+
prune_windows_jre_artifacts "$PY_BINDINGS_DIR/temp_jre"
246+
JRE_SIZE=$(du -sh "$PY_BINDINGS_DIR/temp_jre" | cut -f1)
247+
echo -e "${CYAN}📊 JRE size after Windows cleanup: ${YELLOW}${JRE_SIZE}${NC}"
248+
fi
249+
222250
# Step 3: Copy JRE to package (JARs already filtered in place)
223251
echo -e "${CYAN}📦 Preparing package...${NC}"
224252

0 commit comments

Comments
 (0)