Commit 9f28b4ff authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Windows Fixes for Flutter Tools (#7678)

parent aff4e828
...@@ -52,10 +52,13 @@ if (!(Test-Path $snapshotPath) ` ...@@ -52,10 +52,13 @@ if (!(Test-Path $snapshotPath) `
Invoke-Expression "$flutterRoot\bin\internal\update_dart_sdk.ps1" Invoke-Expression "$flutterRoot\bin\internal\update_dart_sdk.ps1"
Write-Host "Building flutter tool..." Write-Host "Building flutter tool..."
Set-Location $flutterToolsDir
if (Test-Path "$flutterToolsDir\pubspec.lock") { Remove-Item "$flutterToolsDir\pubspec.lock" } if (Test-Path "$flutterToolsDir\pubspec.lock") { Remove-Item "$flutterToolsDir\pubspec.lock" }
Push-Location
Set-Location $flutterToolsDir
Invoke-Expression "$pub get --verbosity=error --no-packages-dir" Invoke-Expression "$pub get --verbosity=error --no-packages-dir"
Set-Location $flutterRoot Pop-Location
Invoke-Expression "$dart --snapshot=`"$snapshotPath`" `"$scriptPath`" --packages=`"$flutterToolsDir\.packages`"" Invoke-Expression "$dart --snapshot=`"$snapshotPath`" `"$scriptPath`" --packages=`"$flutterToolsDir\.packages`""
$revision | Out-File $stampPath $revision | Out-File $stampPath
} }
......
...@@ -212,7 +212,7 @@ List<_Asset> _getMaterialAssets(String fontSet) { ...@@ -212,7 +212,7 @@ List<_Asset> _getMaterialAssets(String fontSet) {
for (Map<String, dynamic> font in family['fonts']) { for (Map<String, dynamic> font in family['fonts']) {
String assetKey = font['asset']; String assetKey = font['asset'];
result.add(new _Asset( result.add(new _Asset(
base: '${Cache.flutterRoot}/bin/cache/artifacts/material_fonts', base: path.join(Cache.flutterRoot, 'bin', 'cache', 'artifacts', 'material_fonts'),
source: path.basename(assetKey), source: path.basename(assetKey),
relativePath: assetKey relativePath: assetKey
)); ));
...@@ -438,7 +438,7 @@ dynamic _loadFlutterManifest(String manifestPath) { ...@@ -438,7 +438,7 @@ dynamic _loadFlutterManifest(String manifestPath) {
Future<int> _validateFlutterManifest(Object manifest) async { Future<int> _validateFlutterManifest(Object manifest) async {
String schemaPath = path.join(path.absolute(Cache.flutterRoot), String schemaPath = path.join(path.absolute(Cache.flutterRoot),
'packages', 'flutter_tools', 'schema', 'pubspec_yaml.json'); 'packages', 'flutter_tools', 'schema', 'pubspec_yaml.json');
Schema schema = await Schema.createSchemaFromUrl('file://$schemaPath'); Schema schema = await Schema.createSchemaFromUrl(path.toUri(schemaPath).toString());
Validator validator = new Validator(schema); Validator validator = new Validator(schema);
if (validator.validate(manifest)) { if (validator.validate(manifest)) {
......
...@@ -45,6 +45,7 @@ bool isEmulatorBuildMode(BuildMode mode) => mode == BuildMode.debug; ...@@ -45,6 +45,7 @@ bool isEmulatorBuildMode(BuildMode mode) => mode == BuildMode.debug;
enum HostPlatform { enum HostPlatform {
darwin_x64, darwin_x64,
linux_x64, linux_x64,
windows_x64,
} }
String getNameForHostPlatform(HostPlatform platform) { String getNameForHostPlatform(HostPlatform platform) {
...@@ -53,6 +54,8 @@ String getNameForHostPlatform(HostPlatform platform) { ...@@ -53,6 +54,8 @@ String getNameForHostPlatform(HostPlatform platform) {
return 'darwin-x64'; return 'darwin-x64';
case HostPlatform.linux_x64: case HostPlatform.linux_x64:
return 'linux-x64'; return 'linux-x64';
case HostPlatform.windows_x64:
return 'windows-x64';
} }
assert(false); assert(false);
return null; return null;
...@@ -110,6 +113,8 @@ HostPlatform getCurrentHostPlatform() { ...@@ -110,6 +113,8 @@ HostPlatform getCurrentHostPlatform() {
return HostPlatform.darwin_x64; return HostPlatform.darwin_x64;
if (platform.isLinux) if (platform.isLinux)
return HostPlatform.linux_x64; return HostPlatform.linux_x64;
if (platform.isWindows)
return HostPlatform.windows_x64;
printError('Unsupported host platform, defaulting to Linux'); printError('Unsupported host platform, defaulting to Linux');
......
...@@ -9,6 +9,7 @@ import 'package:path/path.dart' as path; ...@@ -9,6 +9,7 @@ import 'package:path/path.dart' as path;
import '../base/common.dart'; import '../base/common.dart';
import '../base/file_system.dart'; import '../base/file_system.dart';
import '../base/logger.dart'; import '../base/logger.dart';
import '../base/os.dart';
import '../base/process.dart'; import '../base/process.dart';
import '../base/utils.dart'; import '../base/utils.dart';
import '../build_info.dart'; import '../build_info.dart';
...@@ -118,16 +119,17 @@ Future<String> _buildAotSnapshot( ...@@ -118,16 +119,17 @@ Future<String> _buildAotSnapshot(
String entryPointsDir, dartEntryPointsDir, snapshotterDir, genSnapshot; String entryPointsDir, dartEntryPointsDir, snapshotterDir, genSnapshot;
String engineSrc = tools.engineSrcPath; String engineSrc = tools.engineSrcPath;
String genSnapshotExecutable = os.getExecutableName('gen_snapshot');
if (engineSrc != null) { if (engineSrc != null) {
entryPointsDir = path.join(engineSrc, 'flutter', 'runtime'); entryPointsDir = path.join(engineSrc, 'flutter', 'runtime');
dartEntryPointsDir = path.join(engineSrc, 'dart', 'runtime', 'bin'); dartEntryPointsDir = path.join(engineSrc, 'dart', 'runtime', 'bin');
snapshotterDir = path.join(engineSrc, 'flutter', 'lib', 'snapshot'); snapshotterDir = path.join(engineSrc, 'flutter', 'lib', 'snapshot');
String engineOut = tools.getEngineArtifactsDirectory(platform, buildMode).path; String engineOut = tools.getEngineArtifactsDirectory(platform, buildMode).path;
if (platform == TargetPlatform.ios) { if (platform == TargetPlatform.ios) {
genSnapshot = path.join(engineOut, 'clang_x64', 'gen_snapshot'); genSnapshot = path.join(engineOut, 'clang_x64', genSnapshotExecutable);
} else { } else {
String host32BitToolchain = getCurrentHostPlatform() == HostPlatform.darwin_x64 ? 'clang_i386' : 'clang_x86'; String host32BitToolchain = getCurrentHostPlatform() == HostPlatform.darwin_x64 ? 'clang_i386' : 'clang_x86';
genSnapshot = path.join(engineOut, host32BitToolchain, 'gen_snapshot'); genSnapshot = path.join(engineOut, host32BitToolchain, genSnapshotExecutable);
} }
} else { } else {
String artifactsDir = tools.getEngineArtifactsDirectory(platform, buildMode).path; String artifactsDir = tools.getEngineArtifactsDirectory(platform, buildMode).path;
...@@ -135,10 +137,10 @@ Future<String> _buildAotSnapshot( ...@@ -135,10 +137,10 @@ Future<String> _buildAotSnapshot(
dartEntryPointsDir = entryPointsDir; dartEntryPointsDir = entryPointsDir;
snapshotterDir = entryPointsDir; snapshotterDir = entryPointsDir;
if (platform == TargetPlatform.ios) { if (platform == TargetPlatform.ios) {
genSnapshot = path.join(artifactsDir, 'gen_snapshot'); genSnapshot = path.join(artifactsDir, genSnapshotExecutable);
} else { } else {
String hostToolsDir = path.join(artifactsDir, getNameForHostPlatform(getCurrentHostPlatform())); String hostToolsDir = path.join(artifactsDir, getNameForHostPlatform(getCurrentHostPlatform()));
genSnapshot = path.join(hostToolsDir, 'gen_snapshot'); genSnapshot = path.join(hostToolsDir, genSnapshotExecutable);
} }
} }
......
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