Added some automatic scripts

This commit is contained in:
WolverinDEV 2019-07-03 13:16:38 +02:00
parent e54647f598
commit ad3421843c
17 changed files with 178 additions and 25 deletions

View File

@ -1,4 +1,4 @@
import * as installer from "electron-installer-debian";
const installer = require("electron-installer-debian");
import * as packager from "./package";
import {parse_version, Version} from "../modules/shared/version";

View File

@ -0,0 +1,14 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"sourceMap": true,
"moduleResolution": "node"
},
"include": [
"./deploy/",
"build.ts",
"package.ts",
"package_linux.ts"
]
}

View File

@ -0,0 +1,14 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"sourceMap": true,
"moduleResolution": "node"
},
"include": [
"./deploy/",
"build.ts",
"package.ts",
"package_linux.ts"
]
}

58
jenkins/create_build.sh Executable file
View File

@ -0,0 +1,58 @@
#!/usr/bin/env bash
cd "../$(dirname $0)"
project_name="__build_teaclient"
source ../scripts/build_helper.sh
function install_npm() {
begin_task "${project_name}_update" "Installing NPM"
npm install
check_err_exit ${project_name} "Failed to install nodejs files!"
npm update
check_err_exit ${project_name} "Failed to update nodejs files!"
begin_task "${project_name}_update" "NPM installed"
}
function compile_scripts() {
begin_task "${project_name}_tsc_sass" "Compiling TypeScript & SASS"
npm run compile-tsc -- -p modules/tsconfig_main.json
npm run compile-tsc -- -p modules/tsconfig_renderer.json
npm run compile-tsc -- -p installer/tsconfig_linux.json
check_err_exit ${project_name} "Failed to compile typescript files!"
npm run compile-sass
check_err_exit ${project_name} "Failed to compile sass files!"
begin_task "${project_name}_tsc_sass" "TypeScript & SASS compiled"
echo ""
}
function compile_native() {
begin_task "${project_name}_native" "Compiling native extensions"
local build_path="native/out/${build_os_type}_${build_os_arch}/"
[[ -d ${build_path} ]] && rm -r ${build_path}
mkdir -p ${build_path}
check_err_exit ${project_name} "Failed to create build directory!"
cd ${build_path}
check_err_exit ${project_name} "Failed to enter build directory!"
cmake ../../ -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_MODULE_PATH="/home/wolverindev/TeaSpeak-Client/cmake/" -DCMAKE_PLATFORM_INCLUDE="/home/wolverindev/TeaSpeak-Client/cmake/config/tearoot-client.cmake" -DLIBRARY_PATH="/home/wolverindev/TeaSpeak-Client/third_party/"
check_err_exit ${project_name} "Failed create build targets!"
cmake --build `pwd` --target teaclient_connection -- -j 12
check_err_exit ${project_name} "Failed build teaclient connection!"
cmake --build `pwd` --target teaclient_crash_handler -- -j 12
check_err_exit ${project_name} "Failed build teaclient crash handler!"
cmake --build `pwd` --target teaclient_ppt -- -j 12
check_err_exit ${project_name} "Failed build teaclient ppt!"
begin_task "${project_name}_native" "Native extensions compiled"
}
install_npm
compile_scripts
compile_native

