@@ -29,6 +29,7 @@ use crate::core::builder::{
2929} ;
3030use crate :: core:: config:: TargetSelection ;
3131use crate :: core:: config:: flags:: { Subcommand , get_completion, top_level_help} ;
32+ use crate :: core:: debuggers;
3233use crate :: utils:: build_stamp:: { self , BuildStamp } ;
3334use crate :: utils:: exec:: { BootstrapCommand , command} ;
3435use crate :: utils:: helpers:: {
@@ -38,8 +39,6 @@ use crate::utils::helpers::{
3839use crate :: utils:: render_tests:: { add_flags_and_try_run_tests, try_run_tests} ;
3940use crate :: { CLang , CodegenBackendKind , DocTests , GitRepo , Mode , PathSet , envify} ;
4041
41- const ADB_TEST_DIR : & str = "/data/local/tmp/work" ;
42-
4342/// Runs `cargo test` on various internal tools used by bootstrap.
4443#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
4544pub struct CrateBootstrap {
@@ -2082,39 +2081,24 @@ Please disable assertions with `rust.debug-assertions = false`.
20822081 // modes, even though they should only be needed in "debuginfo" mode,
20832082 // because the GDB-discovery code in compiletest currently assumes that
20842083 // `--android-cross-path` is always set for Android targets.
2085- cmd. arg ( "--adb-path" ) . arg ( "adb" ) ;
2086- cmd. arg ( "--adb-test-dir" ) . arg ( ADB_TEST_DIR ) ;
2087- if target. contains ( "android" ) && !builder. config . dry_run ( ) {
2088- // Assume that cc for this target comes from the android sysroot
2089- cmd. arg ( "--android-cross-path" )
2090- . arg ( builder. cc ( target) . parent ( ) . unwrap ( ) . parent ( ) . unwrap ( ) ) ;
2091- } else {
2092- cmd. arg ( "--android-cross-path" ) . arg ( "" ) ;
2084+ if let Some ( debuggers:: Android { adb_path, adb_test_dir, android_cross_path } ) =
2085+ debuggers:: discover_android ( builder, target)
2086+ {
2087+ cmd. arg ( "--adb-path" ) . arg ( adb_path) ;
2088+ cmd. arg ( "--adb-test-dir" ) . arg ( adb_test_dir) ;
2089+ cmd. arg ( "--android-cross-path" ) . arg ( android_cross_path) ;
20932090 }
20942091
20952092 if mode == "debuginfo" {
2096- if let Some ( ref gdb) = builder. config . gdb {
2093+ if let Some ( debuggers :: Gdb { gdb } ) = debuggers :: discover_gdb ( builder) {
20972094 cmd. arg ( "--gdb" ) . arg ( gdb) ;
20982095 }
20992096
2100- let lldb_exe = builder. config . lldb . clone ( ) . unwrap_or_else ( || PathBuf :: from ( "lldb" ) ) ;
2101- let lldb_version = command ( & lldb_exe)
2102- . allow_failure ( )
2103- . arg ( "--version" )
2104- . run_capture ( builder)
2105- . stdout_if_ok ( )
2106- . and_then ( |v| if v. trim ( ) . is_empty ( ) { None } else { Some ( v) } ) ;
2107- if let Some ( ref vers) = lldb_version {
2108- cmd. arg ( "--lldb-version" ) . arg ( vers) ;
2109- let lldb_python_dir = command ( & lldb_exe)
2110- . allow_failure ( )
2111- . arg ( "-P" )
2112- . run_capture_stdout ( builder)
2113- . stdout_if_ok ( )
2114- . map ( |p| p. lines ( ) . next ( ) . expect ( "lldb Python dir not found" ) . to_string ( ) ) ;
2115- if let Some ( ref dir) = lldb_python_dir {
2116- cmd. arg ( "--lldb-python-dir" ) . arg ( dir) ;
2117- }
2097+ if let Some ( debuggers:: Lldb { lldb_version, lldb_python_dir } ) =
2098+ debuggers:: discover_lldb ( builder)
2099+ {
2100+ cmd. arg ( "--lldb-version" ) . arg ( lldb_version) ;
2101+ cmd. arg ( "--lldb-python-dir" ) . arg ( lldb_python_dir) ;
21182102 }
21192103 }
21202104
0 commit comments