Changeset 12474 in osm for applications/editors


Ignore:
Timestamp:
2008-12-22T14:21:04+01:00 (16 years ago)
Author:
joerg
Message:

Compile each plugin and only insert the ones compiling, use new target to compile josm; add more commets to build script; add color to build output; add logfiles for compilation and reduce compile output

Location:
applications/editors/josm/debian
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/debian/make_install_files.sh

    r11707 r12474  
    11#!/bin/sh
    22
    3 dst_path=$1
    4 
    5 if [ ! -n "$dst_path" ] ; then
    6     echo "Please specify a Directory to use as Basedirectory"
    7     echo "Usage:"
    8     echo "     $0 <working-dir>"
    9     exit -1
    10 fi
     3dst_path=debian/openstreetmap-josm
     4
     5#test -n "$1" || help=1
     6quiet=" -q "
     7verbose=1
     8
     9do_update_icons=true
     10do_update_josm=true
     11do_update_josm_ng=true
     12do_update_plugins=true
     13do_remove_jar=true
     14
     15for arg in "$@" ; do
     16    case $arg in
     17        --dest-path=*) # Destination path to install the final *.jar Files
     18        dst_path=${arg#*=}
     19        ;;
     20       
     21        --no-update-icons) # Do not update icons
     22            do_update_icons=false
     23            ;;
     24
     25        --no-update-josm) # Do not update Josm
     26            do_update_josm=false
     27            ;;
     28
     29        --no-update-josm-ng) # Do not update Josm-NG
     30            do_update_josm_ng=false
     31            ;;
     32
     33        --no-update-plugins) # Do not update the plugins
     34            do_update_plugins=false
     35            ;;
     36
     37        --no-remove-jar) # Do not remove old jar Files
     38            do_remove_jar=false
     39            ;;
     40       
     41        *)
     42            echo ""
     43            echo "!!!!!!!!! Unknown option $arg"
     44            echo ""
     45            help=1
     46            ;;
     47    esac
     48done
     49
     50if [ -n "$help" ] ; then
     51    # extract options from case commands above
     52    options=`grep -E -e esac -e '\s*--.*\).*#' $0 | sed '/esac/,$d;s/.*--/ [--/; s/=\*)/=val]/; s/)[\s ]/]/; s/#.*\s*//; s/[\n/]//g;'`
     53    options=`for a in $options; do echo -n " $a" ; done`
     54    echo "$0 $options"
     55    echo "
     56
     57    This script tries to compile and copy all josm Files
     58    and all the plugins.
     59    In case a plugin will not compile it is omitted.
     60    "
     61    # extract options + description from case commands above
     62    grep -E  -e esac -e '--.*\).*#' -e '^[\t\s  ]+#' $0 | \
     63        grep -v /bin/bash | sed '/esac/,$d;s/.*--/  --/;s/=\*)/=val/;s/)//;s/#//;'
     64    exit;
     65fi
     66
     67
     68# define colors
     69ESC=`echo -e "\033"`
     70RED="${ESC}[91m"
     71GREEN="${ESC}[92m"
     72YELLOW="${ESC}[93m"
     73BLUE="${ESC}[94m"
     74MAGENTA="${ESC}[95m"
     75CYAN="${ESC}[96m"
     76WHITE="${ESC}[97m"
     77BG_RED="${ESC}[41m"
     78BG_GREEN="${ESC}[42m"
     79BG_YELLOW="${ESC}[43m"
     80BG_BLUE="${ESC}[44m"
     81BG_MAGENTA="${ESC}[45m"
     82BG_CYAN="${ESC}[46m"
     83BG_WHITE="${ESC}[47m"
     84BRIGHT="${ESC}[01m"
     85UNDERLINE="${ESC}[04m"
     86BLINK="${ESC}[05m"
     87REVERSE="${ESC}[07m"
     88NORMAL="${ESC}[0m"
    1189
    1290echo "copying Files to '$dst_path'"
     
    29107#    ln -s ../map-icons/classic.small images
    30108#)
     109
     110# --------------------------------------------
     111# Try to update Icons
     112if $do_update_icons ; then
     113    echo "Now we try our best ... to get more icons ..."
     114    find ../../share/map-icons/build/square.small -type f -name "*.png" | while read src_file ; do
     115        file=${src_file#.*square.small/}
     116        dst_dir="plugins/mappaint/icons/`dirname $file`"
     117        mkdir -p $dst_dir
     118        #echo "File $file"
     119        cp -u "$src_file" "plugins/mappaint/icons/$file"
     120    done
     121fi
    31122mkdir -p "$dst_path/usr/lib/josm"
    32123
    33124# ------------------------------------------------------------------
    34 # Compile the Jar Files
    35 echo "------------- Compile Josm"
    36 cd core
    37 ant -q clean
    38 ant -q compile || exit -1
    39 cd ..
    40 
    41 echo "------------- Compile Josm Plugins"
    42 cd plugins
    43 ant -q clean
    44 ant -q dist|| exit -1
    45 cd ..
    46 
     125# Remove Old Jar Files in dist/*.jar
     126
     127$do_remove_jar && rm -f dist/*.jar
     128$do_remove_jar && rm -f plugins/*/dist/*.jar
     129
     130# ------------------------------------------------------------------
     131# Compile the Josm Main File(s)
     132if $do_update_josm ; then
     133    echo "------------- Compile Josm"
     134    cd core
     135    ant -q clean 2>build.err
     136    ant -q dist >>build.log 2>>build.err
     137    rc=$?
     138    if [ "$rc" -ne "0" ] ; then
     139        echo "${BG_RED}!!!!!!!!!! ERROR compiling josm core${NORMAL}"
     140        exit -1
     141    fi
     142    cd ..
     143fi
     144
     145# ------------------------------------------------------------------
     146# Try to Compile as many Josm Plugins as possible
     147if $do_update_plugins ; then
     148    echo "------------- Compile Josm Plugins"
     149    compiling_error=''
     150    compiling_ok=''
     151    cd plugins
     152    plugins=`ls */build.xml | sed s,/build.xml,,`
     153    echo "Plugins(`echo "$plugins"| wc -l`): " $plugins
     154    for dir in $plugins; do
     155        cd $dir
     156        echo -n -e "----- $dir\r"
     157        $do_remove_jar && rm -f dist/*.jar
     158        $do_remove_jar && rm -f ../../dist/$dir.jar
     159        rm -f *.log
     160        echo "ant clean" >build.log
     161        echo "ant clean" >build.err
     162        ant -q clean >>build.log 2>>build.err
     163        echo "ant dist" >>build.log
     164        echo "ant dist" >>build.err
     165        ant -q dist >>build.log 2>>build.err
     166        rc=$?
     167        number_of_jar=`(find . -name "*.jar" ;find ../../dist -name "$dir.jar")| grep -v '/lib'| wc -l`
     168        if [ "$rc" -eq "0" ] ; then
     169            echo "${GREEN}------------------------- compiling $dir successfull${NORMAL}         ( $number_of_jar jar Files)"
     170            grep -i -e error -e warn *.log *.err
     171            compiling_ok="$compiling_ok $dir"
     172        else           
     173            echo "${BG_RED}!!!!!!!!!! ERROR compiling $dir${NORMAL}     ( $number_of_jar jar Files)"
     174            #echo "Details see:"
     175            #echo "    `pwd`/build.log"
     176            #echo "    `pwd`/build.err"
     177            compiling_error="$compiling_error $dir"
     178        fi
     179        find . -name "*.jar" | grep -v -e '/lib'
     180
     181        cd ..
     182    done
     183    if [ -n "$compiling_error" ] ; then
     184        echo "${BG_RED}!!!!!!!!!! ERROR compiling Plugins${NORMAL}"
     185        echo "Details see:"
     186       
     187        err_log_path=''
     188        for dir in $compiling_error; do
     189            echo "    `pwd`/$dir/build.log"
     190            err_log_path="$err_log_path $dir/build.log $dir/build.err"
     191        done
     192        zip -q errors.zip $err_log_path
     193        echo "${RED}Combined ERROR Logfiles are at: `pwd`/errors.zip${NORMAL}"
     194        echo "${RED}Compiling ERRORs(`echo "$compiling_error"| wc -w`): $compiling_error${NORMAL}"
     195    fi
     196    echo "Compiling OK(`echo "$compiling_ok"| wc -w`): $compiling_ok"
     197    cd ..
     198fi
     199
     200# ------------------------------------------------------------------
    47201# Compile the Josm-ng Files
    48 echo "------------- Compile Josm-ng"
    49 cd ../josm-ng
     202if $do_update_josm_ng ; then
     203    echo "------------- Compile Josm-ng"
     204    cd ../josm-ng
    50205    ant -q clean
    51     ant -q josm-ng-impl.jar || {
    52         echo "!!!!!!!!!!!!!!!!! WARNING Josm-NG is not included into the package"
     206    ant -q josm-ng-impl.jar  >>build.log 2>>build.err
     207    rc=$?
     208    if [ "$rc" -ne "0" ] ; then
     209        echo "------------- ERROR Compiling Josm-ng"
     210        echo "${RED}!!!!!!!!!!!!!!!!! WARNING Josm-NG is not included into the package${NORMAL}"
    53211        #exit -1
    54         }
    55 cd ../josm
     212    fi
     213    cd ../josm
     214fi
    56215
    57216
     
    60219
    61220cp ./core/dist/josm-custom.jar $jar_path/josm.jar || exit -1
     221rc=$?
     222if [ "$rc" -ne "0" ] ; then
     223    echo "${RED}------------- ERROR Compiling Josm-ng${NORMAL}"
     224fi
    62225cp ../josm-ng/dist/josm-ng.jar $jar_path/josm-ng.jar || {
    63     echo "!!!!!!!!!!!!!!!!! WARNING Josm-NG is not included into the package"
     226    echo "${RED}!!!!!!!!!!!!!!!!! WARNING Josm-NG is not included into the package${NORMAL}"
    64227    #exit -1
    65228}
    66229
     230# Find all existing plugin-jar files and generate a pluginlist from it
    67231plugin_jars=`find dist -name "*.jar"`
     232plugins=''
    68233for src_fn in $plugin_jars ; do
    69234    fn="`basename ${src_fn}`"
    70235    dst_fn="$plugin_dir/$fn"
    71236    echo "cp $src_fn $dst_fn"
    72     cp "$src_fn" "$dst_fn" || exit -1
     237    cp "$src_fn" "$dst_fn"
     238    if [ "$?" -ne "0" ] ; then
     239        echo "${RED}------------- ERROR Copying $src_fn ${NORMAL}"
     240        exit -1
     241    fi
    73242    plugin_name=${fn%.jar}
    74243    echo $plugin_name | grep -q -e plastic_laf -e lang && continue
     
    82251echo "$plugins"
    83252
     253# Copy words.cfg for spelling
    84254mkdir -p "$jar_path/speller"
    85255cp ../../utils/planet.osm/java/speller/words.cfg "$jar_path/speller/"
     
    92262}
    93263
     264# add plugins to default preferences
    94265sed "s/PLUGIN_LIST/$plugins/;" <debian/bin/preferences >"$jar_path/preferences"
     266
     267# Copy default Bookmarks
    95268cp nsis/bookmarks "$jar_path/bookmarks"
  • applications/editors/josm/debian/rules

    r11708 r12474  
    2424        dh_testroot
    2525        rm -f build-stamp
     26        rm -f dist/*.jar
    2627
    2728        # Add here commands to clean up after the build process.
    2829        -$(MAKE) distclean
    29 
    30         rm dist/*.jar
    3130
    3231        dh_clean
     
    3938
    4039#       ./debian/update_svn_revision.sh
    41         ./debian/make_install_files.sh ${destdir} || exit -1
     40        ./debian/make_install_files.sh --dest-path=${destdir} || exit -1
    4241
    4342
Note: See TracChangeset for help on using the changeset viewer.