Search in sources :

Example 46 with ProjectWorkspace

use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.

the class BuiltinApplePackageIntegrationTest method packageHasProperStructureForWatch21.

@Test
public void packageHasProperStructureForWatch21() throws IOException, InterruptedException {
    assumeTrue(Platform.detect() == Platform.MACOS);
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "watch_application_bundle", tmp);
    workspace.setUp();
    workspace.addBuckConfigLocalOption("apple", "watchsimulator_target_sdk_version", "2.1");
    packageHasProperStructureForWatchHelper(workspace, false);
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) Test(org.junit.Test)

Example 47 with ProjectWorkspace

use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.

the class BuiltinApplePackageIntegrationTest method testDisablingPackageCaching.

@Test
public void testDisablingPackageCaching() throws IOException {
    assumeTrue(Platform.detect() == Platform.MACOS);
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "simple_application_bundle_no_debug", tmp);
    workspace.setUp();
    workspace.enableDirCache();
    workspace.runBuckBuild("-c", "apple.cache_bundles_and_packages=false", "//:DemoAppPackage").assertSuccess();
    workspace.runBuckCommand("clean");
    workspace.runBuckBuild("-c", "apple.cache_bundles_and_packages=false", "//:DemoAppPackage").assertSuccess();
    workspace.getBuildLog().assertTargetBuiltLocally("//:DemoAppPackage");
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) Test(org.junit.Test)

Example 48 with ProjectWorkspace

use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.

the class BuiltinApplePackageIntegrationTest method packageHasProperStructure.

@Test
public void packageHasProperStructure() throws IOException, InterruptedException {
    assumeTrue(Platform.detect() == Platform.MACOS);
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "simple_application_bundle_no_debug", tmp);
    workspace.setUp();
    workspace.enableDirCache();
    BuildTarget appTarget = BuildTargetFactory.newInstance("//:DemoApp#no-debug,no-include-frameworks");
    workspace.runBuckCommand("build", appTarget.getUnflavoredBuildTarget().getFullyQualifiedName()).assertSuccess();
    workspace.getBuildLog().assertTargetBuiltLocally(appTarget.getFullyQualifiedName());
    workspace.runBuckCommand("clean").assertSuccess();
    BuildTarget packageTarget = BuildTargetFactory.newInstance("//:DemoAppPackage");
    workspace.runBuckCommand("build", packageTarget.getFullyQualifiedName()).assertSuccess();
    workspace.getBuildLog().assertTargetWasFetchedFromCache(appTarget.getFullyQualifiedName());
    workspace.getBuildLog().assertTargetBuiltLocally(packageTarget.getFullyQualifiedName());
    Path templateDir = TestDataHelper.getTestDataScenario(this, "simple_application_bundle_no_debug");
    ZipInspector zipInspector = new ZipInspector(workspace.getPath(BuildTargets.getGenPath(filesystem, packageTarget, "%s.ipa")));
    zipInspector.assertFileExists("Payload/DemoApp.app/DemoApp");
    zipInspector.assertFileDoesNotExist("WatchKitSupport");
    zipInspector.assertFileDoesNotExist("WatchKitSupport2");
    zipInspector.assertFileContents("Payload/DemoApp.app/PkgInfo", new String(Files.readAllBytes(templateDir.resolve("DemoApp_output.expected/DemoApp.app/PkgInfo.expected")), UTF_8));
}
Also used : Path(java.nio.file.Path) ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) BuildTarget(com.facebook.buck.model.BuildTarget) ZipInspector(com.facebook.buck.testutil.integration.ZipInspector) Test(org.junit.Test)

Example 49 with ProjectWorkspace

use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.

the class AppleLibraryIntegrationTest method frameworkDependenciesDoNotContainTransitiveDependencies.

@Test
public void frameworkDependenciesDoNotContainTransitiveDependencies() throws Exception {
    assumeTrue(Platform.detect() == Platform.MACOS);
    assumeTrue(AppleNativeIntegrationTestUtils.isApplePlatformAvailable(ApplePlatform.MACOSX));
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_library_with_library_dependencies", tmp);
    workspace.setUp();
    ProjectFilesystem filesystem = new ProjectFilesystem(workspace.getDestPath());
    BuildTarget target = BuildTargetFactory.newInstance("//Libraries/TestLibrary:TestLibrary#framework,macosx-x86_64");
    ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.getFullyQualifiedName());
    result.assertSuccess();
    Path frameworkPath = workspace.getPath(BuildTargets.getGenPath(filesystem, BuildTarget.builder(target).addFlavors(AppleDebugFormat.DWARF.getFlavor()).addFlavors(AppleDescriptions.INCLUDE_FRAMEWORKS_FLAVOR).build(), "%s").resolve("TestLibrary.framework"));
    assertThat(Files.exists(frameworkPath), is(true));
    Path frameworksPath = frameworkPath.resolve("Frameworks");
    assertThat(Files.exists(frameworksPath), is(true));
    Path depFrameworksPath = frameworksPath.resolve("TestLibraryDep.framework/Frameworks");
    assertThat(Files.exists(depFrameworksPath), is(false));
}
Also used : Path(java.nio.file.Path) ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) BuildTarget(com.facebook.buck.model.BuildTarget) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) Test(org.junit.Test)

Example 50 with ProjectWorkspace

use of com.facebook.buck.testutil.integration.ProjectWorkspace in project buck by facebook.

the class AppleLibraryIntegrationTest method testAppleLibraryBuildsForAppleTVOS.

@Test
public void testAppleLibraryBuildsForAppleTVOS() throws IOException {
    assumeTrue(AppleNativeIntegrationTestUtils.isApplePlatformAvailable(ApplePlatform.APPLETVOS));
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "apple_library_builds_something", tmp);
    workspace.setUp();
    ProjectFilesystem filesystem = new ProjectFilesystem(workspace.getDestPath());
    BuildTarget target = BuildTargetFactory.newInstance("//Libraries/TestLibrary:TestLibrary#appletvos-arm64,static");
    ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.getFullyQualifiedName());
    result.assertSuccess();
    assertTrue(Files.exists(workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s"))));
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) BuildTarget(com.facebook.buck.model.BuildTarget) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) Test(org.junit.Test)

Aggregations

ProjectWorkspace (com.facebook.buck.testutil.integration.ProjectWorkspace)747 Test (org.junit.Test)726 Path (java.nio.file.Path)219 BuildTarget (com.facebook.buck.model.BuildTarget)177 ProcessResult (com.facebook.buck.testutil.integration.ProjectWorkspace.ProcessResult)127 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)89 Matchers.containsString (org.hamcrest.Matchers.containsString)50 BuckBuildLog (com.facebook.buck.testutil.integration.BuckBuildLog)47 ProcessExecutor (com.facebook.buck.util.ProcessExecutor)35 ZipInspector (com.facebook.buck.testutil.integration.ZipInspector)21 HumanReadableException (com.facebook.buck.util.HumanReadableException)14 OcamlRuleBuilder.createStaticLibraryBuildTarget (com.facebook.buck.ocaml.OcamlRuleBuilder.createStaticLibraryBuildTarget)13 TestConsole (com.facebook.buck.testutil.TestConsole)12 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)10 DefaultProcessExecutor (com.facebook.buck.util.DefaultProcessExecutor)10 Cell (com.facebook.buck.rules.Cell)9 TestContext (com.facebook.buck.testutil.integration.TestContext)9 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)9 MappedByteBuffer (java.nio.MappedByteBuffer)9 FileChannel (java.nio.channels.FileChannel)9