bazelbuild / bazelbuild/bazel

Using %workspace% variable in source.json for a module registry

Open
#20,688 0 comments 0 reactions 0 assignees View on GitHub
help wanted P3 team-ExternalDeps type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

We have created our own registry index to fetch external dependencies.
In source.json file for a specific module we are able to use environment variable "%workspace%" in windows environment but does not work on Linux (redhat-7)

### Which category does this issue belong to?

External Dependency

### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Below url works in windows environment but not in linux.
{
"url": "file:///%workspace%/thirdparty/abc.tar.gz"
}

Error :
java.lang.IllegalArgumentException: Malformed escape pair: /%workspace%/thirdparty/abc.tar.gz

### Which operating system are you running Bazel on?

Redhat-7 and Windows 10

### What is the output of `bazel info release`?

release 7.0.0

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

_No response_

### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?

_No response_

### Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

_No response_

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

"local_path" in source.json also does not seem to work.
e.g
type:local_path
path: ../thirdparty/abc.tar.gz

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the minimal source.json example with file:///%workspace%/thirdparty/abc.tar.gz on Red Hat 7 and Windows 10 using Bazel 7.0.0. Then investigate how source.json handles the %workspace% variable and the local_path example path: ../thirdparty/abc.tar.gz. Done means both forms behave consistently on Linux and Windows, with coverage for the reported cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.