Search in sources :

Example 1 with BazelExtractor

use of com.synopsys.integration.detectable.detectables.bazel.BazelExtractor in project synopsys-detect by blackducksoftware.

the class DetectableFactory method bazelExtractor.

// #endregion
// #region Utility
private BazelExtractor bazelExtractor(BazelDetectableOptions bazelDetectableOptions) {
    WorkspaceRuleChooser workspaceRuleChooser = new WorkspaceRuleChooser();
    BazelWorkspaceFileParser bazelWorkspaceFileParser = new BazelWorkspaceFileParser();
    HaskellCabalLibraryJsonProtoParser haskellCabalLibraryJsonProtoParser = new HaskellCabalLibraryJsonProtoParser(gson);
    BazelVariableSubstitutor bazelVariableSubstitutor = new BazelVariableSubstitutor(bazelDetectableOptions.getTargetName().orElse(null), bazelDetectableOptions.getBazelCqueryAdditionalOptions());
    BazelProjectNameGenerator bazelProjectNameGenerator = new BazelProjectNameGenerator();
    return new BazelExtractor(executableRunner, externalIdFactory, bazelWorkspaceFileParser, workspaceRuleChooser, toolVersionLogger, haskellCabalLibraryJsonProtoParser, bazelDetectableOptions.getTargetName().orElse(null), bazelDetectableOptions.getWorkspaceRulesFromProperty(), bazelVariableSubstitutor, bazelProjectNameGenerator);
}
Also used : BazelExtractor(com.synopsys.integration.detectable.detectables.bazel.BazelExtractor) WorkspaceRuleChooser(com.synopsys.integration.detectable.detectables.bazel.pipeline.WorkspaceRuleChooser) BazelProjectNameGenerator(com.synopsys.integration.detectable.detectables.bazel.BazelProjectNameGenerator) BazelWorkspaceFileParser(com.synopsys.integration.detectable.detectables.bazel.BazelWorkspaceFileParser) BazelVariableSubstitutor(com.synopsys.integration.detectable.detectables.bazel.pipeline.step.BazelVariableSubstitutor) HaskellCabalLibraryJsonProtoParser(com.synopsys.integration.detectable.detectables.bazel.pipeline.step.HaskellCabalLibraryJsonProtoParser)

Example 2 with BazelExtractor

use of com.synopsys.integration.detectable.detectables.bazel.BazelExtractor in project synopsys-detect by blackducksoftware.

the class BazelDetectableTest method testApplicable.

@Test
public void testApplicable() {
    DetectableEnvironment environment = MockDetectableEnvironment.empty();
    FileFinder fileFinder = Mockito.mock(FileFinder.class);
    Mockito.when(fileFinder.findFile(new File("."), "WORKSPACE")).thenReturn(new File("src/test/resources/functional/bazel/WORKSPACE"));
    BazelExtractor bazelExtractor = null;
    BazelResolver bazelResolver = null;
    BazelDetectableOptions bazelDetectableOptions = new BazelDetectableOptions("target", null, null);
    BazelDetectable detectable = new BazelDetectable(environment, fileFinder, bazelExtractor, bazelResolver, bazelDetectableOptions.getTargetName().orElse(null));
    assertTrue(detectable.applicable().getPassed());
}
Also used : BazelExtractor(com.synopsys.integration.detectable.detectables.bazel.BazelExtractor) BazelDetectableOptions(com.synopsys.integration.detectable.detectables.bazel.BazelDetectableOptions) BazelDetectable(com.synopsys.integration.detectable.detectables.bazel.BazelDetectable) BazelResolver(com.synopsys.integration.detectable.detectable.executable.resolver.BazelResolver) FileFinder(com.synopsys.integration.common.util.finder.FileFinder) File(java.io.File) DetectableEnvironment(com.synopsys.integration.detectable.DetectableEnvironment) MockDetectableEnvironment(com.synopsys.integration.detectable.util.MockDetectableEnvironment) Test(org.junit.jupiter.api.Test)

Aggregations

BazelExtractor (com.synopsys.integration.detectable.detectables.bazel.BazelExtractor)2 FileFinder (com.synopsys.integration.common.util.finder.FileFinder)1 DetectableEnvironment (com.synopsys.integration.detectable.DetectableEnvironment)1 BazelResolver (com.synopsys.integration.detectable.detectable.executable.resolver.BazelResolver)1 BazelDetectable (com.synopsys.integration.detectable.detectables.bazel.BazelDetectable)1 BazelDetectableOptions (com.synopsys.integration.detectable.detectables.bazel.BazelDetectableOptions)1 BazelProjectNameGenerator (com.synopsys.integration.detectable.detectables.bazel.BazelProjectNameGenerator)1 BazelWorkspaceFileParser (com.synopsys.integration.detectable.detectables.bazel.BazelWorkspaceFileParser)1 WorkspaceRuleChooser (com.synopsys.integration.detectable.detectables.bazel.pipeline.WorkspaceRuleChooser)1 BazelVariableSubstitutor (com.synopsys.integration.detectable.detectables.bazel.pipeline.step.BazelVariableSubstitutor)1 HaskellCabalLibraryJsonProtoParser (com.synopsys.integration.detectable.detectables.bazel.pipeline.step.HaskellCabalLibraryJsonProtoParser)1 MockDetectableEnvironment (com.synopsys.integration.detectable.util.MockDetectableEnvironment)1 File (java.io.File)1 Test (org.junit.jupiter.api.Test)1