@Test public void noIncludeFrameworksDoesntContainFrameworkDependencies() 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#" + "dwarf-and-dsym,framework,macosx-x86_64,no-include-frameworks"); ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.getFullyQualifiedName()); result.assertSuccess(); Path frameworkPath = workspace.getPath( BuildTargets.getGenPath(filesystem, target, "%s").resolve("TestLibrary.framework")); assertThat(Files.exists(frameworkPath), is(true)); assertThat(Files.exists(frameworkPath.resolve("Resources/Info.plist")), is(true)); Path libraryPath = frameworkPath.resolve("TestLibrary"); assertThat(Files.exists(libraryPath), is(true)); assertThat( workspace.runCommand("file", libraryPath.toString()).getStdout().get(), containsString("dynamically linked shared library")); Path frameworksPath = frameworkPath.resolve("Contents/Frameworks"); assertThat(Files.exists(frameworksPath), is(false)); }
@Test public void testAppleLibraryBuildsFramework() throws Exception { assumeTrue(Platform.detect() == Platform.MACOS); assumeTrue(AppleNativeIntegrationTestUtils.isApplePlatformAvailable(ApplePlatform.MACOSX)); 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#framework,macosx-x86_64,no-debug"); ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.getFullyQualifiedName()); result.assertSuccess(); Path frameworkPath = workspace.getPath( BuildTargets.getGenPath( filesystem, BuildTarget.builder(target) .addFlavors(AppleDescriptions.INCLUDE_FRAMEWORKS_FLAVOR) .build(), "%s") .resolve("TestLibrary.framework")); assertThat(Files.exists(frameworkPath), is(true)); assertThat(Files.exists(frameworkPath.resolve("Resources/Info.plist")), is(true)); Path libraryPath = frameworkPath.resolve("TestLibrary"); assertThat(Files.exists(libraryPath), is(true)); assertThat( workspace.runCommand("file", libraryPath.toString()).getStdout().get(), containsString("dynamically linked shared library")); }
@Test public void testAppleLibraryBuildsFramework() throws Exception { assumeTrue(Platform.detect() == Platform.MACOS); assumeTrue( AppleNativeIntegrationTestUtils.isApplePlatformAvailable( ApplePlatform.builder().setName(ApplePlatform.Name.MACOSX).build())); ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario( this, "apple_library_builds_something", tmp); workspace.setUp(); ProjectWorkspace.ProcessResult result = workspace.runBuckCommand( "build", "//Libraries/TestLibrary:TestLibrary#framework,macosx-x86_64"); result.assertSuccess(); Path frameworkPath = tmp.getRootPath() .resolve(BuckConstant.GEN_DIR) .resolve( "Libraries/TestLibrary/TestLibrary#framework,macosx-x86_64/TestLibrary.framework"); assertThat(Files.exists(frameworkPath), is(true)); assertThat(Files.exists(frameworkPath.resolve("Contents/Info.plist")), is(true)); Path libraryPath = frameworkPath.resolve("Contents/MacOS/TestLibrary"); assertThat(Files.exists(libraryPath), is(true)); assertThat( workspace.runCommand("file", libraryPath.toString()).getStdout().get(), containsString("dynamically linked shared library")); }
private ProcessExecutor.Result runRuleKeyDiffer(ProjectWorkspace workspace) throws IOException, InterruptedException { ProcessExecutor.Result result = workspace.runCommand( "python2.7", Paths.get("scripts", "diff_rulekeys.py").toString(), tmp.getRootPath().resolve("buck-0.log").toString(), tmp.getRootPath().resolve("buck-1.log").toString(), "//:java_lib_2"); assertThat(result.getStderr(), Matchers.equalTo(Optional.of(""))); assertThat(result.getExitCode(), Matchers.is(0)); return result; }
@Test public void testBuildAppleLibraryThatHasSwift() throws Exception { assumeTrue(Platform.detect() == Platform.MACOS); ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "empty_source_targets", tmp); workspace.setUp(); BuildTarget target = workspace.newBuildTarget("//:none-swift#iphonesimulator-x86_64,shared"); ProjectWorkspace.ProcessResult result = workspace.runBuckCommand("build", target.getFullyQualifiedName()); result.assertSuccess(); ProjectFilesystem filesystem = new ProjectFilesystem(workspace.getDestPath()); Path binaryOutput = workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s/libnone-swift.dylib")); assertThat(Files.exists(binaryOutput), is(true)); assertThat( workspace.runCommand("otool", "-L", binaryOutput.toString()).getStdout().get(), containsString("libswiftCore.dylib")); }