Skip to content

Commit

Permalink
Update maven.sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Steinbeck committed Dec 16, 2023
1 parent d7ae7d0 commit e5f7e6c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build
dist
.gradle
.idea
*.iml
Expand Down
29 changes: 21 additions & 8 deletions scripts/maven.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,45 @@ readonly SCRIPT_DIR=$( cd $(dirname $0); pwd -P)
# The modules to build, sign, and zip.
readonly MODULES=("libvcs4j-api" "libvcs4j" "libvcs4j-tools")

# Directory containing the modules to process.
readonly BASE_DIR="$SCRIPT_DIR/.."
# Directory containing the modules to be processed.
readonly BASE_DIR="${SCRIPT_DIR}/.."

echo "Enter passphrase:"
read -s PASSPHRASE
# Directory containing the distribution files.
readonly DIST_DIR="${BASE_DIR}/dist"
mkdir -p $DIST_DIR

# GPG key to be used for singing the distribution files.
readonly GPG_KEY_ID="EAA00B4FB1C54AA72284D636F71E150CAD9EA40F"

echo "[INFO] Building modules"
pushd $BASE_DIR > /dev/null
./gradlew clean build -x test
./gradlew publish
popd > /dev/null

echo "[INFO] Signing modules"
for module in "${MODULES[@]}"
do
pushd "$BASE_DIR/$module/build/libs" > /dev/null
in_dir="${BASE_DIR}/${module}/build"
out_dir="${DIST_DIR}/${module}"
mkdir -p $out_dir
pushd "${in_dir}/libs" > /dev/null
for file in *
do
echo "$PASSPHRASE" | gpg --no-tty --passphrase-fd 0 -u 0B9BB494 --detach-sign -o "$file.asc" "$file"
out_file="${out_dir}/${file}"
cp $file $out_file
gpg --no-tty -u $GPG_KEY_ID --detach-sign -o "${out_file}.asc" "${out_file}"
done
popd > /dev/null
out_file="${out_dir}/pom.xml"
cp "${in_dir}/publications/mavenJava/pom-default.xml" "${out_file}"
gpg --no-tty -u $GPG_KEY_ID --detach-sign -o "${out_file}.asc" "${out_file}"
done

echo "[INFO] Zipping modules"
for module in "${MODULES[@]}"
do
pushd "$BASE_DIR/$module/build/libs" > /dev/null
zip "$module.zip" ./*
pushd "${DIST_DIR}/${module}" > /dev/null
zip "${DIST_DIR}/${module}.zip" ./*
popd > /dev/null
done

0 comments on commit e5f7e6c

Please sign in to comment.