use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.
the class AppleBundleIntegrationTest method simpleApplicationBundleWithCodeSigning.
@Test
public void simpleApplicationBundleWithCodeSigning() throws Exception {
assumeTrue(Platform.detect() == Platform.MACOS);
assumeTrue(FakeAppleDeveloperEnvironment.supportsCodeSigning());
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "simple_application_bundle_with_codesigning", tmp);
workspace.setUp();
BuildTarget target = workspace.newBuildTarget("//:DemoApp#iphoneos-arm64,no-debug");
workspace.runBuckCommand("build", target.getFullyQualifiedName()).assertSuccess();
workspace.verify(Paths.get("DemoApp_output.expected"), BuildTargets.getGenPath(filesystem, BuildTarget.builder(target).addFlavors(AppleDescriptions.NO_INCLUDE_FRAMEWORKS_FLAVOR).build(), "%s"));
Path appPath = workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTarget.builder(target).addFlavors(AppleDescriptions.NO_INCLUDE_FRAMEWORKS_FLAVOR).build(), "%s").resolve(target.getShortName() + ".app"));
assertTrue(Files.exists(appPath.resolve(target.getShortName())));
assertTrue(checkCodeSigning(appPath));
// Do not match iOS profiles on tvOS targets.
target = workspace.newBuildTarget("//:DemoApp#appletvos-arm64,no-debug");
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.getFullyQualifiedName());
result.assertFailure();
assertTrue(result.getStderr().contains("No valid non-expired provisioning profiles match"));
// Match tvOS profile.
workspace.addBuckConfigLocalOption("apple", "provisioning_profile_search_path", "provisioning_profiles_tvos");
workspace.runBuckCommand("build", target.getFullyQualifiedName()).assertSuccess();
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.
the class AppleBundleIntegrationTest method bundleHasOutputPath.
@Test
public void bundleHasOutputPath() throws IOException {
assumeTrue(Platform.detect() == Platform.MACOS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "simple_application_bundle_no_debug", tmp);
workspace.setUp();
BuildTarget target = BuildTargetFactory.newInstance("//:DemoApp#no-debug");
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("targets", "--show-output", target.getFullyQualifiedName());
result.assertSuccess();
Path appPath = BuildTargets.getGenPath(filesystem, BuildTarget.builder(target).addFlavors(AppleDescriptions.NO_INCLUDE_FRAMEWORKS_FLAVOR).build(), "%s").resolve(target.getShortName() + ".app");
assertEquals(String.format("%s %s", target.getFullyQualifiedName(), appPath), result.getStdout().trim());
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.
the class PrebuiltAppleFrameworkIntegrationTest method testPrebuiltAppleFrameworkLinks.
@Test
public void testPrebuiltAppleFrameworkLinks() throws IOException, InterruptedException {
assumeTrue(Platform.detect() == Platform.MACOS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "prebuilt_apple_framework_links", tmp);
workspace.setUp();
ProjectFilesystem filesystem = new ProjectFilesystem(workspace.getDestPath());
BuildTarget target = BuildTargetFactory.newInstance("//app:TestApp");
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.getFullyQualifiedName());
result.assertSuccess();
Path testBinaryPath = workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s"));
assertTrue(Files.exists(testBinaryPath));
ProcessExecutor.Result otoolResult = workspace.runCommand("otool", "-L", testBinaryPath.toString());
assertEquals(0, otoolResult.getExitCode());
assertThat(otoolResult.getStdout().orElse(""), containsString("@rpath/BuckTest.framework/BuckTest"));
assertThat(otoolResult.getStdout().orElse(""), not(containsString("BuckTest.dylib")));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.
the class PrebuiltAppleFrameworkIntegrationTest method testPrebuiltAppleFrameworkBuildsSomething.
@Test
public void testPrebuiltAppleFrameworkBuildsSomething() throws IOException {
assumeTrue(Platform.detect() == Platform.MACOS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "prebuilt_apple_framework_builds", tmp);
workspace.setUp();
ProjectFilesystem filesystem = new ProjectFilesystem(workspace.getDestPath());
BuildTarget target = BuildTargetFactory.newInstance("//prebuilt:BuckTest");
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.getFullyQualifiedName());
result.assertSuccess();
assertTrue(Files.exists(workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s"))));
}
use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.
the class PrebuiltAppleFrameworkIntegrationTest method testStaticWithDependencies.
@Test
public void testStaticWithDependencies() throws IOException, InterruptedException {
assumeTrue(Platform.detect() == Platform.MACOS);
ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "prebuilt_apple_framework_static", tmp);
workspace.setUp();
ProjectFilesystem filesystem = new ProjectFilesystem(workspace.getDestPath());
BuildTarget target = BuildTargetFactory.newInstance("//app:TestApp#static,macosx-x86_64");
ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.getFullyQualifiedName());
result.assertSuccess();
Path testBinaryPath = workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s"));
ProcessExecutor.Result otoolResult = workspace.runCommand("otool", "-L", testBinaryPath.toString());
assertEquals(0, otoolResult.getExitCode());
assertThat(otoolResult.getStdout().orElse(""), containsString("Foundation.framework"));
assertThat(otoolResult.getStdout().orElse(""), not(containsString("@rpath/BuckTest.framework/BuckTest")));
ProcessExecutor.Result nmResult = workspace.runCommand("nm", testBinaryPath.toString());
assertEquals(0, nmResult.getExitCode());
assertThat(nmResult.getStdout().orElse(""), containsString("S _OBJC_CLASS_$_Hello"));
assertThat(nmResult.getStdout().orElse(""), not(containsString("U _OBJC_CLASS_$_Hello")));
assertThat(nmResult.getStdout().orElse(""), containsString("S _OBJC_CLASS_$_Strings"));
assertThat(nmResult.getStdout().orElse(""), not(containsString("U _OBJC_CLASS_$_Strings")));
}
Aggregations