Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: pkg/analyzer_cli/test/utils.dart

Issue 2719703005: fix dartanalyzer find options in bazel workspace (Closed)
Patch Set: merge Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer_cli/test/driver_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_cli/test/utils.dart
diff --git a/pkg/analyzer_cli/test/utils.dart b/pkg/analyzer_cli/test/utils.dart
index 85fa759e16b72da7fac74e1ae24dd2acf1bc107c..3e61ed24fe62dd05849429d147c80ec464fabb2f 100644
--- a/pkg/analyzer_cli/test/utils.dart
+++ b/pkg/analyzer_cli/test/utils.dart
@@ -4,6 +4,7 @@
library analyzer_cli.test.utils;
+import 'dart:async';
import 'dart:io';
import 'dart:mirrors';
@@ -52,4 +53,31 @@ dynamic withTempDir(fn(String path)) {
}
}
+/// Creates a temporary directory and passes its path to [fn]. Once [fn]
+/// completes, the temporary directory and all its contents will be deleted.
+///
+/// Returns the return value of [fn].
+Future<dynamic> withTempDirAsync(Future<dynamic> fn(String path)) async {
+ var tempDir = (await Directory.systemTemp.createTemp('analyzer_')).path;
+ try {
+ return await fn(tempDir);
+ } finally {
+ await new Directory(tempDir).delete(recursive: true);
+ }
+}
+
+/// Recursively copy the specified [src] directory (or file)
+/// to the specified destination path.
+Future<Null> recursiveCopy(FileSystemEntity src, String dstPath) async {
+ if (src is Directory) {
+ await (new Directory(dstPath)).create(recursive: true);
+ for (FileSystemEntity entity in src.listSync()) {
+ await recursiveCopy(
+ entity, pathos.join(dstPath, pathos.basename(entity.path)));
+ }
+ } else if (src is File) {
+ await src.copy(dstPath);
+ }
+}
+
class _TestUtils {}
« no previous file with comments | « pkg/analyzer_cli/test/driver_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698