#!/bin/bash

test ! "${!WORKSPACE[@]}" && echo 'Variable WORKSPACE is not set, can not continue' && return

"Cleaning artifacts on workspace: $WORKSPACE..."

SRC_ARCHIVE=
BIN_ARCHIVE=$WORKSPACE/bin.tbz
TESTS_ARCHIVE=$WORKSPACE/tests.tbz
ROCKSD_ARCHIVE=$WORKSPACE/rocksDirectory.tbz

# remove the tbz files
rm -rf $WORKSPACE/sources.tbz
rm -rf $WORKSPACE/bin.tbz
rm -rf $WORKSPACE/tests.tbz
rm -rf $WORKSPACE/rocksDirectory.tbz

# remove the directories
rm -rf $WORKSPACE/bin
rm -rf $WORKSPACE/lib
rm -rf $WORKSPACE/sources
rm -rf $WORKSPACE/tests
rm -rf $WORKSPACE/luarocks