Chromium Code Reviews| Index: pkg/analyzer/lib/src/generated/bazel.dart |
| diff --git a/pkg/analyzer/lib/src/generated/bazel.dart b/pkg/analyzer/lib/src/generated/bazel.dart |
| index 92c6cc2334d6e79125ba5dcff4d2e28e0ad2e196..fd0798cfea95338091d8ac2c44c568860f1005ce 100644 |
| --- a/pkg/analyzer/lib/src/generated/bazel.dart |
| +++ b/pkg/analyzer/lib/src/generated/bazel.dart |
| @@ -121,66 +121,12 @@ class BazelWorkspace { |
| */ |
| final String genfiles; |
| - /** |
| - * Create a new Bazel workspace that contains the given [path]. |
| - * |
| - * The [symlinkPrefix] is the prefix for names of symlinks like `bazel-bin`, |
| - * `bazel-genfiles`, etc. |
| - */ |
| - factory BazelWorkspace(ResourceProvider provider, String path, |
| - {String symlinkPrefix: 'bazel', String readonlySuffix}) { |
| - Context context = provider.pathContext; |
| - |
| - // Ensure that the path is absolute and normalized. |
| - if (!context.isAbsolute(path)) { |
| - throw new ArgumentError('not absolute: $path'); |
| - } |
| - path = context.normalize(path); |
| - |
| - Folder folder = provider.getFolder(path); |
| - while (true) { |
| - Folder parent = folder.parent; |
| - |
| - // Found the READONLY folder, must be a git-based workspace. |
| - if (readonlySuffix != null && parent != null) { |
| - Folder readonlyFolder = parent.getChildAssumingFolder(_READONLY); |
| - if (readonlyFolder.exists) { |
| - String root = folder.path; |
| - String readonly = readonlyFolder.path; |
| - return new BazelWorkspace._( |
| - provider, |
| - root, |
| - context.join(readonly, readonlySuffix), |
| - context.join(root, '$symlinkPrefix-bin'), |
| - context.join(root, '$symlinkPrefix-genfiles')); |
| - } |
| - } |
| - |
| - // Found the WORKSPACE file, must be a non-git workspace. |
| - if (folder.getChildAssumingFile(_WORKSPACE).exists) { |
| - String root = folder.path; |
| - return new BazelWorkspace._( |
| - provider, |
| - root, |
| - null, |
| - context.join(root, '$symlinkPrefix-bin'), |
| - context.join(root, '$symlinkPrefix-genfiles')); |
| - } |
| - |
| - // Go up the folder. |
| - folder = parent; |
| - if (folder == null) { |
| - return new BazelWorkspace._(provider, path, null, null, null); |
| - } |
| - } |
| - } |
| - |
| BazelWorkspace._( |
| this.provider, this.root, this.readonly, this.bin, this.genfiles); |
| /** |
| * Return the file with the given [absolutePath], looking first into |
| - * directories for generated files: `bazel-genfiles` and `bazel-bin`, and |
| + * directories for generated files: `bazel-bin` and `bazel-genfiles`, and |
| * then into the workspace root. The file in the workspace root is returned |
| * even if it does not exist. Return `null` if the given [absolutePath] is |
| * not in the workspace [root]. |
| @@ -224,4 +170,58 @@ class BazelWorkspace { |
| File getFile(String pathInWorkspace) { |
| return provider.getFile(provider.pathContext.join(root, pathInWorkspace)); |
| } |
| + |
| + /** |
| + * Find the Bazel workspace that contains the given [path]. |
| + * |
| + * The [symlinkPrefix] is the prefix for names of symlinks like `bazel-bin`, |
| + * `bazel-genfiles`, etc. |
| + */ |
|
Paul Berry
2016/10/07 17:08:36
Can you add a line to the doc comment explaining w
scheglov
2016/10/07 17:15:56
Done.
|
| + static BazelWorkspace find(ResourceProvider provider, String path, |
| + {String symlinkPrefix: 'bazel', String readonlySuffix}) { |
| + Context context = provider.pathContext; |
| + |
| + // Ensure that the path is absolute and normalized. |
| + if (!context.isAbsolute(path)) { |
| + throw new ArgumentError('not absolute: $path'); |
| + } |
| + path = context.normalize(path); |
| + |
| + Folder folder = provider.getFolder(path); |
| + while (true) { |
| + Folder parent = folder.parent; |
| + if (parent == null) { |
| + return null; |
| + } |
| + |
| + // Found the READONLY folder, must be a git-based workspace. |
| + if (readonlySuffix != null && parent != null) { |
|
Paul Berry
2016/10/07 17:08:36
You can drop `&& parent != null` from this line be
scheglov
2016/10/07 17:15:56
Done.
|
| + Folder readonlyFolder = parent.getChildAssumingFolder(_READONLY); |
| + if (readonlyFolder.exists) { |
| + String root = folder.path; |
| + String readonly = readonlyFolder.path; |
| + return new BazelWorkspace._( |
| + provider, |
| + root, |
| + context.join(readonly, readonlySuffix), |
| + context.join(root, '$symlinkPrefix-bin'), |
| + context.join(root, '$symlinkPrefix-genfiles')); |
| + } |
| + } |
| + |
| + // Found the WORKSPACE file, must be a non-git workspace. |
| + if (folder.getChildAssumingFile(_WORKSPACE).exists) { |
| + String root = folder.path; |
| + return new BazelWorkspace._( |
| + provider, |
| + root, |
| + null, |
| + context.join(root, '$symlinkPrefix-bin'), |
| + context.join(root, '$symlinkPrefix-genfiles')); |
| + } |
| + |
| + // Go up the folder. |
| + folder = parent; |
| + } |
| + } |
| } |