Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
eygraber committed Nov 13, 2023
1 parent 54e8803 commit 5c7a665
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 deletions.
13 changes: 6 additions & 7 deletions src/main/java/org/spdx/sbom/gradle/SpdxSbomPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ private void createTaskForTarget(
t.usesService(knownLicenseServiceProvider);

List<String> configurationNames = target.getConfigurations().get();
var rootComponentsProperty = project.getObjects().listProperty(ResolvedComponentResult.class);
var rootComponentsProperty =
project.getObjects().listProperty(ResolvedComponentResult.class);
for (var configurationName : configurationNames) {
Provider<ResolvedComponentResult> rootComponent =
project
Expand All @@ -137,12 +138,10 @@ private void createTaskForTarget(
t.getRootComponents().addAll(rootComponentsProperty);

Provider<List<ResolvedArtifactResult>> resolvedArtifactsProvider =
rootComponentsProperty
.map(
rootComponents ->
DependencyResolver.newDependencyResolver(
project.getDependencies())
.resolveDependencies(rootComponents));
rootComponentsProperty.map(
rootComponents ->
DependencyResolver.newDependencyResolver(project.getDependencies())
.resolveDependencies(rootComponents));

t.getResolvedArtifacts()
.putAll(
Expand Down
54 changes: 27 additions & 27 deletions src/main/java/org/spdx/sbom/gradle/maven/DependencyResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,37 +30,37 @@
import org.gradle.maven.MavenPomArtifact;

/**
* DependencyResolver identifies and collects the component identifiers for dependencies in a project's dependency
* graph, focusing specifically on Maven artifacts. It filters out non-serializable Gradle API components
* to concentrate on Maven dependencies.
* DependencyResolver identifies and collects the component identifiers for dependencies in a
* project's dependency graph, focusing specifically on Maven artifacts. It filters out
* non-serializable Gradle API components to concentrate on Maven dependencies.
*
* <p>Process:</p>
* <ol>
* <li><b>Identifying Component Identifiers:</b>
* The process starts by identifying the component identifiers of all dependencies in a project's
* dependency graph. This is achieved by iterating over the root components (instances of
* {@link org.gradle.api.artifacts.result.ResolvedComponentResult}) of the dependency graph. Each
* root component is analyzed to extract its dependencies and their respective component identifiers.</li>
*
* <li><b>Resolving Dependencies:</b>
* With the component identifiers collected, the class then proceeds to resolve these dependencies.
* This is done using the {@link org.gradle.api.artifacts.dsl.DependencyHandler} to create an
* artifact resolution query. The query targets the collected component identifiers and specifies
* the types of artifacts to resolve, in this case, Maven POM artifacts (represented by
* {@link org.gradle.maven.MavenPomArtifact}).</li>
* <p>Process:
*
* <li><b>Filtering and Collecting Artifacts:</b>
* The resolved artifacts are then processed to filter out non-serializable Gradle components
* (identified by {@link org.gradle.internal.component.local.model.OpaqueComponentIdentifier}).
* This step ensures the focus remains on Maven artifacts. The final output is a list of
* {@link org.gradle.api.artifacts.result.ResolvedArtifactResult} instances, representing the
* resolved Maven POM artifacts. Each ResolvedArtifactResult provides access to the artifact file
* and metadata.</li>
* <ol>
* <li><b>Identifying Component Identifiers:</b> The process starts by identifying the component
* identifiers of all dependencies in a project's dependency graph. This is achieved by
* iterating over the root components (instances of {@link
* org.gradle.api.artifacts.result.ResolvedComponentResult}) of the dependency graph. Each
* root component is analyzed to extract its dependencies and their respective component
* identifiers.
* <li><b>Resolving Dependencies:</b> With the component identifiers collected, the class then
* proceeds to resolve these dependencies. This is done using the {@link
* org.gradle.api.artifacts.dsl.DependencyHandler} to create an artifact resolution query. The
* query targets the collected component identifiers and specifies the types of artifacts to
* resolve, in this case, Maven POM artifacts (represented by {@link
* org.gradle.maven.MavenPomArtifact}).
* <li><b>Filtering and Collecting Artifacts:</b> The resolved artifacts are then processed to
* filter out non-serializable Gradle components (identified by {@link
* org.gradle.internal.component.local.model.OpaqueComponentIdentifier}). This step ensures
* the focus remains on Maven artifacts. The final output is a list of {@link
* org.gradle.api.artifacts.result.ResolvedArtifactResult} instances, representing the
* resolved Maven POM artifacts. Each ResolvedArtifactResult provides access to the artifact
* file and metadata.
* </ol>
*
* <p>Result:</p>
* The outcome is a list of {@link org.gradle.api.artifacts.result.ResolvedArtifactResult}, which provides
* access to the files of resolved Maven POM artifacts, giving detailed insight into the project's Maven dependencies.
* <p>Result: The outcome is a list of {@link
* org.gradle.api.artifacts.result.ResolvedArtifactResult}, which provides access to the files of
* resolved Maven POM artifacts, giving detailed insight into the project's Maven dependencies.
*
* @see org.gradle.api.artifacts.dsl.DependencyHandler
* @see org.gradle.api.artifacts.result.ResolvedArtifactResult
Expand Down

0 comments on commit 5c7a665

Please sign in to comment.