feat: add proxy support for SDK downloads (v1.1.0)

Add --proxy and --no-proxy global flags to control HTTP/HTTPS proxy
usage for all network operations (SDK installs, FTC SDK clone/fetch,
Android SDK download).

Proxy resolution priority:
  1. --no-proxy          → go direct, ignore everything
  2. --proxy <url>       → use the specified proxy
  3. HTTPS_PROXY / HTTP_PROXY env vars (auto-detected)
  4. Nothing             → go direct

Key implementation details:
- reqwest client is always built through ProxyConfig::client() rather
  than Client::new(), so --no-proxy actively suppresses env-var
  auto-detection instead of just being a no-op.
- git2/libgit2 has its own HTTP transport that doesn't use reqwest.
  GitProxyGuard is an RAII guard that temporarily sets/clears the
  HTTPS_PROXY env vars around clone and fetch operations, then restores
  the previous state on drop. This avoids mutating ~/.gitconfig.
- Gradle wrapper reads HTTPS_PROXY natively; no programmatic
  intervention needed.
- All network failure paths now print offline/air-gapped installation
  instructions automatically, covering manual SDK installs and Gradle
  distribution download.

Closes: v1.1.0 proxy support milestone
This commit is contained in:
Eric Ratliff
2026-02-01 09:44:53 -06:00
parent 5596f5bade
commit 54647a47b1
9 changed files with 1161 additions and 48 deletions

View File

@@ -3,13 +3,17 @@ use std::path::PathBuf;
use colored::*;
use crate::sdk::SdkConfig;
use crate::sdk::proxy::ProxyConfig;
use crate::project::ProjectBuilder;
pub fn create_project(
name: &str,
ftc_sdk: Option<&str>,
android_sdk: Option<&str>,
_proxy: &ProxyConfig,
) -> Result<()> {
// _proxy is threaded through here so future flows (e.g. auto-install on
// missing SDK) can use it without changing the call site in main.
// Validate project name
if name.is_empty() {
bail!("Project name cannot be empty");