Add support for building on Fuchsia (#6415)

This patch makes it possible to build Flutter apps that use the framework on
Fuchsia.
This commit is contained in:
Adam Barth 2016-10-20 01:32:45 -07:00 committed by GitHub
parent 6d99acfdde
commit c074265298
4 changed files with 29 additions and 2 deletions

20
packages/flutter/BUILD.gn Normal file
View file

@ -0,0 +1,20 @@
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/dart/dart_package.gni")
dart_package("flutter") {
package_name = "flutter"
source_dir = "lib"
deps = [
"//third_party/dart-pkg/pub/async",
"//third_party/dart-pkg/pub/collection",
"//third_party/dart-pkg/pub/http_parser",
"//third_party/dart-pkg/pub/intl",
"//third_party/dart-pkg/pub/meta",
"//third_party/dart-pkg/pub/vector_math",
]
}

View file

@ -9,6 +9,7 @@ import 'package:args/args.dart';
import '../lib/src/base/context.dart';
import '../lib/src/base/logger.dart';
import '../lib/src/cache.dart';
import '../lib/src/flx.dart';
import '../lib/src/globals.dart';
@ -48,6 +49,7 @@ Future<Null> main(List<String> args) async {
printError('Missing option! All options must be specified.');
exit(1);
}
Cache.flutterRoot = Platform.environment['FLUTTER_ROOT'];
String outputPath = argResults[_kOptionOutput];
final int buildResult = await build(
snapshotterPath: argResults[_kOptionSnapshotter],

View file

@ -68,10 +68,12 @@ class AssetBundle {
Future<int> build({
String manifestPath: defaultManifestPath,
String workingDirPath,
String packagesPath,
bool includeRobotoFonts: true,
bool reportLicensedPackages: false
}) async {
workingDirPath ??= getAssetBuildDirectory();
packagesPath ??= path.absolute(PackageMap.globalPackagesPath);
Object manifest = _loadFlutterYamlManifest(manifestPath);
if (manifest == null) {
// No manifest file found for this application.
@ -88,8 +90,7 @@ class AssetBundle {
_lastBuildTimestamp = new DateTime.now();
final PackageMap packageMap =
new PackageMap(path.join(assetBasePath, '.packages'));
final PackageMap packageMap = new PackageMap(packagesPath);
Map<_Asset, List<_Asset>> assetVariants = _parseAssets(
packageMap,

View file

@ -118,6 +118,7 @@ Future<int> build({
outputPath: outputPath,
privateKeyPath: privateKeyPath,
workingDirPath: workingDirPath,
packagesPath: packagesPath,
includeRobotoFonts: includeRobotoFonts,
reportLicensedPackages: reportLicensedPackages
);
@ -129,11 +130,13 @@ Future<int> assemble({
String outputPath,
String privateKeyPath: defaultPrivateKeyPath,
String workingDirPath,
String packagesPath,
bool includeRobotoFonts: true,
bool reportLicensedPackages: false
}) async {
outputPath ??= defaultFlxOutputPath;
workingDirPath ??= getAssetBuildDirectory();
packagesPath ??= path.absolute(PackageMap.globalPackagesPath);
printTrace('Building $outputPath');
// Build the asset bundle.
@ -141,6 +144,7 @@ Future<int> assemble({
int result = await assetBundle.build(
manifestPath: manifestPath,
workingDirPath: workingDirPath,
packagesPath: packagesPath,
includeRobotoFonts: includeRobotoFonts,
reportLicensedPackages: reportLicensedPackages
);