Commit f307735e authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Remove the assembleFlx accessor and FLX asset path overrides (#4671)

This is now obsolete
parent b81229b5
// 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 'dart:async';
import 'dart:io';
import 'src/flx.dart' as flx;
/// Assembles a Flutter .flx file from a pre-existing manifest descriptor and a
/// pre-compiled snapshot.
Future<int> assembleFlx({
Map<String, dynamic> manifestDescriptor: const <String, dynamic>{},
File snapshotFile: null,
String assetBasePath: flx.defaultAssetBasePath,
Map<String, String> assetPathOverrides: const <String, String>{},
String outputPath: flx.defaultFlxOutputPath,
String privateKeyPath: flx.defaultPrivateKeyPath
}) async {
return flx.assemble(
manifestDescriptor: manifestDescriptor,
snapshotFile: snapshotFile,
assetBasePath: assetBasePath,
assetPathOverrides: assetPathOverrides,
outputPath: outputPath,
privateKeyPath: privateKeyPath
);
}
...@@ -127,8 +127,7 @@ List<_Asset> _getMaterialAssets(String fontSet) { ...@@ -127,8 +127,7 @@ List<_Asset> _getMaterialAssets(String fontSet) {
Map<_Asset, List<_Asset>> _parseAssets( Map<_Asset, List<_Asset>> _parseAssets(
PackageMap packageMap, PackageMap packageMap,
Map<String, dynamic> manifestDescriptor, Map<String, dynamic> manifestDescriptor,
String assetBase, String assetBase, {
Map<String, String> assetPathOverrides, {
List<String> excludeDirs: const <String>[] List<String> excludeDirs: const <String>[]
}) { }) {
Map<_Asset, List<_Asset>> result = <_Asset, List<_Asset>>{}; Map<_Asset, List<_Asset>> result = <_Asset, List<_Asset>>{};
...@@ -141,7 +140,7 @@ Map<_Asset, List<_Asset>> _parseAssets( ...@@ -141,7 +140,7 @@ Map<_Asset, List<_Asset>> _parseAssets(
if (manifestDescriptor.containsKey('assets')) { if (manifestDescriptor.containsKey('assets')) {
for (String asset in manifestDescriptor['assets']) { for (String asset in manifestDescriptor['assets']) {
_Asset baseAsset = _resolveAsset(packageMap, assetBase, assetPathOverrides, asset); _Asset baseAsset = _resolveAsset(packageMap, assetBase, asset);
if (!baseAsset.assetFileExists) { if (!baseAsset.assetFileExists) {
printError('Error: unable to locate asset entry in flutter.yaml: "$asset".'); printError('Error: unable to locate asset entry in flutter.yaml: "$asset".');
...@@ -187,7 +186,7 @@ Map<_Asset, List<_Asset>> _parseAssets( ...@@ -187,7 +186,7 @@ Map<_Asset, List<_Asset>> _parseAssets(
String asset = font['asset']; String asset = font['asset'];
if (asset == null) continue; if (asset == null) continue;
_Asset baseAsset = _resolveAsset(packageMap, assetBase, assetPathOverrides, asset); _Asset baseAsset = _resolveAsset(packageMap, assetBase, asset);
if (!baseAsset.assetFileExists) { if (!baseAsset.assetFileExists) {
printError('Error: unable to locate asset entry in flutter.yaml: "$asset".'); printError('Error: unable to locate asset entry in flutter.yaml: "$asset".');
return null; return null;
...@@ -204,18 +203,8 @@ Map<_Asset, List<_Asset>> _parseAssets( ...@@ -204,18 +203,8 @@ Map<_Asset, List<_Asset>> _parseAssets(
_Asset _resolveAsset( _Asset _resolveAsset(
PackageMap packageMap, PackageMap packageMap,
String assetBase, String assetBase,
Map<String, String> assetPathOverrides,
String asset String asset
) { ) {
String overridePath = assetPathOverrides[asset];
if (overridePath != null) {
return new _Asset(
base: path.dirname(overridePath),
source: path.basename(overridePath),
relativePath: asset
);
}
if (asset.startsWith('packages/') && !FileSystemEntity.isFileSync(path.join(assetBase, asset))) { if (asset.startsWith('packages/') && !FileSystemEntity.isFileSync(path.join(assetBase, asset))) {
// Convert packages/flutter_gallery_assets/clouds-0.png to clouds-0.png. // Convert packages/flutter_gallery_assets/clouds-0.png to clouds-0.png.
String packageKey = asset.substring(9); String packageKey = asset.substring(9);
...@@ -387,7 +376,6 @@ Future<int> assemble({ ...@@ -387,7 +376,6 @@ Future<int> assemble({
Map<String, dynamic> manifestDescriptor: const <String, dynamic>{}, Map<String, dynamic> manifestDescriptor: const <String, dynamic>{},
File snapshotFile, File snapshotFile,
String assetBasePath: defaultAssetBasePath, String assetBasePath: defaultAssetBasePath,
Map<String, String> assetPathOverrides: const <String, String>{},
String outputPath: defaultFlxOutputPath, String outputPath: defaultFlxOutputPath,
String privateKeyPath: defaultPrivateKeyPath, String privateKeyPath: defaultPrivateKeyPath,
String workingDirPath: defaultWorkingDirPath, String workingDirPath: defaultWorkingDirPath,
...@@ -399,7 +387,6 @@ Future<int> assemble({ ...@@ -399,7 +387,6 @@ Future<int> assemble({
new PackageMap(path.join(assetBasePath, '.packages')), new PackageMap(path.join(assetBasePath, '.packages')),
manifestDescriptor, manifestDescriptor,
assetBasePath, assetBasePath,
assetPathOverrides,
excludeDirs: <String>[workingDirPath, path.join(assetBasePath, 'build')] excludeDirs: <String>[workingDirPath, path.join(assetBasePath, 'build')]
); );
......
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