Skip to content

Commit

Permalink
Fix missing digest for m.jar (#8447)
Browse files Browse the repository at this point in the history
### Problem

```
[ 27/207] Rsc-ing 302 mixed sources in 1 target ('<some target>).
rsc(finagle/finagle-core/src/main:main) failed: 
ClasspathEntry ClasspathEntry(path='<some path>/source/.pants.d/compile/rsc/c1e3836b60e5/finagle.finagle-core.src.main.main/current/rsc/m.jar', directory_digest=None) didn't have a Digest, so won't be present for hermetic 
```

The issue is that when we are setting the directory like this
```
ctx.rsc_jar_file = ClasspathEntry(ctx.rsc_jar_file.path, res.output_directory_digest)
```
it creates a new object and assign it to `ctx.rsc_jar_file`, whereas somewhere else in the code still points to the `ClasspathEntry` that `ctx.rsc_jar_file` used to point to.

### Solution

Do not create an object, but change its attribute.

### Result

RSC does not choke on this anymore.
  • Loading branch information
wisechengyi authored Oct 14, 2019
1 parent 7134456 commit a15a134
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -674,15 +674,13 @@ def _runtool_hermetic(self, main, tool_name, distribution, input_digest, ctx):
# TODO: parse the output of -Xprint:timings for rsc and write it to self._record_target_stats()!

res.output_directory_digest.dump(ctx.rsc_jar_file.path)

ctx.rsc_jar_file = ClasspathEntry(ctx.rsc_jar_file.path, res.output_directory_digest)

self.context._scheduler.materialize_directories((
DirectoryToMaterialize(
# NB the first element here is the root to materialize into, not the dir to snapshot
get_buildroot(),
res.output_directory_digest),
))
ctx.rsc_jar_file.hydrate_missing_directory_digest(res.output_directory_digest)

return res

Expand Down

0 comments on commit a15a134

Please sign in to comment.