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();
}
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;
}
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);
}
Aggregations