Search in sources :

Example 1 with XcodeWorkspaceResult

use of com.synopsys.integration.detectable.detectables.xcode.model.XcodeWorkspaceResult in project synopsys-detect by blackducksoftware.

the class XcodeWorkspaceDetectable method extract.

@Override
public Extraction extract(ExtractionEnvironment extractionEnvironment) throws IOException, ParserConfigurationException, SAXException {
    List<CodeLocation> codeLocations = new LinkedList<>();
    if (foundPackageResolvedFile != null) {
        PackageResolvedResult localResult = packageResolvedExtractor.extract(foundPackageResolvedFile);
        Optional<FailedDetectableResult> failedDetectableResult = localResult.getFailedDetectableResult();
        if (failedDetectableResult.isPresent()) {
            return Extraction.failure(failedDetectableResult.get());
        }
        codeLocations.add(new CodeLocation(localResult.getDependencyGraph(), environment.getDirectory()));
    }
    if (foundWorkspaceDataFile != null) {
        XcodeWorkspaceResult xcodeWorkspaceResult = xcodeWorkspaceExtractor.extract(foundWorkspaceDataFile, workspaceDirectory);
        if (xcodeWorkspaceResult.isFailure()) {
            return Extraction.failure(xcodeWorkspaceResult.getFailedDetectableResults());
        }
        codeLocations.addAll(xcodeWorkspaceResult.getCodeLocations());
    }
    return Extraction.success(codeLocations);
}
Also used : CodeLocation(com.synopsys.integration.detectable.detectable.codelocation.CodeLocation) FailedDetectableResult(com.synopsys.integration.detectable.detectable.result.FailedDetectableResult) PackageResolvedResult(com.synopsys.integration.detectable.detectables.swift.lock.model.PackageResolvedResult) XcodeWorkspaceResult(com.synopsys.integration.detectable.detectables.xcode.model.XcodeWorkspaceResult) LinkedList(java.util.LinkedList)

Aggregations

CodeLocation (com.synopsys.integration.detectable.detectable.codelocation.CodeLocation)1 FailedDetectableResult (com.synopsys.integration.detectable.detectable.result.FailedDetectableResult)1 PackageResolvedResult (com.synopsys.integration.detectable.detectables.swift.lock.model.PackageResolvedResult)1 XcodeWorkspaceResult (com.synopsys.integration.detectable.detectables.xcode.model.XcodeWorkspaceResult)1 LinkedList (java.util.LinkedList)1