Skip to content

Commit

Permalink
652
Browse files Browse the repository at this point in the history
  • Loading branch information
srawlins committed Jun 6, 2024
1 parent 5658092 commit d091cdd
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions tool/task.dart
Original file line number Diff line number Diff line change
Expand Up @@ -765,20 +765,8 @@ Future<void> validateBuild() async {

await buildAll();

const analyzerTarget = '6.5.0';
String getAnalyzerInUse() {
var lockfilePath = path.join(Directory.current.path, 'pubspec.lock');
var lockfile = loadYaml(File(lockfilePath).readAsStringSync()) as YamlMap;
var packages = lockfile['packages'] as YamlMap;
var analyzer = packages['analyzer'] as YamlMap;
return analyzer['version'] as String;
}

var analyzerInUse = getAnalyzerInUse();

for (var relPath in _generatedFilesList) {
if (relPath.contains('runtime_renderers') &&
analyzerTarget != analyzerInUse) {
if (relPath.contains('runtime_renderers') && !_analyzerInUseIsTarget) {
// The content of these files is very specific to the version of the
// analyzer package in use. So we only validate if we are working on that
// exact version.
Expand Down Expand Up @@ -818,6 +806,16 @@ Rebuild them with "dart tool/task.dart build" and check the results in.
}
}

bool get _analyzerInUseIsTarget {
var lockfilePath = path.join(Directory.current.path, 'pubspec.lock');
var lockfile = loadYaml(File(lockfilePath).readAsStringSync()) as YamlMap;
var packages = lockfile['packages'] as YamlMap;
var analyzer = packages['analyzer'] as YamlMap;
var analyzerInUse = analyzer['version'] as String;
const analyzerTarget = '6.5.2';
return analyzerInUse == analyzerTarget;
}

/// Paths in this list are relative to lib/.
final _generatedFilesList = [
'../dartdoc_options.yaml',
Expand Down

0 comments on commit d091cdd

Please sign in to comment.