Windows Fixes for Flutter Tools (#7678)
This commit is contained in:
committed by
GitHub
parent
aff4e82891
commit
9f28b4ff71
@@ -52,10 +52,13 @@ if (!(Test-Path $snapshotPath) `
|
||||
Invoke-Expression "$flutterRoot\bin\internal\update_dart_sdk.ps1"
|
||||
|
||||
Write-Host "Building flutter tool..."
|
||||
Set-Location $flutterToolsDir
|
||||
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"
|
||||
Set-Location $flutterRoot
|
||||
Pop-Location
|
||||
|
||||
Invoke-Expression "$dart --snapshot=`"$snapshotPath`" `"$scriptPath`" --packages=`"$flutterToolsDir\.packages`""
|
||||
$revision | Out-File $stampPath
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ List<_Asset> _getMaterialAssets(String fontSet) {
|
||||
for (Map<String, dynamic> font in family['fonts']) {
|
||||
String assetKey = font['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),
|
||||
relativePath: assetKey
|
||||
));
|
||||
@@ -438,7 +438,7 @@ dynamic _loadFlutterManifest(String manifestPath) {
|
||||
Future<int> _validateFlutterManifest(Object manifest) async {
|
||||
String schemaPath = path.join(path.absolute(Cache.flutterRoot),
|
||||
'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);
|
||||
if (validator.validate(manifest)) {
|
||||
|
||||
@@ -45,6 +45,7 @@ bool isEmulatorBuildMode(BuildMode mode) => mode == BuildMode.debug;
|
||||
enum HostPlatform {
|
||||
darwin_x64,
|
||||
linux_x64,
|
||||
windows_x64,
|
||||
}
|
||||
|
||||
String getNameForHostPlatform(HostPlatform platform) {
|
||||
@@ -53,6 +54,8 @@ String getNameForHostPlatform(HostPlatform platform) {
|
||||
return 'darwin-x64';
|
||||
case HostPlatform.linux_x64:
|
||||
return 'linux-x64';
|
||||
case HostPlatform.windows_x64:
|
||||
return 'windows-x64';
|
||||
}
|
||||
assert(false);
|
||||
return null;
|
||||
@@ -110,6 +113,8 @@ HostPlatform getCurrentHostPlatform() {
|
||||
return HostPlatform.darwin_x64;
|
||||
if (platform.isLinux)
|
||||
return HostPlatform.linux_x64;
|
||||
if (platform.isWindows)
|
||||
return HostPlatform.windows_x64;
|
||||
|
||||
printError('Unsupported host platform, defaulting to Linux');
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:path/path.dart' as path;
|
||||
import '../base/common.dart';
|
||||
import '../base/file_system.dart';
|
||||
import '../base/logger.dart';
|
||||
import '../base/os.dart';
|
||||
import '../base/process.dart';
|
||||
import '../base/utils.dart';
|
||||
import '../build_info.dart';
|
||||
@@ -118,16 +119,17 @@ Future<String> _buildAotSnapshot(
|
||||
String entryPointsDir, dartEntryPointsDir, snapshotterDir, genSnapshot;
|
||||
|
||||
String engineSrc = tools.engineSrcPath;
|
||||
String genSnapshotExecutable = os.getExecutableName('gen_snapshot');
|
||||
if (engineSrc != null) {
|
||||
entryPointsDir = path.join(engineSrc, 'flutter', 'runtime');
|
||||
dartEntryPointsDir = path.join(engineSrc, 'dart', 'runtime', 'bin');
|
||||
snapshotterDir = path.join(engineSrc, 'flutter', 'lib', 'snapshot');
|
||||
String engineOut = tools.getEngineArtifactsDirectory(platform, buildMode).path;
|
||||
if (platform == TargetPlatform.ios) {
|
||||
genSnapshot = path.join(engineOut, 'clang_x64', 'gen_snapshot');
|
||||
genSnapshot = path.join(engineOut, 'clang_x64', genSnapshotExecutable);
|
||||
} else {
|
||||
String host32BitToolchain = getCurrentHostPlatform() == HostPlatform.darwin_x64 ? 'clang_i386' : 'clang_x86';
|
||||
genSnapshot = path.join(engineOut, host32BitToolchain, 'gen_snapshot');
|
||||
genSnapshot = path.join(engineOut, host32BitToolchain, genSnapshotExecutable);
|
||||
}
|
||||
} else {
|
||||
String artifactsDir = tools.getEngineArtifactsDirectory(platform, buildMode).path;
|
||||
@@ -135,10 +137,10 @@ Future<String> _buildAotSnapshot(
|
||||
dartEntryPointsDir = entryPointsDir;
|
||||
snapshotterDir = entryPointsDir;
|
||||
if (platform == TargetPlatform.ios) {
|
||||
genSnapshot = path.join(artifactsDir, 'gen_snapshot');
|
||||
genSnapshot = path.join(artifactsDir, genSnapshotExecutable);
|
||||
} else {
|
||||
String hostToolsDir = path.join(artifactsDir, getNameForHostPlatform(getCurrentHostPlatform()));
|
||||
genSnapshot = path.join(hostToolsDir, 'gen_snapshot');
|
||||
genSnapshot = path.join(hostToolsDir, genSnapshotExecutable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user