Search in sources :

Example 1 with FoundFile

use of com.synopsys.integration.detectable.detectable.explanation.FoundFile in project synopsys-detect by blackducksoftware.

the class Requirements method explainFile.

public void explainFile(@NotNull File file) {
    relevantFiles.add(file);
    explanations.add(new FoundFile(file));
}
Also used : FoundFile(com.synopsys.integration.detectable.detectable.explanation.FoundFile)

Example 2 with FoundFile

use of com.synopsys.integration.detectable.detectable.explanation.FoundFile 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 FoundFile

use of com.synopsys.integration.detectable.detectable.explanation.FoundFile 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 4 with FoundFile

use of com.synopsys.integration.detectable.detectable.explanation.FoundFile in project synopsys-detect by blackducksoftware.

the class ConanLockfileDetectable method applicable.

@Override
public DetectableResult applicable() {
    if (conanLockfileExtractorOptions.getLockfilePath().isPresent()) {
        Path conanLockFile = conanLockfileExtractorOptions.getLockfilePath().get();
        logger.debug("Conan Lockfile detectable applies because user supplied lockfile path {}", conanLockFile);
        // TODO: Should lock file be reported as a relevant file?
        return new PassedDetectableResult(new FoundFile(conanLockFile.toFile()));
    }
    Requirements requirements = new Requirements(fileFinder, environment);
    lockfile = requirements.file(CONANLOCKFILE);
    return requirements.result();
}
Also used : Path(java.nio.file.Path) FoundFile(com.synopsys.integration.detectable.detectable.explanation.FoundFile) PassedDetectableResult(com.synopsys.integration.detectable.detectable.result.PassedDetectableResult) Requirements(com.synopsys.integration.detectable.detectable.Requirements)

Example 5 with FoundFile

use of com.synopsys.integration.detectable.detectable.explanation.FoundFile in project synopsys-detect by blackducksoftware.

the class PassedResultBuilder method foundFile.

public void foundFile(@NotNull File file) {
    explanations.add(new FoundFile(file));
    relevantFiles.add(file);
}
Also used : FoundFile(com.synopsys.integration.detectable.detectable.explanation.FoundFile)

Aggregations

FoundFile (com.synopsys.integration.detectable.detectable.explanation.FoundFile)5 PassedDetectableResult (com.synopsys.integration.detectable.detectable.result.PassedDetectableResult)3 Requirements (com.synopsys.integration.detectable.detectable.Requirements)1 DetectableException (com.synopsys.integration.detectable.detectable.exception.DetectableException)1 FoundExecutable (com.synopsys.integration.detectable.detectable.explanation.FoundExecutable)1 FilesNotFoundDetectableResult (com.synopsys.integration.detectable.detectable.result.FilesNotFoundDetectableResult)1 File (java.io.File)1 Path (java.nio.file.Path)1