Search in sources :

Example 1 with MissingSymbolsHandler

use of com.facebook.buck.cli.MissingSymbolsHandler in project buck by facebook.

the class MissingSymbolsHandlerIntegrationTest method shouldFindNeededDependenciesFromSymbols.

@Test
public void shouldFindNeededDependenciesFromSymbols() throws IOException, InterruptedException {
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "symbol_finder", temporaryFolder);
    workspace.setUp();
    ProjectFilesystem projectFilesystem = new ProjectFilesystem(temporaryFolder.getRoot());
    ImmutableMap<String, String> environment = ImmutableMap.copyOf(System.getenv());
    Config rawConfig = Configs.createDefaultConfig(projectFilesystem.getRootPath());
    BuckConfig config = new BuckConfig(rawConfig, projectFilesystem, Architecture.detect(), Platform.detect(), environment, new DefaultCellPathResolver(projectFilesystem.getRootPath(), rawConfig));
    ImmutableSet<Description<?>> allDescriptions = KnownBuildRuleTypesTestUtil.getDefaultKnownBuildRuleTypes(projectFilesystem, environment).getAllDescriptions();
    BuckEventBus buckEventBus = BuckEventBusFactory.newInstance();
    MissingSymbolsHandler missingSymbolsHandler = MissingSymbolsHandler.create(projectFilesystem, allDescriptions, config, buckEventBus, new TestConsole(), DEFAULT_JAVAC_OPTIONS, environment);
    MissingSymbolEvent missingSymbolEvent = MissingSymbolEvent.create(BuildTargetFactory.newInstance(workspace.getDestPath(), "//java/com/example/b:b"), "com.example.a.A", MissingSymbolEvent.SymbolType.Java);
    ImmutableSetMultimap<BuildTarget, BuildTarget> neededDeps = missingSymbolsHandler.getNeededDependencies(ImmutableList.of(missingSymbolEvent));
    assertEquals("MissingSymbolsHandler failed to find the needed dependency.", neededDeps, ImmutableSetMultimap.of(BuildTargetFactory.newInstance(workspace.getDestPath(), "//java/com/example/b:b"), BuildTargetFactory.newInstance(workspace.getDestPath(), "//java/com/example/a:a")));
}
Also used : BuckEventBus(com.facebook.buck.event.BuckEventBus) DefaultCellPathResolver(com.facebook.buck.rules.DefaultCellPathResolver) Description(com.facebook.buck.rules.Description) Config(com.facebook.buck.config.Config) BuckConfig(com.facebook.buck.cli.BuckConfig) Matchers.containsString(org.hamcrest.Matchers.containsString) MissingSymbolsHandler(com.facebook.buck.cli.MissingSymbolsHandler) MissingSymbolEvent(com.facebook.buck.event.MissingSymbolEvent) ProjectWorkspace(com.facebook.buck.testutil.integration.ProjectWorkspace) BuckConfig(com.facebook.buck.cli.BuckConfig) BuildTarget(com.facebook.buck.model.BuildTarget) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) TestConsole(com.facebook.buck.testutil.TestConsole) Test(org.junit.Test)

Aggregations

BuckConfig (com.facebook.buck.cli.BuckConfig)1 MissingSymbolsHandler (com.facebook.buck.cli.MissingSymbolsHandler)1 Config (com.facebook.buck.config.Config)1 BuckEventBus (com.facebook.buck.event.BuckEventBus)1 MissingSymbolEvent (com.facebook.buck.event.MissingSymbolEvent)1 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)1 BuildTarget (com.facebook.buck.model.BuildTarget)1 DefaultCellPathResolver (com.facebook.buck.rules.DefaultCellPathResolver)1 Description (com.facebook.buck.rules.Description)1 TestConsole (com.facebook.buck.testutil.TestConsole)1 ProjectWorkspace (com.facebook.buck.testutil.integration.ProjectWorkspace)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Test (org.junit.Test)1