fix: Complete Windows deployment pipeline
Fixes critical bugs in Windows APK deployment workflow including APK path resolution, adb integration, and config file parsing. Changes: - Fix APK search to look for TeamCode-debug.apk instead of *app-debug.apk - Strip both single and double quotes from batch file path parsing - Add android_sdk_path to project configuration (.weevil.toml) - Resolve adb.exe from Android SDK platform-tools directory - Check adb install exit code and report deployment failures correctly - Add migration support for old .weevil.toml files missing android_sdk_path - Update all tests to use new ProjectConfig::new() signature The deployment workflow now properly finds the generated APK, locates adb, and reports success/failure accurately on Windows.
This commit is contained in:
@@ -9,10 +9,16 @@ pub struct ProjectConfig {
|
||||
pub weevil_version: String,
|
||||
pub ftc_sdk_path: PathBuf,
|
||||
pub ftc_sdk_version: String,
|
||||
#[serde(default = "default_android_sdk_path")]
|
||||
pub android_sdk_path: PathBuf,
|
||||
}
|
||||
|
||||
fn default_android_sdk_path() -> PathBuf {
|
||||
PathBuf::new()
|
||||
}
|
||||
|
||||
impl ProjectConfig {
|
||||
pub fn new(project_name: &str, ftc_sdk_path: PathBuf) -> Result<Self> {
|
||||
pub fn new(project_name: &str, ftc_sdk_path: PathBuf, android_sdk_path: PathBuf) -> Result<Self> {
|
||||
let ftc_sdk_version = crate::sdk::ftc::get_version(&ftc_sdk_path)
|
||||
.unwrap_or_else(|_| "unknown".to_string());
|
||||
|
||||
@@ -21,6 +27,7 @@ impl ProjectConfig {
|
||||
weevil_version: "1.0.0".to_string(),
|
||||
ftc_sdk_path,
|
||||
ftc_sdk_version,
|
||||
android_sdk_path,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -34,9 +41,15 @@ impl ProjectConfig {
|
||||
let contents = fs::read_to_string(&config_path)
|
||||
.context("Failed to read .weevil.toml")?;
|
||||
|
||||
let config: ProjectConfig = toml::from_str(&contents)
|
||||
let mut config: ProjectConfig = toml::from_str(&contents)
|
||||
.context("Failed to parse .weevil.toml")?;
|
||||
|
||||
// Migrate old configs that don't have android_sdk_path
|
||||
if config.android_sdk_path.as_os_str().is_empty() {
|
||||
let sdk_config = crate::sdk::SdkConfig::new()?;
|
||||
config.android_sdk_path = sdk_config.android_sdk_path;
|
||||
}
|
||||
|
||||
Ok(config)
|
||||
}
|
||||
|
||||
@@ -77,6 +90,7 @@ impl ProjectConfig {
|
||||
println!();
|
||||
println!("{:.<20} {}", "FTC SDK Path", self.ftc_sdk_path.display().to_string().bright_white());
|
||||
println!("{:.<20} {}", "FTC SDK Version", self.ftc_sdk_version.bright_white());
|
||||
println!("{:.<20} {}", "Android SDK Path", self.android_sdk_path.display().to_string().bright_white());
|
||||
println!();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user