forked from firka/flutter
[flutter_tools] support new SDK structure for sdkmanager (#51980)
This commit is contained in:
@@ -282,13 +282,15 @@ class AndroidSdk {
|
||||
List<AndroidSdkVersion> _sdkVersions;
|
||||
AndroidSdkVersion _latestVersion;
|
||||
|
||||
/// Whether the `platform-tools` directory exists in the Android SDK.
|
||||
/// Whether the `platform-tools` or `cmdline-tools` directory exists in the Android SDK.
|
||||
///
|
||||
/// It is possible to have an Android SDK folder that is missing this with
|
||||
/// the expectation that it will be downloaded later, e.g. by gradle or the
|
||||
/// sdkmanager. The [licensesAvailable] property should be used to determine
|
||||
/// whether the licenses are at least possibly accepted.
|
||||
bool get platformToolsAvailable => globals.fs.directory(globals.fs.path.join(directory, 'platform-tools')).existsSync();
|
||||
bool get platformToolsAvailable =>
|
||||
globals.fs.directory(globals.fs.path.join(directory, 'cmdline-tools')).existsSync() ||
|
||||
globals.fs.directory(globals.fs.path.join(directory, 'platform-tools')).existsSync();
|
||||
|
||||
/// Whether the `licenses` directory exists in the Android SDK.
|
||||
///
|
||||
@@ -545,8 +547,17 @@ class AndroidSdk {
|
||||
_latestVersion = _sdkVersions.isEmpty ? null : _sdkVersions.last;
|
||||
}
|
||||
|
||||
/// Returns the filesystem path of the Android SDK manager tool or null if not found.
|
||||
/// Returns the filesystem path of the Android SDK manager tool.
|
||||
///
|
||||
/// The sdkmanager was previously in the tools directory but this component
|
||||
/// was marked as obsolete in 3.6.
|
||||
String get sdkManagerPath {
|
||||
final File cmdlineTool = globals.fs.file(
|
||||
globals.fs.path.join(directory, 'cmdline-tools', 'latest', 'bin', 'sdkmanager')
|
||||
);
|
||||
if (cmdlineTool.existsSync()) {
|
||||
return cmdlineTool.path;
|
||||
}
|
||||
return globals.fs.path.join(directory, 'tools', 'bin', 'sdkmanager');
|
||||
}
|
||||
|
||||
|
||||
@@ -359,12 +359,6 @@ class AndroidLicenseValidator extends DoctorValidator {
|
||||
throwToolExit(userMessages.androidMissingSdkManager(androidSdk.sdkManagerPath));
|
||||
}
|
||||
|
||||
final Version sdkManagerVersion = Version.parse(androidSdk.sdkManagerVersion);
|
||||
if (sdkManagerVersion == null || sdkManagerVersion.major < 26) {
|
||||
// SDK manager is found, but needs to be updated.
|
||||
throwToolExit(userMessages.androidSdkManagerOutdated(androidSdk.sdkManagerPath));
|
||||
}
|
||||
|
||||
try {
|
||||
final Process process = await processUtils.start(
|
||||
<String>[androidSdk.sdkManagerPath, '--licenses'],
|
||||
|
||||
Reference in New Issue
Block a user