diff --git a/Earthfile b/Earthfile index 4ad685407..6014f7483 100644 --- a/Earthfile +++ b/Earthfile @@ -320,7 +320,9 @@ rust-base: wget \ file \ 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 # 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/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: FROM +angular-base --configuration=production ARG target="x86_64-pc-windows-msvc" diff --git a/cmds/portmaster-start/run.go b/cmds/portmaster-start/run.go index 5b4e04fd3..42c2b532b 100644 --- a/cmds/portmaster-start/run.go +++ b/cmds/portmaster-start/run.go @@ -64,7 +64,7 @@ type Options struct { // This is a temp value that will be used to test the new UI in beta. var app2Options = Options{ Name: "Portmaster App2", - Identifier: "app2/portmaster", + Identifier: "app2/portmaster-app", AllowDownload: false, AllowHidingWindow: false, RestartOnFail: true, @@ -73,7 +73,7 @@ var app2Options = Options{ func init() { // Make sure the new UI has a proper extension. if onWindows { - app2Options.Identifier += ".exe" + app2Options.Identifier += ".zip" } registerComponent([]Options{ @@ -92,12 +92,6 @@ func init() { AllowHidingWindow: false, RestartOnFail: true, }, - { - Name: "Portmaster App2", - Identifier: "app2/portmaster", - AllowDownload: false, - AllowHidingWindow: false, - }, { Name: "Portmaster Notifier", Identifier: "notifier/portmaster-notifier", @@ -116,6 +110,26 @@ func init() { 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) { diff --git a/service/updates/helper/updates.go b/service/updates/helper/updates.go index b1b9a0fdf..efae917d0 100644 --- a/service/updates/helper/updates.go +++ b/service/updates/helper/updates.go @@ -57,7 +57,7 @@ func MandatoryUpdates() (identifiers []string) { PlatformIdentifier("start/portmaster-start.exe"), PlatformIdentifier("notifier/portmaster-notifier.exe"), PlatformIdentifier("notifier/portmaster-wintoast.dll"), - PlatformIdentifier("app2/portmaster.exe"), + PlatformIdentifier("app2/portmaster-app.zip"), ) } else { identifiers = append( @@ -65,7 +65,7 @@ func MandatoryUpdates() (identifiers []string) { PlatformIdentifier("core/portmaster-core"), PlatformIdentifier("start/portmaster-start"), PlatformIdentifier("notifier/portmaster-notifier"), - PlatformIdentifier("app2/portmaster"), + PlatformIdentifier("app2/portmaster-app"), ) } @@ -90,5 +90,6 @@ func AutoUnpackUpdates() []string { return []string{ PlatformIdentifier("app/portmaster-app.zip"), + PlatformIdentifier("app2/portmaster-app.zip"), } }