bazelbuild / bazelbuild/bazel

External repositories don't regenerate in response to XCode changes

Open
#14,551 8 comments 1 reaction 0 assignees View on GitHub
not stale P2 platform: apple team-ExternalDeps type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the problem / feature request:

An external repositories which uses host state as an input did not regenerate in response to changes. In this case XCode.

### Feature requests: what underlying problem are you trying to solve with this feature?

NA

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

On a machine without XCode (App Store) installed...

1. Clone Bazel repo
2. Run `bazel build //src:bazel-dev`
3. Observe build failure (due to missing SDK, I haven't ruled out my device being in a bad state)
4. Install XCode (App Store)
5. Run `bazel build //src:bazel-dev`
6. Observe build failure due to generated external repositories being out of sync
```
ERROR: /private/var/tmp/_bazel_jordan/334f33179bc015d52bb8bdf09a360987/external/com_google_protobuf/BUILD:161:11: Compiling src/google/protobuf/io/zero_copy_stream.cc failed: undeclared inclusion(s) in rule '@com_google_protobuf//:protobuf_lite':
this rule is missing dependency declarations for the following files included by 'src/google/protobuf/io/zero_copy_stream.cc':
'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string'
'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config'
...
```
7. Run `bazel clean --expunge` (or `bazel sync --configure` as per https://github.com/bazelbuild/bazel/issues/14551#issuecomment-1009934718)
8. Run `bazel build //src:bazel-dev`
9. Observe successful build

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

MacOS

### What's the output of `bazel info release`?

`release 6.0.0-pre.20211215.3`

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

NA

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

```
https://github.com/Silic0nS0ldier/bazel.git
b92d5c3ca209ac3495b72fdf488eb9291455a8e2
26d4aadaf4006efd6ff20004aa1430e97263b30c
```

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

No, I knew what was causing the initial build issues when I saw it. Resolving the missing dependency issues revealed the external repository caching issue.

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

Nope

Contributor guide

Open the contributing guide

Research direction

Reproduce the macOS sequence in the issue, especially installing XCode between the failed and successful builds, and compare the external repository state before and after `bazel clean --expunge` or `bazel sync --configure`. Start from the external repository regeneration and caching path implicated by the stale generated repositories. Done means `bazel build //src:bazel-dev` succeeds after the XCode change without requiring a manual clean or sync.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, devtools
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.