mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Merge pull request #2823 from chinmaygarde/master
Use the artifacts store for iOS assets
This commit is contained in:
commit
fb427a1e5f
1
bin/cache/update_engine.sh
vendored
1
bin/cache/update_engine.sh
vendored
@ -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.');
|
||||
|
Loading…
Reference in New Issue
Block a user