Skip to content

Commit

Permalink
chore(client/electron): move src/electron into client/electron (#1958)
Browse files Browse the repository at this point in the history
* chore(client/electron): move src/electron into client/src/electron

* that fuggin worked holy shoot

* remove environment.json

* Update client/src/electron/electron-builder.json

Co-authored-by: J. Yi <[email protected]>

* wuzziz

* move electron to client root

* force electron resolution

* helpful comment

* ah, it needs to be in both lol

* hell yeah!

* some nudges

* don't need to clean build anymore

* restore ci setup script

* huh, mismatch between vscode and the cli

* put back lookupIP

* correct run action import

* oops lol

* i think the asar unpack was causing the problem

* update windows path

* fix asar unpacked

* fix in progress

* update readme link

* update readme paths

---------

Co-authored-by: J. Yi <[email protected]>
  • Loading branch information
daniellacosse and jyyi1 authored May 8, 2024
1 parent 4f94fa1 commit 2f174c1
Show file tree
Hide file tree
Showing 90 changed files with 319 additions and 532 deletions.
2 changes: 1 addition & 1 deletion client/tools/build/setup_linux_android.sh → .github/scripts/android_setup_ci.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ rm android-commandline-tools.zip

PATH="${PATH}:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/cmdline-tools/tools/bin"

yes | sdkmanager "build-tools;${OUTLINE_ANDROID_BUILD_TOOLS_VERSION}" "ndk;${OUTLINE_ANDROID_NDK_VERSION}"
yes | sdkmanager "build-tools;${OUTLINE_ANDROID_BUILD_TOOLS_VERSION}" "ndk;${OUTLINE_ANDROID_NDK_VERSION}"
File renamed without changes.
6 changes: 3 additions & 3 deletions .github/workflows/build_and_test_debug_client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
go-version-file: '${{ github.workspace }}/go.mod'

- name: Build Linux Client
run: npm run action src/electron/build linux
run: npm run action client/electron/build linux

windows_debug_build:
name: Windows Debug Build
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
go-version-file: '${{ github.workspace }}/go.mod'

- name: Build Windows Client
run: npm run action src/electron/build windows
run: npm run action client/electron/build windows

macos_debug_build:
name: MacOS Debug Build
Expand Down Expand Up @@ -257,7 +257,7 @@ jobs:
java-version: 11

- name: Setup Android
run: bash ./client/tools/build/setup_linux_android.sh
run: bash ./.github/scripts/android_setup_ci.sh

- name: Build Android Client
run: npm run action client/src/cordova/build android -- --verbose
2 changes: 1 addition & 1 deletion client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Each platform is handled differently:
1. [Developing for Apple **(MacOS and iOS)**](src/cordova/apple)
2. [Developing for **Android**](src/cordova/android)
3. [Developing for Electron **(Windows and Linux)**](src/electron)
3. [Developing for Electron **(Windows and Linux)**](electron)
## Error reporting
Expand Down
2 changes: 1 addition & 1 deletion src/electron/README.md → client/electron/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Unlike the Android and Apple clients, the Windows and Linux clients use the Electron framework, rather than Cordova.

To build the Electron clients, run (it will also package an installer executable into `build/dist`):
To build the Electron clients, run (it will also package an installer executable into `output/client/electron/build`):

```sh
npm run action client/electron/build [windows|linux]
Expand Down
File renamed without changes.
21 changes: 7 additions & 14 deletions src/electron/build.action.mjs → client/electron/build.action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,14 @@ import fs from 'fs/promises';
import path from 'path';
import url from 'url';

import copydir from 'copy-dir';
import electron, {Platform} from 'electron-builder';
import minimist from 'minimist';

import {getBuildParameters} from '../../client/src/build/get_build_parameters.mjs';
import {getRootDir} from '../build/get_root_dir.mjs';
import {runAction} from '../build/run_action.mjs';
import {getRootDir} from '../../src/build/get_root_dir.mjs';
import {runAction} from '../../src/build/run_action.mjs';
import {getBuildParameters} from '../src/build/get_build_parameters.mjs';




const ELECTRON_BUILD_DIR = 'build';
const ELECTRON_BUILD_DIR = 'output';
const ELECTRON_PLATFORMS = ['linux', 'windows'];

export async function main(...parameters) {
Expand Down Expand Up @@ -55,15 +51,12 @@ export async function main(...parameters) {

await runAction('client/src/www/build', ...parameters);
await runAction('client/src/tun2socks/build', ...parameters);
await runAction('src/electron/build_main', ...parameters);
await runAction('client/electron/build_main', ...parameters);

await copydir.sync(
path.join(getRootDir(), 'src', 'electron', 'icons'),
path.join(getRootDir(), ELECTRON_BUILD_DIR, 'icons')
);
await fs.mkdir(path.join(getRootDir(), ELECTRON_BUILD_DIR, 'client', 'electron'), {recursive: true});

const electronConfig = JSON.parse(
await fs.readFile(path.resolve(getRootDir(), 'src', 'electron', 'electron-builder.json'))
await fs.readFile(path.resolve(getRootDir(), 'client', 'electron', 'electron-builder.json'))
);

// build electron binary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import path from 'path';
import url from 'url';

import electronMainWebpackConfigs from './webpack_electron_main.mjs';
import {getBuildParameters} from '../../client/src/build/get_build_parameters.mjs';
import {getWebpackBuildMode} from '../../client/src/build/get_webpack_build_mode.mjs';
import {runWebpack} from '../../client/src/build/run_webpack.mjs';
import {getRootDir} from '../build/get_root_dir.mjs';
import {runAction} from '../build/run_action.mjs';
import {getRootDir} from '../../src/build/get_root_dir.mjs';
import {runAction} from '../../src/build/run_action.mjs';
import {getBuildParameters} from '../src/build/get_build_parameters.mjs';
import {getWebpackBuildMode} from '../src/build/get_webpack_build_mode.mjs';
import {runWebpack} from '../src/build/run_webpack.mjs';

const ELECTRON_BUILD_DIR = 'build';
const ELECTRON_BUILD_DIR = 'output';
const ELECTRON_PLATFORMS = ['linux', 'windows'];

export async function main(...parameters) {
Expand Down Expand Up @@ -58,7 +58,7 @@ export async function main(...parameters) {
windowsEnvironment += `\n!define SENTRY_URL "<debug>"`;
}

await fs.writeFile(path.resolve(getRootDir(), ELECTRON_BUILD_DIR, 'env.nsh'), windowsEnvironment);
await fs.writeFile(path.resolve(getRootDir(), ELECTRON_BUILD_DIR, 'client', 'electron', 'env.nsh'), windowsEnvironment);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import * as dns from 'dns';

import {timeoutPromise} from '@outline/infrastructure/timeout_promise';
import * as errors from '../../client/src/www/model/errors';

import * as errors from '../src/www/model/errors';

const DNS_LOOKUP_TIMEOUT_MS = 10000;

Expand Down
Loading

0 comments on commit 2f174c1

Please sign in to comment.