use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class AppleConfigTest method getSpecifiedAppleDeveloperDirectorySupplier.
@Test
public void getSpecifiedAppleDeveloperDirectorySupplier() {
BuckConfig buckConfig = FakeBuckConfig.builder().setSections(ImmutableMap.of("apple", ImmutableMap.of("xcode_developer_dir", "/path/to/somewhere"))).build();
AppleConfig config = new AppleConfig(buckConfig);
Supplier<Optional<Path>> supplier = config.getAppleDeveloperDirectorySupplier(new FakeProcessExecutor());
assertNotNull(supplier);
assertEquals(Optional.of(Paths.get("/path/to/somewhere")), supplier.get());
// Developer directory for tests should fall back to developer dir if not separately specified.
Supplier<Optional<Path>> supplierForTests = config.getAppleDeveloperDirectorySupplierForTests(new FakeProcessExecutor());
assertNotNull(supplierForTests);
assertEquals(Optional.of(Paths.get("/path/to/somewhere")), supplierForTests.get());
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class ProjectGeneratorTest method setUp.
@Before
public void setUp() throws InterruptedException, IOException {
assumeTrue(Platform.detect() == Platform.MACOS || Platform.detect() == Platform.LINUX);
clock = new SettableFakeClock(0, 0);
fakeProjectFilesystem = new FakeProjectFilesystem(clock);
projectCell = (new TestCellBuilder()).setFilesystem(fakeProjectFilesystem).build();
projectFilesystem = projectCell.getFilesystem();
rootPath = projectFilesystem.getRootPath();
// Add files and directories used to test resources.
projectFilesystem.createParentDirs(Paths.get("foodir", "foo.png"));
projectFilesystem.writeContentsToPath("", Paths.get("foodir", "foo.png"));
projectFilesystem.writeContentsToPath("", Paths.get("bar.png"));
fakeProjectFilesystem.touch(Paths.get("Base.lproj", "Bar.storyboard"));
halideBuckConfig = HalideLibraryBuilder.createDefaultHalideConfig(fakeProjectFilesystem);
ImmutableMap<String, ImmutableMap<String, String>> sections = ImmutableMap.of("cxx", ImmutableMap.of("cflags", "-Wno-deprecated -Wno-conversion", "cxxflags", "-Wundeclared-selector -Wno-objc-designated-initializers"), "apple", ImmutableMap.of("force_dsym_mode_in_build_with_buck", "false"), "swift", ImmutableMap.of("version", "1.23"));
BuckConfig config = FakeBuckConfig.builder().setSections(sections).build();
cxxBuckConfig = new CxxBuckConfig(config);
appleConfig = new AppleConfig(config);
swiftBuckConfig = new SwiftBuckConfig(config);
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class CxxPlatformsTest method returnsKnownDefaultPlatformSetInConfig.
@Test
public void returnsKnownDefaultPlatformSetInConfig() {
ImmutableMap<String, ImmutableMap<String, String>> sections = ImmutableMap.of("cxx", ImmutableMap.of("default_platform", "borland_cxx_452"));
CompilerProvider compiler = new CompilerProvider(Paths.get("borland"), Optional.of(CxxToolProvider.Type.GCC));
PreprocessorProvider preprocessor = new PreprocessorProvider(Paths.get("borland"), Optional.of(CxxToolProvider.Type.GCC));
CxxPlatform borlandCxx452Platform = CxxPlatform.builder().setFlavor(InternalFlavor.of("borland_cxx_452")).setAs(compiler).setAspp(preprocessor).setCc(compiler).setCpp(preprocessor).setCxx(compiler).setCxxpp(preprocessor).setLd(new DefaultLinkerProvider(LinkerProvider.Type.GNU, new ConstantToolProvider(new HashedFileTool(Paths.get("borland"))))).setStrip(new HashedFileTool(Paths.get("borland"))).setSymbolNameTool(new PosixNmSymbolNameTool(new HashedFileTool(Paths.get("borland")))).setAr(new GnuArchiver(new HashedFileTool(Paths.get("borland")))).setRanlib(new HashedFileTool(Paths.get("borland"))).setSharedLibraryExtension("so").setSharedLibraryVersionedExtensionFormat(".so.%s").setStaticLibraryExtension("a").setObjectFileExtension("so").setCompilerDebugPathSanitizer(CxxPlatformUtils.DEFAULT_COMPILER_DEBUG_PATH_SANITIZER).setAssemblerDebugPathSanitizer(CxxPlatformUtils.DEFAULT_ASSEMBLER_DEBUG_PATH_SANITIZER).setHeaderVerification(CxxPlatformUtils.DEFAULT_PLATFORM.getHeaderVerification()).build();
BuckConfig buckConfig = FakeBuckConfig.builder().setSections(sections).build();
assertThat(CxxPlatforms.getConfigDefaultCxxPlatform(new CxxBuckConfig(buckConfig), ImmutableMap.of(borlandCxx452Platform.getFlavor(), borlandCxx452Platform), CxxPlatformUtils.DEFAULT_PLATFORM), equalTo(borlandCxx452Platform));
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class DBuckConfigTest method testDLinkerFlagsOverridden.
@Test
public void testDLinkerFlagsOverridden() throws IOException {
Path yooserBin = tmp.newFolder("yooser", "bin");
Path yooserLib = tmp.newFolder("yooser", "lib");
makeFakeExecutable(yooserBin, "dmd");
Path phobos2So = yooserLib.resolve("libphobos2.so");
Files.createFile(phobos2So);
BuckConfig delegate = FakeBuckConfig.builder().setEnvironment(ImmutableMap.of("PATH", yooserBin.toRealPath().toString())).setSections("[d]", "linker_flags = -L/opt/doesnotexist/dmd/lib \"-L/path with spaces\"").build();
DBuckConfig dBuckConfig = new DBuckConfig(delegate);
ImmutableList<String> linkerFlags = dBuckConfig.getLinkerFlags();
assertContains(linkerFlags, "-L/opt/doesnotexist/dmd/lib");
assertContains(linkerFlags, "-L/path with spaces");
assertDoesNotContain(linkerFlags, "-L" + yooserLib.toRealPath());
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class DBuckConfigTest method testCompilerOverridden.
@Test
public void testCompilerOverridden() throws IOException {
Path yooserBeen = tmp.newFolder("yooser", "been");
makeFakeExecutable(yooserBeen, "dmd");
Path ldc = makeFakeExecutable(yooserBeen, "ldc");
BuckConfig delegate = FakeBuckConfig.builder().setEnvironment(ImmutableMap.of("PATH", yooserBeen.toRealPath().toString())).setSections("[d]", "compiler=" + ldc.toRealPath()).build();
DBuckConfig dBuckConfig = new DBuckConfig(delegate);
assertEquals(ldc.toRealPath().toString(), toolPath(dBuckConfig.getDCompiler()));
}
Aggregations