001/*
002 * Licensed under the Apache License, Version 2.0 (the "License");
003 * you may not use this file except in compliance with the License.
004 * You may obtain a copy of the License at
005 *
006 * http://www.apache.org/licenses/LICENSE-2.0
007 *
008 * Unless required by applicable law or agreed to in writing, software
009 * distributed under the License is distributed on an "AS IS" BASIS,
010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
011 * See the License for the specific language governing permissions and
012 * limitations under the License.
013 */
014
015package org.basepom.mojo.dvc;
016
017import org.basepom.mojo.dvc.model.VersionCheckExcludes;
018
019import java.util.List;
020
021import org.apache.maven.project.MavenProject;
022import org.apache.maven.project.ProjectBuilder;
023import org.apache.maven.project.ProjectBuildingRequest;
024import org.apache.maven.project.ProjectDependenciesResolver;
025import org.eclipse.aether.RepositorySystem;
026import org.eclipse.aether.RepositorySystemSession;
027import org.eclipse.aether.artifact.Artifact;
028import org.eclipse.aether.resolution.VersionRangeRequest;
029
030public interface Context {
031
032    /**
033     * @return True if any unresolved system artifacts should fail the build.
034     */
035    boolean isUnresolvedSystemArtifactsFailBuild();
036
037    /**
038     * @return True if the resolver should use multiple threads.
039     */
040    boolean useFastResolution();
041
042    /**
043     * @return True if a deep scan should be performed instead of regular scan.
044     */
045    boolean useDeepScan();
046
047    /**
048     * @return True if all optional dependencies must exist.
049     */
050    boolean isOptionalDependenciesMustExist();
051
052    /**
053     * @return All configured exclusions.
054     */
055    List<VersionCheckExcludes> getExclusions();
056
057    /**
058     * @return The lookup cache for the Strategy resolution
059     */
060    StrategyCache getStrategyCache();
061
062    /**
063     * @return The Maven project builder.
064     */
065    ProjectBuilder getProjectBuilder();
066
067    /**
068     * @return The Maven project dependency resolver.
069     */
070    ProjectDependenciesResolver getProjectDependenciesResolver();
071
072    /**
073     * @return The root project.
074     */
075    MavenProject getRootProject();
076
077    /**
078     * @return All projects that are in the current reactor.
079     */
080    List<MavenProject> getReactorProjects();
081
082    /**
083     * @return The repository session
084     */
085    RepositorySystemSession getRepositorySystemSession();
086
087    /**
088     * @return The repository system for dependency resolution.
089     */
090    RepositorySystem getRepositorySystem();
091
092    /**
093     * @return A new project building request.
094     */
095    ProjectBuildingRequest createProjectBuildingRequest();
096
097    /**
098     * @param artifact The artifact to define the version range resolution request.
099     * @return A version range resolution request.
100     */
101    VersionRangeRequest createVersionRangeRequest(Artifact artifact);
102}