Support periods in label syntax
Kythe needs support for '.' characters in its labels because several of its directories contain the character.
Just wondering, which directories specifically?
Directories under $GOPATH/src that correspond to domain names (e.g. third_party/go/src/golang.org/x/net).
We also have an internal request for that - however, we need to be careful with changes to the allowed package names as that can break services and tools that assume the current one. We might be able to allow it in Bazel, but disallow it internally, maybe...
On Mon, Apr 13, 2015 at 11:03 PM, Cody Schroeder [email protected] wrote:
Directories under $GOPATH/src that correspond to domain names (e.g. third_party/go/src/golang.org/x/net https://github.com/google/kythe/tree/master/third_party/go/src/golang.org/x/net ).
— Reply to this email directly or view it on GitHub https://github.com/google/bazel/issues/118#issuecomment-92497638.
Just as a note, this feature is critical for properly supporting Kythe's third_party Go libraries (since packages are stored under directories like github.com and google.golang.org). Otherwise, we have to have 1 large, rather unmaintainable BUILD file for all of our imported libraries. This will likely come up in Bazel's official Go support as well.
Any progress on this?
Not really. I'm slowly convincing myself that we should be able to add a couple characters without any problems. The question is - which ones?
Here's EBNF for the currently accepted labels (this will be rolled into the docs):
label = ( “@” <workspace_name> )? “//” <package_name> “:” <target_name>
| “:”? <target_name>
| ( “@” <workspace_name> )? “//” ( <package_name> “/” )? ( [0-9A-Za-z_-]+ )
workspace_name = [0-9A-Z_a-z_.-] ( “/”? [0-9A-Z_a-z_.-] )*
package_name = [0-9A-Za-z_-] ( “/”? [0-9A-Za-z_-] )*
target_name = ( <letter> | [/.+,=~_@-] )+
except strings starting with “/”, “./”, or “../”
except strings ending in “/” or “/..”
except strings containing “//”, “/./”, or “/../”
except strings identical to “” “..”
letter = any character for which java.lang.Character.isLetterOrDigit returns true
The consistent thing would be to make package_name closer to target_name, with similar restrictions on the full string (i.e., no "./", no "//", no "/../", etc). Actually, looking at it right now, it looks like the workspace_name is broken, because it allows things like ".", and "./.", and "./../.", which all lead to invalid paths.
I have started work on the Go rules again. I'll work on this shortlty.
I have a proposal. Let's talk.
On Thursday, 24 September 2015, Han-Wen Nienhuys [email protected] wrote:
I have started work on the Go rules again. I'll work on this shortlty.
— Reply to this email directly or view it on GitHub https://github.com/bazelbuild/bazel/issues/118#issuecomment-143007827.
dots are allowed in package names as of c1caffaabd028493188b7e3419bedf3a9506dfee