Commit 68a3aa70 authored by Chinmay Garde's avatar Chinmay Garde

Use the artifacts store for iOS assets

parent c8377d74
646500663e7db5deaab2d0a8a96ace2b29d0da27
c358ddc8f81dc1a59d01bd50420c5fc979c28f19
......@@ -61,6 +61,7 @@ if [ ! -f "$ENGINE_STAMP_PATH" ] || [ "$ENGINE_VERSION" != `cat "$ENGINE_STAMP_P
Darwin)
download_artifacts darwin-x64
chmod a+x "$ENGINE_ARTIFACT_PATH/darwin-x64/sky_snapshot"
download_artifacts ios
;;
Linux)
download_artifacts linux-x64
......
......@@ -42,6 +42,7 @@ enum ArtifactType {
androidIcuData,
androidKeystore,
androidLibSkyShell,
iosXcodeProject,
}
class Artifact {
......@@ -125,6 +126,12 @@ class ArtifactStore {
type: ArtifactType.androidLibSkyShell,
targetPlatform: TargetPlatform.android_arm
),
const Artifact._(
name: 'iOS Runner (Xcode Project)',
fileName: 'FlutterXcode.zip',
type: ArtifactType.iosXcodeProject,
targetPlatform: TargetPlatform.ios
),
];
static Artifact getArtifact({
......
......@@ -8,35 +8,11 @@ import 'dart:io';
import 'package:path/path.dart' as path;
import '../artifacts.dart';
import '../build_configuration.dart';
import '../base/process.dart';
import '../globals.dart';
import '../runner/flutter_command_runner.dart';
Uri _xcodeProjectUri(String revision) {
String uriString = 'https://storage.googleapis.com/flutter_infra/flutter/$revision/ios/FlutterXcode.zip';
return Uri.parse(uriString);
}
Future<List<int>> _fetchXcodeArchive() async {
printStatus('Fetching the Xcode project archive from the cloud...');
HttpClient client = new HttpClient();
Uri xcodeProjectUri = _xcodeProjectUri(ArtifactStore.engineRevision);
printStatus('Downloading $xcodeProjectUri...');
HttpClientRequest request = await client.getUrl(xcodeProjectUri);
HttpClientResponse response = await request.close();
if (response.statusCode != 200)
throw new Exception(response.reasonPhrase);
BytesBuilder bytesBuilder = new BytesBuilder(copy: false);
await for (List<int> chunk in response)
bytesBuilder.add(chunk);
return bytesBuilder.takeBytes();
}
Future<bool> _inflateXcodeArchive(String directory, List<int> archiveBytes) async {
printStatus('Unzipping Xcode project to local directory...');
......@@ -117,7 +93,14 @@ Future<int> setupXcodeProjectHarness(String flutterProjectPath) async {
// Step 1: Fetch the archive from the cloud
String iosFilesPath = path.join(flutterProjectPath, 'ios');
String xcodeprojPath = path.join(iosFilesPath, '.generated');
List<int> archiveBytes = await _fetchXcodeArchive();
Artifact xcodeProject = ArtifactStore.getArtifact(
type: ArtifactType.iosXcodeProject,
targetPlatform: TargetPlatform.ios
);
String xcodeProjectPath = await ArtifactStore.getPath(xcodeProject);
List<int> archiveBytes = await new File(xcodeProjectPath).readAsBytes();
if (archiveBytes.isEmpty) {
printError('Error: No archive bytes received.');
......
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