#!/bin/sh # # Grab specific Dovetail Java source files, process them to remove log4j logging (and replace with ionu.DEBUG) and locate them # in the regular source tree. Run this whenever an update is required # exit 1 DT_SRC="../dt/src" DT_SRC_ESC="..\/dt\/src" FILES="${DT_SRC}/java/com/dt/util/Dates.java ${DT_SRC}/java/com/dt/util/PropUtil.java ${DT_SRC}/java/com/dt/util/Text.java ${DT_SRC}/java/com/dt/util/JSONUtil.java ${DT_SRC}/java/com/dt/util/Crypt.java ${DT_SRC}/java/com/dt/util/URLUtil.java ${DT_SRC}/java/com/dt/io/FileUtil.java" mkdir -p src/main/java/com/dt/util mkdir -p src/main/java/com/dt/io for java in ${FILES}; do out=`echo $java | sed "s/${DT_SRC_ESC}/src\/main/"` echo "Processing: $java to $out" cat "${java}" | awk ' /^package/ { print $0; printf "\n//import com.ionu.LibIOnU;\n"; next; } /import org.apache.log4j/ { next; } /static Category.*/ { next; } /cat\.debug.*/ { next; } /cat\.warn.*/ { next; } /cat\.info.*/ { next; } /cat\.error.*/ { next; } /cat\.log.*/ { next; } /if \(pri instanceof Priority\){/ { printf "if (false){"; next; } { print $0; } ' | sed 's/Priority\.INFO/null/' > $out done exit 0