11//! A module to download static binaries from cpp-linter/clang-tools-static-binaries.
22
33use std:: {
4+ env:: consts:: { ARCH , OS } ,
45 fs,
56 ops:: RangeInclusive ,
67 path:: { Path , PathBuf } ,
@@ -26,8 +27,10 @@ pub enum StaticDistDownloadError {
2627 #[ error( "The requested version does not match any available versions" ) ]
2728 UnsupportedVersion ,
2829
29- /// The static binaries are only built for x86_64 (amd64) architecture.
30- #[ error( "The static binaries are only built for x86_64 (amd64) architecture" ) ]
30+ /// The static binaries are only built for
31+ /// x86_64 and aarch64 architecture on Linux MacOS, and
32+ /// Windows (not aarch64 for Windows currently).
33+ #[ error( "The static binaries are not built for {OS} {ARCH} architecture" ) ]
3134 UnsupportedArchitecture ,
3235
3336 /// Failed to parse a URL.
@@ -98,11 +101,13 @@ impl StaticDistDownloader {
98101 #[ cfg( any(
99102 // Windows support is only for x86_64 architecture (for now)
100103 all( target_os = "windows" , not( target_arch = "x86_64" ) ) ,
101- // Non-Windows platforms support only x86_64 and aarch64 architectures
104+ // Linux and macOS support only x86_64 and aarch64 architectures
102105 all(
103- unix ,
106+ any ( target_os = "linux" , target_os = "macos" ) ,
104107 not( any( target_arch = "x86_64" , target_arch = "aarch64" ) )
105- )
108+ ) ,
109+ // Any OS other than Windows, Linux, or macOS is unsupported
110+ not( any( target_os = "windows" , target_os = "linux" , target_os = "macos" ) ) ,
106111 ) ) ]
107112 return Err ( StaticDistDownloadError :: UnsupportedArchitecture ) ;
108113
0 commit comments