use of com.facebook.buck.android.FakeAndroidDirectoryResolver in project buck by facebook.
the class KnownBuildRuleTypesTest method ocamlUsesConfiguredDefaultPlatform.
@Test
public void ocamlUsesConfiguredDefaultPlatform() throws Exception {
ProjectFilesystem filesystem = new ProjectFilesystem(temporaryFolder.getRoot());
Flavor flavor = InternalFlavor.of("flavor");
ImmutableMap<String, ImmutableMap<String, String>> sections = ImmutableMap.of("cxx", ImmutableMap.of("default_platform", flavor.toString()), "cxx#" + flavor, ImmutableMap.of());
BuckConfig buckConfig = FakeBuckConfig.builder().setSections(sections).build();
KnownBuildRuleTypes knownBuildRuleTypes = KnownBuildRuleTypes.createBuilder(buckConfig, filesystem, createExecutor(), new FakeAndroidDirectoryResolver()).build();
OcamlLibraryDescription ocamlLibraryDescription = (OcamlLibraryDescription) knownBuildRuleTypes.getDescription(knownBuildRuleTypes.getBuildRuleType("ocaml_library"));
assertThat(ocamlLibraryDescription.getOcamlBuckConfig().getCxxPlatform(), Matchers.equalTo(knownBuildRuleTypes.getCxxPlatforms().getValue(flavor)));
OcamlBinaryDescription ocamlBinaryDescription = (OcamlBinaryDescription) knownBuildRuleTypes.getDescription(knownBuildRuleTypes.getBuildRuleType("ocaml_binary"));
assertThat(ocamlBinaryDescription.getOcamlBuckConfig().getCxxPlatform(), Matchers.equalTo(knownBuildRuleTypes.getCxxPlatforms().getValue(flavor)));
}
use of com.facebook.buck.android.FakeAndroidDirectoryResolver in project buck by facebook.
the class KnownBuildRuleTypesTest method canOverrideDefaultHostPlatform.
@Test
public void canOverrideDefaultHostPlatform() throws Exception {
ProjectFilesystem filesystem = new ProjectFilesystem(temporaryFolder.getRoot());
Flavor flavor = InternalFlavor.of("flavor");
String flag = "-flag";
ImmutableMap<String, ImmutableMap<String, String>> sections = ImmutableMap.of("cxx#" + flavor, ImmutableMap.of("cflags", flag));
BuckConfig buckConfig = FakeBuckConfig.builder().setSections(sections).build();
KnownBuildRuleTypes knownBuildRuleTypes = KnownBuildRuleTypes.createBuilder(buckConfig, filesystem, createExecutor(), new FakeAndroidDirectoryResolver()).build();
assertThat(knownBuildRuleTypes.getCxxPlatforms().getValue(flavor).getCflags(), Matchers.contains(flag));
}
use of com.facebook.buck.android.FakeAndroidDirectoryResolver in project buck by facebook.
the class KnownBuildRuleTypesTest method canSetDefaultPlatformToDefault.
@Test
public void canSetDefaultPlatformToDefault() throws Exception {
ProjectFilesystem filesystem = new ProjectFilesystem(temporaryFolder.getRoot());
ImmutableMap<String, ImmutableMap<String, String>> sections = ImmutableMap.of("cxx", ImmutableMap.of("default_platform", "default"));
BuckConfig buckConfig = FakeBuckConfig.builder().setSections(sections).build();
// This would throw if "default" weren't available as a platform.
KnownBuildRuleTypes.createBuilder(buckConfig, filesystem, createExecutor(), new FakeAndroidDirectoryResolver()).build();
}
use of com.facebook.buck.android.FakeAndroidDirectoryResolver in project buck by facebook.
the class KnownBuildRuleTypesTest method createInstanceShouldReturnDifferentInstancesIfCalledWithDifferentParameters.
@Test
public void createInstanceShouldReturnDifferentInstancesIfCalledWithDifferentParameters() throws Exception {
ProjectFilesystem filesystem = new ProjectFilesystem(temporaryFolder.getRoot());
KnownBuildRuleTypes knownBuildRuleTypes1 = KnownBuildRuleTypes.createInstance(FakeBuckConfig.builder().build(), filesystem, createExecutor(), new FakeAndroidDirectoryResolver());
final Path javac = temporaryFolder.newExecutableFile();
ImmutableMap<String, ImmutableMap<String, String>> sections = ImmutableMap.of("tools", ImmutableMap.of("javac", javac.toString()));
BuckConfig buckConfig = FakeBuckConfig.builder().setFilesystem(filesystem).setSections(sections).build();
ProcessExecutor processExecutor = createExecutor(javac.toString(), "");
KnownBuildRuleTypes knownBuildRuleTypes2 = KnownBuildRuleTypes.createInstance(buckConfig, filesystem, processExecutor, new FakeAndroidDirectoryResolver());
assertNotEquals(knownBuildRuleTypes1, knownBuildRuleTypes2);
}
use of com.facebook.buck.android.FakeAndroidDirectoryResolver in project buck by facebook.
the class KnownBuildRuleTypesTestUtil method getDefaultKnownBuildRuleTypes.
public static KnownBuildRuleTypes getDefaultKnownBuildRuleTypes(ProjectFilesystem filesystem, ImmutableMap<String, String> environment) throws InterruptedException, IOException {
BuckConfig config = FakeBuckConfig.builder().setFilesystem(filesystem).build();
List<String> paths = getPaths(environment);
return KnownBuildRuleTypes.createInstance(config, filesystem, new FakeProcessExecutor(ImmutableMap.<ProcessExecutorParams, FakeProcess>builder().put(XCODE_SELECT_PARAMS, XCODE_SELECT_PROCESS).putAll(getPythonProcessMap(paths)).build()), new FakeAndroidDirectoryResolver());
}
Aggregations