/// <summary> /// Use the package manager to retrieve the set of installed and available packages. /// </summary> /// <param name="complete">Called when the query is complete.</param> public void QueryPackages(Action <AndroidSdkPackageCollection> complete) { SdkManagerUtil.QueryPackages( toolPath, "list sdk -u -e -a", (CommandLine.Result result) => { complete(result.exitCode == 0 ? ParseAndroidListSdkOutput(result.stdout) : null); }); }
/// <summary> /// Install a set of packages. /// </summary> /// <param name="packages">List of package versions to install / upgrade.</param> /// <param name="complete">Called when installation is complete.</param> public void InstallPackages(HashSet <AndroidSdkPackageNameVersion> packages, Action <bool> complete) { var packageNames = new List <string>(); foreach (var pkg in packages) { packageNames.Add(pkg.Name); } SdkManagerUtil.InstallPackages(toolPath, String.Join(" ", packageNames.ToArray()), packages, "Accept? (y/N):", "y", "N", new Regex("^License\\W+[^ ]+:"), complete); }
/// <summary> /// Use the package manager to retrieve the set of installed and available packages. /// </summary> /// <param name="complete">Called when the query is complete.</param> public void QueryPackages(Action <AndroidSdkPackageCollection> complete) { bool useVerbose = Package != null && Package.Version >= MINIMUM_VERSION_FOR_VERBOSE_OUTPUT; SdkManagerUtil.QueryPackages( toolPath, "--list" + (useVerbose ? " --verbose" : ""), (CommandLine.Result result) => { complete(result.exitCode == 0 ? useVerbose ? ParseListVerboseOutput(result.stdout) : ParseListOutput(result.stdout) : null); }); }
/// <summary> /// Install a set of packages. /// </summary> /// <param name="packages">List of package versions to install / upgrade.</param> /// <param name="complete">Called when installation is complete.</param> public void InstallPackages(HashSet <AndroidSdkPackageNameVersion> packages, Action <bool> complete) { var packageNames = new List <string>(); foreach (var pkg in packages) { packageNames.Add(pkg.LegacyName); } SdkManagerUtil.InstallPackages( toolPath, String.Format( "update sdk -a -u -t {0}", String.Join(",", packageNames.ToArray())), packages, "Do you accept the license", "yes", "no", new Regex("^--------"), complete); }