cli: get builds in order

This commit is contained in:
Connor Peet
2022-09-20 09:15:01 -07:00
parent 5e2ce13287
commit 9bcc88eafe
29 changed files with 603 additions and 164 deletions
+1
View File
@@ -62,4 +62,5 @@ lto = true
codegen-units = 1
[features]
default = []
vscode-encrypt = []
-8
View File
@@ -1,8 +0,0 @@
[build.env]
passthrough = [
"LAUNCHER_VERSION",
"LAUNCHER_ASSET_NAME",
]
[target.aarch64-unknown-linux-gnu]
image = "microsoft/vscode-server-launcher-xbuild:aarch64"
+2 -2
View File
@@ -302,7 +302,7 @@ impl Auth {
let mut keyring_storage = KeyringStorage::default();
let mut file_storage = FileStorage(PersistedState::new(self.file_storage_path.clone()));
let keyring_storage_result = match std::env::var("LAUNCHER_USE_FILE_KEYCHAIN") {
let keyring_storage_result = match std::env::var("VSCODE_CLI_USE_FILE_KEYCHAIN") {
Ok(_) => Err(wrap("", "user prefers file storage")),
_ => keyring_storage.read(),
};
@@ -495,7 +495,7 @@ impl Auth {
}
async fn prompt_for_provider(&self) -> Result<AuthProvider, AnyError> {
if std::env::var("LAUNCHER_ALLOW_MS_AUTH").is_err() {
if std::env::var("VSCODE_CLI_ALLOW_MS_AUTH").is_err() {
return Ok(AuthProvider::Github);
}
+1 -1
View File
@@ -18,7 +18,7 @@ use log::{Level, Metadata, Record};
#[clap(
long_about = None,
name = "Visual Studio Code Tunnels CLI",
version = match constants::LAUNCHER_VERSION { Some(v) => v, None => "dev" },
version = match constants::VSCODE_CLI_VERSION { Some(v) => v, None => "dev" },
)]
pub struct TunnelCli {
#[clap(flatten, next_help_heading = Some("GLOBAL OPTIONS"))]
+1 -1
View File
@@ -22,7 +22,7 @@ const TEMPLATE: &str = "
help_template = TEMPLATE,
long_about = None,
name = "Visual Studio Code CLI",
version = match constants::LAUNCHER_VERSION { Some(v) => v, None => "dev" },
version = match constants::VSCODE_CLI_VERSION { Some(v) => v, None => "dev" },
)]
pub struct Cli {
/// One or more files, folders, or URIs to open.
+5 -17
View File
@@ -8,29 +8,17 @@ use lazy_static::lazy_static;
pub const CONTROL_PORT: u16 = 31545;
pub const PROTOCOL_VERSION: u32 = 1;
pub const LAUNCHER_VERSION: Option<&'static str> = option_env!("LAUNCHER_VERSION");
pub const LAUNCHER_ASSET_NAME: Option<&'static str> =
if cfg!(all(target_os = "macos", target_arch = "x86_64")) {
Some("x86_64-apple-darwin-signed")
} else if cfg!(all(target_os = "macos", target_arch = "aarch64")) {
Some("aarch64-apple-darwin-signed")
} else if cfg!(all(target_os = "windows", target_arch = "x86_64")) {
Some("x86_64-pc-windows-msvc-signed")
} else if cfg!(all(target_os = "windows", target_arch = "aarch64")) {
Some("aarch64-pc-windows-msvc-signed")
} else {
option_env!("LAUNCHER_ASSET_NAME")
};
pub const LAUNCHER_AI_KEY: Option<&'static str> = option_env!("LAUNCHER_AI_KEY");
pub const LAUNCHER_AI_ENDPOINT: Option<&'static str> = option_env!("LAUNCHER_AI_ENDPOINT");
pub const VSCODE_CLI_VERSION: Option<&'static str> = option_env!("VSCODE_CLI_VERSION");
pub const VSCODE_CLI_ASSET_NAME: Option<&'static str> = option_env!("VSCODE_CLI_ASSET_NAME");
pub const VSCODE_CLI_AI_KEY: Option<&'static str> = option_env!("VSCODE_CLI_AI_KEY");
pub const VSCODE_CLI_AI_ENDPOINT: Option<&'static str> = option_env!("VSCODE_CLI_AI_ENDPOINT");
pub const TUNNEL_SERVICE_USER_AGENT_ENV_VAR: &str = "TUNNEL_SERVICE_USER_AGENT";
pub fn get_default_user_agent() -> String {
format!(
"vscode-server-launcher/{}",
LAUNCHER_VERSION.unwrap_or("dev")
VSCODE_CLI_VERSION.unwrap_or("dev")
)
}
+3 -3
View File
@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
use crate::constants::{CONTROL_PORT, LAUNCHER_VERSION, PROTOCOL_VERSION};
use crate::constants::{CONTROL_PORT, VSCODE_CLI_VERSION, PROTOCOL_VERSION};
use crate::log;
use crate::state::LauncherPaths;
use crate::update::Update;
@@ -362,7 +362,7 @@ async fn send_version(tx: &mpsc::Sender<SocketSignal>) {
tx.send(SocketSignal::from_message(&ToClientRequest {
id: None,
params: ClientRequestMethod::version(VersionParams {
version: LAUNCHER_VERSION.unwrap_or("dev"),
version: VSCODE_CLI_VERSION.unwrap_or("dev"),
protocol_version: PROTOCOL_VERSION,
}),
}))
@@ -620,7 +620,7 @@ async fn handle_update(
let updater = Update::new();
let latest_release = updater.get_latest_release().await?;
let up_to_date = match LAUNCHER_VERSION {
let up_to_date = match VSCODE_CLI_VERSION {
Some(v) => v == latest_release.version,
None => true,
};
+5 -5
View File
@@ -180,7 +180,7 @@ impl ActiveTunnel {
}
}
const LAUNCHER_TUNNEL_TAG: &str = "vscode-server-launcher";
const VSCODE_CLI_TUNNEL_TAG: &str = "vscode-server-launcher";
const MAX_TUNNEL_NAME_LENGTH: usize = 20;
fn get_host_token_from_tunnel(tunnel: &Tunnel) -> String {
@@ -267,7 +267,7 @@ impl DevTunnels {
self.log,
self.log.span("dev-tunnel.rename.search"),
self.client.list_all_tunnels(&TunnelRequestOptions {
tags: vec![LAUNCHER_TUNNEL_TAG.to_string(), name.to_string()],
tags: vec![VSCODE_CLI_TUNNEL_TAG.to_string(), name.to_string()],
require_all_tags: true,
..Default::default()
})
@@ -300,7 +300,7 @@ impl DevTunnels {
)
.map_err(|e| wrap(e, "failed to lookup tunnel"))?;
full_tunnel.tags = vec![name.to_string(), LAUNCHER_TUNNEL_TAG.to_string()];
full_tunnel.tags = vec![name.to_string(), VSCODE_CLI_TUNNEL_TAG.to_string()];
spanf!(
self.log,
self.log.span("dev-tunnel.tag.update"),
@@ -410,7 +410,7 @@ impl DevTunnels {
let mut tried_recycle = false;
let new_tunnel = Tunnel {
tags: vec![name.to_string(), LAUNCHER_TUNNEL_TAG.to_string()],
tags: vec![name.to_string(), VSCODE_CLI_TUNNEL_TAG.to_string()],
..Default::default()
};
@@ -501,7 +501,7 @@ impl DevTunnels {
self.log,
self.log.span("dev-tunnel.listall"),
self.client.list_all_tunnels(&TunnelRequestOptions {
tags: vec![LAUNCHER_TUNNEL_TAG.to_string()],
tags: vec![VSCODE_CLI_TUNNEL_TAG.to_string()],
require_all_tags: true,
..Default::default()
})
+2 -2
View File
@@ -7,8 +7,8 @@ use crate::util::errors::{AnyError, MissingLegalConsent};
use crate::util::input::prompt_yn;
use serde::{Deserialize, Serialize};
const LICENSE_TEXT: Option<&'static str> = option_env!("LAUNCHER_REMOTE_LICENSE_TEXT");
const LICENSE_PROMPT: Option<&'static str> = option_env!("LAUNCHER_REMOTE_LICENSE_PROMPT");
const LICENSE_TEXT: Option<&'static str> = option_env!("VSCODE_CLI_REMOTE_LICENSE_TEXT");
const LICENSE_PROMPT: Option<&'static str> = option_env!("VSCODE_CLI_REMOTE_LICENSE_PROMPT");
#[derive(Clone, Default, Serialize, Deserialize)]
struct PersistedConsent {
+3 -3
View File
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
use crate::constants::{LAUNCHER_ASSET_NAME, LAUNCHER_VERSION};
use crate::constants::{VSCODE_CLI_ASSET_NAME, VSCODE_CLI_VERSION};
use crate::util::{errors, http, io::SilentCopyProgress};
use serde::Deserialize;
use std::{
@@ -39,7 +39,7 @@ impl Update {
"User-Agent",
format!(
"vscode-server-launcher/{}",
LAUNCHER_VERSION.unwrap_or("dev")
VSCODE_CLI_VERSION.unwrap_or("dev")
),
)
.send()
@@ -63,7 +63,7 @@ impl Update {
target_path.file_name().unwrap().to_string_lossy()
));
let an = LAUNCHER_ASSET_NAME.unwrap();
let an = VSCODE_CLI_ASSET_NAME.unwrap();
let mut url = format!("{}/{}/{}", update.url, an, an);
if cfg!(target_os = "windows") {
url += ".exe";