Commit graph

35 commits

Author SHA1 Message Date
Jiahao XU
b2d09e2b13
Rm unused derive(Clone) for DesiredTargets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 15:07:09 +10:00
Jiahao XU
eda7b9445a
Rm unnecessary Arc inside DesiredTargetsInner
Since `DesiredTargets` is now stored in `binstall::Options`, which
itself is wrapped in an `Arc`, `DesiredTargetsInner::Initialized` no
longer needs an `Arc` for O(1) `clone`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 15:06:00 +10:00
Jiahao XU
758dab7d4f
Optimize DesiredTargets: Avoid mem alloc on clone
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-19 11:59:10 +10:00
Jiahao XU
9e1f873bb5
derive(Clone) for DesiredTargets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 16:05:37 +10:00
Jiahao XU
1ec1f972b7
Fix copy-paste error in detect_targets_windows
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-01 19:46:30 +10:00
Jiahao XU
8e58398f57
Fix windows target detection for abi gnullvm
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-01 19:34:52 +10:00
Jiahao XU
ec6f81935c
Refactor: Extract detect_alternative_targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-01 19:30:31 +10:00
Félix Saparelli
9d70e33337
Merge pull request #193 from NobodyXu/fix/macos-target-detection
Fix macos detection: Use built-time `TARGET` as fallback
2022-06-28 03:10:18 +12:00
Félix Saparelli
cc8144e06d
Merge pull request #192 from NobodyXu/optimize/parallelize-target-detection
Optimize/parallelize target detection
2022-06-23 21:41:15 +12:00
Jiahao XU
536f3b2c6f
Fix macos detection: Use super::TARGET as fallback
When `guess_host_triple` failed to detect the target.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 19:39:36 +10:00
Jiahao XU
be4b3ead97
Add new fn get_desired_targets & newtype DesiredTargets
so that if `opts.targets` is `None`, the future returned by
`detect_targets` can be run in parallel by using `tokio::spawn` with
other async code in `entry`, such as `fetch_crate_cratesio`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 14:46:53 +10:00
Jiahao XU
8bc0f11569
Detect *-pc-windows-gnu targets in targets
And add fallback `*-pc-windows-msvc` to the returned targets.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 13:59:53 +10:00
Félix Saparelli
0b5d3ec1a6
Fix format now
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 01:44:11 +12:00
Félix Saparelli
fa56a729b0
Just unwrap it 2022-06-08 01:42:25 +12:00
Félix Saparelli
fcf5728dde
Replace Box<str> with String 2022-06-08 00:54:49 +12:00
Jiahao XU
ecf6fdbab5
Revert back to using Vec<Box<str>> for targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 12:20:46 +10:00
Jiahao XU
9ee2609b25
Refactor get_target_from_rustc impl
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 12:14:27 +10:00
Jiahao XU
96336e4dd9
Update doc of get_target_from_rustc
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 12:11:49 +10:00
Jiahao XU
95b7c4f771
Rename get_targets_from_rustc to get_target_from_rustc
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 12:11:04 +10:00
Jiahao XU
1d71f92ee6
Impl IntoIterator for &Targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 12:10:05 +10:00
Jiahao XU
efc8119c45
Add opaque newtype Targets over ArrayVec<Box<str>, 2>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 11:45:53 +10:00
Jiahao XU
11fe943a11
Fix parse_abi for gnu_ilp32 and gnuspe
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 11:30:00 +10:00
Jiahao XU
1df135f4c0
Fix target::linux::parse_abi: Remove const
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 00:20:52 +10:00
Jiahao XU
44b1bdbfe5
Fix use of ends_with
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 23:20:09 +10:00
Jiahao XU
3f7f293b78
Fix bugs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 23:17:07 +10:00
Jiahao XU
c9c3cffb25
Fix detect_targets for win and other targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 23:08:00 +10:00
Jiahao XU
6b764b0b3f
Add fallbacks for get_targets_from_rustc
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 23:07:25 +10:00
Jiahao XU
cce378e2c5
Add get_targets_from_rustc to detect_targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 23:00:33 +10:00
Jiahao XU
8bf4d187ee
Rename parse_libc_version to parse_libc_version_from_ldd_output
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:53:12 +10:00
Jiahao XU
7232f32428
Use ArrayVec to avoid heap alloc in detect_targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:52:11 +10:00
Jiahao XU
b74139f457
Support for other platforms in detect_targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:42:43 +10:00
Jiahao XU
9a8b28afcf
Fix invocation of linux::detect_targets_linux
in `detect_targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:41:36 +10:00
Jiahao XU
4157f20b99
Support for macos in detect_targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:40:52 +10:00
Jiahao XU
8bd4b9b6a1
Impl detect_targets for linux
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:32:15 +10:00
Jiahao XU
69f2a56595
Move TARGET in lib.rs into new mod target.rs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:00:01 +10:00