Skip to content
Snippets Groups Projects

Migrate to Jakarta 10 & JDK 17

Merged Olivier Maury requested to merge jakarta-10 into main
Files
14
+ 65
23
#!/bin/bash
BIN_DIR=$(dirname $0)
ROOT_DIR=$(dirname $BIN_DIR)
TOKEI2CLOC=$BIN_DIR/tokei2cloc.py
TOKEI=$(command -v tokei)
TOKEI_VERSION="12.1.2"
TOKEI2SLOCCOUNT=$(dirname $0)/tokei2sloccount.py
TOKEI2CLOC=$(dirname $0)/tokei2cloc.py
TOKEITGZ=tokei-v7.0.3-x86_64-unknown-linux-gnu.tar.gz
if [ ! -f bin/tokei ]; then
mkdir -p ~/tmp bin
if [ ! -f ~/tmp/$TOKEITGZ ]; then
wget "https://github.com/Aaronepower/tokei/releases/download/v7.0.3/$TOKEITGZ" -O ~/tmp/$TOKEITGZ
function check_tokei_version() {
echo "Checking tokei version"
VERSION=$($TOKEI --version | awk '{print $2}')
echo "tokei version: $VERSION"
echo "tokei expected version: $TOKEI_VERSION"
if [ "$TOKEI_VERSION" == "$VERSION" ]; then
return 0
fi
tar zxf ~/tmp/$TOKEITGZ -C bin
return 1
}
function install_tokei() {
echo "Installing tokei"
TOKEITGZ=tokei-x86_64-unknown-linux-gnu.tar.gz
TOKEITMP=~/tmp/tokei-$TOKEI_VERSION.tar.gz
if [ -f $TOKEITMP ]; then
if ! gzip -t $TOKEITMP; then
echo "$TOKEITMP is not a valid gzip archive"
rm -f $TOKEITMP
fi
fi
if [ ! -f $TOKEITMP ]; then
mkdir -p ~/tmp
URL="https://github.com/XAMPPRocky/tokei/releases/download/v$TOKEI_VERSION/$TOKEITGZ"
echo "Downloading tokei from $URL"
curl --location $URL -o $TOKEITMP
fi
echo "Extracting tokei"
tar zxf $TOKEITMP -C $BIN_DIR
TOKEI=$BIN_DIR/tokei
}
PYTHON=$(command -v python)
if [ ! -x "$PYTHON" ]; then
PYTHON=$(command -v python3)
fi
if [ -f bin/tokei ]; then
mkdir -p target
#bin/tokei -f -o json src | $TOKEI2SLOCCOUNT > target/sloccount.sc
bin/tokei -f -o json src | $TOKEI2CLOC > target/cloc.xml
exit
if [ ! -x "$PYTHON" ]; then
echo "Strange, python not found!"
exit 1
fi
SLOCCOUNT=$(which sloccount);
if [ "$SLOCCOUNT" != "" ]; then
DATADIR=$(dirname $0)/.slocdata;
if [ ! -f $DATADIR ]; then
mkdir -p $DATADIR;
if [ ! -x "$TOKEI" ]; then
if [ -f $BIN_DIR/tokei ]; then
TOKEI=$BIN_DIR/tokei
fi
mkdir -p target ;
/usr/bin/sloccount --datadir $DATADIR --duplicates --wide --details src > target/sloccount.sc;
else
echo "sloccount not found!";
fi
\ No newline at end of file
fi
if [ -x "$TOKEI" ]; then
check_tokei_version
if [ $? -eq 1 ]; then
install_tokei
fi
fi
if [ ! -x "$TOKEI" ]; then
install_tokei
fi
if [ ! -f $TOKEI ]; then
echo "Strange, $TOKEI does not exist!"
exit 1
fi
echo "tokei is installed at $TOKEI"
$TOKEI --version
mkdir -p $ROOT_DIR/target
$TOKEI -f -o json $ROOT_DIR/src | $PYTHON $TOKEI2CLOC > $ROOT_DIR/target/cloc.xml
Loading