Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.eclipse.aether.collection.DependencySelector;
import org.eclipse.aether.collection.DependencyTraverser;
import org.eclipse.aether.collection.VersionFilter;
import org.eclipse.aether.platform.PlatformManager;
import org.eclipse.aether.repository.Authentication;
import org.eclipse.aether.repository.AuthenticationSelector;
import org.eclipse.aether.repository.LocalRepository;
Expand Down Expand Up @@ -116,6 +117,8 @@ public final class DefaultRepositorySystemSession implements RepositorySystemSes

private DependencyManager dependencyManager;

private PlatformManager platformManager;

private DependencySelector dependencySelector;

private VersionFilter versionFilter;
Expand Down Expand Up @@ -200,6 +203,7 @@ public DefaultRepositorySystemSession(RepositorySystemSession session) {
setArtifactTypeRegistry(session.getArtifactTypeRegistry());
setDependencyTraverser(session.getDependencyTraverser());
setDependencyManager(session.getDependencyManager());
setPlatformManager(session.getPlatformManager());
setDependencySelector(session.getDependencySelector());
setVersionFilter(session.getVersionFilter());
setDependencyGraphTransformer(session.getDependencyGraphTransformer());
Expand Down Expand Up @@ -714,6 +718,24 @@ public DefaultRepositorySystemSession setDependencyManager(DependencyManager dep
return this;
}

@Override
public PlatformManager getPlatformManager() {
return platformManager;
}

/**
* Sets the platform manager to use for building dependency graphs.
*
* @param platformManager The platform manager to use for building dependency graphs, may be {@code null}.
* @return This session for chaining, never {@code null}.
* @since 2.0.13
*/
public DefaultRepositorySystemSession setPlatformManager(PlatformManager platformManager) {
verifyStateForMutation();
this.platformManager = platformManager;
return this;
}

@Override
public DependencySelector getDependencySelector() {
return dependencySelector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.eclipse.aether.collection.DependencySelector;
import org.eclipse.aether.collection.DependencyTraverser;
import org.eclipse.aether.collection.VersionFilter;
import org.eclipse.aether.platform.PlatformManager;
import org.eclipse.aether.repository.AuthenticationSelector;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.LocalRepositoryManager;
Expand Down Expand Up @@ -351,6 +352,15 @@ interface SessionBuilder {
*/
SessionBuilder setDependencyManager(DependencyManager dependencyManager);

/**
* Sets the platform manager to use for building dependency graphs.
*
* @param platformManager The platform manager to use for building dependency graphs, may be {@code null}.
* @return This session for chaining, never {@code null}.
* @since 2.0.13
*/
SessionBuilder setPlatformManager(PlatformManager platformManager);

/**
* Sets the dependency selector to use for building dependency graphs.
*
Expand Down Expand Up @@ -723,6 +733,15 @@ interface SessionBuilder {
*/
DependencyManager getDependencyManager();

/**
* Gets the platform manager to use for building dependency graphs.
*
* @return The platform manager to use for building dependency graphs or {@code null} if dependency management is
* not performed.
* @since 2.0.13
*/
PlatformManager getPlatformManager();

/**
* Gets the dependency selector to use for building dependency graphs.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,21 @@
package org.eclipse.aether.collection;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.eclipse.aether.graph.DependencyManagementRule;
import org.eclipse.aether.graph.Exclusion;

import static java.util.Objects.requireNonNull;

/**
* The management updates to apply to a dependency.
*
* @see DependencyManager#manageDependency(org.eclipse.aether.graph.Dependency)
*/
public final class DependencyManagement {
private final List<DependencyManagementRule<?>> rules;

private String version;

Expand All @@ -42,9 +47,27 @@ public final class DependencyManagement {

/**
* Creates an empty management update.
*
* @deprecated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We many times missing description on deprecations .... why, what should be used instead of ... and so on

*/
@Deprecated
public DependencyManagement() {
// enables default constructor
this.rules = null;
}

/**
* Creates instance with given rules.
*/
public DependencyManagement(List<DependencyManagementRule<?>> rules) {
this.rules = requireNonNull(rules);
}

/**
* Returns the {@link DependencyManagementRule} or {@code null}.
*/
public List<DependencyManagementRule<?>> getRules() {
return rules;
}

/**
Expand All @@ -53,6 +76,7 @@ public DependencyManagement() {
* @return The new version or {@code null} if the version is not managed and the existing dependency version should
* remain unchanged.
*/
@Deprecated
public String getVersion() {
return version;
}
Expand All @@ -63,6 +87,7 @@ public String getVersion() {
* @param version The new version, may be {@code null} if the version is not managed.
* @return This management update for chaining, never {@code null}.
*/
@Deprecated
public DependencyManagement setVersion(String version) {
this.version = version;
return this;
Expand All @@ -74,6 +99,7 @@ public DependencyManagement setVersion(String version) {
* @return The new scope or {@code null} if the scope is not managed and the existing dependency scope should remain
* unchanged.
*/
@Deprecated
public String getScope() {
return scope;
}
Expand All @@ -84,6 +110,7 @@ public String getScope() {
* @param scope The new scope, may be {@code null} if the scope is not managed.
* @return This management update for chaining, never {@code null}.
*/
@Deprecated
public DependencyManagement setScope(String scope) {
this.scope = scope;
return this;
Expand All @@ -95,6 +122,7 @@ public DependencyManagement setScope(String scope) {
* @return The new optional flag or {@code null} if the flag is not managed and the existing optional flag of the
* dependency should remain unchanged.
*/
@Deprecated
public Boolean getOptional() {
return optional;
}
Expand All @@ -105,6 +133,7 @@ public Boolean getOptional() {
* @param optional The optional flag, may be {@code null} if the flag is not managed.
* @return This management update for chaining, never {@code null}.
*/
@Deprecated
public DependencyManagement setOptional(Boolean optional) {
this.optional = optional;
return this;
Expand All @@ -118,6 +147,7 @@ public DependencyManagement setOptional(Boolean optional) {
* @return The new exclusions or {@code null} if the exclusions are not managed and the existing dependency
* exclusions should remain unchanged.
*/
@Deprecated
public Collection<Exclusion> getExclusions() {
return exclusions;
}
Expand All @@ -130,6 +160,7 @@ public Collection<Exclusion> getExclusions() {
* @param exclusions The new exclusions, may be {@code null} if the exclusions are not managed.
* @return This management update for chaining, never {@code null}.
*/
@Deprecated
public DependencyManagement setExclusions(Collection<Exclusion> exclusions) {
this.exclusions = exclusions;
return this;
Expand All @@ -143,6 +174,7 @@ public DependencyManagement setExclusions(Collection<Exclusion> exclusions) {
* @return The new artifact properties or {@code null} if the properties are not managed and the existing properties
* should remain unchanged.
*/
@Deprecated
public Map<String, String> getProperties() {
return properties;
}
Expand All @@ -155,6 +187,7 @@ public Map<String, String> getProperties() {
* @param properties The new artifact properties, may be {@code null} if the properties are not managed.
* @return This management update for chaining, never {@code null}.
*/
@Deprecated
public DependencyManagement setProperties(Map<String, String> properties) {
this.properties = properties;
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.eclipse.aether.collection;

import java.util.Objects;

import org.eclipse.aether.artifact.Artifact;

/**
* A key used for dependency management.
*
* @since 2.0.13
*/
public final class DependencyManagementKey {
private final String groupId;
private final String artifactId;
private final String extension;
private final String classifier;
private final int hashCode;

/**
* Creates a new DM key for given artifact.
*/
public DependencyManagementKey(Artifact artifact) {
this.groupId = artifact.getGroupId();
this.artifactId = artifact.getArtifactId();
this.extension = artifact.getExtension();
this.classifier = artifact.getClassifier();
this.hashCode = Objects.hash(groupId, artifactId, extension, classifier);
}

@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
} else if (!(obj instanceof DependencyManagementKey)) {
return false;
}
DependencyManagementKey that = (DependencyManagementKey) obj;
return artifactId.equals(that.artifactId)
&& groupId.equals(that.groupId)
&& extension.equals(that.extension)
&& classifier.equals(that.classifier);
}

@Override
public int hashCode() {
return hashCode;
}

@Override
public String toString() {
if (classifier.isEmpty()) {
return groupId + ":" + artifactId + ":" + extension;
} else {
return groupId + ":" + artifactId + ":" + extension + ":" + classifier;
}
}
}
Loading
Loading