-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In Resolver 1.x times, resolver was unaware of "resolution scope", to get the wanted resolution scope caller had to tweak and set up various nits and bits, like selectors, filters, and so on. It was easy to miss. Similarly, resolver had no "first class" type for "dependency scope" either, they were just string labels (that everyone knew HOW should behave, but was never codified) and its meaning and notion was sprinkled across several classes. Introducing new scope in these conditions (or alter selector to something that would have new scopes, like Maven4 plans) was nearly impossible. The ScopeManager aims to solve these issues: it defines "resolution scope" and "dependency scope", interprets them, and allows caller to simply make a call to "resolve me main-runtime" resolution scope. No hoops and loops. Moreover, it is FASTER than Resolver 1.x was, that used always same selector (to build dirty graph), so potentially huge graph even if you needed just a bit of it, that was later chopped down to clean up the graph. ScopeManager automates selector selection/setup, and goes directly for result, in most cases the resulting tree is done in first pass. Finally, and most importantly, ScopeManager allows to be "configured": by supplying the recipe for dependency and resolution scopes, hence, makes Resolver 2.x versatile, in a sense, it is not "this or that" anymore, it can obey Maven3 and Maven4 dependency scopes at the same time. --- https://issues.apache.org/jira/browse/MRESOLVER-512
- Loading branch information
Showing
55 changed files
with
3,976 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
maven-resolver-api/src/main/java/org/eclipse/aether/scope/DependencyScope.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* 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.scope; | ||
|
||
/** | ||
* Generic dependency scope. | ||
* | ||
* @since 2.0.0 | ||
* | ||
* @noimplement This interface is not intended to be implemented by clients. | ||
* @noextend This interface is not intended to be extended by clients. | ||
*/ | ||
public interface DependencyScope { | ||
/** | ||
* The label. | ||
*/ | ||
String getId(); | ||
|
||
/** | ||
* Shorthand method of {@link #getId()#equals(Object)}. | ||
*/ | ||
default boolean is(String label) { | ||
return getId().equals(label); | ||
} | ||
|
||
/** | ||
* Is it transitive scope? | ||
*/ | ||
boolean isTransitive(); | ||
} |
34 changes: 34 additions & 0 deletions
34
maven-resolver-api/src/main/java/org/eclipse/aether/scope/ResolutionScope.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* 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.scope; | ||
|
||
/** | ||
* Generic resolution scope. | ||
* | ||
* @since 2.0.0 | ||
* | ||
* @noimplement This interface is not intended to be implemented by clients. | ||
* @noextend This interface is not intended to be extended by clients. | ||
*/ | ||
public interface ResolutionScope { | ||
/** | ||
* The label. | ||
*/ | ||
String getId(); | ||
} |
70 changes: 70 additions & 0 deletions
70
maven-resolver-api/src/main/java/org/eclipse/aether/scope/ScopeManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* 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.scope; | ||
|
||
import java.util.Collection; | ||
import java.util.Optional; | ||
|
||
/** | ||
* Scope manager. | ||
* | ||
* @since 2.0.0 | ||
* | ||
* @noimplement This interface is not intended to be implemented by clients. | ||
* @noextend This interface is not intended to be extended by clients. | ||
*/ | ||
public interface ScopeManager { | ||
/** | ||
* The label. | ||
*/ | ||
String getId(); | ||
|
||
/** | ||
* Returns the "system" scope, if exists. | ||
* <p> | ||
* This is a special scope. In this scope case, Resolver should handle it specially, as it has no POM (so is | ||
* always a leaf on graph), is not in any repository, but is actually hosted on host OS file system. On resolution | ||
* resolver merely checks is file present or not. | ||
*/ | ||
Optional<SystemDependencyScope> getSystemScope(); | ||
|
||
/** | ||
* Returns a specific dependency scope by label. | ||
* <p> | ||
* Note: despite returns optional, this method may throw as well, if manager set in "strict" mode. | ||
*/ | ||
Optional<DependencyScope> getDependencyScope(String id); | ||
|
||
/** | ||
* Returns the "universe" (all) of dependency scopes. | ||
*/ | ||
Collection<DependencyScope> getDependencyScopeUniverse(); | ||
|
||
/** | ||
* Returns a specific resolution scope by label. | ||
* <p> | ||
* Note: despite returns optional, this method may throw as well, if manager set in "strict" mode. | ||
*/ | ||
Optional<ResolutionScope> getResolutionScope(String id); | ||
|
||
/** | ||
* Returns the "universe" (all) of resolution scopes. | ||
*/ | ||
Collection<ResolutionScope> getResolutionScopeUniverse(); | ||
} |
Oops, something went wrong.