1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//! # msvc-kit
//!
//! A portable MSVC Build Tools installer and manager for Rust development.
//!
//! This crate provides both a CLI tool and a library for downloading and managing
//! MSVC compiler and Windows SDK components without requiring a full Visual Studio installation.
//!
//! ## Features
//!
//! - Download MSVC compiler components from Microsoft servers
//! - Download Windows SDK to specified directories
//! - Configure environment variables for cc-rs compatibility
//! - Support version selection (defaults to latest)
//! - Generate activation scripts for shell environments
//! - Create portable bundles with all dependencies
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use msvc_kit::{download_msvc, extract_and_finalize_msvc, DownloadOptions, Architecture};
//!
//! #[tokio::main]
//! async fn main() -> anyhow::Result<()> {
//! // Use builder pattern for configuration
//! let options = DownloadOptions::builder()
//! .target_dir("C:/msvc-kit")
//! .arch(Architecture::X64)
//! .parallel_downloads(8)
//! .build();
//!
//! // Download MSVC packages
//! let mut msvc_info = download_msvc(&options).await?;
//!
//! // Extract and finalize (determines full version number)
//! extract_and_finalize_msvc(&mut msvc_info).await?;
//!
//! println!("Installed MSVC {} to: {:?}", msvc_info.version, msvc_info.install_path);
//! Ok(())
//! }
//! ```
//!
//! ## Bundle Creation
//!
//! ```rust,no_run
//! use msvc_kit::bundle::{create_bundle, BundleOptions, BundleLayout};
//! use msvc_kit::Architecture;
//!
//! #[tokio::main]
//! async fn main() -> anyhow::Result<()> {
//! // Create a portable bundle
//! let options = BundleOptions {
//! output_dir: "./msvc-bundle".into(),
//! arch: Architecture::X64,
//! ..Default::default()
//! };
//!
//! let result = create_bundle(options).await?;
//! println!("Bundle created with MSVC {}", result.msvc_info.version);
//!
//! // Later, discover an existing bundle
//! let layout = BundleLayout::from_root("./msvc-bundle")?;
//! println!("cl.exe at: {:?}", layout.cl_exe_path());
//! Ok(())
//! }
//! ```
//!
//! ## Advanced Configuration
//!
//! ```rust,no_run
//! use msvc_kit::{DownloadOptions, Architecture};
//!
//! let options = DownloadOptions::builder()
//! .msvc_version("14.44") // Specific MSVC version
//! .sdk_version("10.0.26100.0") // Specific SDK version
//! .target_dir("C:/msvc-kit")
//! .arch(Architecture::X64)
//! .host_arch(Architecture::X64) // For cross-compilation
//! .verify_hashes(true)
//! .parallel_downloads(8)
//! .dry_run(false) // Set to true for preview mode
//! .build();
//! ```
// Re-export main types and functions
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
// Re-export bundle types
pub use ;