use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class ProGuardConfigTest method proGuardJarOverrideUsedShouldBeRelativeToTheProjectRoot.
@Test
public void proGuardJarOverrideUsedShouldBeRelativeToTheProjectRoot() throws IOException {
Path proGuardJar = Paths.get("proguard.jar");
FakeProjectFilesystem filesystem = new FakeProjectFilesystem();
filesystem.touch(proGuardJar);
BuckConfig buckConfig = FakeBuckConfig.builder().setSections(ImmutableMap.of("tools", ImmutableMap.of("proguard", proGuardJar.toString()))).setFilesystem(filesystem).build();
ProGuardConfig proGuardConfig = new ProGuardConfig(buckConfig);
Optional<SourcePath> proGuardJarOverride = proGuardConfig.getProguardJarOverride();
assertTrue(proGuardJarOverride.isPresent());
assertEquals(new PathSourcePath(filesystem, proGuardJar), proGuardJarOverride.get());
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class ProGuardConfigTest method whenProGuardJarNotFound.
@Test(expected = HumanReadableException.class)
public void whenProGuardJarNotFound() throws IOException {
Path proGuardJar = Paths.get("proguard.jar");
FakeProjectFilesystem filesystem = new FakeProjectFilesystem();
BuckConfig buckConfig = FakeBuckConfig.builder().setSections(ImmutableMap.of("tools", ImmutableMap.of("proguard", proGuardJar.toString()))).setFilesystem(filesystem).build();
ProGuardConfig proGuardConfig = new ProGuardConfig(buckConfig);
Optional<SourcePath> proGuardJarOverride = proGuardConfig.getProguardJarOverride();
assertTrue(proGuardJarOverride.isPresent());
assertEquals(new PathSourcePath(filesystem, proGuardJar), proGuardJarOverride.get());
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class ProGuardConfigTest method whenProGuardMaxHeapSizeOverrideUsed.
@Test
public void whenProGuardMaxHeapSizeOverrideUsed() throws IOException {
String proGuardMaxHeapSize = "1234M";
FakeProjectFilesystem filesystem = new FakeProjectFilesystem();
BuckConfig buckConfig = FakeBuckConfig.builder().setSections(ImmutableMap.of("tools", ImmutableMap.of("proguard-max-heap-size", proGuardMaxHeapSize))).setFilesystem(filesystem).build();
ProGuardConfig proGuardConfig = new ProGuardConfig(buckConfig);
assertEquals(proGuardMaxHeapSize, proGuardConfig.getProguardMaxHeapSize());
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class AppleConfigTest method getSpecifiedAppleDeveloperDirectorySupplierForTests.
@Test
public void getSpecifiedAppleDeveloperDirectorySupplierForTests() {
BuckConfig buckConfig = FakeBuckConfig.builder().setSections(ImmutableMap.of("apple", ImmutableMap.of("xcode_developer_dir", "/path/to/somewhere", "xcode_developer_dir_for_tests", "/path/to/somewhere2"))).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());
Supplier<Optional<Path>> supplierForTests = config.getAppleDeveloperDirectorySupplierForTests(new FakeProcessExecutor());
assertNotNull(supplierForTests);
assertEquals(Optional.of(Paths.get("/path/to/somewhere2")), supplierForTests.get());
}
use of com.facebook.buck.cli.BuckConfig in project buck by facebook.
the class StackedDownloaderTest method shouldNotUseRetryingDownloaderIfMaxNumberOfRetriesIsSet.
@Test
public void shouldNotUseRetryingDownloaderIfMaxNumberOfRetriesIsSet() throws IOException {
BuckConfig config = FakeBuckConfig.builder().build();
Downloader downloader = StackedDownloader.createFromConfig(config, Optional.empty());
assertThat(downloader, not(includes(RetryingDownloader.class)));
}
Aggregations