Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -975,10 +975,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
sha256: "046d3928e16fa4dc46e8350415661755ab759d9fc97fc21b5ab295f71e4f0499"
url: "https://pub.dev"
source: hosted
version: "15.0.2"
version: "15.1.0"
vm_service_protos:
dependency: transitive
description:
Expand Down
15 changes: 10 additions & 5 deletions tool/lib/commands/presubmit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ class PresubmitCommand extends Command {
final pathsToFormat = _getPathsToFormat(p);

final formatProcess = await pm.runProcess(
CliCommand.dart(['format', ...pathsToFormat], throwOnException: false),
CliCommand.dart([
'format',
...pathsToFormat,
], throwOnException: false),
workingDirectory: p.packagePath,
);

Expand Down Expand Up @@ -108,10 +111,12 @@ class PresubmitCommand extends Command {
final pathsToFormat = _getPathsToFormat(p);

final formatProcess = await pm.runProcess(
CliCommand.dart(
['format', '--output=none', '--set-exit-if-changed', ...pathsToFormat],
throwOnException: false,
),
CliCommand.dart([
'format',
'--output=none',
'--set-exit-if-changed',
...pathsToFormat,
], throwOnException: false),
workingDirectory: p.packagePath,
);

Expand Down
34 changes: 20 additions & 14 deletions tool/lib/commands/update_version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,25 @@ bool isDevVersion(String version) {
return RegExp(r'-dev\.\d+').hasMatch(version);
}

String calculateNewVersion(String currentVersion, String type) {
switch (type) {
case 'release':
if (isDevVersion(currentVersion)) {
return stripPreReleases(currentVersion);
} else {
return incrementVersionByType(currentVersion, 'minor')!;
}
case 'dev':
return incrementDevVersion(currentVersion);
default:
final version = incrementVersionByType(currentVersion, type);
if (version == null) {
throw 'Failed to determine the newVersion.';
}
return version;
}
}

const pubspecVersionPrefix = 'version:';

class ManualUpdateCommand extends Command {
Expand Down Expand Up @@ -326,23 +345,10 @@ class AutoUpdateCommand extends Command {
final type = argResults!['type'] as String;
final isDryRun = argResults!['dry-run'] as bool;
final currentVersion = versionFromPubspecFile();
String? newVersion;
if (currentVersion == null) {
throw 'Could not automatically determine current version.';
}
switch (type) {
case 'release':
newVersion = stripPreReleases(currentVersion);
break;
case 'dev':
newVersion = incrementDevVersion(currentVersion);
break;
default:
newVersion = incrementVersionByType(currentVersion, type);
if (newVersion == null) {
throw 'Failed to determine the newVersion.';
}
}
final newVersion = calculateNewVersion(currentVersion, type);
Comment thread
kenzieschmoll marked this conversation as resolved.
print('Bump version from $currentVersion to $newVersion');

if (isDryRun) {
Expand Down
40 changes: 40 additions & 0 deletions tool/test/update_version_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2026 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.

import 'package:devtools_tool/commands/update_version.dart';
import 'package:test/test.dart';

void main() {
group('calculateNewVersion', () {
test('release type strips pre-release when on dev version', () {
expect(calculateNewVersion('2.28.0-dev.0', 'release'), '2.28.0');
expect(calculateNewVersion('2.28.0-dev.5', 'release'), '2.28.0');
});

test('release type increments minor version when not on dev version', () {
expect(calculateNewVersion('2.28.0', 'release'), '2.29.0');
expect(calculateNewVersion('2.28.1', 'release'), '2.29.0');
});

test('dev type increments dev version', () {
expect(calculateNewVersion('1.2.3', 'dev'), '1.2.3-dev.0');
expect(calculateNewVersion('1.2.3-dev.4', 'dev'), '1.2.3-dev.5');
});

test('patch type increments patch version', () {
expect(calculateNewVersion('1.2.3', 'patch'), '1.2.4');
expect(calculateNewVersion('1.2.3-dev.4', 'patch'), '1.2.4');
});

test('minor type increments minor version', () {
expect(calculateNewVersion('1.2.3', 'minor'), '1.3.0');
expect(calculateNewVersion('1.2.3-dev.4', 'minor'), '1.3.0');
});

test('major type increments major version', () {
expect(calculateNewVersion('1.2.3', 'major'), '2.0.0');
expect(calculateNewVersion('1.2.3-dev.4', 'major'), '2.0.0');
});
});
}
15 changes: 10 additions & 5 deletions tool/test/validate_skills_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ void main() {
test('Validate DevTools Skills', () async {
final Level oldLevel = Logger.root.level;
Logger.root.level = Level.ALL;
final StreamSubscription<LogRecord> subscription = Logger.root.onRecord.listen((record) {
print(record.message);
});
final StreamSubscription<LogRecord> subscription = Logger.root.onRecord
.listen((record) {
print(record.message);
});

try {
// TODO(https://github.com/flutter/skills/issues/85): Update test
// TODO(https://github.com/flutter/skills/issues/85): Update test
// to use dart_skills_lint.yaml for config when available.
final bool isValid = await validateSkills(
skillDirPaths: ['../.agents/skills'],
Expand All @@ -26,7 +27,11 @@ void main() {
'check-trailing-whitespace': AnalysisSeverity.error,
},
);
expect(isValid, isTrue, reason: 'Skills validation failed. See above for details.');
expect(
isValid,
isTrue,
reason: 'Skills validation failed. See above for details.',
);
} finally {
Logger.root.level = oldLevel;
await subscription.cancel();
Expand Down
Loading