Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Commit

Permalink
Make StripLinkable filesystem match the underlying rule/target
Browse files Browse the repository at this point in the history
Summary:
When AndroidBinary creates strip rules for its native libraries, it creates
them using the buildtargets of the libraries (so that multiple
android_binary can share the same strip rule), but it uses its own
filesystem. This causes cross-cell strip rules to be created with a
filesystem that doesn't match their own buildtarget...

We'll make ModernBuildRule enforce that these match so we can catch
other instances as we migrate (which hopefully don't exist).

Reviewed By: rajyengi

fbshipit-source-id: 1a65cc943a
  • Loading branch information
cjhopman authored and facebook-github-bot committed Mar 22, 2019
1 parent 97a889f commit 432f8fc
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,16 +427,19 @@ private ImmutableMap<StripLinkable, StrippedObjectDescription> generateStripRule
// shareable (like just using the app's containing directory, or even the repo root),
// but stripping the C++ runtime is pretty fast, so just keep the safe old behavior for now.
BuildTarget baseBuildTarget = originalBuildTarget;
ProjectFilesystem filesystem = this.projectFilesystem;
// But if we're stripping a cxx_library, use that library as the base of the target
// to allow sharing the rule between all apps that depend on it.
if (sourcePath instanceof BuildTargetSourcePath) {
baseBuildTarget = ((BuildTargetSourcePath) sourcePath).getTarget();
BuildTargetSourcePath targetSourcePath = (BuildTargetSourcePath) sourcePath;
baseBuildTarget = targetSourcePath.getTarget();
filesystem = ruleFinder.getRule(targetSourcePath).getProjectFilesystem();
}

String sharedLibrarySoName = entry.getKey().getSoName();
StripLinkable stripLinkable =
requireStripLinkable(
projectFilesystem,
filesystem,
ruleFinder,
graphBuilder,
sourcePath,
Expand Down

0 comments on commit 432f8fc

Please sign in to comment.