Skip to content

Commit 397d238

Browse files
shmuelieCopilot
andcommitted
msix: add release script to build MSIX packages
Add msix/release.sh to build MSIX packages for Git for Windows. The script reuses the shared helpers from release-common.sh for argument parsing, root directory setup, file list generation, and gitconfig configuration. MSIX-specific logic includes: - Converting Git for Windows version strings to the X.X.X.X format required by MSIX (e.g. 2.47.1.windows.1 becomes 2.47.1.1) - Generating asset images at build time from git-for-windows.svg using rsvg-convert, avoiding committed binary artifacts - Locating makeappx.exe from the Windows SDK to produce the final .msix package Signed-off-by: Shmueli Englard <shmueli.yosef@englard.net> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8981073 commit 397d238

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed

msix/release.sh

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#!/bin/sh
2+
3+
# Build the MSIX package for Git for Windows.
4+
5+
. "$(dirname "$0")/../release-common.sh"
6+
7+
case "$MSYSTEM" in
8+
MINGW32) ARTIFACT_SUFFIX="x86";;
9+
MINGW64) ARTIFACT_SUFFIX="x64";;
10+
CLANGARM64) ARTIFACT_SUFFIX=arm64;;
11+
esac
12+
13+
# MSIX requires version in X.X.X.X format (numeric only)
14+
# Convert Git for Windows versions like "2.47.1.windows.1" to "2.47.1.1"
15+
# and test versions like "0-test" to "0.0.0.0"
16+
MSIX_VERSION="$(echo "$VERSION" | sed -e 's/\.windows\./\./' -e 's/[^0-9.]//g')"
17+
# Ensure we have exactly 4 numeric segments
18+
while test "$(echo "$MSIX_VERSION" | tr -cd '.' | wc -c)" -lt 3
19+
do
20+
MSIX_VERSION="$MSIX_VERSION.0"
21+
done
22+
23+
TARGET="$output_directory"/Git.GitforWindows_"$VERSION"_"$ARTIFACT_SUFFIX".msix
24+
25+
# Generate MSIX asset images from SVG
26+
ASSETS_DIR="$SCRIPT_PATH/Assets"
27+
mkdir -p "$ASSETS_DIR" ||
28+
die "Could not create Assets directory"
29+
30+
SVG_SOURCE="$SCRIPT_PATH/../git-for-windows.svg"
31+
for spec in \
32+
LockScreenLogo.png:24 \
33+
LockScreenLogo.scale-200.png:48 \
34+
Square150x150Logo.png:150 \
35+
Square150x150Logo.scale-200.png:300 \
36+
Square44x44Logo.png:44 \
37+
Square44x44Logo.scale-200.png:88 \
38+
Square44x44Logo.targetsize-24_altform-unplated.png:24 \
39+
StoreLogo.png:50
40+
do
41+
name="${spec%%:*}"
42+
size="${spec##*:}"
43+
rsvg-convert -w "$size" -h "$size" "$SVG_SOURCE" \
44+
-o "$ASSETS_DIR/$name" ||
45+
die "Could not generate $name"
46+
done
47+
48+
prepare_root
49+
50+
init_etc_gitconfig
51+
generate_file_list "$@"
52+
copy_dlls_to_libexec
53+
unpack_pdbs
54+
55+
# Find makeappx.exe from the Windows SDK
56+
MAKEAPPX=
57+
for sdk_dir in "/c/Program Files (x86)/Windows Kits/10/bin"/*/
58+
do
59+
case "$ARCH" in
60+
x86_64) sdk_arch=x64;;
61+
i686) sdk_arch=x86;;
62+
aarch64) sdk_arch=arm64;;
63+
esac
64+
if test -f "$sdk_dir$sdk_arch/makeappx.exe"
65+
then
66+
MAKEAPPX="$sdk_dir$sdk_arch/makeappx.exe"
67+
fi
68+
done
69+
test -n "$MAKEAPPX" ||
70+
die "Could not find makeappx.exe in the Windows SDK"
71+
72+
# Create MSIX
73+
74+
MAPFILE=$SCRIPT_PATH/root/files.map
75+
MANIFESTIN=$SCRIPT_PATH/appxmanifest.xml.in
76+
MANIFESTOUT=$SCRIPT_PATH/root/appxmanifest.xml
77+
78+
echo "Create MSIX"
79+
80+
sed -e "s/@@VERSION@@/$MSIX_VERSION/g" <"$MANIFESTIN" >"$MANIFESTOUT"
81+
82+
echo "[Files]" >"$MAPFILE" &&
83+
echo "\"$(cygpath -aw "$SCRIPT_PATH")/root/appxmanifest.xml\" \"AppxManifest.xml\"" >>"$MAPFILE" &&
84+
echo "\"$(cygpath -aw "$SCRIPT_PATH")/root/bin/git.exe\" \"bin/git.exe\"" >>"$MAPFILE" &&
85+
echo "\"$(cygpath -aw "$SCRIPT_PATH")/root/bin/sh.exe\" \"bin/sh.exe\"" >>"$MAPFILE" &&
86+
echo "\"$(cygpath -aw "$SCRIPT_PATH")/root/bin/bash.exe\" \"bin/bash.exe\"" >>"$MAPFILE" &&
87+
echo "\"$(cygpath -aw "$SCRIPT_PATH")/Assets/LockScreenLogo.png\" \"Assets/LockScreenLogo.png\"" >>"$MAPFILE" &&
88+
echo "\"$(cygpath -aw "$SCRIPT_PATH")/Assets/LockScreenLogo.scale-200.png\" \"Assets/LockScreenLogo.scale-200.png\"" >>"$MAPFILE" &&
89+
echo "\"$(cygpath -aw "$SCRIPT_PATH")/Assets/Square150x150Logo.png\" \"Assets/Square150x150Logo.png\"" >>"$MAPFILE" &&
90+
echo "\"$(cygpath -aw "$SCRIPT_PATH")/Assets/Square150x150Logo.scale-200.png\" \"Assets/Square150x150Logo.scale-200.png\"" >>"$MAPFILE" &&
91+
echo "\"$(cygpath -aw "$SCRIPT_PATH")/Assets/Square44x44Logo.png\" \"Assets/Square44x44Logo.png\"" >>"$MAPFILE" &&
92+
echo "\"$(cygpath -aw "$SCRIPT_PATH")/Assets/Square44x44Logo.scale-200.png\" \"Assets/Square44x44Logo.scale-200.png\"" >>"$MAPFILE" &&
93+
echo "\"$(cygpath -aw "$SCRIPT_PATH")/Assets/Square44x44Logo.targetsize-24_altform-unplated.png\" \"Assets/Square44x44Logo.targetsize-24_altform-unplated.png\"" >>"$MAPFILE" &&
94+
echo "\"$(cygpath -aw "$SCRIPT_PATH")/Assets/StoreLogo.png\" \"Assets/StoreLogo.png\"" >>"$MAPFILE" &&
95+
MSYS_ROOT="$(cygpath -aw /)" &&
96+
echo "$LIST" | while IFS= read -r entry; do
97+
winpath="${entry//\//\\}"
98+
echo "\"$MSYS_ROOT\\$winpath\" \"$winpath\""
99+
done >>"$MAPFILE"
100+
101+
MSYS_NO_PATHCONV=1 "$MAKEAPPX" pack /v /o /f "$(cygpath -aw "$MAPFILE")" /p "$(cygpath -aw "$TARGET")" &&
102+
echo "Package created at $TARGET"

0 commit comments

Comments
 (0)