use of com.facebook.buck.io.FakeExecutableFinder in project buck by facebook.
the class AppleCxxPlatformsTest method iphoneOSSdkPathsBuiltFromDirectory.
@Test
public void iphoneOSSdkPathsBuiltFromDirectory() throws Exception {
AppleSdkPaths appleSdkPaths = AppleSdkPaths.builder().setDeveloperPath(Paths.get(".")).addToolchainPaths(Paths.get("Toolchains/XcodeDefault.xctoolchain")).setPlatformPath(Paths.get("Platforms/iPhoneOS.platform")).setSdkPath(Paths.get("Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk")).build();
AppleToolchain toolchain = AppleToolchain.builder().setIdentifier("com.apple.dt.XcodeDefault").setPath(Paths.get("Toolchains/XcodeDefault.xctoolchain")).setVersion("1").build();
AppleSdk targetSdk = AppleSdk.builder().setApplePlatform(ApplePlatform.IPHONEOS).setName("iphoneos8.0").setVersion("8.0").setToolchains(ImmutableList.of(toolchain)).build();
ImmutableSet<Path> paths = ImmutableSet.<Path>builder().addAll(COMMON_KNOWN_PATHS).add(Paths.get("Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate")).add(Paths.get("Platforms/iPhoneOS.platform/Developer/usr/bin/libtool")).add(Paths.get("Platforms/iPhoneOS.platform/Developer/usr/bin/ar")).add(Paths.get("Tools/otest")).build();
AppleCxxPlatform appleCxxPlatform = AppleCxxPlatforms.buildWithExecutableChecker(projectFilesystem, targetSdk, "7.0", "armv7", appleSdkPaths, FakeBuckConfig.builder().build(), new FakeAppleConfig(), new FakeExecutableFinder(paths), Optional.empty(), Optional.empty());
CxxPlatform cxxPlatform = appleCxxPlatform.getCxxPlatform();
BuildRuleResolver ruleResolver = new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
SourcePathResolver resolver = new SourcePathResolver(new SourcePathRuleFinder(ruleResolver));
assertEquals(ImmutableList.of("usr/bin/actool"), appleCxxPlatform.getActool().getCommandPrefix(resolver));
assertEquals(ImmutableList.of("usr/bin/ibtool"), appleCxxPlatform.getIbtool().getCommandPrefix(resolver));
assertEquals(ImmutableList.of("usr/bin/lldb"), appleCxxPlatform.getLldb().getCommandPrefix(resolver));
assertEquals(ImmutableList.of("Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil"), appleCxxPlatform.getDsymutil().getCommandPrefix(resolver));
assertEquals(ImmutableList.of("Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate"), appleCxxPlatform.getCodesignAllocate().get().getCommandPrefix(resolver));
assertEquals(ImmutableList.of("usr/bin/xctest"), appleCxxPlatform.getXctest().getCommandPrefix(resolver));
assertEquals(InternalFlavor.of("iphoneos8.0-armv7"), cxxPlatform.getFlavor());
assertEquals(Paths.get("Toolchains/XcodeDefault.xctoolchain/usr/bin/clang").toString(), cxxPlatform.getCc().resolve(ruleResolver).getCommandPrefix(resolver).get(0));
assertThat(ImmutableList.<String>builder().addAll(cxxPlatform.getCc().resolve(ruleResolver).getCommandPrefix(resolver)).addAll(cxxPlatform.getCflags()).build(), hasConsecutiveItems("-isysroot", Paths.get("Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk").toString()));
assertThat(cxxPlatform.getCflags(), hasConsecutiveItems("-arch", "armv7"));
assertThat(cxxPlatform.getAsflags(), hasConsecutiveItems("-arch", "armv7"));
assertThat(cxxPlatform.getCflags(), hasConsecutiveItems("-mios-version-min=7.0"));
assertThat(cxxPlatform.getLdflags(), hasConsecutiveItems("-Wl,-sdk_version", "-Wl,8.0"));
assertEquals(Paths.get("Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++").toString(), cxxPlatform.getCxx().resolve(ruleResolver).getCommandPrefix(resolver).get(0));
assertEquals(Paths.get("Platforms/iPhoneOS.platform/Developer/usr/bin/ar").toString(), cxxPlatform.getAr().getCommandPrefix(resolver).get(0));
}
use of com.facebook.buck.io.FakeExecutableFinder in project buck by facebook.
the class AppleCxxPlatformsTest method iphoneOSSimulatorPlatformSetsLinkerFlags.
@Test
public void iphoneOSSimulatorPlatformSetsLinkerFlags() throws Exception {
AppleSdkPaths appleSdkPaths = AppleSdkPaths.builder().setDeveloperPath(Paths.get(".")).addToolchainPaths(Paths.get("Toolchains/XcodeDefault.xctoolchain")).setPlatformPath(Paths.get("Platforms/iPhoneOS.platform")).setSdkPath(Paths.get("Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneSimulator8.0.sdk")).build();
ImmutableSet<Path> paths = ImmutableSet.<Path>builder().addAll(COMMON_KNOWN_PATHS).add(Paths.get("Platforms/iPhoneSimulator.platform/Developer/usr/bin/libtool")).add(Paths.get("Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar")).add(Paths.get("Tools/otest")).build();
AppleToolchain toolchain = AppleToolchain.builder().setIdentifier("com.apple.dt.XcodeDefault").setPath(Paths.get("Toolchains/XcodeDefault.xctoolchain")).setVersion("1").build();
AppleSdk targetSdk = AppleSdk.builder().setApplePlatform(ApplePlatform.IPHONESIMULATOR).setName("iphonesimulator8.0").setVersion("8.0").setToolchains(ImmutableList.of(toolchain)).build();
AppleCxxPlatform appleCxxPlatform = AppleCxxPlatforms.buildWithExecutableChecker(projectFilesystem, targetSdk, "7.0", "armv7", appleSdkPaths, FakeBuckConfig.builder().build(), new FakeAppleConfig(), new FakeExecutableFinder(paths), Optional.empty(), Optional.empty());
CxxPlatform cxxPlatform = appleCxxPlatform.getCxxPlatform();
assertThat(cxxPlatform.getCflags(), hasItem("-mios-simulator-version-min=7.0"));
assertThat(cxxPlatform.getLdflags(), hasItem("-mios-simulator-version-min=7.0"));
}
use of com.facebook.buck.io.FakeExecutableFinder in project buck by facebook.
the class LuaBinaryIntegrationTest method getLuaBuckConfig.
private LuaBuckConfig getLuaBuckConfig() throws IOException {
Config rawConfig = Configs.createDefaultConfig(tmp.getRoot());
BuckConfig buckConfig = new BuckConfig(rawConfig, new ProjectFilesystem(tmp.getRoot()), Architecture.detect(), Platform.detect(), ImmutableMap.of(), new DefaultCellPathResolver(tmp.getRoot(), rawConfig));
return new LuaBuckConfig(buckConfig, new FakeExecutableFinder(ImmutableList.of()));
}
use of com.facebook.buck.io.FakeExecutableFinder in project buck by facebook.
the class AppleCxxPlatformsTest method appleTVOSSimulatorPlatformSetsLinkerFlags.
@Test
public void appleTVOSSimulatorPlatformSetsLinkerFlags() throws Exception {
AppleSdkPaths appleSdkPaths = AppleSdkPaths.builder().setDeveloperPath(Paths.get(".")).addToolchainPaths(Paths.get("Toolchains/XcodeDefault.xctoolchain")).setPlatformPath(Paths.get("Platforms/AppleTVSimulator.platform")).setSdkPath(Paths.get("Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator9.1.sdk")).build();
ImmutableSet<Path> paths = ImmutableSet.<Path>builder().addAll(COMMON_KNOWN_PATHS).add(Paths.get("Platforms/AppleTVSimulator.platform/Developer/usr/bin/libtool")).add(Paths.get("Platforms/AppleTVSimulator.platform/Developer/usr/bin/ar")).build();
AppleToolchain toolchain = AppleToolchain.builder().setIdentifier("com.apple.dt.XcodeDefault").setPath(Paths.get("Toolchains/XcodeDefault.xctoolchain")).setVersion("1").build();
AppleSdk targetSdk = AppleSdk.builder().setApplePlatform(ApplePlatform.APPLETVSIMULATOR).setName("appletvsimulator9.1").setVersion("9.1").setToolchains(ImmutableList.of(toolchain)).build();
AppleCxxPlatform appleCxxPlatform = AppleCxxPlatforms.buildWithExecutableChecker(projectFilesystem, targetSdk, "9.1", "arm64", appleSdkPaths, FakeBuckConfig.builder().build(), new FakeAppleConfig(), new FakeExecutableFinder(paths), Optional.empty(), Optional.empty());
CxxPlatform cxxPlatform = appleCxxPlatform.getCxxPlatform();
assertThat(cxxPlatform.getCflags(), hasItem("-mtvos-simulator-version-min=9.1"));
assertThat(cxxPlatform.getLdflags(), hasItem("-mtvos-simulator-version-min=9.1"));
}
use of com.facebook.buck.io.FakeExecutableFinder in project buck by facebook.
the class AppleCxxPlatformsTest method invalidFlavorCharactersInSdkAreEscaped.
@Test
public void invalidFlavorCharactersInSdkAreEscaped() throws Exception {
AppleSdkPaths appleSdkPaths = AppleSdkPaths.builder().setDeveloperPath(Paths.get(".")).addToolchainPaths(Paths.get("Toolchains/XcodeDefault.xctoolchain")).setPlatformPath(Paths.get("Platforms/iPhoneOS.platform")).setSdkPath(Paths.get("Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk")).build();
ImmutableSet<Path> paths = ImmutableSet.<Path>builder().addAll(COMMON_KNOWN_PATHS).add(Paths.get("Platforms/iPhoneOS.platform/Developer/usr/bin/libtool")).add(Paths.get("Platforms/iPhoneOS.platform/Developer/usr/bin/ar")).add(Paths.get("Tools/otest")).build();
AppleToolchain toolchain = AppleToolchain.builder().setIdentifier("com.apple.dt.XcodeDefault").setPath(Paths.get("Toolchains/XcodeDefault.xctoolchain")).setVersion("1").build();
AppleSdk targetSdk = AppleSdk.builder().setApplePlatform(ApplePlatform.IPHONEOS).setName("_(in)+va|id_").setVersion("8.0").setToolchains(ImmutableList.of(toolchain)).build();
AppleCxxPlatform appleCxxPlatform = AppleCxxPlatforms.buildWithExecutableChecker(projectFilesystem, targetSdk, "7.0", "cha+rs", appleSdkPaths, FakeBuckConfig.builder().build(), new FakeAppleConfig(), new FakeExecutableFinder(paths), Optional.empty(), Optional.empty());
assertEquals(InternalFlavor.of("__in__va_id_-cha_rs"), appleCxxPlatform.getCxxPlatform().getFlavor());
}
Aggregations