#!/bin/sh
set -e

VERSION=$2
DIR=CRONOMETER
TAR=../cronometer_${VERSION}.orig.tar.xz

tar -xf $3
rm $3
XZ_OPT=--best tar -c -v -J -f $TAR \
    --exclude 'docs/project-support.jpg' \
    --exclude '.settings' \
    --exclude '.classpath' \
    --exclude '.project' \
    --exclude '.cvsignore' \
    --exclude '.svnignore' \
    --exclude '._*' \
    --exclude 'lib/cronometer.jar' \
    --exclude 'lib/docs.jar' \
    $DIR
rm -Rf $DIR ._*
