Skip to content

Commit

Permalink
fix(electron/windows): build windows on linux (#1818)
Browse files Browse the repository at this point in the history
* fix(electron/windows): build windows on linux

* use go build when the target and host platforms match [WIP]

* oops

* scope to electron

* revert windows job changes

* lol ai

* fix path

* resolve current platform
  • Loading branch information
daniellacosse authored Jan 19, 2024
1 parent e8dcd79 commit 973aa55
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/tun2socks/build.action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

import url from 'url';
import os from 'os';
import {spawnStream} from '../build/spawn_stream.mjs';
import {getBuildParameters} from '../build/get_build_parameters.mjs';

Expand All @@ -22,9 +23,15 @@ import {getBuildParameters} from '../build/get_build_parameters.mjs';
* @param {string[]} parameters
*/
export async function main(...parameters) {
const {platform} = getBuildParameters(parameters);
const {platform: targetPlatform} = getBuildParameters(parameters);

await spawnStream('make', ['ios', 'macos', 'maccatalyst'].includes(platform) ? 'apple' : platform);
const currentPlatform = os.platform() === 'win32' ? 'windows' : os.platform();

if (targetPlatform === currentPlatform && ['linux', 'windows'].includes(targetPlatform)) {
return spawnStream('go', 'build', '-o', `output/build/${targetPlatform}/tun2socks`, 'github.com/Jigsaw-Code/outline-client/src/tun2socks/outline/electron');
}

await spawnStream('make', ['ios', 'macos', 'maccatalyst'].includes(targetPlatform) ? 'apple' : targetPlatform);
}

if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
Expand Down

0 comments on commit 973aa55

Please sign in to comment.