Search in sources :

Example 1 with SwiftPackage

use of com.synopsys.integration.detectable.detectables.swift.cli.model.SwiftPackage in project synopsys-detect by blackducksoftware.

the class SwiftExtractor method extract.

public Extraction extract(File environmentDirectory, ExecutableTarget swiftExecutable) throws ExecutableFailedException {
    toolVersionLogger.log(environmentDirectory, swiftExecutable);
    SwiftPackage rootSwiftPackage = getRootSwiftPackage(environmentDirectory, swiftExecutable);
    CodeLocation codeLocation = swiftPackageTransformer.transform(rootSwiftPackage);
    return new Extraction.Builder().success(codeLocation).projectName(rootSwiftPackage.getName()).projectVersion(rootSwiftPackage.getVersion()).build();
}
Also used : SwiftPackage(com.synopsys.integration.detectable.detectables.swift.cli.model.SwiftPackage) CodeLocation(com.synopsys.integration.detectable.detectable.codelocation.CodeLocation)

Example 2 with SwiftPackage

use of com.synopsys.integration.detectable.detectables.swift.cli.model.SwiftPackage in project synopsys-detect by blackducksoftware.

the class SwiftPackageTransformer method convertToDependency.

private Dependency convertToDependency(DependencyGraph dependencyGraph, SwiftPackage swiftPackage) {
    ExternalId externalId;
    if ("unspecified".equals(swiftPackage.getVersion())) {
        externalId = externalIdFactory.createModuleNamesExternalId(SWIFT_FORGE, swiftPackage.getName());
    } else {
        externalId = externalIdFactory.createNameVersionExternalId(SWIFT_FORGE, swiftPackage.getName(), swiftPackage.getVersion());
    }
    Dependency dependency = new Dependency(externalId);
    for (SwiftPackage swiftPackageDependency : swiftPackage.getDependencies()) {
        Dependency childDependency = convertToDependency(dependencyGraph, swiftPackageDependency);
        dependencyGraph.addParentWithChild(dependency, childDependency);
    }
    return dependency;
}
Also used : SwiftPackage(com.synopsys.integration.detectable.detectables.swift.cli.model.SwiftPackage) ExternalId(com.synopsys.integration.bdio.model.externalid.ExternalId) Dependency(com.synopsys.integration.bdio.model.dependency.Dependency)

Example 3 with SwiftPackage

use of com.synopsys.integration.detectable.detectables.swift.cli.model.SwiftPackage in project synopsys-detect by blackducksoftware.

the class SwiftPackageTransformer method transform.

public CodeLocation transform(SwiftPackage rootSwiftPackage) {
    DependencyGraph dependencyGraph = new BasicDependencyGraph();
    for (SwiftPackage swiftPackageDependency : rootSwiftPackage.getDependencies()) {
        Dependency dependency = convertToDependency(dependencyGraph, swiftPackageDependency);
        dependencyGraph.addChildToRoot(dependency);
    }
    return new CodeLocation(dependencyGraph);
}
Also used : SwiftPackage(com.synopsys.integration.detectable.detectables.swift.cli.model.SwiftPackage) CodeLocation(com.synopsys.integration.detectable.detectable.codelocation.CodeLocation) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) BasicDependencyGraph(com.synopsys.integration.bdio.graph.BasicDependencyGraph) BasicDependencyGraph(com.synopsys.integration.bdio.graph.BasicDependencyGraph) Dependency(com.synopsys.integration.bdio.model.dependency.Dependency)

Aggregations

SwiftPackage (com.synopsys.integration.detectable.detectables.swift.cli.model.SwiftPackage)3 Dependency (com.synopsys.integration.bdio.model.dependency.Dependency)2 CodeLocation (com.synopsys.integration.detectable.detectable.codelocation.CodeLocation)2 BasicDependencyGraph (com.synopsys.integration.bdio.graph.BasicDependencyGraph)1 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)1 ExternalId (com.synopsys.integration.bdio.model.externalid.ExternalId)1