[cmds] Move new UI to a zip for windows

This commit is contained in:
Vladimir Stoilov
2024-07-16 11:26:20 +03:00
parent 090a5e6508
commit c868598deb
3 changed files with 77 additions and 11 deletions

View File

@@ -320,7 +320,9 @@ rust-base:
wget \ wget \
file \ file \
libsoup-3.0-dev \ libsoup-3.0-dev \
libwebkit2gtk-4.1-dev libwebkit2gtk-4.1-dev \
gcc-mingw-w64-x86-64 \
zip
# Install library dependencies for all supported architectures # Install library dependencies for all supported architectures
# required for succesfully linking. # required for succesfully linking.
@@ -451,6 +453,55 @@ tauri-build:
SAVE ARTIFACT --if-exists "target/${target}/release/bundle/deb/*.deb" AS LOCAL "${outputDir}/${GO_ARCH_STRING}/" SAVE ARTIFACT --if-exists "target/${target}/release/bundle/deb/*.deb" AS LOCAL "${outputDir}/${GO_ARCH_STRING}/"
SAVE ARTIFACT --if-exists "target/${target}/release/bundle/rpm/*.rpm" AS LOCAL "${outputDir}/${GO_ARCH_STRING}/" SAVE ARTIFACT --if-exists "target/${target}/release/bundle/rpm/*.rpm" AS LOCAL "${outputDir}/${GO_ARCH_STRING}/"
tauri-build-windows-binary:
FROM +tauri-src
ARG target="x86_64-pc-windows-gnu"
ARG output=".*/release/(([^\./]+|([^\./]+\.(dll|exe))))"
ARG bundle="none"
ARG --required version_suffix
ARG GOOS=windows
ARG GOARCH=amd64
ARG GOARM
# The binaries will not be used but we still need to create them. Tauri will check for them.
RUN mkdir /tmp/gobuild
RUN mkdir ./binaries
DO +RUST_TO_GO_ARCH_STRING --rustTarget="${target}"
RUN echo "GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} GO_ARCH_STRING=${GO_ARCH_STRING}"
# Our tauri app has externalBins configured so tauri will look for them when it finished compiling
# the app. Make sure we copy portmaster-start and portmaster-core in all architectures supported.
# See documentation for externalBins for more information on how tauri searches for the binaries.
COPY (+go-build/output --GOOS="${GOOS}" --CMDS="portmaster-start portmaster-core" --GOARCH="${GOARCH}" --GOARM="${GOARM}") /tmp/gobuild
# Place them in the correct folder with the rust target tripple attached.
FOR bin IN $(ls /tmp/gobuild)
# ${bin$.*} does not work in SET commands unfortunately so we use a shell
# snippet here:
RUN set -e ; \
dest="./binaries/${bin}-${target}" ; \
if [ -z "${bin##*.exe}" ]; then \
dest="./binaries/${bin%.*}-${target}.exe" ; \
fi ; \
cp "/tmp/gobuild/${bin}" "${dest}" ;
END
# Just for debugging ...
# RUN ls -R ./binaries
DO rust+SET_CACHE_MOUNTS_ENV
RUN --mount=$EARTHLY_RUST_TARGET_CACHE cargo tauri build --no-bundle --ci --target="${target}"
DO rust+COPY_OUTPUT --output="${output}"
RUN echo output: $(ls -R "target/${target}/release")
RUN mv "target/${target}/release/app.exe" "target/${target}/release/portmaster-app_${version_suffix}.exe"
RUN zip "target/${target}/release/portmaster-app_${version_suffix}.zip" "target/${target}/release/portmaster-app_${version_suffix}.exe" -j portmaster-app${version_suffix}.exe "target/${target}/release/WebView2Loader.dll" -j WebView2Loader.dll
SAVE ARTIFACT --if-exists "target/${target}/release/portmaster-app_${version_suffix}.zip" AS LOCAL "${outputDir}/${GO_ARCH_STRING}/"
tauri-prep-windows: tauri-prep-windows:
FROM +angular-base --configuration=production FROM +angular-base --configuration=production
ARG target="x86_64-pc-windows-msvc" ARG target="x86_64-pc-windows-msvc"

View File

@@ -64,7 +64,7 @@ type Options struct {
// This is a temp value that will be used to test the new UI in beta. // This is a temp value that will be used to test the new UI in beta.
var app2Options = Options{ var app2Options = Options{
Name: "Portmaster App2", Name: "Portmaster App2",
Identifier: "app2/portmaster", Identifier: "app2/portmaster-app",
AllowDownload: false, AllowDownload: false,
AllowHidingWindow: false, AllowHidingWindow: false,
RestartOnFail: true, RestartOnFail: true,
@@ -73,7 +73,7 @@ var app2Options = Options{
func init() { func init() {
// Make sure the new UI has a proper extension. // Make sure the new UI has a proper extension.
if onWindows { if onWindows {
app2Options.Identifier += ".exe" app2Options.Identifier += ".zip"
} }
registerComponent([]Options{ registerComponent([]Options{
@@ -92,12 +92,6 @@ func init() {
AllowHidingWindow: false, AllowHidingWindow: false,
RestartOnFail: true, RestartOnFail: true,
}, },
{
Name: "Portmaster App2",
Identifier: "app2/portmaster",
AllowDownload: false,
AllowHidingWindow: false,
},
{ {
Name: "Portmaster Notifier", Name: "Portmaster Notifier",
Identifier: "notifier/portmaster-notifier", Identifier: "notifier/portmaster-notifier",
@@ -116,6 +110,26 @@ func init() {
RestartOnFail: true, RestartOnFail: true,
}, },
}) })
if onWindows {
registerComponent([]Options{
{
Name: "Portmaster App2",
Identifier: "app2/portmaster-app.zip",
AllowDownload: false,
AllowHidingWindow: false,
},
})
} else {
registerComponent([]Options{
{
Name: "Portmaster App2",
Identifier: "app2/portmaster-app",
AllowDownload: false,
AllowHidingWindow: false,
},
})
}
} }
func registerComponent(opts []Options) { func registerComponent(opts []Options) {

View File

@@ -57,7 +57,7 @@ func MandatoryUpdates() (identifiers []string) {
PlatformIdentifier("start/portmaster-start.exe"), PlatformIdentifier("start/portmaster-start.exe"),
PlatformIdentifier("notifier/portmaster-notifier.exe"), PlatformIdentifier("notifier/portmaster-notifier.exe"),
PlatformIdentifier("notifier/portmaster-wintoast.dll"), PlatformIdentifier("notifier/portmaster-wintoast.dll"),
PlatformIdentifier("app2/portmaster.exe"), PlatformIdentifier("app2/portmaster-app.zip"),
) )
} else { } else {
identifiers = append( identifiers = append(
@@ -65,7 +65,7 @@ func MandatoryUpdates() (identifiers []string) {
PlatformIdentifier("core/portmaster-core"), PlatformIdentifier("core/portmaster-core"),
PlatformIdentifier("start/portmaster-start"), PlatformIdentifier("start/portmaster-start"),
PlatformIdentifier("notifier/portmaster-notifier"), PlatformIdentifier("notifier/portmaster-notifier"),
PlatformIdentifier("app2/portmaster"), PlatformIdentifier("app2/portmaster-app"),
) )
} }
@@ -90,5 +90,6 @@ func AutoUnpackUpdates() []string {
return []string{ return []string{
PlatformIdentifier("app/portmaster-app.zip"), PlatformIdentifier("app/portmaster-app.zip"),
PlatformIdentifier("app2/portmaster-app.zip"),
} }
} }