use of com.synopsys.integration.detectable.detectables.swift.model.SwiftPackage in project synopsys-detect by blackducksoftware.
the class SwiftExtractor method extract.
public Extraction extract(File environmentDirectory, ExecutableTarget swiftExecutable) {
try {
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();
} catch (IntegrationException | ExecutableRunnerException e) {
return new Extraction.Builder().exception(e).build();
}
}
use of com.synopsys.integration.detectable.detectables.swift.model.SwiftPackage in project synopsys-detect by blackducksoftware.
the class SwiftPackageTransformer method transform.
public CodeLocation transform(SwiftPackage rootSwiftPackage) {
MutableDependencyGraph dependencyGraph = new MutableMapDependencyGraph();
for (SwiftPackage swiftPackageDependency : rootSwiftPackage.getDependencies()) {
Dependency dependency = convertToDependency(dependencyGraph, swiftPackageDependency);
dependencyGraph.addChildToRoot(dependency);
}
return new CodeLocation(dependencyGraph);
}
use of com.synopsys.integration.detectable.detectables.swift.model.SwiftPackage in project synopsys-detect by blackducksoftware.
the class SwiftPackageTransformer method convertToDependency.
private Dependency convertToDependency(MutableDependencyGraph 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;
}
Aggregations