🔧 Build archives for effects

This commit is contained in:
Simon Schneegans
2022-06-10 15:13:49 +02:00
parent 4e2edc1492
commit d4e0ee95c9
15 changed files with 18 additions and 10 deletions
+1
View File
@@ -8,3 +8,4 @@
/resources/burn-my-windows.gresource /resources/burn-my-windows.gresource
/resources/burn-my-windows.gresource.xml /resources/burn-my-windows.gresource.xml
kwin/_build kwin/_build
kwin/*.tar.gz
+16 -9
View File
@@ -33,7 +33,7 @@ generate() {
DIR_NAME="kwin4_effect_$(echo "$1" | tr '-' '_')" DIR_NAME="kwin4_effect_$(echo "$1" | tr '-' '_')"
# Use the name of the effect for the JavaScript class name by removing all spaces. # Use the name of the effect for the JavaScript class name by removing all spaces.
EFFECT_CLASS="BurnMyWindows$(echo "$2" | tr -d ' ')" EFFECT_CLASS="BurnMyWindows$(echo "$2" | tr -d ' ')Effect"
# Create resource directories. # Create resource directories.
mkdir -p "$BUILD_DIR/$DIR_NAME/contents/shaders" mkdir -p "$BUILD_DIR/$DIR_NAME/contents/shaders"
@@ -42,25 +42,25 @@ generate() {
mkdir -p "$BUILD_DIR/$DIR_NAME/contents/ui" mkdir -p "$BUILD_DIR/$DIR_NAME/contents/ui"
# Copy the config file if it exists. # Copy the config file if it exists.
if [ -f "$DIR_NAME/main.xml" ]; then if [ -f "$1/main.xml" ]; then
cp "$DIR_NAME/main.xml" "$BUILD_DIR/$DIR_NAME/contents/config" cp "$1/main.xml" "$BUILD_DIR/$DIR_NAME/contents/config"
fi fi
# Copy the ui file if it exists. # Copy the ui file if it exists.
if [ -f "$DIR_NAME/config.ui" ]; then if [ -f "$1/config.ui" ]; then
cp "$DIR_NAME/config.ui" "$BUILD_DIR/$DIR_NAME/contents/ui" cp "$1/config.ui" "$BUILD_DIR/$DIR_NAME/contents/ui"
fi fi
ON_SETTINGS_CHANGE="" ON_SETTINGS_CHANGE=""
ON_ANIMATION_BEGIN="" ON_ANIMATION_BEGIN=""
if [ -f "$DIR_NAME/onSettingsChanged.js" ]; then if [ -f "$1/onSettingsChanged.js" ]; then
ON_SETTINGS_CHANGE=$(tr '/' '\f' < "$DIR_NAME/onSettingsChanged.js") ON_SETTINGS_CHANGE=$(tr '/' '\f' < "$1/onSettingsChanged.js")
fi fi
if [ -f "$DIR_NAME/onAnimationBegin.js" ]; then if [ -f "$1/onAnimationBegin.js" ]; then
ON_ANIMATION_BEGIN=$(tr '/' '\f' < "$DIR_NAME/onAnimationBegin.js") ON_ANIMATION_BEGIN=$(tr '/' '\f' < "$1/onAnimationBegin.js")
fi fi
cp main.js.in "$BUILD_DIR/$DIR_NAME/contents/code/main.js" cp main.js.in "$BUILD_DIR/$DIR_NAME/contents/code/main.js"
@@ -96,6 +96,13 @@ generate() {
} > "$BUILD_DIR/$DIR_NAME/contents/shaders/$1.frag" } > "$BUILD_DIR/$DIR_NAME/contents/shaders/$1.frag"
# If clang-format is installed, try to beauty the code a bit. # If clang-format is installed, try to beauty the code a bit.
if command -v clang-format &> /dev/null
then
clang-format -i "$BUILD_DIR/$DIR_NAME/contents/code/main.js"
fi
# Create an archive for the effect.
tar -C "$BUILD_DIR" -czf $DIR_NAME.tar.gz "$DIR_NAME"
} }
generate "energize-a" "Energize A" "Beam your windows away" generate "energize-a" "Energize A" "Beam your windows away"