Search in sources :

Example 1 with ExclusionDescriptor

use of org.eclipse.ceylon.cmr.resolver.aether.ExclusionDescriptor in project ceylon by eclipse.

the class AetherUtils method createArtifactResult.

protected ArtifactResult createArtifactResult(final RepositoryManager manager, CmrRepository repository, final String groupId, final String artifactId, final String classifier, final String dVersion, final boolean shared, final boolean optional, final ModuleScope scope, final String repositoryDisplayString, final List<ExclusionDescriptor> exclusions) {
    final String dName = MavenUtils.moduleName(groupId, artifactId, classifier);
    return new MavenArtifactResult(repository, dName, dVersion, groupId, artifactId, classifier, repositoryDisplayString) {

        private ArtifactResult result;

        {
            if (exclusions != null) {
                List<Exclusion> ret = new ArrayList<>(exclusions.size());
                for (ExclusionDescriptor xDescr : exclusions) {
                    ret.add(new Exclusion(xDescr.getGroupId(), xDescr.getArtifactId()));
                }
                setExclusions(ret);
            }
        }

        @Override
        public boolean exported() {
            return shared;
        }

        @Override
        public boolean optional() {
            return optional;
        }

        @Override
        public ModuleScope moduleScope() {
            return scope;
        }

        private synchronized ArtifactResult getResult() {
            if (result == null) {
                result = fetchDependencies(manager, (CmrRepository) repository(), groupId, artifactId, classifier, dVersion, false, repositoryDisplayString);
            }
            return result;
        }

        protected File artifactInternal() throws RepositoryException {
            return getResult().artifact();
        }

        public List<ArtifactResult> dependencies() throws RepositoryException {
            return getResult().dependencies();
        }
    };
}
Also used : Exclusion(org.eclipse.ceylon.model.cmr.Exclusion) ArrayList(java.util.ArrayList) ExclusionDescriptor(org.eclipse.ceylon.cmr.resolver.aether.ExclusionDescriptor) CmrRepository(org.eclipse.ceylon.cmr.api.CmrRepository) LazyArtifactResult(org.eclipse.ceylon.cmr.impl.LazyArtifactResult) AbstractArtifactResult(org.eclipse.ceylon.cmr.impl.AbstractArtifactResult) ArtifactResult(org.eclipse.ceylon.model.cmr.ArtifactResult)

Aggregations

ArrayList (java.util.ArrayList)1 CmrRepository (org.eclipse.ceylon.cmr.api.CmrRepository)1 AbstractArtifactResult (org.eclipse.ceylon.cmr.impl.AbstractArtifactResult)1 LazyArtifactResult (org.eclipse.ceylon.cmr.impl.LazyArtifactResult)1 ExclusionDescriptor (org.eclipse.ceylon.cmr.resolver.aether.ExclusionDescriptor)1 ArtifactResult (org.eclipse.ceylon.model.cmr.ArtifactResult)1 Exclusion (org.eclipse.ceylon.model.cmr.Exclusion)1