Search in sources :

Example 1 with PassedDetectableResult

use of com.synopsys.integration.detectable.detectable.result.PassedDetectableResult in project synopsys-detect by blackducksoftware.

the class GradleDetectable method extractable.

@Override
public DetectableResult extractable() throws DetectableException {
    List<Explanation> explanations = new ArrayList<>();
    gradleExe = gradleResolver.resolveGradle(environment);
    if (gradleExe == null) {
        return new ExecutableNotFoundDetectableResult("gradle");
    } else {
        explanations.add(new FoundExecutable(gradleExe));
    }
    gradleInspector = gradleInspectorResolver.resolveGradleInspector();
    if (gradleInspector == null) {
        return new InspectorNotFoundDetectableResult("gradle");
    } else {
        explanations.add(new FoundInspector(gradleInspector));
    }
    return new PassedDetectableResult(explanations);
}
Also used : ExecutableNotFoundDetectableResult(com.synopsys.integration.detectable.detectable.result.ExecutableNotFoundDetectableResult) FoundExecutable(com.synopsys.integration.detectable.detectable.explanation.FoundExecutable) Explanation(com.synopsys.integration.detectable.detectable.explanation.Explanation) ArrayList(java.util.ArrayList) FoundInspector(com.synopsys.integration.detectable.detectable.explanation.FoundInspector) PassedDetectableResult(com.synopsys.integration.detectable.detectable.result.PassedDetectableResult) InspectorNotFoundDetectableResult(com.synopsys.integration.detectable.detectable.result.InspectorNotFoundDetectableResult)

Example 2 with PassedDetectableResult

use of com.synopsys.integration.detectable.detectable.result.PassedDetectableResult in project synopsys-detect by blackducksoftware.

the class GradleDetectable method applicable.

@Override
public DetectableResult applicable() {
    File buildGradle = fileFinder.findFile(environment.getDirectory(), BUILD_GRADLE_FILENAME);
    if (buildGradle != null) {
        return new PassedDetectableResult(new FoundFile(buildGradle));
    }
    File kotlinBuildGradle = fileFinder.findFile(environment.getDirectory(), KOTLIN_BUILD_GRADLE_FILENAME);
    if (kotlinBuildGradle != null) {
        return new PassedDetectableResult(new FoundFile(kotlinBuildGradle));
    }
    return new FilesNotFoundDetectableResult(BUILD_GRADLE_FILENAME, KOTLIN_BUILD_GRADLE_FILENAME);
}
Also used : FilesNotFoundDetectableResult(com.synopsys.integration.detectable.detectable.result.FilesNotFoundDetectableResult) FoundFile(com.synopsys.integration.detectable.detectable.explanation.FoundFile) FoundFile(com.synopsys.integration.detectable.detectable.explanation.FoundFile) File(java.io.File) PassedDetectableResult(com.synopsys.integration.detectable.detectable.result.PassedDetectableResult)

Example 3 with PassedDetectableResult

use of com.synopsys.integration.detectable.detectable.result.PassedDetectableResult in project synopsys-detect by blackducksoftware.

the class DartPubDepDetectable method extractable.

@Override
public DetectableResult extractable() throws DetectableException {
    if (!pubspecLock.isPresent() && pubspecYaml.isPresent()) {
        return new PubSpecLockNotFoundDetectableResult(environment.getDirectory().getAbsolutePath());
    } else if (pubspecLock.isPresent() && !pubspecYaml.isPresent()) {
        return new FileNotFoundDetectableResult(PUBSPEC_LOCK_FILENAME);
    }
    dartExe = dartResolver.resolveDart();
    flutterExe = flutterResolver.resolveFlutter();
    if (dartExe == null && flutterExe == null) {
        return new ExecutablesNotFoundDetectableResult(Arrays.asList("dart", "flutter"));
    }
    return new PassedDetectableResult();
}
Also used : ExecutablesNotFoundDetectableResult(com.synopsys.integration.detectable.detectable.result.ExecutablesNotFoundDetectableResult) FileNotFoundDetectableResult(com.synopsys.integration.detectable.detectable.result.FileNotFoundDetectableResult) PubSpecLockNotFoundDetectableResult(com.synopsys.integration.detectable.detectable.result.PubSpecLockNotFoundDetectableResult) PassedDetectableResult(com.synopsys.integration.detectable.detectable.result.PassedDetectableResult)

