mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +00:00
server bin cleanup
This commit is contained in:
@@ -300,26 +300,28 @@ function packageTask(type, platform, arch, sourceFolderName, destinationFolderNa
|
||||
|
||||
if (platform === 'win32') {
|
||||
result = es.merge(result,
|
||||
gulp.src('resources/server/bin/code.cmd', { base: '.' })
|
||||
gulp.src('resources/server/bin/remote-cli/code.cmd', { base: '.' })
|
||||
.pipe(replace('@@VERSION@@', version))
|
||||
.pipe(replace('@@COMMIT@@', commit))
|
||||
.pipe(replace('@@APPNAME@@', product.applicationName))
|
||||
.pipe(rename(`bin/${product.applicationName}.cmd`)),
|
||||
.pipe(rename(`bin/remote-cli/${product.applicationName}.cmd`)),
|
||||
gulp.src('resources/server/bin/helpers/browser.cmd', { base: '.' })
|
||||
.pipe(replace('@@VERSION@@', version))
|
||||
.pipe(replace('@@COMMIT@@', commit))
|
||||
.pipe(replace('@@APPNAME@@', product.applicationName))
|
||||
.pipe(rename(`bin/helpers/browser.cmd`)),
|
||||
gulp.src('resources/server/bin/server.cmd', { base: '.' })
|
||||
.pipe(rename(`server.cmd`))
|
||||
gulp.src('resources/server/bin/server-old.cmd', { base: '.' })
|
||||
.pipe(rename(`server.cmd`)),
|
||||
gulp.src('resources/server/bin/code-server.cmd', { base: '.' })
|
||||
.pipe(rename(`bin/${product.serverApplicationName}.cmd`)),
|
||||
);
|
||||
} else if (platform === 'linux' || platform === 'alpine' || platform === 'darwin') {
|
||||
result = es.merge(result,
|
||||
gulp.src('resources/server/bin/code.sh', { base: '.' })
|
||||
gulp.src('resources/server/bin/remote-cli/code.sh', { base: '.' })
|
||||
.pipe(replace('@@VERSION@@', version))
|
||||
.pipe(replace('@@COMMIT@@', commit))
|
||||
.pipe(replace('@@APPNAME@@', product.applicationName))
|
||||
.pipe(rename(`bin/${product.applicationName}`))
|
||||
.pipe(rename(`bin/remote-cli/${product.applicationName}`))
|
||||
.pipe(util.setExecutableBit()),
|
||||
gulp.src('resources/server/bin/helpers/browser.sh', { base: '.' })
|
||||
.pipe(replace('@@VERSION@@', version))
|
||||
@@ -327,8 +329,11 @@ function packageTask(type, platform, arch, sourceFolderName, destinationFolderNa
|
||||
.pipe(replace('@@APPNAME@@', product.applicationName))
|
||||
.pipe(rename(`bin/helpers/browser.sh`))
|
||||
.pipe(util.setExecutableBit()),
|
||||
gulp.src('resources/server/bin/server.sh', { base: '.' })
|
||||
gulp.src('resources/server/bin/server-old.sh', { base: '.' })
|
||||
.pipe(rename(`server.sh`))
|
||||
.pipe(util.setExecutableBit()),
|
||||
gulp.src('resources/server/bin/code-server.sh', { base: '.' })
|
||||
.pipe(rename(`bin/${product.serverApplicationName}`))
|
||||
.pipe(util.setExecutableBit())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { updateUrl, commit, quality, serverDataFolderName, dataFolderName } = getProductConfiguration();
|
||||
const { updateUrl, commit, quality, serverDataFolderName, serverApplicationName, dataFolderName } = getProductConfiguration();
|
||||
const commandArgs = ['--host=127.0.0.1', '--port=0', '--disable-telemetry', '--use-host-proxy', '--accept-server-license-terms'];
|
||||
const env = getNewEnv();
|
||||
const remoteDataDir = process.env['TESTRESOLVER_DATA_FOLDER'] || path.join(os.homedir(), serverDataFolderName || `${dataFolderName}-testresolver`);
|
||||
@@ -102,7 +102,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
commandArgs.push('--connection-token-file', connectionTokenFile);
|
||||
|
||||
if (!commit) { // dev mode
|
||||
const serverCommand = process.platform === 'win32' ? 'server.bat' : 'server.sh';
|
||||
const serverCommand = process.platform === 'win32' ? 'code-server.bat' : 'code-server.sh';
|
||||
const vscodePath = path.resolve(path.join(context.extensionPath, '..', '..'));
|
||||
const serverCommandPath = path.join(vscodePath, 'resources', 'server', 'bin-dev', serverCommand);
|
||||
|
||||
@@ -115,7 +115,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
commandArgs.push('--install-builtin-extension', extensionToInstall);
|
||||
commandArgs.push('--start-server');
|
||||
}
|
||||
const serverCommand = process.platform === 'win32' ? 'server.cmd' : 'server.sh';
|
||||
const serverCommand = `${serverApplicationName}${process.platform === 'win32' ? '.cmd' : ''}`;
|
||||
let serverLocation = env['VSCODE_REMOTE_SERVER_PATH']; // support environment variable to specify location of server on disk
|
||||
if (!serverLocation) {
|
||||
const serverBin = path.join(remoteDataDir, 'bin');
|
||||
@@ -390,6 +390,7 @@ export interface IProductConfiguration {
|
||||
commit: string;
|
||||
quality: string;
|
||||
dataFolderName: string;
|
||||
serverApplicationName?: string;
|
||||
serverDataFolderName?: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"serverGreeting": [],
|
||||
"serverLicense": [],
|
||||
"serverLicensePrompt": "",
|
||||
"serverApplicationName": "code-server-oss",
|
||||
"win32DirName": "Microsoft Code OSS",
|
||||
"win32NameVersion": "Microsoft Code OSS",
|
||||
"win32RegValueName": "CodeOSS",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@echo off
|
||||
setlocal
|
||||
SET VSCODE_PATH=%~dp0..\..\..
|
||||
SET VSCODE_PATH=%~dp0..\..\..\..
|
||||
FOR /F "tokens=* USEBACKQ" %%g IN (`where /r "%VSCODE_PATH%\.build\node" node.exe`) do (SET "NODE=%%g")
|
||||
call "%NODE%" "%VSCODE_PATH%\out\vs\server\cli.js" "Code Server - Dev" "" "" "code.cmd" %*
|
||||
endlocal
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
|
||||
VSCODE_PATH=$(dirname $(dirname $(dirname $(dirname $(realpath "$0")))))
|
||||
VSCODE_PATH=$(dirname $(dirname $(dirname $(dirname $(dirname $(realpath "$0"))))))
|
||||
else
|
||||
VSCODE_PATH=$(dirname $(dirname $(dirname $(dirname $(readlink -f $0)))))
|
||||
VSCODE_PATH=$(dirname $(dirname $(dirname $(dirname $(dirname $(readlink -f $0))))))
|
||||
fi
|
||||
|
||||
PROD_NAME="Code Server - Dev"
|
||||
24
resources/server/bin/code-server.cmd
Normal file
24
resources/server/bin/code-server.cmd
Normal file
@@ -0,0 +1,24 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set ROOT_DIR=%~dp0..
|
||||
|
||||
set _FIRST_ARG=%1
|
||||
if "%_FIRST_ARG:~0,9%"=="--inspect" (
|
||||
set INSPECT=%1
|
||||
shift
|
||||
) else (
|
||||
set INSPECT=
|
||||
)
|
||||
|
||||
:loop1
|
||||
if "%~1"=="" goto after_loop
|
||||
set RESTVAR=%RESTVAR% %1
|
||||
shift
|
||||
goto loop1
|
||||
|
||||
:after_loop
|
||||
|
||||
"%ROOT_DIR%\node.exe" %INSPECT% "%ROOT_DIR%\out\vs\server\main.js" %RESTVAR%
|
||||
|
||||
endlocal
|
||||
@@ -7,6 +7,6 @@ case "$1" in
|
||||
--inspect*) INSPECT="$1"; shift;;
|
||||
esac
|
||||
|
||||
ROOT="$(dirname "$0")"
|
||||
ROOT=$(dirname "$(dirname "$0")")
|
||||
|
||||
"$ROOT/node" ${INSPECT:-} "$ROOT/out/vs/server/main.js" "$@"
|
||||
@@ -1,4 +0,0 @@
|
||||
@echo off
|
||||
setlocal
|
||||
call "%~dp0..\node" "%~dp0..\out\vs\server\cli.js" "@@APPNAME@@" "@@VERSION@@" "@@COMMIT@@" "@@APPNAME@@.cmd" %*
|
||||
endlocal
|
||||
@@ -1,4 +1,5 @@
|
||||
@echo off
|
||||
setlocal
|
||||
call "%~dp0..\..\node" "%~dp0..\..\out\vs\server\cli.js" "@@APPNAME@@" "@@VERSION@@" "@@COMMIT@@" "@@APPNAME@@.cmd" "--openExternal" %*
|
||||
set ROOT_DIR=%~dp0..\..
|
||||
call "%ROOT_DIR%\node.exe" "%ROOT_DIR%\out\vs\server\cli.js" "@@APPNAME@@" "@@VERSION@@" "@@COMMIT@@" "@@APPNAME@@.cmd" "--openExternal" %*
|
||||
endlocal
|
||||
|
||||
5
resources/server/bin/remote-cli/code.cmd
Normal file
5
resources/server/bin/remote-cli/code.cmd
Normal file
@@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
setlocal
|
||||
set ROOT_DIR=%~dp0..\..
|
||||
call "%ROOT_DIR%\node.exe" "%ROOT_DIR%\out\vs\server\cli.js" "@@APPNAME@@" "@@VERSION@@" "@@COMMIT@@" "@@APPNAME@@.cmd" %*
|
||||
endlocal
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
#
|
||||
ROOT=$(dirname "$(dirname "$0")")
|
||||
ROOT=$(dirname "$(dirname "$(dirname "$0")")")
|
||||
|
||||
APP_NAME="@@APPNAME@@"
|
||||
VERSION="@@VERSION@@"
|
||||
@@ -19,6 +19,6 @@ goto loop1
|
||||
|
||||
:after_loop
|
||||
|
||||
"%ROOT_DIR%node.exe" %INSPECT% "%ROOT_DIR%out\vs\server\main.js" %RESTVAR%
|
||||
"%ROOT_DIR%node.exe" %INSPECT% "%ROOT_DIR%out\vs\server\main.js" --compatibility=1.63 %RESTVAR%
|
||||
|
||||
endlocal
|
||||
12
resources/server/bin/server-old.sh
Normal file
12
resources/server/bin/server-old.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env sh
|
||||
#
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
#
|
||||
|
||||
case "$1" in
|
||||
--inspect*) INSPECT="$1"; shift;;
|
||||
esac
|
||||
|
||||
ROOT="$(dirname "$0")"
|
||||
|
||||
"$ROOT/node" ${INSPECT:-} "$ROOT/out/vs/server/main.js" --compatibility=1.63 "$@"
|
||||
@@ -34,12 +34,13 @@ export async function buildUserEnvironment(startParamsEnv: { [key: string]: stri
|
||||
}
|
||||
|
||||
const binFolder = environmentService.isBuilt ? join(environmentService.appRoot, 'bin') : join(environmentService.appRoot, 'resources', 'server', 'bin-dev');
|
||||
const remoteCliBinFolder = join(binFolder, 'remote-cli'); // contains the `code` command that can talk to the remote server
|
||||
const processEnv = process.env;
|
||||
let PATH = startParamsEnv['PATH'] || (userShellEnv ? userShellEnv['PATH'] : undefined) || processEnv['PATH'];
|
||||
if (PATH) {
|
||||
PATH = binFolder + delimiter + PATH;
|
||||
PATH = remoteCliBinFolder + delimiter + PATH;
|
||||
} else {
|
||||
PATH = binFolder;
|
||||
PATH = remoteCliBinFolder;
|
||||
}
|
||||
|
||||
const env: IProcessEnvironment = {
|
||||
@@ -58,7 +59,7 @@ export async function buildUserEnvironment(startParamsEnv: { [key: string]: stri
|
||||
...startParamsEnv
|
||||
};
|
||||
if (!environmentService.args['without-browser-env-var']) {
|
||||
env.BROWSER = join(binFolder, 'helpers', isWindows ? 'browser.cmd' : 'browser.sh');
|
||||
env.BROWSER = join(binFolder, 'helpers', isWindows ? 'browser.cmd' : 'browser.sh'); // a command that opens a browser on the local machine
|
||||
}
|
||||
|
||||
setCaseInsensitive(env, 'PATH', PATH);
|
||||
|
||||
@@ -925,6 +925,7 @@ function parseConnectionToken(args: ServerParsedArgs): { connectionToken: string
|
||||
|
||||
let connectionToken = args['connection-token'];
|
||||
const connectionTokenFile = args['connection-token-file'];
|
||||
const compatibility = args['compatibility'] === '1.63';
|
||||
|
||||
if (args['without-connection-token']) {
|
||||
if (connectionToken || connectionTokenFile) {
|
||||
@@ -959,9 +960,11 @@ function parseConnectionToken(args: ServerParsedArgs): { connectionToken: string
|
||||
} else {
|
||||
connectionToken = generateUuid();
|
||||
console.log(`Connection token: ${connectionToken}`);
|
||||
console.log(`Connection token or will made mandatory in the next release. To run without connection token, use '--without-connection-token'.`);
|
||||
if (compatibility) {
|
||||
console.log(`Connection token or will made mandatory in the next release. To run without connection token, use '--without-connection-token'.`);
|
||||
}
|
||||
}
|
||||
return { connectionToken, connectionTokenIsMandatory: false };
|
||||
return { connectionToken, connectionTokenIsMandatory: !compatibility };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ export const serverOptions: OptionDescriptions<ServerParsedArgs> = {
|
||||
'help': OPTIONS['help'],
|
||||
'version': OPTIONS['version'],
|
||||
|
||||
'compatibility': { type: 'string' },
|
||||
|
||||
_: OPTIONS['_']
|
||||
};
|
||||
@@ -175,6 +176,8 @@ export interface ServerParsedArgs {
|
||||
help: boolean;
|
||||
version: boolean;
|
||||
|
||||
compatibility: string
|
||||
|
||||
_: string[];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user