22
jenkins/deploy_build.sh Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
cd "../$(dirname $0)"
if [[ "${teaclient_deploy_secret}" == "" ]]; then
echo "Missing deploy secret!"
exit 1
fi
if [[ $# -lt 1 ]]; then
echo "Missing build channel!"
exit 1
fi
npm run build-linux-64
if [[ $? -ne 0 ]]; then
echo "Failed to build project"
fi
npm run package-linux-64 $1
if [[ $? -ne 0 ]]; then
echo "Failed to package project"
fi

View File

@ -19,7 +19,7 @@ import {Headers} from "tar-stream";
import {Arguments, process_args} from "../../shared/process-arguments";
import * as electron from "electron";
import {PassThrough} from "stream";
import {prevent_instant_close} from "../../core/main_window";
import * as _main_windows from "../main_window";
import ErrnoException = NodeJS.ErrnoException;
import {EPERM} from "constants";
import * as winmgr from "../window";
@ -484,7 +484,7 @@ export async function execute_update(update_file: string, restart_callback: (cal
console.debug("Extracting entry %s of type %s to %s", header.name, header.type, target_file);
if(header.type == "directory") {
await util.promisify(ofs.mkdir)(target_file, {recursive: true});
await fs.mkdirp(target_file);
} else if(header.type == "file") {
{
const directory = path.parse(target_file).dir;
@ -492,7 +492,7 @@ export async function execute_update(update_file: string, restart_callback: (cal
if(!(await util.promisify(ofs.exists)(directory)) || !(await util.promisify(ofs.stat)(directory)).isDirectory()) {
console.log("Creating directory %s", directory);
try {
await util.promisify(ofs.mkdir)(directory, {recursive: true});
await fs.mkdirp(directory);
} catch(error) {
console.warn("failed to create directory for file %s", header.type);
}
@ -801,7 +801,7 @@ export async function execute_graphical(channel: string, ask_install: boolean) :
try {
await execute_update(update_path, callback => {
prevent_instant_close = true;
_main_windows.set_prevent_instant_close(true);
update_restart_pending = true;
window.close();
callback();

View File

@ -3,6 +3,10 @@ import * as electron from "electron";
import * as winmgr from "./window";
export let prevent_instant_close: boolean = true;
export function set_prevent_instant_close(flag: boolean) {
prevent_instant_close = flag;
}
export let is_debug: boolean;
export let allow_dev_tools: boolean;

View File

@ -4,10 +4,17 @@ import * as fs from "fs-extra";
import {BrowserWindow, ipcMain as ipc} from "electron";
import {Arguments, process_args} from "../../shared/process-arguments";
import UserData = forum.UserData;
import {main_window} from "../main_window";
import * as winmgr from "../window";
export interface UserData {
session_id: string;
username: string;
application_data: string;
application_data_sign: string;
}
let current_window: BrowserWindow;
let _current_data: UserData;

View File

@ -1,4 +1,6 @@
window.$ = require("jquery");
import {UserData} from "../index";
(window as any).$ = require("jquery");
{
const request = require('request');
const util = require('util');

View File

@ -259,7 +259,7 @@ export namespace _connection {
data[0]["return_code"] = return_code;
console.log("Sending %s (%o)", command, data);
const promise = new Promise((resolve, reject) => {
const promise = new Promise<CommandResult>((resolve, reject) => {
const timeout_id = setTimeout(() => {
delete this._return_listener[return_code];
reject("timeout");

View File

@ -76,7 +76,7 @@ namespace _dns {
const aaaa_response: string[] | undefined | null = await async_resolve_aaaa(address, options.timeout).catch(error => {
options.log("AAAA record resolved unsuccessfully (%o)", error);
return Promise.resolve(undefined);
});
}) as any;
if(typeof(aaaa_response) !== "undefined") {
@ -95,7 +95,7 @@ namespace _dns {
const a_response: string[] | undefined | null = await async_resolve_a(address, options.timeout).catch(error => {
options.log("A record resolved unsuccessfully (%o)", error);
return Promise.resolve(undefined);
});
}) as any;
if(typeof(a_response) !== "undefined") {
if(!a_response || a_response.length == 0)

View File

@ -107,7 +107,7 @@ const parse = (args: string[], options: minimist.Opts) => {
flags.strings[key] || flags.bools[key] || aliases[key];
}
function setArg (key, val, arg) {
function setArg (key, val, arg?) {
if (arg && flags.unknownFn && !argDefined(key, arg)) {
if (flags.unknownFn(arg) === false) return;
}
@ -156,7 +156,7 @@ const parse = (args: string[], options: minimist.Opts) => {
// http://stackoverflow.com/a/1068308/13216
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
var key = m[1];
var value = m[2];
var value: any = m[2];
if (flags.bools[key]) {
value = value !== 'false';
}

View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"sourceMap": true,
"moduleResolution": "node"
},
"include": [
"./core",
"./crash_handler",
"./shared",
"../main.ts"
],
"exclude": [
"node_modules",
"declarations",
"app/dummy-declarations/*.d.ts"
]
}

View File

@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"sourceMap": true,
"moduleResolution": "node"
},
"include": [
"./renderer",
"./crash_handler",
"./shared",
"../native/*/exports/"
],
"exclude": [
"node_modules",
"declarations",
"app/dummy-declarations/*.d.ts"
]
}

View File

@ -114,13 +114,14 @@ include_directories(${opus_INCLUDE_DIR})
find_package(spdlog REQUIRED)
message("Libraries: ${LIBEVENT_LIBRARIES}")
set(REQUIRED_LIBRARIES
${TeaSpeak_SharedLib_LIBRARIES_STATIC}
${TomCrypt_LIBRARIES_STATIC}
${TomMath_LIBRARIES_STATIC}
${LIBEVENT_STATIC_LIBRARIES}
${LIBEVENT_LIBRARIES}
${StringVariable_LIBRARIES_STATIC}
${DataPipes_LIBRARIES_STATIC} #Needs to be static because something causes ca bad function call when loaded in electron

View File

@ -1,9 +0,0 @@
/* General file with least possible errors. This is just for your IDE (PHP-Storm for example) */
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"sourceMap": true
},
"exclude": [ ]
}

View File

@ -30,8 +30,9 @@
"asar": "^2.0.1",
"cmake-js": "^4.0.1",
"ejs": "^2.6.2",
"electron-packager": "^14.0.0",
"nodemon": "^1.19.1"
"electron-packager": "^14.0.1",
"nodemon": "^1.19.1",
"typescript": "^3.5.2"
},
"dependencies": {
"@types/minimist": "^1.2.0",
@ -54,7 +55,7 @@
"nan": "^2.14.0",
"node-ssh": "^6.0.0",
"only": "0.0.2",
"psl": "^1.1.33",
"psl": "^1.2.0",
"pure-uuid": "^1.5.7",
"request": "^2.47.1",
"request-progress": "^3.0.0",