From fe8a5cff2386dbd5eea6d0156688a408e08db464 Mon Sep 17 00:00:00 2001 From: Daniel LaCosse <3759828+daniellacosse@users.noreply.github.com> Date: Tue, 6 Aug 2024 21:44:43 -0400 Subject: [PATCH 1/8] refactor(client): move client/go output into root --- client/electron/app_paths.ts | 2 +- client/go/Taskfile.yml | 6 +++--- .../apple/OutlineLib/OutlineLib.xcodeproj/project.pbxproj | 2 +- .../src/cordova/plugin/android/scripts/copy_third_party.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/electron/app_paths.ts b/client/electron/app_paths.ts index b4866ca0ed..93c4c18d0b 100644 --- a/client/electron/app_paths.ts +++ b/client/electron/app_paths.ts @@ -45,7 +45,7 @@ export function getAppPath() { export function pathToEmbeddedTun2socksBinary() { return path.join( - unpackedAppPath(), 'client', 'output', 'build', + unpackedAppPath(), 'output', 'build', 'client', (isWindows ? 'windows' : 'linux'), 'tun2socks' + (isWindows ? '.exe' : '')); } diff --git a/client/go/Taskfile.yml b/client/go/Taskfile.yml index 70619397ff..309819948e 100644 --- a/client/go/Taskfile.yml +++ b/client/go/Taskfile.yml @@ -17,9 +17,9 @@ version: '3' vars: # This needs to be updated if the file moves. REPO_ROOT: '{{joinPath .TASKFILE_DIR "../.."}}' - # TODO: Output to $REPO_ROOT/output/client/tun2socks instead. - OUT_DIR: '{{joinPath .REPO_ROOT "client/output/build"}}' - BIN_DIR: '{{joinPath .OUT_DIR "/bin"}}' + OUTPUT_DIR: '{{joinPath .REPO_ROOT "output"}}' + BIN_DIR: '{{joinPath .OUTPUT_DIR "/bin"}}' + OUT_DIR: '{{joinPath .OUTPUT_DIR "/build/client"}}' MOBILE_PKG: "{{.TASKFILE_DIR}}/outline/tun2socks" GOMOBILE_BIND_CMD: "env PATH=\"{{.BIN_DIR}}:${PATH}\" '{{.BIN_DIR}}/gomobile' bind -ldflags='-s -w'" diff --git a/client/src/cordova/apple/OutlineLib/OutlineLib.xcodeproj/project.pbxproj b/client/src/cordova/apple/OutlineLib/OutlineLib.xcodeproj/project.pbxproj index 3345a1c056..9921dc86e0 100644 --- a/client/src/cordova/apple/OutlineLib/OutlineLib.xcodeproj/project.pbxproj +++ b/client/src/cordova/apple/OutlineLib/OutlineLib.xcodeproj/project.pbxproj @@ -17,7 +17,7 @@ /* Begin PBXFileReference section */ 522987032C4F273E009EE577 /* PacketTunnelProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PacketTunnelProvider.h; sourceTree = ""; }; 522987042C4F273E009EE577 /* PacketTunnelProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PacketTunnelProvider.m; sourceTree = ""; }; - 5229870D2C4F2873009EE577 /* Tun2socks.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Tun2socks.xcframework; path = ../../../../output/build/apple/Tun2socks.xcframework; sourceTree = ""; }; + 5229870D2C4F2873009EE577 /* Tun2socks.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Tun2socks.xcframework; path = ../../../../../output/client/build/apple/Tun2socks.xcframework; sourceTree = ""; }; 52334EAC2B0D58AD00817E56 /* VpnExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = VpnExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 52334EAE2B0D58AD00817E56 /* NetworkExtension.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NetworkExtension.framework; path = System/Library/Frameworks/NetworkExtension.framework; sourceTree = SDKROOT; }; 52334EB32B0D58AD00817E56 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; diff --git a/client/src/cordova/plugin/android/scripts/copy_third_party.js b/client/src/cordova/plugin/android/scripts/copy_third_party.js index cbe6e8bc34..13539efc35 100644 --- a/client/src/cordova/plugin/android/scripts/copy_third_party.js +++ b/client/src/cordova/plugin/android/scripts/copy_third_party.js @@ -19,7 +19,7 @@ const fs = require('fs/promises'); const path = require('node:path'); const ANDROID_LIBS_FOLDER_PATH = path.join('plugins', 'cordova-plugin-outline', 'android', 'libs'); -const TUN2SOCKS_ANDROID_FOLDER_PATH = path.join('output', 'build', 'android'); +const TUN2SOCKS_ANDROID_FOLDER_PATH = path.join('output', 'build', 'client', 'android'); module.exports = async function () { console.log('Copying Android third party libraries...'); From 09023e22a7a19039b5357becac50b86b4e1e4d42 Mon Sep 17 00:00:00 2001 From: Daniel LaCosse <3759828+daniellacosse@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:34:52 -0400 Subject: [PATCH 2/8] fix lint --- client/electron/app_paths.ts | 18 ++++++++++++++---- .../plugin/android/scripts/copy_third_party.js | 16 ++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/client/electron/app_paths.ts b/client/electron/app_paths.ts index 93c4c18d0b..7b397d3c62 100644 --- a/client/electron/app_paths.ts +++ b/client/electron/app_paths.ts @@ -45,9 +45,13 @@ export function getAppPath() { export function pathToEmbeddedTun2socksBinary() { return path.join( - unpackedAppPath(), 'output', 'build', 'client', - (isWindows ? 'windows' : 'linux'), - 'tun2socks' + (isWindows ? '.exe' : '')); + unpackedAppPath(), + 'output', + 'build', + 'client', + isWindows ? 'windows' : 'linux', + 'tun2socks' + (isWindows ? '.exe' : '') + ); } /** @@ -60,5 +64,11 @@ export function pathToEmbeddedOutlineService() { if (isWindows) { return getAppPath(); } - return path.join(unpackedAppPath(), 'client', 'tools', 'outline_proxy_controller', 'dist'); + return path.join( + unpackedAppPath(), + 'client', + 'tools', + 'outline_proxy_controller', + 'dist' + ); } diff --git a/client/src/cordova/plugin/android/scripts/copy_third_party.js b/client/src/cordova/plugin/android/scripts/copy_third_party.js index 13539efc35..ef97d8ee06 100644 --- a/client/src/cordova/plugin/android/scripts/copy_third_party.js +++ b/client/src/cordova/plugin/android/scripts/copy_third_party.js @@ -1,5 +1,3 @@ -#!/usr/bin/env node - // Copyright 2018 The Outline Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,8 +16,18 @@ const fs = require('fs/promises'); // const child_process = require('child_process'); const path = require('node:path'); -const ANDROID_LIBS_FOLDER_PATH = path.join('plugins', 'cordova-plugin-outline', 'android', 'libs'); -const TUN2SOCKS_ANDROID_FOLDER_PATH = path.join('output', 'build', 'client', 'android'); +const ANDROID_LIBS_FOLDER_PATH = path.join( + 'plugins', + 'cordova-plugin-outline', + 'android', + 'libs' +); +const TUN2SOCKS_ANDROID_FOLDER_PATH = path.join( + 'output', + 'build', + 'client', + 'android' +); module.exports = async function () { console.log('Copying Android third party libraries...'); From bd46caf787fd46a07c8ee78e6634318361b1aab0 Mon Sep 17 00:00:00 2001 From: Daniel LaCosse <3759828+daniellacosse@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:36:47 -0400 Subject: [PATCH 3/8] fix apple path --- .../apple/OutlineLib/OutlineLib.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/cordova/apple/OutlineLib/OutlineLib.xcodeproj/project.pbxproj b/client/src/cordova/apple/OutlineLib/OutlineLib.xcodeproj/project.pbxproj index 9921dc86e0..46695ec763 100644 --- a/client/src/cordova/apple/OutlineLib/OutlineLib.xcodeproj/project.pbxproj +++ b/client/src/cordova/apple/OutlineLib/OutlineLib.xcodeproj/project.pbxproj @@ -17,7 +17,7 @@ /* Begin PBXFileReference section */ 522987032C4F273E009EE577 /* PacketTunnelProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PacketTunnelProvider.h; sourceTree = ""; }; 522987042C4F273E009EE577 /* PacketTunnelProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PacketTunnelProvider.m; sourceTree = ""; }; - 5229870D2C4F2873009EE577 /* Tun2socks.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Tun2socks.xcframework; path = ../../../../../output/client/build/apple/Tun2socks.xcframework; sourceTree = ""; }; + 5229870D2C4F2873009EE577 /* Tun2socks.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Tun2socks.xcframework; path = ../../../../../output/build/client/apple/Tun2socks.xcframework; sourceTree = ""; }; 52334EAC2B0D58AD00817E56 /* VpnExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = VpnExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 52334EAE2B0D58AD00817E56 /* NetworkExtension.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NetworkExtension.framework; path = System/Library/Frameworks/NetworkExtension.framework; sourceTree = SDKROOT; }; 52334EB32B0D58AD00817E56 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; From df9bdb3e41b14c0adaa29be4faa3993793e8ce24 Mon Sep 17 00:00:00 2001 From: Daniel LaCosse <3759828+daniellacosse@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:59:27 -0400 Subject: [PATCH 4/8] fix android path --- client/src/cordova/plugin/android/scripts/copy_third_party.js | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/cordova/plugin/android/scripts/copy_third_party.js b/client/src/cordova/plugin/android/scripts/copy_third_party.js index ef97d8ee06..7ec794205e 100644 --- a/client/src/cordova/plugin/android/scripts/copy_third_party.js +++ b/client/src/cordova/plugin/android/scripts/copy_third_party.js @@ -23,6 +23,7 @@ const ANDROID_LIBS_FOLDER_PATH = path.join( 'libs' ); const TUN2SOCKS_ANDROID_FOLDER_PATH = path.join( + '..', 'output', 'build', 'client', From 94024e8516740b9f99ea426a7c13b42a0dec9b6a Mon Sep 17 00:00:00 2001 From: Daniel LaCosse <3759828+daniellacosse@users.noreply.github.com> Date: Wed, 7 Aug 2024 12:02:00 -0400 Subject: [PATCH 5/8] maybe this will work? --- client/electron/app_paths.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/client/electron/app_paths.ts b/client/electron/app_paths.ts index 7b397d3c62..7e984bc710 100644 --- a/client/electron/app_paths.ts +++ b/client/electron/app_paths.ts @@ -46,6 +46,7 @@ export function getAppPath() { export function pathToEmbeddedTun2socksBinary() { return path.join( unpackedAppPath(), + '..', 'output', 'build', 'client', From deb73df173a894149a786bc87d08a1884a8e6907 Mon Sep 17 00:00:00 2001 From: Daniel LaCosse <3759828+daniellacosse@users.noreply.github.com> Date: Wed, 7 Aug 2024 12:02:32 -0400 Subject: [PATCH 6/8] revert that --- client/electron/app_paths.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/client/electron/app_paths.ts b/client/electron/app_paths.ts index 7e984bc710..7b397d3c62 100644 --- a/client/electron/app_paths.ts +++ b/client/electron/app_paths.ts @@ -46,7 +46,6 @@ export function getAppPath() { export function pathToEmbeddedTun2socksBinary() { return path.join( unpackedAppPath(), - '..', 'output', 'build', 'client', From 5d2583bc12364dc772bb06c894bc6b0bb0aaa1aa Mon Sep 17 00:00:00 2001 From: Daniel LaCosse <3759828+daniellacosse@users.noreply.github.com> Date: Thu, 8 Aug 2024 14:09:13 -0400 Subject: [PATCH 7/8] update gradle path --- .../cordova/android/OutlineAndroidLib/outline/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/cordova/android/OutlineAndroidLib/outline/build.gradle b/client/src/cordova/android/OutlineAndroidLib/outline/build.gradle index f08084e379..8d742aeaea 100644 --- a/client/src/cordova/android/OutlineAndroidLib/outline/build.gradle +++ b/client/src/cordova/android/OutlineAndroidLib/outline/build.gradle @@ -34,9 +34,9 @@ android { dependencies { // To make this project editable directly in the source tree, we need to load - // tun2socks.aar from its original path in the third_party directory. We do + // tun2socks.aar from its original path in the output directory. We do // this by relative path: - compileOnly fileTree(dir: '../../../../../output/build/android', + compileOnly fileTree(dir: '../../../../../../output/build/client/android', include: ['tun2socks.aar']) // Note: A flatDir repository might be preferable, but this is not compatible // with a composite build (https://github.com/gradle/gradle/issues/911). From 9dad77846fe085d8b932fceef85cd1e7a1fcd638 Mon Sep 17 00:00:00 2001 From: Daniel LaCosse <3759828+daniellacosse@users.noreply.github.com> Date: Fri, 9 Aug 2024 11:25:48 -0400 Subject: [PATCH 8/8] Update Taskfile.yml --- client/go/Taskfile.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/go/Taskfile.yml b/client/go/Taskfile.yml index 309819948e..1803d9963c 100644 --- a/client/go/Taskfile.yml +++ b/client/go/Taskfile.yml @@ -17,9 +17,9 @@ version: '3' vars: # This needs to be updated if the file moves. REPO_ROOT: '{{joinPath .TASKFILE_DIR "../.."}}' - OUTPUT_DIR: '{{joinPath .REPO_ROOT "output"}}' - BIN_DIR: '{{joinPath .OUTPUT_DIR "/bin"}}' - OUT_DIR: '{{joinPath .OUTPUT_DIR "/build/client"}}' + OUTPUT_ROOT: '{{joinPath .REPO_ROOT "output"}}' + BIN_DIR: '{{joinPath .OUTPUT_ROOT "/bin"}}' + OUT_DIR: '{{joinPath .OUTPUT_ROOT "/build/client"}}' MOBILE_PKG: "{{.TASKFILE_DIR}}/outline/tun2socks" GOMOBILE_BIND_CMD: "env PATH=\"{{.BIN_DIR}}:${PATH}\" '{{.BIN_DIR}}/gomobile' bind -ldflags='-s -w'"