diff --git a/lib/src/scheme/scheme.dart b/lib/src/scheme/scheme.dart index 9ef9f0b..004e40d 100644 --- a/lib/src/scheme/scheme.dart +++ b/lib/src/scheme/scheme.dart @@ -5,6 +5,8 @@ class XCScheme extends XmlElementWrapper { XCScheme._(this._path, XmlElement element) : super(element); + String get name => path_lib.basename(_path).split('.').first; + factory XCScheme.load(String path) { var doc = XmlDocument.parse(File(path).readAsStringSync()); return XCScheme._(path, doc.findElements('Scheme').first); diff --git a/lib/src/xcode.dart b/lib/src/xcode.dart index f06b07f..c0e0519 100644 --- a/lib/src/xcode.dart +++ b/lib/src/xcode.dart @@ -1,9 +1,10 @@ import 'dart:io'; +import 'package:path/path.dart' as path_lib; import 'package:snapshot/snapshot.dart'; import 'package:xcodeproj/src/plist/plain_format.dart'; -import 'package:path/path.dart' as path_lib; import 'package:xcodeproj/src/scheme.dart'; + import 'pbx.dart'; mixin XCodeProjMixin on SnapshotView { @@ -92,7 +93,8 @@ class XCodeProj extends ModifiableSnapshotView with XCodeProjMixin { return dir .listSync() .where((f) => f.path.endsWith('.xcscheme')) - .map((f) => XCScheme.load(f.path)) as List; + .map((f) => XCScheme.load(f.path)) + .toList(); } XCScheme createScheme(String name, PBXTarget target) { diff --git a/test/plist/plain_format_parser_test.dart b/test/plist/plain_format_parser_test.dart index 650111e..0e6ba02 100644 --- a/test/plist/plain_format_parser_test.dart +++ b/test/plist/plain_format_parser_test.dart @@ -64,7 +64,7 @@ void main() { }); group('Parsing annotated value', () { - var parser = grammar.buildFrom(grammar.annotatedValue()); + var parser = grammar.build(arguments: grammar.annotatedValue().children); test('Parsing annotated value with single annotation', () { shouldSucceed( @@ -85,7 +85,9 @@ void main() { }); group('Parsing arrays', () { - var parser = grammar.buildFrom(grammar.array()); + final array = grammar.array(); + + var parser = grammar.build(arguments: array.children); test('Parsing empty array', () { shouldSucceed(parser, '()', []); }); @@ -117,7 +119,7 @@ void main() { }); group('Parsing dictionaries', () { - var parser = grammar.buildFrom(grammar.dictionary()); + var parser = grammar.build(arguments: grammar.dictionary().children); test('Parsing an empty dictionary', () { shouldSucceed(parser, '{}', {}); shouldSucceed(parser, '\t\n\t{\n\t\n}', {});