Commit 6610b7ea authored by Matt Perry's avatar Matt Perry

Support local paths to third-party jars in flutter apk.

Also improve the error message a bit if a download fails.
parent dc74fe3d
......@@ -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)));
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment