use of com.facebook.buck.rules.SourcePathResolver in project buck by facebook.
the class CxxLibraryDescription method createExportedHeaderSymlinkTreeBuildRule.
/**
* @return a {@link HeaderSymlinkTree} for the exported headers of this C/C++ library.
*/
private <A extends Arg> HeaderSymlinkTree createExportedHeaderSymlinkTreeBuildRule(BuildRuleParams params, BuildRuleResolver resolver, CxxPreprocessables.HeaderMode mode, A args) throws NoSuchBuildTargetException {
SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(resolver);
SourcePathResolver pathResolver = new SourcePathResolver(ruleFinder);
return CxxDescriptionEnhancer.createHeaderSymlinkTree(params, resolver, mode, CxxDescriptionEnhancer.parseExportedHeaders(params.getBuildTarget(), resolver, ruleFinder, pathResolver, Optional.empty(), args), HeaderVisibility.PUBLIC);
}
use of com.facebook.buck.rules.SourcePathResolver in project buck by facebook.
the class CxxLibraryDescription method createStaticLibraryBuildRule.
/**
* Create all build rules needed to generate the static library.
*
* @return build rule that builds the static library version of this C/C++ library.
*/
private static BuildRule createStaticLibraryBuildRule(BuildRuleParams params, BuildRuleResolver resolver, CxxBuckConfig cxxBuckConfig, CxxPlatform cxxPlatform, Arg args, CxxSourceRuleFactory.PicType pic) throws NoSuchBuildTargetException {
SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(resolver);
SourcePathResolver sourcePathResolver = new SourcePathResolver(ruleFinder);
// Create rules for compiling the object files.
ImmutableMap<CxxPreprocessAndCompile, SourcePath> objects = requireObjects(params, resolver, sourcePathResolver, ruleFinder, cxxBuckConfig, cxxPlatform, pic, args);
// Write a build rule to create the archive for this C/C++ library.
BuildTarget staticTarget = CxxDescriptionEnhancer.createStaticLibraryBuildTarget(params.getBuildTarget(), cxxPlatform.getFlavor(), pic);
if (objects.isEmpty()) {
return new NoopBuildRule(new BuildRuleParams(staticTarget, Suppliers.ofInstance(ImmutableSortedSet.of()), Suppliers.ofInstance(ImmutableSortedSet.of()), params.getProjectFilesystem(), params.getCellRoots()));
}
Path staticLibraryPath = CxxDescriptionEnhancer.getStaticLibraryPath(params.getProjectFilesystem(), params.getBuildTarget(), cxxPlatform.getFlavor(), pic, cxxPlatform.getStaticLibraryExtension());
return Archive.from(staticTarget, params, ruleFinder, cxxPlatform, cxxBuckConfig.getArchiveContents(), staticLibraryPath, ImmutableList.copyOf(objects.values()));
}
use of com.facebook.buck.rules.SourcePathResolver in project buck by facebook.
the class CxxLibraryDescription method createHeaderSymlinkTreeBuildRule.
/**
* @return a {@link HeaderSymlinkTree} for the headers of this C/C++ library.
*/
private <A extends Arg> HeaderSymlinkTree createHeaderSymlinkTreeBuildRule(BuildRuleParams params, BuildRuleResolver resolver, CxxPlatform cxxPlatform, A args) throws NoSuchBuildTargetException {
boolean shouldCreatePrivateHeaderSymlinks = args.xcodePrivateHeadersSymlinks.orElse(true);
SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(resolver);
SourcePathResolver pathResolver = new SourcePathResolver(ruleFinder);
return CxxDescriptionEnhancer.createHeaderSymlinkTree(params, resolver, cxxPlatform, CxxDescriptionEnhancer.parseHeaders(params.getBuildTarget(), resolver, ruleFinder, pathResolver, Optional.of(cxxPlatform), args), HeaderVisibility.PRIVATE, shouldCreatePrivateHeaderSymlinks);
}
use of com.facebook.buck.rules.SourcePathResolver in project buck by facebook.
the class CxxLibraryDescription method createExportedPlatformHeaderSymlinkTreeBuildRule.
/**
* @return a {@link HeaderSymlinkTree} for the exported headers of this C/C++ library.
*/
private <A extends Arg> HeaderSymlinkTree createExportedPlatformHeaderSymlinkTreeBuildRule(BuildRuleParams params, BuildRuleResolver resolver, CxxPlatform cxxPlatform, A args) throws NoSuchBuildTargetException {
boolean shouldCreatePublicHeaderSymlinks = args.xcodePublicHeadersSymlinks.orElse(true);
SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(resolver);
SourcePathResolver pathResolver = new SourcePathResolver(ruleFinder);
return CxxDescriptionEnhancer.createHeaderSymlinkTree(params, resolver, cxxPlatform, CxxDescriptionEnhancer.parseExportedPlatformHeaders(params.getBuildTarget(), resolver, ruleFinder, pathResolver, cxxPlatform, args), HeaderVisibility.PUBLIC, shouldCreatePublicHeaderSymlinks);
}
use of com.facebook.buck.rules.SourcePathResolver in project buck by facebook.
the class CxxLinkableEnhancer method frameworksToLinkerArg.
@VisibleForTesting
static Arg frameworksToLinkerArg(ImmutableSortedSet<FrameworkPath> frameworkPaths) {
return new FrameworkPathArg(frameworkPaths) {
@Override
public void appendToCommandLine(ImmutableCollection.Builder<String> builder, SourcePathResolver pathResolver) {
for (FrameworkPath frameworkPath : frameworkPaths) {
builder.add("-framework");
builder.add(frameworkPath.getName(pathResolver::getAbsolutePath));
}
}
};
}
Aggregations