From ebae0ac9f1e45257e9a2cedcbd8c7a488cbd3986 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Fri, 24 May 2024 13:02:13 -0700 Subject: [PATCH] Fix flutter CI with re-internalized snippets tool --- tool/task.dart | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tool/task.dart b/tool/task.dart index 00c03b3622..220cd5e854 100644 --- a/tool/task.dart +++ b/tool/task.dart @@ -305,7 +305,7 @@ Future runDoc(ArgResults commandResults) async { } Future docFlutter({bool withStats = false}) async { - print('building flutter docs into: $flutterDir'); + print('building flutter docs into: ${flutterDir.path}'); var env = createThrowawayPubCache(); await _docFlutter( flutterPath: flutterDir.path, @@ -325,17 +325,20 @@ Future>> _docFlutter({ }) async { var flutterRepo = await FlutterRepo.copyFromExistingFlutterRepo( await cleanFlutterRepo, flutterPath, env, label); - try { - await flutterRepo.launcher.runStreamed( - flutterRepo.dartCmd, - ['pub', 'global', 'deactivate', 'snippets'], - ); - } on SubprocessException { - // Ignore failure to deactivate so this works on completely clean bots. - } + var snippetsPath = path.join(flutterPath, 'dev', 'snippets'); + var snippetsOutPath = + path.join(flutterPath, 'bin', 'cache', 'artifacts', 'snippets'); + print('building snippets tool executable...'); + Directory(snippetsOutPath).createSync(recursive: true); + await flutterRepo.launcher.runStreamed( + flutterRepo.flutterCmd, + ['pub', 'get'], + workingDirectory: path.join(snippetsPath), + ); await flutterRepo.launcher.runStreamed( flutterRepo.dartCmd, - ['pub', 'global', 'activate', 'snippets', '0.4.3'], + ['compile', 'exe', '-o', '$snippetsOutPath/snippets', 'bin/snippets.dart'], + workingDirectory: path.join(snippetsPath), ); // TODO(jcollins-g): flutter's dart SDK pub tries to precompile the universe // when using -spath. Why?