@@ -13,29 +13,29 @@ void main() {
13
13
// Remove comments and empty lines.
14
14
data.removeWhere ((row) => row.length < 3 );
15
15
16
- Directory ('lib/src/generated' ).createSync (recursive: true );
16
+ Directory (_generatedDir ).createSync (recursive: true );
17
17
18
18
_writeGlyphSetInterface (data);
19
19
_writeGlyphSet (data, ascii: false );
20
20
_writeGlyphSet (data, ascii: true );
21
21
_writeTopLevel (data);
22
22
23
- final result = Process .runSync (
24
- 'pub' , ['run' , 'dart_style:format' , '-w' , 'lib/src/generated' ]);
23
+ final result = Process .runSync (Platform .resolvedExecutable, [
24
+ 'format' ,
25
+ _generatedDir,
26
+ ]);
25
27
print (result.stderr);
26
28
exit (result.exitCode);
27
29
}
28
30
31
+ const _generatedDir = 'lib/src/generated' ;
32
+
29
33
/// Writes `lib/src/generated/glyph_set.dart` .
30
34
void _writeGlyphSetInterface (List <List <dynamic >> data) {
31
35
final file =
32
- File ('lib/src/generated/glyph_set.dart' ).openSync (mode: FileMode .write);
36
+ File ('$_generatedDir /glyph_set.dart' ).openSync (mode: FileMode .write);
37
+ file.writeStringSync (_header);
33
38
file.writeStringSync (r'''
34
- // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
35
- // for details. All rights reserved. Use of this source code is governed by a
36
- // BSD-style license that can be found in the LICENSE file.
37
-
38
- // Don't modify this file by hand! It's generated by tool/generate.dart.
39
39
40
40
/// A class that provides access to every configurable glyph.
41
41
///
@@ -84,16 +84,13 @@ void _writeGlyphSetInterface(List<List<dynamic>> data) {
84
84
/// the Unicode glyph set.
85
85
void _writeGlyphSet (List <List <dynamic >> data, {required bool ascii}) {
86
86
final file =
87
- File ('lib/src/generated /${ascii ? "ascii" : "unicode" }_glyph_set.dart' )
87
+ File ('$ _generatedDir /${ascii ? "ascii" : "unicode" }_glyph_set.dart' )
88
88
.openSync (mode: FileMode .write);
89
89
90
90
final className = '${ascii ? "Ascii" : "Unicode" }GlyphSet' ;
91
91
file.writeStringSync ('''
92
- // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
93
- // for details. All rights reserved. Use of this source code is governed by a
94
- // BSD-style license that can be found in the LICENSE file.
92
+ $_header
95
93
96
- // Don't modify this file by hand! It's generated by tool/generate.dart.
97
94
98
95
import 'glyph_set.dart';
99
96
@@ -122,14 +119,10 @@ void _writeGlyphSet(List<List<dynamic>> data, {required bool ascii}) {
122
119
/// Writes `lib/src/generated/top_level.dart` .
123
120
void _writeTopLevel (List <List <dynamic >> data) {
124
121
final file =
125
- File ('lib/src/generated /top_level.dart' ).openSync (mode: FileMode .write);
122
+ File ('$ _generatedDir /top_level.dart' ).openSync (mode: FileMode .write);
126
123
127
124
file.writeStringSync ('''
128
- // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
129
- // for details. All rights reserved. Use of this source code is governed by a
130
- // BSD-style license that can be found in the LICENSE file.
131
-
132
- // Don't modify this file by hand! It's generated by tool/generate.dart.
125
+ $_header
133
126
134
127
import '../../term_glyph.dart' as glyph;
135
128
''' );
@@ -151,3 +144,13 @@ void _writeTopLevel(List<List<dynamic>> data) {
151
144
}
152
145
153
146
String _quote (String input) => input.contains ("'" ) ? '"$input "' : "'$input '" ;
147
+
148
+ const _header = '''
149
+ // Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
150
+ // for details. All rights reserved. Use of this source code is governed by a
151
+ // BSD-style license that can be found in the LICENSE file.
152
+
153
+ // Don't modify this file by hand! It's generated by tool/generate.dart.
154
+
155
+ // ignore_for_file: lines_longer_than_80_chars
156
+ ''' ;
0 commit comments