Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete --compatibility=1.63 code from the server #183738

Merged
merged 1 commit into from May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 0 additions & 9 deletions build/gulpfile.reh.js
Expand Up @@ -309,8 +309,6 @@ function packageTask(type, platform, arch, sourceFolderName, destinationFolderNa
.pipe(replace('@@COMMIT@@', commit))
.pipe(replace('@@APPNAME@@', product.applicationName))
.pipe(rename(`bin/helpers/browser.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`)),
);
Expand All @@ -332,13 +330,6 @@ function packageTask(type, platform, arch, sourceFolderName, destinationFolderNa
.pipe(rename(`bin/${product.serverApplicationName}`))
.pipe(util.setExecutableBit())
);
if (type !== 'reh-web') {
result = es.merge(result,
gulp.src('resources/server/bin/server-old.sh', { base: '.' })
.pipe(rename(`server.sh`))
.pipe(util.setExecutableBit()),
);
}
}

return result.pipe(vfs.dest(destination));
Expand Down
24 changes: 0 additions & 24 deletions resources/server/bin/server-old.cmd

This file was deleted.

12 changes: 0 additions & 12 deletions resources/server/bin/server-old.sh

This file was deleted.

6 changes: 0 additions & 6 deletions src/server-main.js
Expand Up @@ -45,12 +45,6 @@ async function start() {
return;
}

if (parsedArgs['compatibility'] === '1.63') {
console.warn(`server.sh is being replaced by 'bin/${product.serverApplicationName}'. Please migrate to the new command and adopt the following new default behaviors:`);
console.warn('* connection token is mandatory unless --without-connection-token is used');
console.warn('* host defaults to `localhost`');
}

/**
* @typedef { import('./vs/server/node/remoteExtensionHostAgentServer').IServerAPI } IServerAPI
*/
Expand Down
25 changes: 1 addition & 24 deletions src/vs/server/node/serverConnectionToken.ts
Expand Up @@ -29,17 +29,6 @@ export class NoneServerConnectionToken {
}
}

export class OptionalServerConnectionToken {
public readonly type = ServerConnectionTokenType.Optional;

constructor(public readonly value: string) {
}

public validate(connectionToken: any): boolean {
return (connectionToken === this.value);
}
}

export class MandatoryServerConnectionToken {
public readonly type = ServerConnectionTokenType.Mandatory;

Expand All @@ -51,7 +40,7 @@ export class MandatoryServerConnectionToken {
}
}

export type ServerConnectionToken = NoneServerConnectionToken | OptionalServerConnectionToken | MandatoryServerConnectionToken;
export type ServerConnectionToken = NoneServerConnectionToken | MandatoryServerConnectionToken;

export class ServerConnectionTokenParseError {
constructor(
Expand All @@ -63,7 +52,6 @@ export async function parseServerConnectionToken(args: ServerParsedArgs, default
const withoutConnectionToken = args['without-connection-token'];
const connectionToken = args['connection-token'];
const connectionTokenFile = args['connection-token-file'];
const compatibility = (args['compatibility'] === '1.63');

if (withoutConnectionToken) {
if (typeof connectionToken !== 'undefined' || typeof connectionTokenFile !== 'undefined') {
Expand Down Expand Up @@ -96,20 +84,9 @@ export async function parseServerConnectionToken(args: ServerParsedArgs, default
return new ServerConnectionTokenParseError(`The connection token '${connectionToken} does not adhere to the characters 0-9, a-z, A-Z or -.`);
}

if (compatibility) {
// TODO: Remove this case soon
return new OptionalServerConnectionToken(connectionToken);
}

return new MandatoryServerConnectionToken(connectionToken);
}

if (compatibility) {
// TODO: Remove this case soon
console.log(`Breaking change in the next release: Please use one of the following arguments: '--connection-token', '--connection-token-file' or '--without-connection-token'.`);
return new OptionalServerConnectionToken(await defaultValue());
}

return new MandatoryServerConnectionToken(await defaultValue());
}

Expand Down
14 changes: 0 additions & 14 deletions src/vs/server/test/node/serverConnectionToken.test.ts
Expand Up @@ -27,13 +27,6 @@ suite('parseServerConnectionToken', () => {
assert.ok(result.type === ServerConnectionTokenType.Mandatory);
});

test('no arguments with --compatibility generates a token that is not mandatory', async () => {
const result = await parseServerConnectionToken({ 'compatibility': '1.63' } as ServerParsedArgs, async () => 'defaultTokenValue');
assert.ok(!(result instanceof ServerConnectionTokenParseError));
assert.ok(result.type === ServerConnectionTokenType.Optional);
assert.strictEqual(result.value, 'defaultTokenValue');
});

test('--without-connection-token', async () => {
const result = await parseServerConnectionToken({ 'without-connection-token': true } as ServerParsedArgs, async () => 'defaultTokenValue');
assert.ok(!(result instanceof ServerConnectionTokenParseError));
Expand Down Expand Up @@ -74,11 +67,4 @@ suite('parseServerConnectionToken', () => {
assert.strictEqual(result.value, connectionToken);
});

test('--connection-token --compatibility marks a as not mandatory', async () => {
const connectionToken = `12345-123-abc`;
const result = await parseServerConnectionToken({ 'connection-token': connectionToken, 'compatibility': '1.63' } as ServerParsedArgs, async () => 'defaultTokenValue');
assert.ok(!(result instanceof ServerConnectionTokenParseError));
assert.ok(result.type === ServerConnectionTokenType.Optional);
assert.strictEqual(result.value, connectionToken);
});
});