From d091cdd4f3f7633598c92fbc21319aa35953e108 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Thu, 6 Jun 2024 16:09:29 -0700 Subject: [PATCH] 652 --- tool/task.dart | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/tool/task.dart b/tool/task.dart index 8328e214f7..b6a52eaee4 100644 --- a/tool/task.dart +++ b/tool/task.dart @@ -765,20 +765,8 @@ Future 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. @@ -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',