Skip to content

Commit a5c7a3c

Browse files
Soner YukselGinder-Singh
Soner Yuksel
authored andcommitted
Issue #669: Wireguard Go Bridge script issues
1 parent 6c56e8f commit a5c7a3c

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

Windscribe.xcodeproj/project.pbxproj

-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@
3939
1E006BBB2C6AA91500EE6389 /* BasePopUpViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1E006BBA2C6AA91500EE6389 /* BasePopUpViewController.xib */; };
4040
1E006BBF2C6B739B00EE6389 /* BasePopupViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E006BBE2C6B739B00EE6389 /* BasePopupViewModel.swift */; };
4141
1E006BC12C6B7AC300EE6389 /* PopupTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E006BC02C6B7AC300EE6389 /* PopupTypes.swift */; };
42-
1E01D8FF2C5164EA00B679E9 /* (null) in Sources */ = {isa = PBXBuildFile; };
43-
1E01D9002C5164EA00B679E9 /* (null) in Sources */ = {isa = PBXBuildFile; };
4442
1E09747D2D7F33FE003F7AA7 /* RxRealm+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E09747C2D7F33F1003F7AA7 /* RxRealm+Extension.swift */; };
4543
1E09747E2D7F33FE003F7AA7 /* RxRealm+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E09747C2D7F33F1003F7AA7 /* RxRealm+Extension.swift */; };
4644
1E0974812D7F34E2003F7AA7 /* CocoaLumberjack in Frameworks */ = {isa = PBXBuildFile; productRef = 1E0974802D7F34E2003F7AA7 /* CocoaLumberjack */; };
@@ -5629,7 +5627,6 @@
56295627
E97ABD5728E5F95E00B38587 /* ProtocolSetPreferredViewController.swift in Sources */,
56305628
AF018E0D21B1921600B225FF /* Session.swift in Sources */,
56315629
AF04983021FA43690046D33B /* Section.swift in Sources */,
5632-
1E01D8FF2C5164EA00B679E9 /* (null) in Sources */,
56335630
C57BDE4229B93FBB00337E63 /* LinkProvider.swift in Sources */,
56345631
AF4E91D521ED277A00A3F584 /* MobilePlan.swift in Sources */,
56355632
AF8DA7AB2204B50200885BD8 /* PreferencesViewController+UI.swift in Sources */,
@@ -5886,7 +5883,6 @@
58865883
C59FF1A02CB998610072EF70 /* IntentCommon.swift in Sources */,
58875884
C561237D2C5F25790090EB5A /* Resolver.swift in Sources */,
58885885
1E60E01B2CAD666400623CD5 /* ContainerResolvertype.swift in Sources */,
5889-
1E01D9002C5164EA00B679E9 /* (null) in Sources */,
58905886
1E7A19582C34237E00851AE2 /* DNSValue.swift in Sources */,
58915887
C585F3E52C8E79A400A70524 /* Preferences+Favourites.swift in Sources */,
58925888
C52DA5132B63821300E5C571 /* RepositoryErrors.swift in Sources */,

build_wireguard_go_bridge.sh

+29-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/sh
22

3+
# Skip this script when running SwiftUI previews
4+
if [ "$XCODE_RUNNING_FOR_PREVIEWS" == "1" ]; then
5+
echo "Skipping WireGuardTunnel for SwiftUI Previews"
6+
exit 0
7+
fi
8+
39
# build_wireguard_go_bridge.sh - Builds WireGuardKitGo
410
#
511
# Figures out the directory where the wireguard-apple SPM package
@@ -35,21 +41,31 @@ install_go() {
3541
export PATH="${TEMP_DIR}/go/bin:$PATH"
3642

3743
# Verify the Go installation
38-
go version
44+
go version || {
45+
echo "Error: Failed to install Go."
46+
exit 1
47+
}
3948

4049
# Clean up by removing the downloaded tarball
4150
rm -rf "${TEMP_DIR}/go.tar.gz"
4251
}
4352

44-
# Check if Go is installed
45-
goPath=$(which go)
53+
# Check if Go is installed and has the correct version
54+
current_go_version=$(go version 2>/dev/null | awk '{print $3}' | sed 's/go//')
4655

47-
# If Go is not installed, install it
48-
if [ -z "$goPath" ]; then
49-
echo "Go is not installed. Installing version ${GO_VERSION}..."
50-
install_go
56+
if [ "$current_go_version" == "$GO_VERSION" ]; then
57+
echo "Correct Go version (${GO_VERSION}) is already installed. Skipping installation."
5158
else
52-
echo "Go is already installed at ${goPath}."
59+
echo "Go version mismatch (found: $current_go_version, expected: $GO_VERSION). Installing correct version..."
60+
install_go
61+
fi
62+
63+
# Prevent redundant builds by adding a caching marker
64+
BUILD_ARTIFACT="$BUILD_DIR/WireGuardGoBridge.artifact"
65+
66+
if [ -f "$BUILD_ARTIFACT" ]; then
67+
echo "WireGuardGoBridge already built. Skipping build step..."
68+
exit 0
5369
fi
5470

5571
# Proceed with the WireGuard build process
@@ -87,3 +103,8 @@ cd "$wireguard_go_dir" && /usr/bin/make || {
87103
echo "Error: Make failed in $wireguard_go_dir"
88104
exit 1
89105
}
106+
107+
# Create marker file to prevent redundant builds
108+
touch "$BUILD_ARTIFACT"
109+
110+
echo "WireGuardGoBridge successfully built."

0 commit comments

Comments
 (0)