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

Unified Diff: pkg/analyzer/lib/src/generated/bazel.dart

Issue 2406603002: Automatically identify the workspace suffix for READONLY. (Closed)
Patch Set: Ignore invalid READONLY folders. Created 4 years, 2 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 | « no previous file | pkg/analyzer/test/generated/bazel_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f3d8dd59acea315b64bdfb03763a26433fa51669..8d9858f5b48ac6a5f938c8f84463e181196bafe9 100644
--- a/pkg/analyzer/lib/src/generated/bazel.dart
+++ b/pkg/analyzer/lib/src/generated/bazel.dart
@@ -106,8 +106,8 @@ class BazelWorkspace {
final String root;
/**
- * The absolute path to the optional `READONLY` folder if a git-based
- * workspace, or `null`.
+ * The absolute path to the optional read only workspace root, in the
+ * `READONLY` folder if a git-based workspace, or `null`.
*/
final String readonly;
@@ -179,9 +179,12 @@ class BazelWorkspace {
*
* Return `null` if the workspace does not have `bazel-genfiles` or
* `blaze-genfiles` folders, so we don't know where to search generated files.
+ *
+ * Return `null` if there is a folder 'foo' with the sibling `READONLY`
+ * folder, but there is corresponding folder 'foo' in `READONLY`, i.e. the
+ * corresponding readonly workspace root.
*/
- static BazelWorkspace find(ResourceProvider provider, String path,
- {String readonlySuffix}) {
+ static BazelWorkspace find(ResourceProvider provider, String path) {
Context context = provider.pathContext;
// Ensure that the path is absolute and normalized.
@@ -197,22 +200,22 @@ class BazelWorkspace {
return null;
}
- // Found the READONLY folder, must be a git-based workspace.
- if (readonlySuffix != null) {
- Folder readonlyFolder = parent.getChildAssumingFolder(_READONLY);
- if (readonlyFolder.exists) {
- String root = folder.path;
- String readonly = readonlyFolder.path;
+ // Found the READONLY folder, might be a git-based workspace.
+ Folder readonlyFolder = parent.getChildAssumingFolder(_READONLY);
+ if (readonlyFolder.exists) {
+ String root = folder.path;
+ String readonlyRoot =
+ context.join(readonlyFolder.path, folder.shortName);
+ if (provider.getFolder(readonlyRoot).exists) {
String symlinkPrefix = _findSymlinkPrefix(provider, root);
- if (symlinkPrefix == null) {
- return null;
+ if (symlinkPrefix != null) {
+ return new BazelWorkspace._(
+ provider,
+ root,
+ readonlyRoot,
+ context.join(root, '$symlinkPrefix-bin'),
+ context.join(root, '$symlinkPrefix-genfiles'));
}
- return new BazelWorkspace._(
- provider,
- root,
- context.join(readonly, readonlySuffix),
- context.join(root, '$symlinkPrefix-bin'),
- context.join(root, '$symlinkPrefix-genfiles'));
}
}
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/bazel_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698