Search in sources :

Example 51 with ExecutableOutput

use of com.synopsys.integration.executable.ExecutableOutput in project synopsys-detect by blackducksoftware.

the class GoModDetectableUnusedTest method setup.

@Override
protected void setup() throws IOException {
    addFile(Paths.get("go.mod"));
    ExecutableOutput goListOutput = createStandardOutputFromResource("/go/go-list.xout");
    addExecutableOutput(goListOutput, "go", "list", "-m", "-json");
    ExecutableOutput goVersionOutput = createStandardOutput("go version go1.16.5 darwin/amd64");
    addExecutableOutput(goVersionOutput, "go", "version");
    ExecutableOutput goListUJsonOutput = createStandardOutputFromResource("/go/go-list-all.xout");
    addExecutableOutput(goListUJsonOutput, "go", "list", "-mod=readonly", "-m", "-json", "all");
    ExecutableOutput goModGraphOutput = createStandardOutput("github.com/gin-gonic/gin golang.org/x/text@v0.3.0", "github.com/gin-gonic/gin sigs.k8s.io/yaml@v1.2.0", "golang.org/x/text@v0.3.0 golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e", "gopkg.in/yaml.v2@v2.2.8 gopkg.in/check.v1@v0.0.0-20161208181325-20d25e280405", "sigs.k8s.io/yaml@v1.2.0 github.com/davecgh/go-spew@v1.1.1", "sigs.k8s.io/yaml@v1.2.0 gopkg.in/yaml.v2@v2.2.8");
    addExecutableOutput(goModGraphOutput, "go", "mod", "graph");
    ExecutableOutput goModWhyOutput = createStandardOutput("# github.com/gin-gonic/gin", "github.com/gin-gonic/gin", "", "# github.com/davecgh/go-spew", "(main module does not need module github.com/davecgh/go-spew)", "", "# golang.org/x/text", "github.com/gin-gonic/gin", "golang.org/x/text/language", "", "# golang.org/x/tools", "(main module does not need module golang.org/x/tools)", "", "# gopkg.in/check.v1", "(main module does not need module gopkg.in/check.v1)", "", "# gopkg.in/yaml.v2", "(main module does not need module gopkg.in/yaml.v2)", "", "# sigs.k8s.io/yaml", "(main module does not need module sigs.k8s.io/yaml)");
    addExecutableOutput(goModWhyOutput, "go", "mod", "why", "-m", "all");
}
Also used : ExecutableOutput(com.synopsys.integration.executable.ExecutableOutput)

Example 52 with ExecutableOutput

use of com.synopsys.integration.executable.ExecutableOutput in project synopsys-detect by blackducksoftware.

the class DotNetRuntimeFinder method listAvailableRuntimes.

public List<String> listAvailableRuntimes() throws DetectableException {
    try {
        ExecutableOutput runtimesOutput = dotnetListRuntimes();
        List<String> foundRuntimes = runtimesOutput.getStandardOutputAsList().stream().map(StringUtils::trimToEmpty).filter(StringUtils::isNotBlank).collect(Collectors.toList());
        logger.info("Found {} available dotnet runtimes", foundRuntimes.size());
        if (foundRuntimes.isEmpty()) {
            throw new DetectableException("No available dotnet runtimes");
        }
        return foundRuntimes;
    } catch (ExecutableRunnerException e) {
        throw new DetectableException("Could not determine available dotnet runtimes", e);
    }
}
Also used : ExecutableOutput(com.synopsys.integration.executable.ExecutableOutput) StringUtils(org.apache.commons.lang3.StringUtils) DetectableException(com.synopsys.integration.detectable.detectable.exception.DetectableException) ExecutableRunnerException(com.synopsys.integration.executable.ExecutableRunnerException)

Example 53 with ExecutableOutput

use of com.synopsys.integration.executable.ExecutableOutput in project blackduck-docker-inspector by blackducksoftware.

the class UpdateArtifactoryPropertiesTask method getArtifactoryItems.

private ArtifactSearchResult getArtifactoryItems(final String url, final List<String> defaultCurlArgs) throws ExecutableRunnerException {
    final List<String> curlArgs = new ArrayList<>(Arrays.asList("--header", "X-Result-Detail: info", url));
    curlArgs.addAll(defaultCurlArgs);
    final ExecutableOutput executableOutput = curlResponse(curlArgs);
    return gson.fromJson(executableOutput.getStandardOutput(), ArtifactSearchResult.class);
}
Also used : ExecutableOutput(com.synopsys.integration.executable.ExecutableOutput) ArrayList(java.util.ArrayList)

Aggregations

ExecutableOutput (com.synopsys.integration.executable.ExecutableOutput)53 File (java.io.File)18 DetectableExecutableRunner (com.synopsys.integration.detectable.detectable.executable.DetectableExecutableRunner)14 ArrayList (java.util.ArrayList)14 Extraction (com.synopsys.integration.detectable.extraction.Extraction)13 ExecutableRunnerException (com.synopsys.integration.executable.ExecutableRunnerException)13 CodeLocation (com.synopsys.integration.detectable.detectable.codelocation.CodeLocation)10 ExecutableTarget (com.synopsys.integration.detectable.ExecutableTarget)9 Executable (com.synopsys.integration.executable.Executable)9 DetectableException (com.synopsys.integration.detectable.detectable.exception.DetectableException)8 Test (org.junit.jupiter.api.Test)7 NameVersion (com.synopsys.integration.util.NameVersion)6 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)5 HashMap (java.util.HashMap)5 List (java.util.List)5 StringUtils (org.apache.commons.lang3.StringUtils)5 ExecutableUtils (com.synopsys.integration.detectable.ExecutableUtils)4 IOException (java.io.IOException)4 Optional (java.util.Optional)4 Gson (com.google.gson.Gson)3