Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion license-header
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2023 Red Hat, Inc.
* Copyright © $YEAR Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/com/redhat/exhort/providers/AnalysisType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright © 2023 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.redhat.exhort.providers;

public enum AnalysisType {
STACK,
COMPONENT
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected BaseJavaProvider(Ecosystem.Type ecosystem, Path manifest) {
super(ecosystem, manifest);
}

void parseDependencyTree(String src, int srcDepth, String[] lines, Sbom sbom) {
void parseDependencyTree(String src, int srcDepth, String[] lines, Sbom sbom, String scope) {
if (lines.length == 0) {
return;
}
Expand All @@ -47,11 +47,12 @@ void parseDependencyTree(String src, int srcDepth, String[] lines, Sbom sbom) {
PackageURL from = parseDep(src);
PackageURL to = parseDep(target);
if (dependencyIsNotTestScope(from) && dependencyIsNotTestScope(to)) {
sbom.addDependency(from, to);
sbom.addDependency(from, to, scope);
}
} else {
String[] modifiedLines = Arrays.copyOfRange(lines, index, lines.length);
parseDependencyTree(lines[index - 1], getDepth(lines[index - 1]), modifiedLines, sbom);
parseDependencyTree(
lines[index - 1], getDepth(lines[index - 1]), modifiedLines, sbom, scope);
}
if (index < lines.length - 1) {
target = lines[++index];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ private Sbom buildSbomFromGraph(
dep -> {
PackageURL targetPurl =
toPurl((String) dep, "@", this.goEnvironmentVariableForPurl);
sbom.addDependency(source, targetPurl);
sbom.addDependency(source, targetPurl, null);
});
});
List<String> ignoredDepsPurl =
Expand Down Expand Up @@ -433,7 +433,7 @@ private Sbom buildSbomFromList(String golangDeps, List<PackageURL> ignoredDeps)
dep -> {
PackageURL targetPurl = toPurl(dep, "@", this.goEnvironmentVariableForPurl);
if (dependencyNotToBeIgnored(ignoredDeps, targetPurl)) {
sbom.addDependency(root, targetPurl);
sbom.addDependency(root, targetPurl, null);
}
});
List<String> ignoredDepsByName = new ArrayList<>();
Expand Down
Loading
Loading