@@ -23,7 +23,8 @@ void main(List<String> args) async {
23
23
'A program for updating the devtools version' ,
24
24
)
25
25
..addCommand (ManualUpdateCommand ())
26
- ..addCommand (AutoUpdateCommand ());
26
+ ..addCommand (AutoUpdateCommand ())
27
+ ..addCommand (CurrentVersionCommand ());
27
28
runner.run (args).catchError ((error) {
28
29
if (error is ! UsageException ) throw error;
29
30
print (error);
@@ -32,8 +33,11 @@ void main(List<String> args) async {
32
33
return ;
33
34
}
34
35
35
- Future <void > performTheVersionUpdate (
36
- {required String currentVersion, required String newVersion}) async {
36
+ Future <void > performTheVersionUpdate ({
37
+ required String currentVersion,
38
+ required String newVersion,
39
+ bool modifyChangeLog = true ,
40
+ }) async {
37
41
print ('Updating pubspecs from $currentVersion to version $newVersion ...' );
38
42
39
43
for (final pubspec in _pubspecs) {
@@ -46,8 +50,10 @@ Future<void> performTheVersionUpdate(
46
50
newVersion,
47
51
);
48
52
49
- print ('Updating CHANGELOG to version $newVersion ...' );
50
- writeVersionToChangelog (File ('CHANGELOG.md' ), newVersion);
53
+ if (modifyChangeLog) {
54
+ print ('Updating CHANGELOG to version $newVersion ...' );
55
+ writeVersionToChangelog (File ('CHANGELOG.md' ), newVersion);
56
+ }
51
57
52
58
print ('Updating index.html to version $newVersion ...' );
53
59
writeVersionToIndexHtml (
@@ -284,6 +290,18 @@ class ManualUpdateCommand extends Command {
284
290
}
285
291
}
286
292
293
+ class CurrentVersionCommand extends Command {
294
+ @override
295
+ final name = 'current-version' ;
296
+ @override
297
+ final description = 'Print the current devtools_app version.' ;
298
+
299
+ @override
300
+ void run () async {
301
+ print (versionFromPubspecFile ());
302
+ }
303
+ }
304
+
287
305
class AutoUpdateCommand extends Command {
288
306
@override
289
307
final name = 'auto' ;
@@ -343,6 +361,7 @@ class AutoUpdateCommand extends Command {
343
361
final type = argResults! ['type' ].toString ();
344
362
final isDryRun = argResults! ['dry-run' ];
345
363
final currentVersion = versionFromPubspecFile ();
364
+ bool modifyChangeLog = true ;
346
365
String ? newVersion;
347
366
if (currentVersion == null ) {
348
367
throw 'Could not automatically determine current version.' ;
@@ -353,6 +372,7 @@ class AutoUpdateCommand extends Command {
353
372
break ;
354
373
case 'dev' :
355
374
newVersion = incrementDevVersion (currentVersion);
375
+ modifyChangeLog = false ;
356
376
break ;
357
377
default :
358
378
newVersion = incrementVersionByType (currentVersion, type);
@@ -369,6 +389,7 @@ class AutoUpdateCommand extends Command {
369
389
performTheVersionUpdate (
370
390
currentVersion: currentVersion,
371
391
newVersion: newVersion,
392
+ modifyChangeLog: modifyChangeLog,
372
393
);
373
394
}
374
395
}
0 commit comments