Search in sources :

Example 1 with BazelWorkspaceFileParser

use of com.synopsys.integration.detectable.detectables.bazel.BazelWorkspaceFileParser 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 BazelWorkspaceFileParser

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

the class BazelWorkspaceFileParserTest method testMultipleRules.

@Test
void testMultipleRules() throws IOException {
    File workspaceFile = new File("src/test/resources/detectables/functional/bazel/WORKSPACE_multipleRules");
    List<String> workspaceFileLines = FileUtils.readLines(workspaceFile, StandardCharsets.UTF_8);
    BazelWorkspaceFileParser bazelWorkspaceFileParser = new BazelWorkspaceFileParser();
    Set<WorkspaceRule> rulesFound = bazelWorkspaceFileParser.parseWorkspaceRuleTypes(workspaceFileLines);
    assertEquals(Sets.newHashSet(WorkspaceRule.MAVEN_INSTALL, WorkspaceRule.HASKELL_CABAL_LIBRARY), rulesFound);
}
Also used : BazelWorkspaceFileParser(com.synopsys.integration.detectable.detectables.bazel.BazelWorkspaceFileParser) WorkspaceRule(com.synopsys.integration.detectable.detectables.bazel.WorkspaceRule) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 3 with BazelWorkspaceFileParser

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

the class BazelWorkspaceFileParserTest method testSingleRule.

@Test
void testSingleRule() throws IOException {
    File workspaceFile = new File("src/test/resources/detectables/functional/bazel/WORKSPACE");
    List<String> workspaceFileLines = FileUtils.readLines(workspaceFile, StandardCharsets.UTF_8);
    BazelWorkspaceFileParser bazelWorkspaceFileParser = new BazelWorkspaceFileParser();
    assertEquals(Sets.newHashSet(WorkspaceRule.MAVEN_INSTALL), bazelWorkspaceFileParser.parseWorkspaceRuleTypes(workspaceFileLines));
}
Also used : BazelWorkspaceFileParser(com.synopsys.integration.detectable.detectables.bazel.BazelWorkspaceFileParser) File(java.io.File) Test(org.junit.jupiter.api.Test)

Aggregations

BazelWorkspaceFileParser (com.synopsys.integration.detectable.detectables.bazel.BazelWorkspaceFileParser)3 File (java.io.File)2 Test (org.junit.jupiter.api.Test)2 BazelExtractor (com.synopsys.integration.detectable.detectables.bazel.BazelExtractor)1 BazelProjectNameGenerator (com.synopsys.integration.detectable.detectables.bazel.BazelProjectNameGenerator)1 WorkspaceRule (com.synopsys.integration.detectable.detectables.bazel.WorkspaceRule)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