use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class JavaBuckConfigTest method whenJavacIsSetInBuckConfigConfiguredRulesCreateJavaLibraryRuleWithJavacSet.
@Test
public void whenJavacIsSetInBuckConfigConfiguredRulesCreateJavaLibraryRuleWithJavacSet() throws IOException, NoSuchBuildTargetException, InterruptedException {
final String javac = temporaryFolder.newExecutableFile().toString();
ImmutableMap<String, ImmutableMap<String, String>> sections = ImmutableMap.of("tools", ImmutableMap.of("javac", javac));
BuckConfig buckConfig = FakeBuckConfig.builder().setFilesystem(defaultFilesystem).setSections(sections).build();
JavaBuckConfig javaConfig = buckConfig.getView(JavaBuckConfig.class);
JavacOptions javacOptions = javaConfig.getDefaultJavacOptions();
assertEquals(javac, ((ExternalJavac) javacOptions.getJavac()).getShortName());
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class KnownBuildRuleTypesTest method canOverrideMultipleHostPlatforms.
@Test
public void canOverrideMultipleHostPlatforms() throws Exception {
ProjectFilesystem filesystem = new ProjectFilesystem(temporaryFolder.getRoot());
ImmutableMap<String, ImmutableMap<String, String>> sections = ImmutableMap.of("cxx#linux-x86_64", ImmutableMap.of("cache_links", "true"), "cxx#macosx-x86_64", ImmutableMap.of("cache_links", "true"), "cxx#windows-x86_64", ImmutableMap.of("cache_links", "true"));
BuckConfig buckConfig = FakeBuckConfig.builder().setSections(sections).build();
// It should be legal to override multiple host platforms even though
// only one will be practically used in a build.
KnownBuildRuleTypes.createBuilder(buckConfig, filesystem, createExecutor(), new FakeAndroidDirectoryResolver()).build();
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class ProjectWorkspace method asCell.
public Cell asCell() throws IOException, InterruptedException {
ProjectFilesystemAndConfig filesystemAndConfig = projectFilesystemAndConfig.get();
ProjectFilesystem filesystem = filesystemAndConfig.projectFilesystem;
Config config = filesystemAndConfig.config;
TestConsole console = new TestConsole();
ImmutableMap<String, String> env = ImmutableMap.copyOf(System.getenv());
DefaultAndroidDirectoryResolver directoryResolver = new DefaultAndroidDirectoryResolver(filesystem.getRootPath().getFileSystem(), env, Optional.empty(), Optional.empty());
return CellProvider.createForLocalBuild(filesystem, Watchman.NULL_WATCHMAN, new BuckConfig(config, filesystem, Architecture.detect(), Platform.detect(), env, new DefaultCellPathResolver(filesystem.getRootPath(), config)), CellConfig.of(), new KnownBuildRuleTypesFactory(new DefaultProcessExecutor(console), directoryResolver)).getCellByPath(filesystem.getRootPath());
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class Build method createConfiguredBuckOutSymlinks.
/**
* When the user overrides the configured buck-out directory via the `.buckconfig` and also sets
* the `project.buck_out_compat_link` setting to `true`, we symlink the original output path
* (`buck-out/`) to this newly configured location for backwards compatibility.
*/
private void createConfiguredBuckOutSymlinks() throws IOException {
for (Cell cell : getAllCells()) {
BuckConfig buckConfig = cell.getBuckConfig();
ProjectFilesystem filesystem = cell.getFilesystem();
BuckPaths configuredPaths = filesystem.getBuckPaths();
if (!configuredPaths.getConfiguredBuckOut().equals(configuredPaths.getBuckOut()) && buckConfig.getBuckOutCompatLink() && Platform.detect() != Platform.WINDOWS) {
BuckPaths unconfiguredPaths = configuredPaths.withConfiguredBuckOut(configuredPaths.getBuckOut());
ImmutableMap<Path, Path> paths = ImmutableMap.of(unconfiguredPaths.getGenDir(), configuredPaths.getGenDir(), unconfiguredPaths.getScratchDir(), configuredPaths.getScratchDir());
for (Map.Entry<Path, Path> entry : paths.entrySet()) {
filesystem.deleteRecursivelyIfExists(entry.getKey());
filesystem.createSymLink(entry.getKey(), entry.getKey().getParent().relativize(entry.getValue()), /* force */
false);
}
}
}
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class AppleNativeIntegrationTestUtils method isSwiftAvailable.
public static boolean isSwiftAvailable(ApplePlatform platform) {
BuckConfig buckConfig = FakeBuckConfig.builder().build();
ImmutableMap<AppleSdk, AppleSdkPaths> sdkPaths = discoverSystemSdkPaths(buckConfig);
Optional<AppleSdk> anySdkOptional = anySdkForPlatform(platform, sdkPaths);
if (!anySdkOptional.isPresent()) {
return false;
}
AppleSdk anySdk = anySdkOptional.get();
AppleCxxPlatform appleCxxPlatform = AppleCxxPlatforms.build(new FakeProjectFilesystem(), anySdk, "fakeversion", "fakearch", sdkPaths.get(anySdk), buckConfig, new AppleConfig(buckConfig), Optional.of(new DefaultProcessExecutor(Console.createNullConsole())), Optional.empty());
return appleCxxPlatform.getSwiftPlatform().isPresent();
}
Aggregations