mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Support local paths to third-party jars in flutter apk.
Also improve the error message a bit if a download fails.
This commit is contained in:
parent
dc74fe3d6c
commit
6610b7ea04
@ -328,9 +328,10 @@ class ArtifactStore {
|
||||
File cachedFile = new File(
|
||||
path.join(cacheDir.path, url.pathSegments[url.pathSegments.length-1]));
|
||||
if (!cachedFile.existsSync()) {
|
||||
await _downloadFileToCache(url, cachedFile);
|
||||
if (!cachedFile.existsSync()) {
|
||||
logging.severe('Unable to fetch third-party artifact: $url');
|
||||
try {
|
||||
await _downloadFileToCache(url, cachedFile);
|
||||
} catch (e) {
|
||||
logging.severe('Failed to fetch third-party artifact: $url: $e');
|
||||
throw new ProcessExit(2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,16 +194,17 @@ class ApkCommand extends FlutterCommand {
|
||||
continue;
|
||||
components.services.addAll(serviceConfig['services']);
|
||||
for (String jar in serviceConfig['jars']) {
|
||||
// Jar might refer to an android SDK jar, or URL to download.
|
||||
if (jar.startsWith("android-sdk:")) {
|
||||
// Jar is something shipped in the standard android SDK.
|
||||
jar = jar.replaceAll('android-sdk:', '${components.androidSdk.path}/');
|
||||
components.jars.add(new File(jar));
|
||||
} else if (jar.startsWith("http")) {
|
||||
// Jar is a URL to download.
|
||||
String cachePath = await ArtifactStore.getThirdPartyFile(jar, service);
|
||||
components.jars.add(new File(cachePath));
|
||||
} else {
|
||||
logging.severe('Service depends on a jar in an unrecognized format: $jar');
|
||||
throw new ProcessExit(2);
|
||||
// Assume jar is a path relative to the service's root dir.
|
||||
components.jars.add(new File(path.join(serviceRoot, jar)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user