use of com.facebook.buck.rules.coercer.FrameworkPath in project buck by facebook.
the class CxxPrecompiledHeaderTemplate method getPreprocessDeps.
private ImmutableSortedSet<BuildRule> getPreprocessDeps(CxxPlatform cxxPlatform) {
ImmutableSortedSet.Builder<BuildRule> builder = ImmutableSortedSet.naturalOrder();
for (CxxPreprocessorInput input : getCxxPreprocessorInputs(cxxPlatform)) {
builder.addAll(input.getDeps(ruleResolver, ruleFinder));
}
for (CxxHeaders cxxHeaders : getIncludes(cxxPlatform)) {
builder.addAll(cxxHeaders.getDeps(ruleFinder));
}
for (FrameworkPath frameworkPath : getFrameworks(cxxPlatform)) {
builder.addAll(frameworkPath.getDeps(ruleFinder));
}
builder.addAll(getDeps());
builder.addAll(getExportedDeps());
return builder.build();
}
use of com.facebook.buck.rules.coercer.FrameworkPath in project buck by facebook.
the class CxxLibraryDescriptionTest method sharedLibraryShouldLinkOwnRequiredLibrariesForCxxLibrary.
@Test
public void sharedLibraryShouldLinkOwnRequiredLibrariesForCxxLibrary() throws Exception {
ProjectFilesystem filesystem = new FakeProjectFilesystem();
CxxPlatform platform = CxxLibraryBuilder.createDefaultPlatform();
ImmutableSortedSet<FrameworkPath> libraries = ImmutableSortedSet.of(FrameworkPath.ofSourcePath(new FakeSourcePath("/some/path/libs.dylib")), FrameworkPath.ofSourcePath(new FakeSourcePath("/another/path/liba.dylib")));
CxxLibraryBuilder libraryBuilder = new CxxLibraryBuilder(BuildTargetFactory.newInstance("//:foo"), cxxBuckConfig);
libraryBuilder.setLibraries(libraries).setSrcs(ImmutableSortedSet.of(SourceWithFlags.of(new FakeSourcePath("foo.c"))));
TargetGraph targetGraph = TargetGraphFactory.newInstance(libraryBuilder.build());
BuildRuleResolver resolver = new BuildRuleResolver(targetGraph, new DefaultTargetNodeToBuildRuleTransformer());
CxxLibrary library = (CxxLibrary) libraryBuilder.build(resolver, filesystem, targetGraph);
assertThat(library.getNativeLinkTargetInput(platform).getLibraries(), equalTo(libraries));
}
use of com.facebook.buck.rules.coercer.FrameworkPath in project buck by facebook.
the class FrameworkPathArgTest method testGetDeps.
@Test
public void testGetDeps() throws Exception {
ProjectFilesystem filesystem = new FakeProjectFilesystem();
BuildRuleResolver ruleResolver = new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(ruleResolver);
BuildTarget genruleTarget = BuildTargetFactory.newInstance("//:genrule");
Genrule genrule = GenruleBuilder.newGenruleBuilder(genruleTarget).setOut("foo/bar.o").build(ruleResolver, filesystem);
FrameworkPath sourcePathFrameworkPath = FrameworkPath.ofSourcePath(genrule.getSourcePathToOutput());
FrameworkPathArg sourcePathFrameworkPathArg = new TestFrameworkPathArg(sourcePathFrameworkPath);
assertThat(sourcePathFrameworkPathArg.getDeps(ruleFinder), Matchers.contains(genrule));
}
use of com.facebook.buck.rules.coercer.FrameworkPath in project buck by facebook.
the class NewNativeTargetProjectMutator method addFrameworksBuildPhase.
private void addFrameworksBuildPhase(PBXProject project, PBXNativeTarget target) {
if (frameworks.isEmpty() && archives.isEmpty()) {
return;
}
PBXGroup sharedFrameworksGroup = project.getMainGroup().getOrCreateChildGroupByName("Frameworks");
PBXFrameworksBuildPhase frameworksBuildPhase = new PBXFrameworksBuildPhase();
target.getBuildPhases().add(frameworksBuildPhase);
for (FrameworkPath framework : frameworks) {
SourceTreePath sourceTreePath;
if (framework.getSourceTreePath().isPresent()) {
sourceTreePath = framework.getSourceTreePath().get();
} else if (framework.getSourcePath().isPresent()) {
sourceTreePath = new SourceTreePath(PBXReference.SourceTree.SOURCE_ROOT, pathRelativizer.outputPathToSourcePath(framework.getSourcePath().get()), Optional.empty());
} else {
throw new RuntimeException();
}
PBXFileReference fileReference = sharedFrameworksGroup.getOrCreateFileReferenceBySourceTreePath(sourceTreePath);
frameworksBuildPhase.getFiles().add(new PBXBuildFile(fileReference));
}
for (PBXFileReference archive : archives) {
frameworksBuildPhase.getFiles().add(new PBXBuildFile(archive));
}
}
Aggregations