Absolute paths embedded in dependency files
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 75
Description
### Description of the problem / feature request:
When compiling `objc_library` targets, we're seeing absolute paths of generated files being embedded in dependency files (`.d` files).
### Feature requests: what underlying problem are you trying to solve with this feature?
We're trying to make the dependency files cacheable by removing or normalizing the absolute paths that are embedded in the dependency files.
### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Please check the attached project: [nondeterministic-depfile.zip](https://github.com/bazelbuild/bazel/files/4957578/nondeterministic-depfile.zip).
* Run `bazel build //:B`
* Check the `B.d` file contents. It contains an absolute path to a file that is generated during the build (` /private/var/tmp/_bazel_user/b4422045cf7215be2d3fa4e439c7376a/sandbox/darwin-sandbox/214/execroot/__main__/bazel-out/apl-darwin_x86_64-fastbuild/bin/AModule-module.modulemap`)
The attached project uses some custom rules but the issue can be reproduced with an `objc_library` (that has modules enabled) depending on a `swift_library` and importing it via a Clang module.
### What operating system are you running Bazel on?
macOS Catalina 10.15.5 (19F101)
### What's the output of `bazel info release`?
release 3.4.1
### Have you found anything relevant by searching the web?
Found a related issue with system headers: https://github.com/bazelbuild/bazel/issues/7772. We found an additional issue with generated files during a build.
Found two issues with dependency files: https://github.com/bazelbuild/bazel/issues/7769, https://github.com/bazelbuild/bazel/pull/7771. The `dependency_file` feature can't be disabled because it's necessary to keep the C++ builds correct.
Contributor guide
Research direction
Start with the attached nondeterministic-depfile.zip and run `bazel build //:B` on the described macOS setup. Inspect the generated `B.d` file and the `objc_library`/`swift_library` module interaction; done means generated dependency files no longer embed machine-specific absolute paths while preserving correct C++ dependencies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- objective-c, swift
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100