-
Notifications
You must be signed in to change notification settings - Fork 746
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
Invalid file path pattern on Windows #2394
Comments
The problem appears to be due to excluding generated source code from the errorprone analysis. error-prone/check_api/src/main/java/com/google/errorprone/ErrorProneOptions.java Lines 460 to 462 in 22990c1
where my excludedPaths = "${buildDir}/generated-sources/.*" From the error this looks like a wrong assumption that the path is UNIX style, so a Windows path separator must be escaped. |
From the docs, I suppose one could argue that the above is a user error that violates the param as it is described as
So while using |
The excludePaths option for ErrorProne is used to ignore warnings in generated code. That supplied the path using `buildDir`, but in fact this is documented as a regular expression. On Windows the separator / is an invalid regex character if not escaped. By instead using a more generic pattern, rather than a file path, the build is cross-platform. google/error-prone#2394
The excludePaths option for ErrorProne is used to ignore warnings in generated code. That supplied the path using `buildDir`, but in fact this is documented as a regular expression. On Windows the separator \ is an invalid regex character if not escaped. By instead using a more generic pattern, rather than a file path, the build is cross-platform. google/error-prone#2394
We had a similar report from a Windows user and ended up modifying the regex to clarify that the initial path should be interpreted verbatim:
(We're using Maven, but I imagine this trick will also work with Gradle.) Perhaps it's worthwhile to document this trick somewhere. |
Fwiw, in Gradle, using absolute paths make the task non-relocatable, so using a relative path like in the docs would actually be better as it makes your compile task cacheable (and that cache relocatable). |
Thanks @tbroyer and @Stephan202. Those are helpful insights. I followed up by removing the exclusion as it only suppressed a warning due to using the |
So... it turns out that |
A student trying to run the simulator in Caffeine faced a compilation error because of a malformed regex. I reviewed the Gradle build configuration (build, options) and do not see a mistake there. Since I am not very familiar with Windows my debugging is limited.
I was able to reproduce his problem by running a Windows 10 trial virtual machine. The attached screenshot is from ".\gradlew.bat simulator:run -S". I disabled the errorprone plugin and provided the student those steps so that his project is unblocked.
The text was updated successfully, but these errors were encountered: