Search in sources :

Example 6 with DefaultCellPathResolver

use of com.facebook.buck.rules.DefaultCellPathResolver in project buck by facebook.

the class OCamlIntegrationTest method checkOcamlIsConfigured.

@Before
public void checkOcamlIsConfigured() throws IOException {
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "ocaml", tmp);
    workspace.setUp();
    ProjectFilesystem filesystem = new ProjectFilesystem(tmp.getRoot());
    Config rawConfig = Configs.createDefaultConfig(filesystem.getRootPath());
    BuckConfig buckConfig = new BuckConfig(rawConfig, filesystem, Architecture.detect(), Platform.detect(), ImmutableMap.copyOf(System.getenv()), new DefaultCellPathResolver(filesystem.getRootPath(), rawConfig));
    OcamlBuckConfig ocamlBuckConfig = new OcamlBuckConfig(buckConfig, DefaultCxxPlatforms.build(Platform.detect(), filesystem, new CxxBuckConfig(buckConfig)));
    assumeTrue(ocamlBuckConfig.getOcamlCompiler().isPresent());
    assumeTrue(ocamlBuckConfig.getOcamlBytecodeCompiler().isPresent());
    assumeTrue(ocamlBuckConfig.getOcamlDepTool().isPresent());
    assumeTrue(ocamlBuckConfig.getYaccCompiler().isPresent());
    assumeTrue(ocamlBuckConfig.getLexCompiler().isPresent());
}
Also used : ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) DefaultCellPathResolver(com.facebook.buck.rules.DefaultCellPathResolver) CxxBuckConfig(com.facebook.buck.cxx.CxxBuckConfig) BuckConfig(com.facebook.buck.cli.BuckConfig) FakeBuckConfig(com.facebook.buck.cli.FakeBuckConfig) CxxBuckConfig(com.facebook.buck.cxx.CxxBuckConfig) Config(com.facebook.buck.config.Config) BuckConfig(com.facebook.buck.cli.BuckConfig) FakeBuckConfig(com.facebook.buck.cli.FakeBuckConfig) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) CxxBuckConfig(com.facebook.buck.cxx.CxxBuckConfig) Before(org.junit.Before)

Example 7 with DefaultCellPathResolver

use of com.facebook.buck.rules.DefaultCellPathResolver 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());
}
Also used : DefaultCellPathResolver(com.facebook.buck.rules.DefaultCellPathResolver) DefaultAndroidDirectoryResolver(com.facebook.buck.android.DefaultAndroidDirectoryResolver) BuckConfig(com.facebook.buck.cli.BuckConfig) DefaultProcessExecutor(com.facebook.buck.util.DefaultProcessExecutor) BuckConfig(com.facebook.buck.cli.BuckConfig) Config(com.facebook.buck.config.Config) CellConfig(com.facebook.buck.config.CellConfig) KnownBuildRuleTypesFactory(com.facebook.buck.rules.KnownBuildRuleTypesFactory) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) TestConsole(com.facebook.buck.testutil.TestConsole)

Example 8 with DefaultCellPathResolver

use of com.facebook.buck.rules.DefaultCellPathResolver in project buck by facebook.

the class GroovyBuckConfigTest method createGroovyConfig.

private GroovyBuckConfig createGroovyConfig(ImmutableMap<String, String> environment, ImmutableMap<String, ImmutableMap<String, String>> rawConfig) {
    ProjectFilesystem projectFilesystem = new ProjectFilesystem(temporaryFolder.getRoot());
    Config config = new Config(RawConfig.of(rawConfig));
    BuckConfig buckConfig = new BuckConfig(config, projectFilesystem, Architecture.detect(), Platform.detect(), environment, new DefaultCellPathResolver(projectFilesystem.getRootPath(), config));
    return new GroovyBuckConfig(buckConfig);
}
Also used : DefaultCellPathResolver(com.facebook.buck.rules.DefaultCellPathResolver) BuckConfig(com.facebook.buck.cli.BuckConfig) Config(com.facebook.buck.config.Config) RawConfig(com.facebook.buck.config.RawConfig) BuckConfig(com.facebook.buck.cli.BuckConfig) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem)

Example 9 with DefaultCellPathResolver

use of com.facebook.buck.rules.DefaultCellPathResolver 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()));
}
Also used : DefaultCellPathResolver(com.facebook.buck.rules.DefaultCellPathResolver) BuckConfig(com.facebook.buck.cli.BuckConfig) CxxBuckConfig(com.facebook.buck.cxx.CxxBuckConfig) FakeBuckConfig(com.facebook.buck.cli.FakeBuckConfig) BuckConfig(com.facebook.buck.cli.BuckConfig) CxxBuckConfig(com.facebook.buck.cxx.CxxBuckConfig) Config(com.facebook.buck.config.Config) FakeBuckConfig(com.facebook.buck.cli.FakeBuckConfig) FakeExecutableFinder(com.facebook.buck.io.FakeExecutableFinder) FakeProjectFilesystem(com.facebook.buck.testutil.FakeProjectFilesystem) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem)

Example 10 with DefaultCellPathResolver

use of com.facebook.buck.rules.DefaultCellPathResolver in project buck by facebook.

the class DistBuildStateTest method canReconstructConfig.

@Test
public void canReconstructConfig() throws IOException, InterruptedException {
    ProjectFilesystem filesystem = createJavaOnlyFilesystem("/saving");
    Config config = new Config(ConfigBuilder.rawFromLines());
    BuckConfig buckConfig = new BuckConfig(config, filesystem, Architecture.detect(), Platform.detect(), ImmutableMap.<String, String>builder().putAll(System.getenv()).put("envKey", "envValue").build(), new DefaultCellPathResolver(filesystem.getRootPath(), config));
    Cell rootCellWhenSaving = new TestCellBuilder().setFilesystem(filesystem).setBuckConfig(buckConfig).build();
    BuildJobState dump = DistBuildState.dump(new DistBuildCellIndexer(rootCellWhenSaving), emptyActionGraph(), createDefaultCodec(rootCellWhenSaving, Optional.empty()), createTargetGraph(filesystem), ImmutableSet.of(BuildTargetFactory.newInstance(filesystem.getRootPath(), "//:dummy")));
    Cell rootCellWhenLoading = new TestCellBuilder().setFilesystem(createJavaOnlyFilesystem("/loading")).build();
    DistBuildState distributedBuildState = DistBuildState.load(Optional.empty(), dump, rootCellWhenLoading, knownBuildRuleTypesFactory);
    ImmutableMap<Integer, Cell> cells = distributedBuildState.getCells();
    assertThat(cells, Matchers.aMapWithSize(1));
    assertThat(cells.get(0).getBuckConfig(), Matchers.equalTo(buckConfig));
}
Also used : DefaultCellPathResolver(com.facebook.buck.rules.DefaultCellPathResolver) BuckConfig(com.facebook.buck.cli.BuckConfig) FakeBuckConfig(com.facebook.buck.cli.FakeBuckConfig) BuckConfig(com.facebook.buck.cli.BuckConfig) Config(com.facebook.buck.config.Config) ParserConfig(com.facebook.buck.parser.ParserConfig) FakeBuckConfig(com.facebook.buck.cli.FakeBuckConfig) BuildJobState(com.facebook.buck.distributed.thrift.BuildJobState) FakeProjectFilesystem(com.facebook.buck.testutil.FakeProjectFilesystem) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) Cell(com.facebook.buck.rules.Cell) TestCellBuilder(com.facebook.buck.rules.TestCellBuilder) Test(org.junit.Test)

Aggregations

DefaultCellPathResolver (com.facebook.buck.rules.DefaultCellPathResolver)15 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)14 BuckConfig (com.facebook.buck.cli.BuckConfig)13 Config (com.facebook.buck.config.Config)13 FakeBuckConfig (com.facebook.buck.cli.FakeBuckConfig)8 Test (org.junit.Test)6 ParserConfig (com.facebook.buck.parser.ParserConfig)5 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)5 Cell (com.facebook.buck.rules.Cell)4 TestConsole (com.facebook.buck.testutil.TestConsole)4 CxxBuckConfig (com.facebook.buck.cxx.CxxBuckConfig)3 BuildJobState (com.facebook.buck.distributed.thrift.BuildJobState)3 BuckEventBus (com.facebook.buck.event.BuckEventBus)3 ExecutableFinder (com.facebook.buck.io.ExecutableFinder)3 ProjectWorkspace (com.facebook.buck.testutil.integration.ProjectWorkspace)3 DefaultProcessExecutor (com.facebook.buck.util.DefaultProcessExecutor)3 Path (java.nio.file.Path)3 DefaultAndroidDirectoryResolver (com.facebook.buck.android.DefaultAndroidDirectoryResolver)2 BuildTarget (com.facebook.buck.model.BuildTarget)2 Description (com.facebook.buck.rules.Description)2