use of com.facebook.buck.apple.xcode.xcodeproj.PBXCopyFilesBuildPhase in project buck by facebook.
the class ProjectGeneratorTest method testAppleWatchTarget.
@Test
public void testAppleWatchTarget() throws IOException {
BuildTarget watchAppBinaryTarget = BuildTarget.builder(rootPath, "//foo", "WatchAppBinary").build();
TargetNode<?, ?> watchAppBinaryNode = AppleBinaryBuilder.createBuilder(watchAppBinaryTarget).build();
BuildTarget watchAppTarget = BuildTarget.builder(rootPath, "//foo", "WatchApp").addFlavors(DEFAULT_FLAVOR).build();
TargetNode<?, ?> watchAppNode = AppleBundleBuilder.createBuilder(watchAppTarget).setExtension(Either.ofLeft(AppleBundleExtension.APP)).setXcodeProductType(Optional.of("com.apple.product-type.application.watchapp2")).setInfoPlist(new FakeSourcePath("Info.plist")).setBinary(watchAppBinaryTarget).build();
BuildTarget hostAppBinaryTarget = BuildTarget.builder(rootPath, "//foo", "HostAppBinary").build();
TargetNode<?, ?> hostAppBinaryNode = AppleBinaryBuilder.createBuilder(hostAppBinaryTarget).build();
BuildTarget hostAppTarget = BuildTarget.builder(rootPath, "//foo", "HostApp").build();
TargetNode<?, ?> hostAppNode = AppleBundleBuilder.createBuilder(hostAppTarget).setExtension(Either.ofLeft(AppleBundleExtension.APP)).setInfoPlist(new FakeSourcePath("Info.plist")).setBinary(hostAppBinaryTarget).setDeps(ImmutableSortedSet.of(watchAppTarget)).build();
ProjectGenerator projectGenerator = createProjectGeneratorForCombinedProject(ImmutableSet.of(watchAppNode, watchAppBinaryNode, hostAppNode, hostAppBinaryNode));
projectGenerator.createXcodeProjects();
PBXTarget target = assertTargetExistsAndReturnTarget(projectGenerator.getGeneratedProject(), "//foo:HostApp");
assertEquals(target.getProductType(), ProductType.APPLICATION);
ProjectGeneratorTestUtils.assertHasSingletonCopyFilesPhaseWithFileEntries(target, ImmutableList.of("$BUILT_PRODUCTS_DIR/WatchApp.app"));
PBXCopyFilesBuildPhase copyBuildPhase = ProjectGeneratorTestUtils.getSingletonPhaseByType(target, PBXCopyFilesBuildPhase.class);
assertEquals(copyBuildPhase.getDstSubfolderSpec(), CopyFilePhaseDestinationSpec.builder().setDestination(PBXCopyFilesBuildPhase.Destination.PRODUCTS).setPath("$(CONTENTS_FOLDER_PATH)/Watch").build());
}
use of com.facebook.buck.apple.xcode.xcodeproj.PBXCopyFilesBuildPhase in project buck by facebook.
the class ProjectGenerator method getSingleCopyFilesBuildPhase.
private PBXCopyFilesBuildPhase getSingleCopyFilesBuildPhase(CopyFilePhaseDestinationSpec destinationSpec, Iterable<TargetNode<?, ?>> targetNodes) {
PBXCopyFilesBuildPhase copyFilesBuildPhase = new PBXCopyFilesBuildPhase(destinationSpec);
HashSet<UnflavoredBuildTarget> frameworkTargets = new HashSet<UnflavoredBuildTarget>();
for (TargetNode<?, ?> targetNode : targetNodes) {
PBXFileReference fileReference = getLibraryFileReference(targetNode);
PBXBuildFile buildFile = new PBXBuildFile(fileReference);
if (fileReference.getExplicitFileType().equals(Optional.of("wrapper.framework"))) {
UnflavoredBuildTarget buildTarget = targetNode.getBuildTarget().getUnflavoredBuildTarget();
if (frameworkTargets.contains(buildTarget)) {
continue;
}
frameworkTargets.add(buildTarget);
NSDictionary settings = new NSDictionary();
settings.put("ATTRIBUTES", new String[] { "CodeSignOnCopy", "RemoveHeadersOnCopy" });
buildFile.setSettings(Optional.of(settings));
}
copyFilesBuildPhase.getFiles().add(buildFile);
}
return copyFilesBuildPhase;
}
Aggregations