Example 4 with PassedDetectableResult

use of com.synopsys.integration.detectable.detectable.result.PassedDetectableResult in project synopsys-detect by blackducksoftware.

the class GitDetectable method extractable.

@Override
public DetectableResult extractable() throws DetectableException {
    try {
        gitExecutable = gitResolver.resolveGit();
    } catch (DetectableException e) {
        gitExecutable = null;
    }
    if (gitExecutable != null) {
        return new PassedDetectableResult(new FoundExecutable(gitExecutable));
    } else {
        // Couldn't find git executable, so we try to parse git files
        gitConfigFile = fileFinder.findFile(gitDirectory, GIT_CONFIG_FILENAME);
        gitHeadFile = fileFinder.findFile(gitDirectory, GIT_HEAD_FILENAME);
        if ((gitConfigFile != null && gitHeadFile != null)) {
            canParse = true;
            return new PassedDetectableResult(Arrays.asList(new FoundFile(gitConfigFile), new FoundFile(gitHeadFile)));
        }
    }
    return new PassedDetectableResult();
}
Also used : FoundExecutable(com.synopsys.integration.detectable.detectable.explanation.FoundExecutable) FoundFile(com.synopsys.integration.detectable.detectable.explanation.FoundFile) PassedDetectableResult(com.synopsys.integration.detectable.detectable.result.PassedDetectableResult) DetectableException(com.synopsys.integration.detectable.detectable.exception.DetectableException)

Example 5 with PassedDetectableResult

use of com.synopsys.integration.detectable.detectable.result.PassedDetectableResult in project synopsys-detect by blackducksoftware.

the class ConanLockfileDetectable method extractable.

@Override
public DetectableResult extractable() throws DetectableException {
    if (conanLockfileExtractorOptions.getLockfilePath().isPresent()) {
        Path givenLockfilePath = conanLockfileExtractorOptions.getLockfilePath().get();
        File userProvidedLockfile = givenLockfilePath.toFile();
        if (userProvidedLockfile.exists()) {
            lockfile = userProvidedLockfile;
        } else {
            logger.debug("File {} does not exist", givenLockfilePath);
            return new GivenFileNotFoundDetectableResult(givenLockfilePath.toString());
        }
    }
    return new PassedDetectableResult();
}
Also used : Path(java.nio.file.Path) GivenFileNotFoundDetectableResult(com.synopsys.integration.detectable.detectable.result.GivenFileNotFoundDetectableResult) FoundFile(com.synopsys.integration.detectable.detectable.explanation.FoundFile) File(java.io.File) PassedDetectableResult(com.synopsys.integration.detectable.detectable.result.PassedDetectableResult)

Aggregations

PassedDetectableResult (com.synopsys.integration.detectable.detectable.result.PassedDetectableResult)14 DetectableResult (com.synopsys.integration.detectable.detectable.result.DetectableResult)6 Test (org.junit.jupiter.api.Test)6 Extraction (com.synopsys.integration.detectable.extraction.Extraction)5 File (java.io.File)5 FoundFile (com.synopsys.integration.detectable.detectable.explanation.FoundFile)4 DetectableException (com.synopsys.integration.detectable.detectable.exception.DetectableException)3 FoundExecutable (com.synopsys.integration.detectable.detectable.explanation.FoundExecutable)3 Detectable (com.synopsys.integration.detectable.Detectable)2 DetectableEnvironment (com.synopsys.integration.detectable.DetectableEnvironment)2 Explanation (com.synopsys.integration.detectable.detectable.explanation.Explanation)2 ExecutableNotFoundDetectableResult (com.synopsys.integration.detectable.detectable.result.ExecutableNotFoundDetectableResult)2 ExtractionEnvironment (com.synopsys.integration.detectable.extraction.ExtractionEnvironment)2 DetectorEvaluation (com.synopsys.integration.detector.base.DetectorEvaluation)2 DetectorEvaluationTree (com.synopsys.integration.detector.base.DetectorEvaluationTree)2 DetectorRule (com.synopsys.integration.detector.rule.DetectorRule)2 DetectorRuleSet (com.synopsys.integration.detector.rule.DetectorRuleSet)2 Path (java.nio.file.Path)2 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2