-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set go DebugConfguration working directory for tests #6748
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -409,6 +409,8 @@ private static File findExecutable(Label target, List<File> outputs) { | |
private static final Pattern TEST_SRCDIR = Pattern.compile("TEST_SRCDIR=([^ ]+)"); | ||
// Matches RUNFILES_<NAME>=<value> | ||
private static final Pattern RUNFILES_VAR = Pattern.compile("RUNFILES_([A-Z_]+)=([^ ]+)"); | ||
// Matches TEST_TARGET=//<package_path>:<target> | ||
private static final Pattern TEST_TARGET = Pattern.compile("TEST_TARGET=//([^:]*):([^\\s]+)"); | ||
// Matches a space-delimited arg list. Supports wrapping arg in single quotes. | ||
private static final Pattern ARGS = Pattern.compile("([^\']\\S*|\'.+?\')\\s*"); | ||
|
||
|
@@ -443,7 +445,6 @@ private static ExecutableInfo parseScriptPathFile( | |
while (runfilesVars.find()) { | ||
envVars.put(String.format("RUNFILES_%s", runfilesVars.group(1)), runfilesVars.group(2)); | ||
} | ||
workingDir = workspaceRoot.directory(); | ||
String workspaceName = execRoot.getName(); | ||
binary = | ||
Paths.get( | ||
|
@@ -452,6 +453,21 @@ private static ExecutableInfo parseScriptPathFile( | |
workspaceName, | ||
args.get(1)) | ||
.toFile(); | ||
|
||
Matcher testTarget = TEST_TARGET.matcher(text); | ||
if (testTarget.find()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that thanks to this |
||
String packagePath = testTarget.group(1); | ||
workingDir = | ||
Paths.get( | ||
workspaceRoot.directory().getPath(), | ||
testScrDir.group(1), | ||
workspaceName, | ||
packagePath) | ||
.toFile(); | ||
} else { | ||
workingDir = workspaceRoot.directory(); | ||
} | ||
|
||
// Remove everything except the args. | ||
args = args.subList(2, args.size() - 1); | ||
} else { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tested it both with bzlmod and without it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have bzlmod in some form in our company's repo which I have also tested this on, however I'm not familiar with what it does and what implications it can bring. So, no, and I don't really know how to test this extensively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the main difference between bzlmod and non-bzlmod projects is the introduction of canonical repository names. Also some rulesets behave differently depending on whether bzlmod is enabled or not (however user-visible differences are usually a bug).
I was asking because whenever there's a target pattern with a single
@
or without any@
s it is possible that under bzlmod it got turned into a@@
(we - JetBrains - have run into such problems in out Hirschgarten repo).But if it works with bzlmod it's much more probable that it will work without it than the other way round :)
So I'll merge it if it works for you!