Commit 1bdf3518 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Merge pubspec.yaml and flutter.yaml. (#7605)

parent ba4d78ac
...@@ -4,3 +4,5 @@ dependencies: ...@@ -4,3 +4,5 @@ dependencies:
sdk: flutter sdk: flutter
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter:
uses-material-design: true
name: complex_layout
uses-material-design: true
assets:
- packages/flutter_gallery_assets/ali_connors.png
- packages/flutter_gallery_assets/ali_connors_sml.png
- packages/flutter_gallery_assets/top_10_australian_beaches.png
name: complex_layout name: complex_layout
description: A new flutter project. description: A benchmark of a relatively complex layout.
dependencies: dependencies:
flutter: flutter:
...@@ -16,3 +16,10 @@ dependencies: ...@@ -16,3 +16,10 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter:
uses-material-design: true
assets:
- packages/flutter_gallery_assets/ali_connors.png
- packages/flutter_gallery_assets/ali_connors_sml.png
- packages/flutter_gallery_assets/top_10_australian_beaches.png
name: microbenchmarks
uses-material-design: true
name: microbenchmarks name: microbenchmarks
description: A new flutter project. description: Small benchmarks for very specific parts of the Flutter framework.
dependencies: dependencies:
meta: ^1.0.3 meta: ^1.0.3
flutter: flutter:
...@@ -8,3 +8,5 @@ dependencies: ...@@ -8,3 +8,5 @@ dependencies:
sdk: flutter sdk: flutter
stocks: stocks:
path: ../../../examples/stocks path: ../../../examples/stocks
flutter:
uses-material-design: true
uses-material-design: true
name: flutter_manual_tests name: flutter_manual_tests
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter:
uses-material-design: true
name: flutter_gallery
uses-material-design: true
assets:
- lib/gallery/example_code.dart
- packages/flutter_gallery_assets/appbar_background.jpg
- packages/flutter_gallery_assets/appbar/appbar_background_layer0.png
- packages/flutter_gallery_assets/appbar/appbar_background_layer1.png
- packages/flutter_gallery_assets/appbar/appbar_background_layer2.png
- packages/flutter_gallery_assets/appbar/appbar_background_layer3.png
- packages/flutter_gallery_assets/appbar/appbar_background_layer4.png
- packages/flutter_gallery_assets/appbar/appbar_background_layer5.png
- packages/flutter_gallery_assets/pesto/avatar.jpg
- packages/flutter_gallery_assets/pesto/image10.jpg
- packages/flutter_gallery_assets/pesto/image11.jpg
- packages/flutter_gallery_assets/pesto/image12.jpg
- packages/flutter_gallery_assets/pesto/image13.jpg
- packages/flutter_gallery_assets/pesto/image1.jpg
- packages/flutter_gallery_assets/pesto/image2.jpg
- packages/flutter_gallery_assets/pesto/image3.jpg
- packages/flutter_gallery_assets/pesto/image4.jpg
- packages/flutter_gallery_assets/pesto/image5.jpg
- packages/flutter_gallery_assets/pesto/image6.jpg
- packages/flutter_gallery_assets/pesto/image7.jpg
- packages/flutter_gallery_assets/pesto/image8.jpg
- packages/flutter_gallery_assets/pesto/image9.jpg
- packages/flutter_gallery_assets/pesto/logo_small.png
- packages/flutter_gallery_assets/pesto/logo_medium.png
- packages/flutter_gallery_assets/pesto/fish.png
- packages/flutter_gallery_assets/pesto/healthy.png
- packages/flutter_gallery_assets/pesto/main.png
- packages/flutter_gallery_assets/pesto/meat.png
- packages/flutter_gallery_assets/pesto/quick.png
- packages/flutter_gallery_assets/pesto/spicy.png
- packages/flutter_gallery_assets/pesto/veggie.png
- packages/flutter_gallery_assets/about_logo.png
- packages/flutter_gallery_assets/ali_connors.jpg
- packages/flutter_gallery_assets/drawer_logo.png
- packages/flutter_gallery_assets/kangaroo_valley_safari.jpg
- packages/flutter_gallery_assets/top_10_australian_beaches.jpg
- packages/flutter_gallery_assets/landscape_0.jpg
- packages/flutter_gallery_assets/landscape_1.jpg
- packages/flutter_gallery_assets/landscape_2.jpg
- packages/flutter_gallery_assets/landscape_3.jpg
- packages/flutter_gallery_assets/landscape_4.jpg
- packages/flutter_gallery_assets/landscape_5.jpg
- packages/flutter_gallery_assets/landscape_6.jpg
- packages/flutter_gallery_assets/landscape_7.jpg
- packages/flutter_gallery_assets/landscape_8.jpg
- packages/flutter_gallery_assets/landscape_9.jpg
- packages/flutter_gallery_assets/landscape_10.jpg
- packages/flutter_gallery_assets/landscape_11.jpg
- packages/flutter_gallery_assets/shrine/products/backpack.png
- packages/flutter_gallery_assets/shrine/products/beachball.png
- packages/flutter_gallery_assets/shrine/products/binoculars.png
- packages/flutter_gallery_assets/shrine/products/brush.png
- packages/flutter_gallery_assets/shrine/products/chair.png
- packages/flutter_gallery_assets/shrine/products/chucks.png
- packages/flutter_gallery_assets/shrine/products/clock.png
- packages/flutter_gallery_assets/shrine/products/fish_bowl.png
- packages/flutter_gallery_assets/shrine/products/flippers.png
- packages/flutter_gallery_assets/shrine/products/green-shoes.png
- packages/flutter_gallery_assets/shrine/products/heels.png
- packages/flutter_gallery_assets/shrine/products/helmet.png
- packages/flutter_gallery_assets/shrine/products/lawn_chair.png
- packages/flutter_gallery_assets/shrine/products/lipstick.png
- packages/flutter_gallery_assets/shrine/products/popsicle.png
- packages/flutter_gallery_assets/shrine/products/radio.png
- packages/flutter_gallery_assets/shrine/products/sunnies.png
- packages/flutter_gallery_assets/shrine/products/surfboard.png
- packages/flutter_gallery_assets/shrine/products/teapot.png
- packages/flutter_gallery_assets/shrine/vendors/16c477b.jpg
- packages/flutter_gallery_assets/shrine/vendors/ali-connors.png
- packages/flutter_gallery_assets/shrine/vendors/peter-carlsson.png
- packages/flutter_gallery_assets/shrine/vendors/sandra-adams.jpg
- packages/flutter_gallery_assets/shrine/vendors/zach.jpg
fonts:
- family: Raleway
fonts:
- asset: packages/flutter_gallery_assets/pesto/fonts/Raleway-Regular.ttf
- asset: packages/flutter_gallery_assets/pesto/fonts/Raleway-Medium.ttf
weight: 500
- asset: packages/flutter_gallery_assets/pesto/fonts/Raleway-SemiBold.ttf
weight: 600
- family: AbrilFatface
fonts:
- asset: packages/flutter_gallery_assets/shrine/fonts/abrilfatface/AbrilFatface-Regular.ttf
...@@ -18,3 +18,90 @@ dev_dependencies: ...@@ -18,3 +18,90 @@ dev_dependencies:
sdk: flutter sdk: flutter
flutter_driver: flutter_driver:
sdk: flutter sdk: flutter
flutter:
uses-material-design: true
assets:
- lib/gallery/example_code.dart
- packages/flutter_gallery_assets/appbar_background.jpg
- packages/flutter_gallery_assets/appbar/appbar_background_layer0.png
- packages/flutter_gallery_assets/appbar/appbar_background_layer1.png
- packages/flutter_gallery_assets/appbar/appbar_background_layer2.png
- packages/flutter_gallery_assets/appbar/appbar_background_layer3.png
- packages/flutter_gallery_assets/appbar/appbar_background_layer4.png
- packages/flutter_gallery_assets/appbar/appbar_background_layer5.png
- packages/flutter_gallery_assets/pesto/avatar.jpg
- packages/flutter_gallery_assets/pesto/image10.jpg
- packages/flutter_gallery_assets/pesto/image11.jpg
- packages/flutter_gallery_assets/pesto/image12.jpg
- packages/flutter_gallery_assets/pesto/image13.jpg
- packages/flutter_gallery_assets/pesto/image1.jpg
- packages/flutter_gallery_assets/pesto/image2.jpg
- packages/flutter_gallery_assets/pesto/image3.jpg
- packages/flutter_gallery_assets/pesto/image4.jpg
- packages/flutter_gallery_assets/pesto/image5.jpg
- packages/flutter_gallery_assets/pesto/image6.jpg
- packages/flutter_gallery_assets/pesto/image7.jpg
- packages/flutter_gallery_assets/pesto/image8.jpg
- packages/flutter_gallery_assets/pesto/image9.jpg
- packages/flutter_gallery_assets/pesto/logo_small.png
- packages/flutter_gallery_assets/pesto/logo_medium.png
- packages/flutter_gallery_assets/pesto/fish.png
- packages/flutter_gallery_assets/pesto/healthy.png
- packages/flutter_gallery_assets/pesto/main.png
- packages/flutter_gallery_assets/pesto/meat.png
- packages/flutter_gallery_assets/pesto/quick.png
- packages/flutter_gallery_assets/pesto/spicy.png
- packages/flutter_gallery_assets/pesto/veggie.png
- packages/flutter_gallery_assets/about_logo.png
- packages/flutter_gallery_assets/ali_connors.jpg
- packages/flutter_gallery_assets/drawer_logo.png
- packages/flutter_gallery_assets/kangaroo_valley_safari.jpg
- packages/flutter_gallery_assets/top_10_australian_beaches.jpg
- packages/flutter_gallery_assets/landscape_0.jpg
- packages/flutter_gallery_assets/landscape_1.jpg
- packages/flutter_gallery_assets/landscape_2.jpg
- packages/flutter_gallery_assets/landscape_3.jpg
- packages/flutter_gallery_assets/landscape_4.jpg
- packages/flutter_gallery_assets/landscape_5.jpg
- packages/flutter_gallery_assets/landscape_6.jpg
- packages/flutter_gallery_assets/landscape_7.jpg
- packages/flutter_gallery_assets/landscape_8.jpg
- packages/flutter_gallery_assets/landscape_9.jpg
- packages/flutter_gallery_assets/landscape_10.jpg
- packages/flutter_gallery_assets/landscape_11.jpg
- packages/flutter_gallery_assets/shrine/products/backpack.png
- packages/flutter_gallery_assets/shrine/products/beachball.png
- packages/flutter_gallery_assets/shrine/products/binoculars.png
- packages/flutter_gallery_assets/shrine/products/brush.png
- packages/flutter_gallery_assets/shrine/products/chair.png
- packages/flutter_gallery_assets/shrine/products/chucks.png
- packages/flutter_gallery_assets/shrine/products/clock.png
- packages/flutter_gallery_assets/shrine/products/fish_bowl.png
- packages/flutter_gallery_assets/shrine/products/flippers.png
- packages/flutter_gallery_assets/shrine/products/green-shoes.png
- packages/flutter_gallery_assets/shrine/products/heels.png
- packages/flutter_gallery_assets/shrine/products/helmet.png
- packages/flutter_gallery_assets/shrine/products/lawn_chair.png
- packages/flutter_gallery_assets/shrine/products/lipstick.png
- packages/flutter_gallery_assets/shrine/products/popsicle.png
- packages/flutter_gallery_assets/shrine/products/radio.png
- packages/flutter_gallery_assets/shrine/products/sunnies.png
- packages/flutter_gallery_assets/shrine/products/surfboard.png
- packages/flutter_gallery_assets/shrine/products/teapot.png
- packages/flutter_gallery_assets/shrine/vendors/16c477b.jpg
- packages/flutter_gallery_assets/shrine/vendors/ali-connors.png
- packages/flutter_gallery_assets/shrine/vendors/peter-carlsson.png
- packages/flutter_gallery_assets/shrine/vendors/sandra-adams.jpg
- packages/flutter_gallery_assets/shrine/vendors/zach.jpg
fonts:
- family: Raleway
fonts:
- asset: packages/flutter_gallery_assets/pesto/fonts/Raleway-Regular.ttf
- asset: packages/flutter_gallery_assets/pesto/fonts/Raleway-Medium.ttf
weight: 500
- asset: packages/flutter_gallery_assets/pesto/fonts/Raleway-SemiBold.ttf
weight: 600
- family: AbrilFatface
fonts:
- asset: packages/flutter_gallery_assets/shrine/fonts/abrilfatface/AbrilFatface-Regular.ttf
name: hello_world
uses-material-design: true
...@@ -7,3 +7,6 @@ dependencies: ...@@ -7,3 +7,6 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter:
uses-material-design: true
name: layers-examples
assets:
- services/data.json
...@@ -6,3 +6,7 @@ dependencies: ...@@ -6,3 +6,7 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter:
assets:
- services/data.json
name: stocks
uses-material-design: true
...@@ -9,3 +9,6 @@ dev_dependencies: ...@@ -9,3 +9,6 @@ dev_dependencies:
sdk: flutter sdk: flutter
flutter_driver: flutter_driver:
sdk: flutter sdk: flutter
flutter:
uses-material-design: true
...@@ -21,8 +21,15 @@ import 'theme.dart'; ...@@ -21,8 +21,15 @@ import 'theme.dart';
/// Available icons are shown on this page: <https://design.google.com/icons/> /// Available icons are shown on this page: <https://design.google.com/icons/>
/// ///
/// To use this class, make sure you set `uses-material-design: true` in your /// To use this class, make sure you set `uses-material-design: true` in your
/// project's `flutter.yaml` file. This ensures that the MaterialIcons font is /// project's `pubspec.yaml` file in the `flutter` section. This ensures that
/// included in your application. This font is used to display the icons. /// the MaterialIcons font is included in your application. This font is used to
/// display the icons. For example:
///
/// ```yaml
/// name: my_awesome_application
/// flutter:
/// uses-material-design: true
/// ```
/// ///
/// See also: /// See also:
/// ///
......
...@@ -21,8 +21,18 @@ import 'platform_messages.dart'; ...@@ -21,8 +21,18 @@ import 'platform_messages.dart';
/// ///
/// Applications have a [rootBundle], which contains the resources that were /// Applications have a [rootBundle], which contains the resources that were
/// packaged with the application when it was built. To add resources to the /// packaged with the application when it was built. To add resources to the
/// [rootBundle] for your application, add them to the `assets` section of your /// [rootBundle] for your application, add them to the `assets` subsection of
/// `flutter.yaml` manifest. /// the `flutter` section of your application's `pubspec.yaml` manifest.
///
/// For example:
///
/// ```yaml
/// name: my_awesome_application
/// flutter:
/// assets:
/// - images/hamilton.jpeg
/// - images/lafayette.jpeg
/// ```
/// ///
/// Rather than accessing the [rootBundle] global static directly, consider /// Rather than accessing the [rootBundle] global static directly, consider
/// obtaining the [AssetBundle] for the current [BuildContext] using /// obtaining the [AssetBundle] for the current [BuildContext] using
...@@ -202,8 +212,18 @@ AssetBundle _initRootBundle() { ...@@ -202,8 +212,18 @@ AssetBundle _initRootBundle() {
/// ///
/// The [rootBundle] contains the resources that were packaged with the /// The [rootBundle] contains the resources that were packaged with the
/// application when it was built. To add resources to the [rootBundle] for your /// application when it was built. To add resources to the [rootBundle] for your
/// application, add them to the `assets` section of your `flutter.yaml` /// application, add them to the `assets` subsection of the `flutter` section of
/// manifest. /// your application's `pubspec.yaml` manifest.
///
/// For example:
///
/// ```yaml
/// name: my_awesome_application
/// flutter:
/// assets:
/// - images/hamilton.jpeg
/// - images/lafayette.jpeg
/// ```
/// ///
/// Rather than using [rootBundle] directly, consider obtaining the /// Rather than using [rootBundle] directly, consider obtaining the
/// [AssetBundle] for the current [BuildContext] using [DefaultAssetBundle.of]. /// [AssetBundle] for the current [BuildContext] using [DefaultAssetBundle.of].
......
...@@ -20,7 +20,7 @@ import 'globals.dart'; ...@@ -20,7 +20,7 @@ import 'globals.dart';
class AssetBundle { class AssetBundle {
final Map<String, DevFSContent> entries = <String, DevFSContent>{}; final Map<String, DevFSContent> entries = <String, DevFSContent>{};
static const String defaultManifestPath = 'flutter.yaml'; static const String defaultManifestPath = 'pubspec.yaml';
static const String _kAssetManifestJson = 'AssetManifest.json'; static const String _kAssetManifestJson = 'AssetManifest.json';
static const String _kFontManifestJson = 'FontManifest.json'; static const String _kFontManifestJson = 'FontManifest.json';
static const String _kFontSetMaterial = 'material'; static const String _kFontSetMaterial = 'material';
...@@ -31,7 +31,7 @@ class AssetBundle { ...@@ -31,7 +31,7 @@ class AssetBundle {
DateTime _lastBuildTimestamp; DateTime _lastBuildTimestamp;
/// Constructs an [AssetBundle] that gathers the set of assets from the /// Constructs an [AssetBundle] that gathers the set of assets from the
/// flutter.yaml manifest. /// pubspec.yaml manifest.
AssetBundle(); AssetBundle();
/// Constructs an [AssetBundle] with a fixed set of assets. /// Constructs an [AssetBundle] with a fixed set of assets.
...@@ -77,9 +77,9 @@ class AssetBundle { ...@@ -77,9 +77,9 @@ class AssetBundle {
packagesPath ??= path.absolute(PackageMap.globalPackagesPath); packagesPath ??= path.absolute(PackageMap.globalPackagesPath);
Object manifest; Object manifest;
try { try {
manifest = _loadFlutterYamlManifest(manifestPath); manifest = _loadFlutterManifest(manifestPath);
} catch (e) { } catch (e) {
printStatus('Error detected in flutter.yaml:', emphasis: true); printStatus('Error detected in pubspec.yaml:', emphasis: true);
printError(e); printError(e);
return 1; return 1;
} }
...@@ -89,12 +89,12 @@ class AssetBundle { ...@@ -89,12 +89,12 @@ class AssetBundle {
return 0; return 0;
} }
if (manifest != null) { if (manifest != null) {
int result = await _validateFlutterYamlManifest(manifest); int result = await _validateFlutterManifest(manifest);
if (result != 0) if (result != 0)
return result; return result;
} }
Map<String, dynamic> manifestDescriptor = manifest; Map<String, dynamic> manifestDescriptor = manifest;
assert(manifestDescriptor != null); manifestDescriptor = manifestDescriptor['flutter'] ?? <String, dynamic>{};
String assetBasePath = path.dirname(path.absolute(manifestPath)); String assetBasePath = path.dirname(path.absolute(manifestPath));
_lastBuildTimestamp = new DateTime.now(); _lastBuildTimestamp = new DateTime.now();
...@@ -112,6 +112,7 @@ class AssetBundle { ...@@ -112,6 +112,7 @@ class AssetBundle {
return 1; return 1;
final bool usesMaterialDesign = (manifestDescriptor != null) && final bool usesMaterialDesign = (manifestDescriptor != null) &&
manifestDescriptor.containsKey('uses-material-design') &&
manifestDescriptor['uses-material-design']; manifestDescriptor['uses-material-design'];
for (_Asset asset in assetVariants.keys) { for (_Asset asset in assetVariants.keys) {
...@@ -321,8 +322,8 @@ DevFSContent _createFontManifest(Map<String, dynamic> manifestDescriptor, ...@@ -321,8 +322,8 @@ DevFSContent _createFontManifest(Map<String, dynamic> manifestDescriptor,
return new DevFSStringContent(JSON.encode(fonts)); return new DevFSStringContent(JSON.encode(fonts));
} }
/// Given an assetBase location and a flutter.yaml manifest, return a map of /// Given an assetBase location and a pubspec.yaml Flutter manifest, return a
/// assets to asset variants. /// map of assets to asset variants.
/// ///
/// Returns `null` on missing assets. /// Returns `null` on missing assets.
Map<_Asset, List<_Asset>> _parseAssets( Map<_Asset, List<_Asset>> _parseAssets(
...@@ -344,7 +345,7 @@ Map<_Asset, List<_Asset>> _parseAssets( ...@@ -344,7 +345,7 @@ Map<_Asset, List<_Asset>> _parseAssets(
_Asset baseAsset = _resolveAsset(packageMap, assetBase, 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 pubspec.yaml: "$asset".');
return null; return null;
} }
...@@ -389,7 +390,7 @@ Map<_Asset, List<_Asset>> _parseAssets( ...@@ -389,7 +390,7 @@ Map<_Asset, List<_Asset>> _parseAssets(
_Asset baseAsset = _resolveAsset(packageMap, assetBase, 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 pubspec.yaml: "$asset".');
return null; return null;
} }
...@@ -427,23 +428,23 @@ _Asset _resolveAsset( ...@@ -427,23 +428,23 @@ _Asset _resolveAsset(
return new _Asset(base: assetBase, relativePath: asset); return new _Asset(base: assetBase, relativePath: asset);
} }
dynamic _loadFlutterYamlManifest(String manifestPath) { dynamic _loadFlutterManifest(String manifestPath) {
if (manifestPath == null || !fs.isFileSync(manifestPath)) if (manifestPath == null || !fs.isFileSync(manifestPath))
return null; return null;
String manifestDescriptor = fs.file(manifestPath).readAsStringSync(); String manifestDescriptor = fs.file(manifestPath).readAsStringSync();
return loadYaml(manifestDescriptor); return loadYaml(manifestDescriptor);
} }
Future<int> _validateFlutterYamlManifest(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', 'flutter_yaml.json'); 'packages', 'flutter_tools', 'schema', 'pubspec_yaml.json');
Schema schema = await Schema.createSchemaFromUrl('file://$schemaPath'); Schema schema = await Schema.createSchemaFromUrl('file://$schemaPath');
Validator validator = new Validator(schema); Validator validator = new Validator(schema);
if (validator.validate(manifest)) { if (validator.validate(manifest)) {
return 0; return 0;
} else { } else {
printStatus('Error detected in flutter.yaml:', emphasis: true); printStatus('Error detected in pubspec.yaml:', emphasis: true);
printError(validator.errors.join('\n')); printError(validator.errors.join('\n'));
return 1; return 1;
} }
......
...@@ -29,7 +29,7 @@ const String _kDefaultAndroidManifestPath = 'android/AndroidManifest.xml'; ...@@ -29,7 +29,7 @@ const String _kDefaultAndroidManifestPath = 'android/AndroidManifest.xml';
const String _kDefaultResourcesPath = 'android/res'; const String _kDefaultResourcesPath = 'android/res';
const String _kDefaultAssetsPath = 'android/assets'; const String _kDefaultAssetsPath = 'android/assets';
const String _kFlutterManifestPath = 'flutter.yaml'; const String _kFlutterManifestPath = 'pubspec.yaml';
const String _kPackagesStatusPath = '.packages'; const String _kPackagesStatusPath = '.packages';
// Alias of the key provided in the Chromium debug keystore // Alias of the key provided in the Chromium debug keystore
......
...@@ -19,7 +19,7 @@ import 'zip.dart'; ...@@ -19,7 +19,7 @@ import 'zip.dart';
const String defaultMainPath = 'lib/main.dart'; const String defaultMainPath = 'lib/main.dart';
const String defaultAssetBasePath = '.'; const String defaultAssetBasePath = '.';
const String defaultManifestPath = 'flutter.yaml'; const String defaultManifestPath = 'pubspec.yaml';
String get defaultFlxOutputPath => path.join(getBuildDirectory(), 'app.flx'); String get defaultFlxOutputPath => path.join(getBuildDirectory(), 'app.flx');
String get defaultSnapshotPath => path.join(getBuildDirectory(), 'snapshot_blob.bin'); String get defaultSnapshotPath => path.join(getBuildDirectory(), 'snapshot_blob.bin');
String get defaultDepfilePath => path.join(getBuildDirectory(), 'snapshot_blob.bin.d'); String get defaultDepfilePath => path.join(getBuildDirectory(), 'snapshot_blob.bin.d');
......
...@@ -208,9 +208,28 @@ abstract class FlutterCommand extends Command<Null> { ...@@ -208,9 +208,28 @@ abstract class FlutterCommand extends Command<Null> {
if (!PackageMap.isUsingCustomPackagesPath) { if (!PackageMap.isUsingCustomPackagesPath) {
// Don't expect a pubspec.yaml file if the user passed in an explicit .packages file path. // Don't expect a pubspec.yaml file if the user passed in an explicit .packages file path.
if (!fs.isFileSync('pubspec.yaml')) { if (!fs.isFileSync('pubspec.yaml')) {
throw new ToolExit('Error: No pubspec.yaml file found.\n' throw new ToolExit(
'Error: No pubspec.yaml file found.\n'
'This command should be run from the root of your Flutter project.\n' 'This command should be run from the root of your Flutter project.\n'
'Do not run this command from the root of your git clone of Flutter.'); 'Do not run this command from the root of your git clone of Flutter.'
);
}
if (fs.isFileSync('flutter.yaml')) {
throw new ToolExit(
'Please merge your flutter.yaml into your pubspec.yaml.\n\n'
'We have changed from having separate flutter.yaml and pubspec.yaml\n'
'files to having just one pubspec.yaml file. Transitioning is simple:\n'
'add a line that just says "flutter:" to your pubspec.yaml file, and\n'
'move everything from your current flutter.yaml file into the\n'
'pubspec.yaml file, below that line, with everything indented by two\n'
'extra spaces compared to how it was in the flutter.yaml file. Then, if\n'
'you had a "name:" line, move that to the top of your "pubspec.yaml"\n'
'file (you may already have one there), so that there is only one\n'
'"name:" line. Finally, delete the flutter.yaml file.\n\n'
'For an example of what a new-style pubspec.yaml file might look like,\n'
'check out the Flutter Gallery pubspec.yaml:\n'
'https://github.com/flutter/flutter/blob/master/examples/flutter_gallery/pubspec.yaml\n'
);
} }
} }
......
...@@ -13,7 +13,7 @@ import 'dart/package_map.dart'; ...@@ -13,7 +13,7 @@ import 'dart/package_map.dart';
import 'android/android_sdk.dart'; import 'android/android_sdk.dart';
import 'globals.dart'; import 'globals.dart';
const String _kFlutterManifestPath = 'flutter.yaml'; const String _kFlutterManifestPath = 'pubspec.yaml';
const String _kFlutterServicesManifestPath = 'flutter_services.yaml'; const String _kFlutterServicesManifestPath = 'flutter_services.yaml';
dynamic _loadYamlFile(String path) { dynamic _loadYamlFile(String path) {
...@@ -24,7 +24,7 @@ dynamic _loadYamlFile(String path) { ...@@ -24,7 +24,7 @@ dynamic _loadYamlFile(String path) {
return loadYaml(manifestString); return loadYaml(manifestString);
} }
/// Loads all services specified in `flutter.yaml`. Parses each service config file, /// Loads all services specified in `pubspec.yaml`. Parses each service config file,
/// storing meta data in [services] and the list of jar files in [jars]. /// storing meta data in [services] and the list of jar files in [jars].
Future<Null> parseServiceConfigs( Future<Null> parseServiceConfigs(
List<Map<String, String>> services, { List<File> jars } List<Map<String, String>> services, { List<File> jars }
...@@ -40,8 +40,9 @@ Future<Null> parseServiceConfigs( ...@@ -40,8 +40,9 @@ Future<Null> parseServiceConfigs(
dynamic manifest; dynamic manifest;
try { try {
manifest = _loadYamlFile(_kFlutterManifestPath); manifest = _loadYamlFile(_kFlutterManifestPath);
manifest = manifest['flutter'];
} catch (e) { } catch (e) {
printStatus('Error detected in flutter.yaml:', emphasis: true); printStatus('Error detected in pubspec.yaml:', emphasis: true);
printError(e); printError(e);
return; return;
} }
......
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "flutter.yaml",
"type": "object",
"additionalProperties": false,
"properties": {
"name": { "type": "string" },
"uses-material-design": { "type": "boolean" },
"assets": {
"type": "array",
"items": { "type": "string" }
},
"services": {
"type": "array",
"items": { "type": "string" }
},
"fonts": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"family": { "type": "string" },
"fonts": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"asset": { "type": "string" },
"weight": { "type": "integer" },
"style": { "enum": [ "normal", "italic" ] }
}
}
}
}
}
}
}
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "pubspec.yaml",
"type": "object",
"additionalProperties": true,
"properties": {
"name": { "type": "string" },
"flutter": {
"type": "object",
"additionalProperties": false,
"properties": {
"uses-material-design": { "type": "boolean" },
"assets": {
"type": "array",
"items": { "type": "string" }
},
"services": {
"type": "array",
"items": { "type": "string" }
},
"fonts": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"family": { "type": "string" },
"fonts": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"asset": { "type": "string" },
"weight": { "enum": [ 100, 200, 300, 400, 500, 600, 700, 800, 900 ] },
"style": { "enum": [ "normal", "italic" ] }
}
}
}
}
}
}
}
}
}
}
name: {{projectName}}
uses-material-design: true
name: {{projectName}} name: {{projectName}}
description: {{description}} description: {{description}}
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
...@@ -8,3 +9,37 @@ dev_dependencies: ...@@ -8,3 +9,37 @@ dev_dependencies:
flutter_driver: flutter_driver:
sdk: flutter sdk: flutter
{{/withDriverTest}} {{/withDriverTest}}
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the Icons class.
uses-material-design: true
# To add assets to your application, add an assets section here, in
# this "flutter" section, as in:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
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