Class CatalogPathResolver
java.lang.Object
name.jurgenei.gradle.antlr.catalog.CatalogPathResolver
Resolves local path and URL grammar coordinates declared in a catalog entry.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PathresolveToPath(String value, Path baseDirectory) Resolves a catalog coordinate to a local file system path when possible.static URIresolveToUri(String value, Path baseDirectory) Resolves a catalog coordinate to a URI.
-
Method Details
-
resolveToUri
Resolves a catalog coordinate to a URI.Absolute URIs are returned as-is. Non-absolute values are treated as paths relative to
baseDirectory.Protocol-relative coordinates (`//host/path.g4`) and host/path coordinates without explicit scheme (`localhost:8080/MiniParser.g4`, `example.org/Parser.g4`) are also supported. The default scheme is `http` for localhost/loopback hosts and `https` otherwise.
- Parameters:
value- catalog value (path or URI).baseDirectory- base directory for relative values.- Returns:
- resolved URI.
-
resolveToPath
Resolves a catalog coordinate to a local file system path when possible.- Parameters:
value- catalog value (path or URI).baseDirectory- base directory for relative values.- Returns:
- resolved local path, or
nullfor non-file URIs.
-