From 995dece521146ee04fe667d463029db8ede01270 Mon Sep 17 00:00:00 2001 From: and94x Date: Mon, 15 Aug 2022 15:39:00 +0200 Subject: [PATCH] simplified mkdir and feedback build steps, added chrome build script --- build-cr.sh | 37 +++++++++++++++++++++++++++++++++++++ build-ff.sh | 5 ++--- 2 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 build-cr.sh diff --git a/build-cr.sh b/build-cr.sh new file mode 100644 index 0000000..899e92d --- /dev/null +++ b/build-cr.sh @@ -0,0 +1,37 @@ +#!/usr/bin/bash +printf " _ _____ \r\n" +printf " ___| |_ __ _ _ __ ___ _ __ ___/__ \/ \ /\ \r\n" +printf "/ __| __/ _\` | '_ \` _ \| '_ \` _ \ / /\/\ \ / / \r\n" +printf "\__ \ || (_| | | | | | | | | | | / / \ V / \r\n" +printf "|___/\__\__,_|_| |_| |_|_| |_| |_\/ \_/ \r\n" + +# Define paths +BASE_DIR=base +MANIFEST_DIR=chrome +OUTPUT_DIR=out/artifacts/chrome + +OUTPUT_FILE=${OUTPUT_DIR}/extension.zip + +printf "Base dir: \t%s\r\n" "$BASE_DIR" +printf "Manifest dir: \t%s\r\n" "$MANIFEST_DIR" +printf "Output dir: \t%s\r\n" "$OUTPUT_DIR" +printf "\r\n" + +# Create output directory, if not existing +mkdir -p "${OUTPUT_DIR}" + +# Remove previous build, if existing +[ -f ${OUTPUT_FILE} ] && rm -f ${OUTPUT_FILE} + +# Add base components to zip +pushd ${BASE_DIR} 1> /dev/null || exit +zip -r ../${OUTPUT_FILE} * 1> /dev/null +popd 1> /dev/null || exit + +# Add firefox manifest to zip +pushd ${MANIFEST_DIR} 1> /dev/null || exit +zip ../${OUTPUT_FILE} manifest.json 1> /dev/null +popd 1> /dev/null || exit + +# Feedback +[ -f ${OUTPUT_FILE} ] && echo "✔ Successfully created $(file ${OUTPUT_FILE})" || echo "❌ Failed to build extension. See output printed above for more details." diff --git a/build-ff.sh b/build-ff.sh index 101ab0f..fc01afe 100644 --- a/build-ff.sh +++ b/build-ff.sh @@ -18,7 +18,7 @@ printf "Output dir: \t%s\r\n" "$OUTPUT_DIR" printf "\r\n" # Create output directory, if not existing -[ ! -d "${OUTPUT_DIR}" ] && mkdir -p "${OUTPUT_DIR}" +mkdir -p "${OUTPUT_DIR}" # Remove previous build, if existing [ -f ${OUTPUT_FILE} ] && rm -f ${OUTPUT_FILE} @@ -34,5 +34,4 @@ zip ../${OUTPUT_FILE} manifest.json 1> /dev/null popd 1> /dev/null || exit # Feedback -[ -f ${OUTPUT_FILE} ] && echo "✔ Successfully created $(file ${OUTPUT_FILE})" -[ ! -f ${OUTPUT_FILE} ] && echo "❌ Failed to build extension. See output printed above for more details." +[ -f ${OUTPUT_FILE} ] && echo "✔ Successfully created $(file ${OUTPUT_FILE})" || echo "❌ Failed to build extension. See output printed above for more details."