Search in sources :

Example 1 with VersionedTool

use of com.facebook.buck.rules.VersionedTool in project buck by facebook.

the class AppleCxxPlatformsTest method checkSwiftPlatformUsesCorrectMinTargetSdk.

@Test
public void checkSwiftPlatformUsesCorrectMinTargetSdk() throws IOException {
    AppleCxxPlatform platformWithConfiguredSwift = buildAppleCxxPlatformWithSwiftToolchain(true);
    Tool swift = platformWithConfiguredSwift.getSwiftPlatform().get().getSwift();
    assertThat(swift, notNullValue());
    assertThat(swift, instanceOf(VersionedTool.class));
    VersionedTool versionedSwift = (VersionedTool) swift;
    assertThat(versionedSwift.getExtraArgs(), hasItem("i386-apple-ios7.0"));
}
Also used : VersionedTool(com.facebook.buck.rules.VersionedTool) VersionedTool(com.facebook.buck.rules.VersionedTool) Tool(com.facebook.buck.rules.Tool) Test(org.junit.Test)

Example 2 with VersionedTool

use of com.facebook.buck.rules.VersionedTool in project buck by facebook.

the class AppleCxxPlatformsTest method appleCxxPlatformWhenNoSwiftToolchainPreferredShouldUseDefaultSwift.

@Test
public void appleCxxPlatformWhenNoSwiftToolchainPreferredShouldUseDefaultSwift() throws IOException {
    AppleCxxPlatform platformWithDefaultSwift = buildAppleCxxPlatformWithSwiftToolchain(true);
    Optional<SwiftPlatform> swiftPlatformOptional = platformWithDefaultSwift.getSwiftPlatform();
    assertThat(swiftPlatformOptional.isPresent(), is(true));
    Tool swiftTool = swiftPlatformOptional.get().getSwift();
    assertTrue(swiftTool instanceof VersionedTool);
    assertThat(((VersionedTool) swiftTool).getPath(), equalTo(Paths.get("Toolchains/XcodeDefault.xctoolchain/usr/bin/swift")));
    assertThat(swiftPlatformOptional.get().getSwiftRuntimePaths(), Matchers.empty());
}
Also used : VersionedTool(com.facebook.buck.rules.VersionedTool) SwiftPlatform(com.facebook.buck.swift.SwiftPlatform) VersionedTool(com.facebook.buck.rules.VersionedTool) Tool(com.facebook.buck.rules.Tool) Test(org.junit.Test)

Example 3 with VersionedTool

use of com.facebook.buck.rules.VersionedTool in project buck by facebook.

the class AppleCxxPlatformsTest method appleCxxPlatformShouldUsePreferredSwiftVersion.

@Test
public void appleCxxPlatformShouldUsePreferredSwiftVersion() throws IOException {
    AppleCxxPlatform platformWithConfiguredSwift = buildAppleCxxPlatformWithSwiftToolchain(false);
    Optional<SwiftPlatform> swiftPlatformOptional = platformWithConfiguredSwift.getSwiftPlatform();
    assertThat(swiftPlatformOptional.isPresent(), is(true));
    Tool swiftTool = swiftPlatformOptional.get().getSwift();
    assertThat(((VersionedTool) swiftTool).getPath(), not(equalTo(Paths.get("Toolchains/Swift_2.3.xctoolchain/usr/bin/swift"))));
    assertThat(swiftPlatformOptional.get().getSwiftRuntimePaths(), equalTo(ImmutableSet.of(temp.getRoot().resolve("usr/lib/swift/iphoneos"))));
}
Also used : SwiftPlatform(com.facebook.buck.swift.SwiftPlatform) VersionedTool(com.facebook.buck.rules.VersionedTool) Tool(com.facebook.buck.rules.Tool) Test(org.junit.Test)

Aggregations

Tool (com.facebook.buck.rules.Tool)3 VersionedTool (com.facebook.buck.rules.VersionedTool)3 Test (org.junit.Test)3 SwiftPlatform (com.facebook.buck.swift.SwiftPlatform)2