|
| 1 | +# Load from the env file |
| 2 | +env_files = [{ path = ".env" }] |
| 3 | + |
| 4 | +# Build Windows and Linux in parallel (Cross compiling with cargo cross) |
| 5 | +[tasks.build-all] |
| 6 | +run_task = { name = ["build-windows", "build-linux"], parallel = true } |
| 7 | + |
| 8 | +# Build a Linux build |
| 9 | +[tasks.build-linux] |
| 10 | +run_task = [ |
| 11 | + # Windows host taks |
| 12 | + { name = [ |
| 13 | + "build-linux-windows", |
| 14 | + "copy-build-linux-windows", |
| 15 | + ], condition = { platforms = [ |
| 16 | + "windows", |
| 17 | + ] } }, |
| 18 | + |
| 19 | + # Linux host tasks |
| 20 | + { name = [ |
| 21 | + "build-linux-linux", |
| 22 | + "copy-build-linux-linux", |
| 23 | + ], condition = { platforms = [ |
| 24 | + "linux", |
| 25 | + ] } }, |
| 26 | +] |
| 27 | + |
| 28 | +# Build a Windows Build |
| 29 | +[tasks.build-windows] |
| 30 | +run_task = [ |
| 31 | + # Windows host tasks (Both UI builds must run sequentual as they use the same output path) |
| 32 | + { name = [ |
| 33 | + "build-windows-windows", |
| 34 | + "copy-build-windows-windows", |
| 35 | + "sign-windows", |
| 36 | + |
| 37 | + "build-windows-native-windows", |
| 38 | + "copy-build-windows-native-windows", |
| 39 | + "sign-windows-native", |
| 40 | + ], condition = { platforms = [ |
| 41 | + "windows", |
| 42 | + ] } }, |
| 43 | + |
| 44 | + # Linux host tasks |
| 45 | + { name = [ |
| 46 | + "build-windows-linux", |
| 47 | + "copy-build-windows-linux", |
| 48 | + |
| 49 | + "build-windows-native-linux", |
| 50 | + "copy-build-windows-native-linux", |
| 51 | + ], condition = { platforms = [ |
| 52 | + "linux", |
| 53 | + ] } }, |
| 54 | +] |
| 55 | + |
| 56 | +# Signs the windows executable |
| 57 | +[tasks.sign-windows] |
| 58 | +command = "${SIGNTOOL_PATH}" |
| 59 | +args = [ |
| 60 | + "sign", |
| 61 | + "/fd", |
| 62 | + "SHA256", |
| 63 | + "/f", |
| 64 | + "${SIGN_FILE}", |
| 65 | + "/p", |
| 66 | + "${SIGN_PASSWORD}", |
| 67 | + ".release/binaries/pocket-relay-client.exe", |
| 68 | +] |
| 69 | + |
| 70 | +[tasks.sign-windows.condition] |
| 71 | +env_set = ["SIGN_FILE", "SIGN_PASSWORD", "SIGNTOOL_PATH"] |
| 72 | +platforms = ["windows"] |
| 73 | +files_exist = ["${SIGNTOOL_PATH}"] |
| 74 | + |
| 75 | +# Signs the windows executable (Native UI) |
| 76 | +[tasks.sign-windows-native] |
| 77 | +command = "${SIGNTOOL_PATH}" |
| 78 | +args = [ |
| 79 | + "sign", |
| 80 | + "/fd", |
| 81 | + "SHA256", |
| 82 | + "/f", |
| 83 | + "${SIGN_FILE}", |
| 84 | + "/p", |
| 85 | + "${SIGN_PASSWORD}", |
| 86 | + ".release/binaries/pocket-relay-client-native.exe", |
| 87 | +] |
| 88 | + |
| 89 | + |
| 90 | +[tasks.sign-windows-native.condition] |
| 91 | +env_set = ["SIGN_FILE", "SIGN_PASSWORD", "SIGNTOOL_PATH"] |
| 92 | +platforms = ["windows"] |
| 93 | +files_exist = ["${SIGNTOOL_PATH}"] |
| 94 | + |
| 95 | +# ---- Building from a windows host ---- |
| 96 | + |
| 97 | +# Build a Windows binary from a Windows host |
| 98 | +[tasks.build-windows-windows] |
| 99 | +command = "cargo" |
| 100 | +args = ["build", "--release"] |
| 101 | + |
| 102 | +# Build a Windows binary (Native UI) from a Windows host |
| 103 | +[tasks.build-windows-native-windows] |
| 104 | +command = "cargo" |
| 105 | +args = ["build", "--release", "--no-default-features", "--features", "native"] |
| 106 | + |
| 107 | +# Build the linux version (Requires cross be installed) |
| 108 | +[tasks.build-linux-windows] |
| 109 | +command = "cross" |
| 110 | +args = ["build", "--target", "x86_64-unknown-linux-gnu", "--release"] |
| 111 | + |
| 112 | +# Copy the linux build to the releases folder |
| 113 | +[tasks.copy-build-linux-windows] |
| 114 | +script_runner = "@shell" |
| 115 | +script = "cp target/x86_64-unknown-linux-gnu/release/pocket-relay-client .release/binaries/pocket-relay-client" |
| 116 | +dependencies = ["create-release-dir"] |
| 117 | + |
| 118 | +# Copy the Windows build to the releases folder |
| 119 | +[tasks.copy-build-windows-windows] |
| 120 | +script_runner = "@shell" |
| 121 | +script = "cp target/release/pocket-relay-client.exe .release/binaries/pocket-relay-client.exe" |
| 122 | +dependencies = ["create-release-dir"] |
| 123 | + |
| 124 | +# Copy the Windows build to the releases folder |
| 125 | +[tasks.copy-build-windows-native-windows] |
| 126 | +script_runner = "@shell" |
| 127 | +script = "cp target/release/pocket-relay-client.exe .release/binaries/pocket-relay-client-native.exe" |
| 128 | +dependencies = ["create-release-dir"] |
| 129 | + |
| 130 | + |
| 131 | +# ---- Building from a linux host ---- |
| 132 | + |
| 133 | +# Build a Windows binary from a linux host |
| 134 | +[tasks.build-windows-linux] |
| 135 | +command = "cargo" |
| 136 | +args = ["build", "--target", "x86_64-pc-windows-gnu", "--release"] |
| 137 | + |
| 138 | + |
| 139 | +# Build a Windows binary (Native UI) from a linux host |
| 140 | +[tasks.build-windows-native-linux] |
| 141 | +command = "cargo" |
| 142 | +args = [ |
| 143 | + "build", |
| 144 | + "--target", |
| 145 | + "x86_64-pc-windows-gnu", |
| 146 | + "--release", |
| 147 | + "--no-default-features", |
| 148 | + "--features", |
| 149 | + "native", |
| 150 | +] |
| 151 | + |
| 152 | + |
| 153 | +# Build the linux version (Requires cross be installed) |
| 154 | +[tasks.build-linux-linux] |
| 155 | +command = "cross" |
| 156 | +args = ["build", "--release"] |
| 157 | + |
| 158 | +# Copy the linux build to the releases folder |
| 159 | +[tasks.copy-build-linux-linux] |
| 160 | +script_runner = "@shell" |
| 161 | +script = "cp target/release/pocket-relay-client .release/binaries/pocket-relay-client-linux" |
| 162 | +dependencies = ["create-release-dir"] |
| 163 | + |
| 164 | +# Copy the Windows build to the releases folder |
| 165 | +[tasks.copy-build-windows-linux] |
| 166 | +script_runner = "@shell" |
| 167 | +script = "cp target/x86_64-pc-windows-gnu/release/pocket-relay-client.exe .release/binaries/pocket-relay-client.exe" |
| 168 | +dependencies = ["create-release-dir"] |
| 169 | + |
| 170 | +# Copy the Windows build to the releases folder |
| 171 | +[tasks.copy-build-windows-native-linux] |
| 172 | +script_runner = "@shell" |
| 173 | +script = "cp target/x86_64-pc-windows-gnu/release/pocket-relay-client.exe .release/binaries/pocket-relay-client-native.exe" |
| 174 | +dependencies = ["create-release-dir"] |
| 175 | + |
| 176 | + |
| 177 | +# Create releases directory |
| 178 | +[tasks.create-release-dir] |
| 179 | +condition = { files_not_exist = [".release/binaries"] } |
| 180 | +script_runner = "@shell" |
| 181 | +script = "mkdir -p .release/binaries" |
0 commit comments