diff --git a/apply_patches.sh b/apply_patches.sh index 53b35b6..8d581f9 100755 --- a/apply_patches.sh +++ b/apply_patches.sh @@ -4,22 +4,37 @@ set -e mydir="$(dirname "$(realpath "$0")")" +print_section() { + local msg="$1" + echo "##############################################################" + echo "# $msg" + echo "##############################################################" +} + pushd "$mydir" > /dev/null source ./merge_helpers.sh # Apply our patches +print_section "Apply patches to matrix-js-sdk" apply_patches matrix-js-sdk +print_section "Apply patches to matrix-react-sdk" apply_patches matrix-react-sdk +#print_section "Apply patches to element-web" #apply_patches element-web +print_section "Apply patches to element-desktop" apply_patches element-desktop # Automatic adjustments +#print_section "Apply i18n" #automatic_i18n_adjustment +print_section "Apply automatic package adjustments" automatic_packagejson_adjustment # Automatic theme and icon update +print_section "Apply automatic theme updates" ./theme.sh y -./graphics/icon_gen.sh +print_section "Generate icons" +./graphics/icon_gen.sh y popd > /dev/null diff --git a/graphics/icon_gen.sh b/graphics/icon_gen.sh index 6bd1236..b7fdf4f 100755 --- a/graphics/icon_gen.sh +++ b/graphics/icon_gen.sh @@ -1,6 +1,16 @@ #!/bin/bash +set -e + mydir="$(dirname "$(realpath "$0")")" +automatic_commit="$1" + +SCHILDI_ROOT="$mydir/.." +source "$SCHILDI_ROOT/merge_helpers.sh" + +if [[ "$automatic_commit" == [Yy]* ]]; then + forelement_repos check_clean_git +fi export_rect() { @@ -17,7 +27,7 @@ export_square() { export_rect "$1" "$size" "$in" "$out" } -repo_dir="$mydir/../element-web" +repo_dir="$SCHILDI_ROOT/element-web" base_out="$repo_dir/res/vector-icons" for i in 1024 120 150 152 180 24 300 44 48 50 76 88; do @@ -45,7 +55,7 @@ for f in "$base_out"/*.png; do done -repo_dir="$mydir/../element-desktop" +repo_dir="$SCHILDI_ROOT/element-desktop" base_out="$repo_dir/res/img" export_square 256 "$mydir/ic_launcher_sc.svg" "$base_out/element.png" @@ -77,3 +87,8 @@ rm "$base_out/icons/1024x1024.png" for f in "$base_out/icons"/*.png; do pngcrush -ow "$f" done + + +if [[ "$automatic_commit" == [Yy]* ]]; then + forelement_repos commit_if_dirty "Automatic icon update" +fi diff --git a/merge_helpers.sh b/merge_helpers.sh index 2e36b6f..d80ff9e 100755 --- a/merge_helpers.sh +++ b/merge_helpers.sh @@ -1,6 +1,8 @@ #!/bin/bash -SCHILDI_ROOT="$(dirname "$(realpath "$0")")" +if [ -z "$SCHILDI_ROOT" ]; then + SCHILDI_ROOT="$(dirname "$(realpath "$0")")" +fi branch=${BRANCH:-"lite"} @@ -290,3 +292,10 @@ on_apply_patch_fail() { echo "----------------------------------" read -p "Press enter after committing resolved conflicts: " } + +commit_if_dirty() { + local message="$1" + # see: https://devops.stackexchange.com/a/5443 + git add -A + git diff-index --quiet HEAD || git commit -m "$message" +} diff --git a/merge_upstream.sh b/merge_upstream.sh index 2e7d31e..79b3f5b 100755 --- a/merge_upstream.sh +++ b/merge_upstream.sh @@ -52,6 +52,7 @@ popd > /dev/null # Refresh environment make clean make setup +forall_repos commit_if_dirty "Automatic setup commit" ./apply_patches.sh diff --git a/theme.sh b/theme.sh index ef664fd..8aee68d 100755 --- a/theme.sh +++ b/theme.sh @@ -172,10 +172,10 @@ for f in res/**/*.svg; do replace_colors "$f" done -popd > /dev/null +if [[ "$automatic_commit" == [Yy]* ]]; then + # see: https://devops.stackexchange.com/a/5443 + git add -A + git diff-index --quiet HEAD || git commit -m "Automatic theme update" +fi -#if [[ "$automatic_commit" == [Yy]* ]]; then -# # see: https://devops.stackexchange.com/a/5443 -# git add -A -# git diff-index --quiet HEAD || git commit -m "Automatic theme update" -#fi +popd > /dev/null