use of com.synopsys.integration.detectable.detectable.exception.DetectableException in project synopsys-detect by blackducksoftware.
the class SbtPluginFinder method listPlugins.
private List<String> listPlugins(File directory, ExecutableTarget sbt, @Nullable String sbtCommandAdditionalArguments) throws DetectableException {
try {
List<String> args = sbtCommandArgumentGenerator.generateSbtCmdArgs(sbtCommandAdditionalArguments, "plugins");
ExecutableOutput output = executableRunner.executeSuccessfully(ExecutableUtils.createFromTarget(directory, sbt, args));
return output.getStandardOutputAsList();
} catch (ExecutableFailedException e) {
throw new DetectableException("Unable to list installed sbt plugins, detect requires a suitable sbt plugin is available to find dependency graphs.", e);
}
}
use of com.synopsys.integration.detectable.detectable.exception.DetectableException in project synopsys-detect by blackducksoftware.
the class LocalPipInspectorResolver method resolvePipInspector.
@Override
public File resolvePipInspector() throws DetectableException {
try {
if (!hasResolvedInspector) {
hasResolvedInspector = true;
resolvedInspector = installInspector();
}
return resolvedInspector;
} catch (Exception e) {
throw new DetectableException(e);
}
}
use of com.synopsys.integration.detectable.detectable.exception.DetectableException in project synopsys-detect by blackducksoftware.
the class OnlineNugetInspectorResolver method resolveNugetInspector.
@Override
public ExecutableTarget resolveNugetInspector() throws DetectableException {
if (!hasResolvedInspector) {
File inspectorFile = null;
hasResolvedInspector = true;
File installDirectory = directoryManager.getPermanentDirectory(INSPECTOR_NAME);
try {
inspectorFile = installer.install(installDirectory);
} catch (DetectableException e) {
logger.debug("Unable to install the detect nuget inspector from Artifactory.", e);
}
if (inspectorFile == null) {
// Remote installation has failed
logger.debug("Attempting to locate previous install of detect nuget inspector.");
return installedToolLocator.locateTool(INSPECTOR_NAME).map(ExecutableTarget::forFile).orElseThrow(() -> new DetectableException("Unable to locate previous install of the detect nuget inspector."));
} else {
installedToolManager.saveInstalledToolLocation(INSPECTOR_NAME, inspectorFile.getAbsolutePath());
}
inspector = ExecutableTarget.forFile(inspectorFile);
}
return inspector;
}
use of com.synopsys.integration.detectable.detectable.exception.DetectableException in project synopsys-detect by blackducksoftware.
the class OnlineProjectInspectorResolver method resolveProjectInspector.
@Override
public ExecutableTarget resolveProjectInspector() throws DetectableException {
File inspectorFile = null;
if (!hasResolvedInspector) {
hasResolvedInspector = true;
File installDirectory = directoryManager.getPermanentDirectory(INSTALLED_TOOL_JSON_KEY);
try {
inspectorFile = projectInspectorInstaller.install(installDirectory);
} catch (DetectableException e) {
logger.debug("Unable to install the project inspector from Artifactory.");
}
if (inspectorFile == null) {
// Remote installation has failed
logger.debug("Attempting to locate previous install of project inspector.");
return installedToolLocator.locateTool(INSTALLED_TOOL_JSON_KEY).map(ExecutableTarget::forFile).orElseThrow(() -> new DetectableException("Unable to locate previous install of the project inspector."));
} else {
installedToolManager.saveInstalledToolLocation(INSTALLED_TOOL_JSON_KEY, inspectorFile.getAbsolutePath());
}
}
return ExecutableTarget.forFile(inspectorFile);
}
use of com.synopsys.integration.detectable.detectable.exception.DetectableException in project synopsys-detect by blackducksoftware.
the class ProjectInspectorExecutableLocator method findExecutable.
@Nullable
public File findExecutable(File extractedZip, String executableName) throws DetectableException {
logger.debug("Looking for '" + executableName + "' in " + extractedZip.toString());
File bin = new File(extractedZip, "bin");
File executable = new File(bin, executableName);
if (executable.exists()) {
logger.debug("Found it: " + executable);
if (!executable.canExecute()) {
if (!executable.setExecutable(true)) {
throw new DetectableException("Unable to set project inspector to executable: " + executable);
}
}
return executable;
} else {
logger.debug("Could not find executable: " + executable);
return null;
}
}
Aggregations