| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:io'; | 5 import 'dart:io'; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 | 7 |
| 8 import 'package:archive/archive.dart'; | 8 import 'package:archive/archive.dart'; |
| 9 import 'package:args/args.dart'; | 9 import 'package:args/args.dart'; |
| 10 import 'package:yaml/yaml.dart'; | 10 import 'package:yaml/yaml.dart'; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 currentAssetDescriptor['theme'] = theme; | 48 currentAssetDescriptor['theme'] = theme; |
| 49 for (String size in generateValues(assetDescriptor, 'size', kSizes)) { | 49 for (String size in generateValues(assetDescriptor, 'size', kSizes)) { |
| 50 currentAssetDescriptor['size'] = size; | 50 currentAssetDescriptor['size'] = size; |
| 51 yield new MaterialAsset(currentAssetDescriptor); | 51 yield new MaterialAsset(currentAssetDescriptor); |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 Iterable<MaterialAsset> parseMaterialAssets(Map manifestDescriptor) sync* { | 57 Iterable<MaterialAsset> parseMaterialAssets(Map manifestDescriptor) sync* { |
| 58 if (manifestDescriptor == null || !manifestDescriptor.containsKey('material-de
sign-icons')) |
| 59 return; |
| 58 for (Map assetDescriptor in manifestDescriptor['material-design-icons']) { | 60 for (Map assetDescriptor in manifestDescriptor['material-design-icons']) { |
| 59 for (MaterialAsset asset in generateMaterialAssets(assetDescriptor)) { | 61 for (MaterialAsset asset in generateMaterialAssets(assetDescriptor)) { |
| 60 yield asset; | 62 yield asset; |
| 61 } | 63 } |
| 62 } | 64 } |
| 63 } | 65 } |
| 64 | 66 |
| 65 Future loadManifest(String manifestPath) async { | 67 Future loadManifest(String manifestPath) async { |
| 66 String manifestDescriptor = await new File(manifestPath).readAsString(); | 68 String manifestDescriptor = await new File(manifestPath).readAsString(); |
| 67 return loadYaml(manifestDescriptor); | 69 return loadYaml(manifestDescriptor); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 String snapshot = args['snapshot']; | 104 String snapshot = args['snapshot']; |
| 103 if (snapshot != null) | 105 if (snapshot != null) |
| 104 archive.addFile(await createSnapshotFile(snapshot)); | 106 archive.addFile(await createSnapshotFile(snapshot)); |
| 105 | 107 |
| 106 for (MaterialAsset asset in materialAssets) | 108 for (MaterialAsset asset in materialAssets) |
| 107 archive.addFile(await createFile(asset, args['asset-base'])); | 109 archive.addFile(await createFile(asset, args['asset-base'])); |
| 108 | 110 |
| 109 File outputFile = new File(args['output-file']); | 111 File outputFile = new File(args['output-file']); |
| 110 await outputFile.writeAsBytes(new ZipEncoder().encode(archive)); | 112 await outputFile.writeAsBytes(new ZipEncoder().encode(archive)); |
| 111 } | 113 } |
| OLD | NEW |