Skip to content

Commit

Permalink
Use the new scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Jan 31, 2024
1 parent 2536929 commit cf08727
Show file tree
Hide file tree
Showing 17 changed files with 47 additions and 230 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public interface BuildPathScope extends ExtensibleEnum {
ProjectScope projectScope();

@Nonnull
Set<DependencyScope> getDependencyScopes();
Set<DependencyScope> dependencyScopes();

BuildPathScope MAIN_COMPILE = buildPathScope(
"main-compile",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public interface Dependency extends Artifact {
DependencyProperties getDependencyProperties();

@Nonnull
Scope getScope();
DependencyScope getScope();

boolean isOptional();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public interface DependencyCoordinate extends ArtifactCoordinate {
Type getType();

@Nonnull
Scope getScope();
DependencyScope getScope();

@Nullable
Boolean getOptional();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public ProjectScope projectScope() {
}

@Override
public Set<DependencyScope> getDependencyScopes() {
public Set<DependencyScope> dependencyScopes() {
return dependencyScopes;
}
}
Expand Down

This file was deleted.

66 changes: 0 additions & 66 deletions api/maven-api-core/src/main/java/org/apache/maven/api/Scope.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.apache.maven.api.annotations.Nullable;
import org.apache.maven.api.annotations.ThreadSafe;
import org.apache.maven.api.model.Repository;
import org.apache.maven.api.services.BuildPathScopeRegistry;
import org.apache.maven.api.services.DependencyCoordinateFactory;
import org.apache.maven.api.settings.Settings;

Expand Down Expand Up @@ -428,11 +427,11 @@ Artifact createArtifact(
/**
* Shortcut for {@code getService(DependencyResolver.class).flatten(...)}.
*
* @see org.apache.maven.api.services.DependencyResolver#flatten(Session, Node, ResolutionScope)
* @see org.apache.maven.api.services.DependencyResolver#flatten(Session, Node, BuildPathScope)
* @throws org.apache.maven.api.services.DependencyResolverException if the dependency flattening failed
*/
@Nonnull
List<Node> flattenDependencies(@Nonnull Node node, @Nonnull ResolutionScope scope);
List<Node> flattenDependencies(@Nonnull Node node, @Nonnull BuildPathScope scope);

@Nonnull
List<Path> resolveDependencies(@Nonnull DependencyCoordinate dependencyCoordinate);
Expand All @@ -441,7 +440,7 @@ Artifact createArtifact(
List<Path> resolveDependencies(@Nonnull List<DependencyCoordinate> dependencyCoordinates);

@Nonnull
List<Path> resolveDependencies(@Nonnull Project project, @Nonnull ResolutionScope scope);
List<Path> resolveDependencies(@Nonnull Project project, @Nonnull BuildPathScope scope);

/**
* Resolves an artifact's meta version (if any) to a concrete version. For example, resolves "1.0-SNAPSHOT"
Expand Down Expand Up @@ -514,5 +513,4 @@ Artifact createArtifact(
DependencyScope requireDependencyScope(String id);

BuildPathScope requireBuildPathScope(String id);

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

import java.util.List;

import org.apache.maven.api.BuildPathScope;
import org.apache.maven.api.DependencyCoordinate;
import org.apache.maven.api.Node;
import org.apache.maven.api.Project;
import org.apache.maven.api.ResolutionScope;
import org.apache.maven.api.Service;
import org.apache.maven.api.Session;
import org.apache.maven.api.annotations.Experimental;
Expand All @@ -35,7 +35,7 @@
@Experimental
public interface DependencyResolver extends Service {

List<Node> flatten(Session session, Node node, ResolutionScope scope) throws DependencyResolverException;
List<Node> flatten(Session session, Node node, BuildPathScope scope) throws DependencyResolverException;

/**
* This method collects, flattens and resolves the dependencies.
Expand All @@ -47,7 +47,7 @@ public interface DependencyResolver extends Service {
* @throws ArtifactResolverException
*
* @see DependencyCollector#collect(DependencyCollectorRequest)
* @see #flatten(Session, Node, ResolutionScope)
* @see #flatten(Session, Node, BuildPathScope)
* @see ArtifactResolver#resolve(ArtifactResolverRequest)
*/
DependencyResolverResult resolve(DependencyResolverRequest request)
Expand All @@ -60,7 +60,7 @@ default DependencyResolverResult resolve(@Nonnull Session session, @Nonnull Proj

@Nonnull
default DependencyResolverResult resolve(
@Nonnull Session session, @Nonnull Project project, @Nonnull ResolutionScope scope) {
@Nonnull Session session, @Nonnull Project project, @Nonnull BuildPathScope scope) {
return resolve(DependencyResolverRequest.build(session, project, scope));
}

Expand All @@ -71,7 +71,7 @@ default DependencyResolverResult resolve(@Nonnull Session session, @Nonnull Depe

@Nonnull
default DependencyResolverResult resolve(
@Nonnull Session session, @Nonnull DependencyCoordinate dependency, @Nonnull ResolutionScope scope) {
@Nonnull Session session, @Nonnull DependencyCoordinate dependency, @Nonnull BuildPathScope scope) {
return resolve(DependencyResolverRequest.build(session, dependency, scope));
}

Expand All @@ -83,9 +83,7 @@ default DependencyResolverResult resolve(

@Nonnull
default DependencyResolverResult resolve(
@Nonnull Session session,
@Nonnull List<DependencyCoordinate> dependencies,
@Nonnull ResolutionScope scope) {
@Nonnull Session session, @Nonnull List<DependencyCoordinate> dependencies, @Nonnull BuildPathScope scope) {
return resolve(DependencyResolverRequest.build(session, dependencies, scope));
}
}

0 comments on commit cf08727

Please sign in to comment.