Java 类org.gradle.api.internal.artifacts.DefaultModuleVersionIdentifier 实例源码

项目:Reer    文件:MavenPlugin.java   
private void configureUploadArchivesTask() {
    configurationActionContainer.add(new Action<Project>() {
        public void execute(Project project) {
            Upload uploadArchives = project.getTasks().withType(Upload.class).findByName(BasePlugin.UPLOAD_ARCHIVES_TASK_NAME);
            if (uploadArchives == null) {
                return;
            }

            ConfigurationInternal configuration = (ConfigurationInternal) uploadArchives.getConfiguration();
            Module module = configuration.getModule();
            for (MavenResolver resolver : uploadArchives.getRepositories().withType(MavenResolver.class)) {
                MavenPom pom = resolver.getPom();
                ModuleVersionIdentifier publicationId = new DefaultModuleVersionIdentifier(
                        pom.getGroupId().equals(MavenProject.EMPTY_PROJECT_GROUP_ID) ? module.getGroup() : pom.getGroupId(),
                        pom.getArtifactId().equals(MavenProject.EMPTY_PROJECT_ARTIFACT_ID) ? module.getName() : pom.getArtifactId(),
                        pom.getVersion().equals(MavenProject.EMPTY_PROJECT_VERSION) ? module.getVersion() : pom.getVersion()
                );
                publicationRegistry.registerPublication(project.getPath(), new DefaultProjectPublication(publicationId));
            }
        }
    });
}
项目:Reer    文件:ProjectDependencyPublicationResolver.java   
public ModuleVersionIdentifier resolve(ProjectDependency dependency) {
    Project dependencyProject = dependency.getDependencyProject();
    ((ProjectInternal) dependencyProject).evaluate();

    PublishingExtension publishing = dependencyProject.getExtensions().findByType(PublishingExtension.class);

    if (publishing == null || publishing.getPublications().withType(PublicationInternal.class).isEmpty()) {
        // Project does not apply publishing (or has no publications): simply use the project name in place of the dependency name
        return new DefaultModuleVersionIdentifier(dependency.getGroup(), dependencyProject.getName(), dependency.getVersion());
    }

    // See if all publications have the same identifier
    Set<? extends PublicationInternal> publications = publishing.getPublications().withType(PublicationInternal.class);
    Iterator<? extends PublicationInternal> iterator = publications.iterator();
    ModuleVersionIdentifier candidate = iterator.next().getCoordinates();
    while (iterator.hasNext()) {
        ModuleVersionIdentifier alternative = iterator.next().getCoordinates();
        if (!candidate.equals(alternative)) {
            throw new UnsupportedOperationException("Publishing is not yet able to resolve a dependency on a project with multiple different publications.");
        }
    }
    return candidate;

}
项目:Reer    文件:CachingModuleComponentRepository.java   
private void listModuleVersionsFromCache(DependencyMetadata dependency, BuildableModuleVersionListingResolveResult result) {
    ModuleVersionSelector requested = dependency.getRequested();
    final ModuleIdentifier moduleId = getCacheKey(requested);
    ModuleVersionsCache.CachedModuleVersionList cachedModuleVersionList = moduleVersionsCache.getCachedModuleResolution(delegate, moduleId);
    if (cachedModuleVersionList != null) {
        Set<String> versionList = cachedModuleVersionList.getModuleVersions();
        Set<ModuleVersionIdentifier> versions = CollectionUtils.collect(versionList, new Transformer<ModuleVersionIdentifier, String>() {
            public ModuleVersionIdentifier transform(String original) {
                return new DefaultModuleVersionIdentifier(moduleId, original);
            }
        });
        if (cachePolicy.mustRefreshVersionList(moduleId, versions, cachedModuleVersionList.getAgeMillis())) {
            LOGGER.debug("Version listing in dynamic revision cache is expired: will perform fresh resolve of '{}' in '{}'", requested, delegate.getName());
        } else {
            result.listed(versionList);
            // When age == 0, verified since the start of this build, assume listing hasn't changed
            result.setAuthoritative(cachedModuleVersionList.getAgeMillis() == 0);
        }
    }
}
项目:Reer    文件:BasePlugin.java   
private void configureUploadArchivesTask() {
    configurationActionContainer.add(new Action<Project>() {
        public void execute(Project project) {
            Upload uploadArchives = project.getTasks().withType(Upload.class).findByName(UPLOAD_ARCHIVES_TASK_NAME);
            if (uploadArchives == null) {
                return;
            }

            boolean hasIvyRepo = !uploadArchives.getRepositories().withType(IvyArtifactRepository.class).isEmpty();
            if (!hasIvyRepo) {
                return;
            } // Maven repos are handled by MavenPlugin

            ConfigurationInternal configuration = (ConfigurationInternal) uploadArchives.getConfiguration();
            Module module = configuration.getModule();
            ModuleVersionIdentifier publicationId =
                    new DefaultModuleVersionIdentifier(module.getGroup(), module.getName(), module.getVersion());
            publicationRegistry.registerPublication(module.getProjectPath(), new DefaultProjectPublication(publicationId));
        }
    });
}
项目:Pushjet-Android    文件:MavenPlugin.java   
private void configureUploadArchivesTask() {
    configurationActionContainer.add(new Action<Project>() {
        public void execute(Project project) {
            Upload uploadArchives = project.getTasks().withType(Upload.class).findByName(BasePlugin.UPLOAD_ARCHIVES_TASK_NAME);
            if (uploadArchives == null) { return; }

            ConfigurationInternal configuration = (ConfigurationInternal) uploadArchives.getConfiguration();
            ModuleInternal module = configuration.getModule();
            for (MavenResolver resolver : uploadArchives.getRepositories().withType(MavenResolver.class)) {
                MavenPom pom = resolver.getPom();
                ModuleVersionIdentifier publicationId = new DefaultModuleVersionIdentifier(
                        pom.getGroupId().equals(MavenProject.EMPTY_PROJECT_GROUP_ID) ? module.getGroup() : pom.getGroupId(),
                        pom.getArtifactId().equals(MavenProject.EMPTY_PROJECT_ARTIFACT_ID) ? module.getName() : pom.getArtifactId(),
                        pom.getVersion().equals(MavenProject.EMPTY_PROJECT_VERSION) ? module.getVersion() : pom.getVersion()
                );
                publicationRegistry.registerPublication(project.getPath(), new DefaultProjectPublication(publicationId));
            }
        }
    });
}
项目:Pushjet-Android    文件:ProjectDependencyPublicationResolver.java   
public ModuleVersionIdentifier resolve(ProjectDependency dependency) {
    Project dependencyProject = dependency.getDependencyProject();
    ((ProjectInternal) dependencyProject).evaluate();

    PublishingExtension publishing = dependencyProject.getExtensions().findByType(PublishingExtension.class);

    if (publishing == null || publishing.getPublications().withType(PublicationInternal.class).isEmpty()) {
        // Project does not apply publishing (or has no publications): simply use the project name in place of the dependency name
        return new DefaultModuleVersionIdentifier(dependency.getGroup(), dependencyProject.getName(), dependency.getVersion());
    }

    // See if all publications have the same identifier
    Set<? extends PublicationInternal> publications = publishing.getPublications().withType(PublicationInternal.class);
    Iterator<? extends PublicationInternal> iterator = publications.iterator();
    ModuleVersionIdentifier candidate = iterator.next().getCoordinates();
    while (iterator.hasNext()) {
        ModuleVersionIdentifier alternative = iterator.next().getCoordinates();
        if (!candidate.equals(alternative)) {
            throw new UnsupportedOperationException("Publishing is not yet able to resolve a dependency on a project with multiple different publications.");
        }
    }
    return candidate;

}
项目:Pushjet-Android    文件:CachingModuleComponentRepository.java   
private void listModuleVersionsFromCache(DependencyMetaData dependency, BuildableModuleComponentVersionSelectionResolveResult result) {
    ModuleVersionSelector requested = dependency.getRequested();
    final ModuleIdentifier moduleId = getCacheKey(requested);
    ModuleVersionsCache.CachedModuleVersionList cachedModuleVersionList = moduleVersionsCache.getCachedModuleResolution(delegate, moduleId);
    if (cachedModuleVersionList != null) {
        ModuleVersionListing versionList = cachedModuleVersionList.getModuleVersions();
        Set<ModuleVersionIdentifier> versions = CollectionUtils.collect(versionList.getVersions(), new Transformer<ModuleVersionIdentifier, Versioned>() {
            public ModuleVersionIdentifier transform(Versioned original) {
                return new DefaultModuleVersionIdentifier(moduleId, original.getVersion());
            }
        });
        if (cachePolicy.mustRefreshVersionList(moduleId, versions, cachedModuleVersionList.getAgeMillis())) {
            LOGGER.debug("Version listing in dynamic revision cache is expired: will perform fresh resolve of '{}' in '{}'", requested, delegate.getName());
        } else {
            result.listed(versionList);
            // When age == 0, verified since the start of this build, assume listing hasn't changed
            result.setAuthoritative(cachedModuleVersionList.getAgeMillis() == 0);
        }
    }
}
项目:Pushjet-Android    文件:DependencyResolverIvyPublisher.java   
public void publish(IvyNormalizedPublication publication, PublicationAwareRepository repository) {
    ModuleVersionPublisher publisher = repository.createPublisher();
    IvyPublicationIdentity projectIdentity = publication.getProjectIdentity();
    ModuleRevisionId moduleRevisionId = IvyUtil.createModuleRevisionId(projectIdentity.getOrganisation(), projectIdentity.getModule(), projectIdentity.getRevision());
    ModuleVersionIdentifier moduleVersionIdentifier = DefaultModuleVersionIdentifier.newId(moduleRevisionId);
    DefaultIvyModulePublishMetaData publishMetaData = new DefaultIvyModulePublishMetaData(moduleVersionIdentifier);

    try {
        for (IvyArtifact publishArtifact : publication.getArtifacts()) {
            Artifact ivyArtifact = createIvyArtifact(publishArtifact, moduleRevisionId);
            publishMetaData.addArtifact(ivyArtifact, publishArtifact.getFile());
        }

        Artifact artifact = DefaultArtifact.newIvyArtifact(moduleRevisionId, null);
        publishMetaData.addArtifact(artifact, publication.getDescriptorFile());

        publisher.publish(publishMetaData);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
项目:Pushjet-Android    文件:BasePlugin.java   
private void configureUploadArchivesTask() {
    configurationActionContainer.add(new Action<Project>() {
        public void execute(Project project) {
            Upload uploadArchives = project.getTasks().withType(Upload.class).findByName(UPLOAD_ARCHIVES_TASK_NAME);
            if (uploadArchives == null) { return; }

            boolean hasIvyRepo = !uploadArchives.getRepositories().withType(IvyArtifactRepository.class).isEmpty();
            if (!hasIvyRepo) { return; } // Maven repos are handled by MavenPlugin

            ConfigurationInternal configuration = (ConfigurationInternal) uploadArchives.getConfiguration();
            ModuleInternal module = configuration.getModule();
            ModuleVersionIdentifier publicationId =
                    new DefaultModuleVersionIdentifier(module.getGroup(), module.getName(), module.getVersion());
            publicationRegistry.registerPublication(module.getProjectPath(), new DefaultProjectPublication(publicationId));
        }
    });
}
项目:Pushjet-Android    文件:MavenPlugin.java   
private void configureUploadArchivesTask() {
    configurationActionContainer.add(new Action<Project>() {
        public void execute(Project project) {
            Upload uploadArchives = project.getTasks().withType(Upload.class).findByName(BasePlugin.UPLOAD_ARCHIVES_TASK_NAME);
            if (uploadArchives == null) { return; }

            ConfigurationInternal configuration = (ConfigurationInternal) uploadArchives.getConfiguration();
            ModuleInternal module = configuration.getModule();
            for (MavenResolver resolver : uploadArchives.getRepositories().withType(MavenResolver.class)) {
                MavenPom pom = resolver.getPom();
                ModuleVersionIdentifier publicationId = new DefaultModuleVersionIdentifier(
                        pom.getGroupId().equals(MavenProject.EMPTY_PROJECT_GROUP_ID) ? module.getGroup() : pom.getGroupId(),
                        pom.getArtifactId().equals(MavenProject.EMPTY_PROJECT_ARTIFACT_ID) ? module.getName() : pom.getArtifactId(),
                        pom.getVersion().equals(MavenProject.EMPTY_PROJECT_VERSION) ? module.getVersion() : pom.getVersion()
                );
                publicationRegistry.registerPublication(project.getPath(), new DefaultProjectPublication(publicationId));
            }
        }
    });
}
项目:Pushjet-Android    文件:ProjectDependencyPublicationResolver.java   
public ModuleVersionIdentifier resolve(ProjectDependency dependency) {
    Project dependencyProject = dependency.getDependencyProject();
    ((ProjectInternal) dependencyProject).evaluate();

    PublishingExtension publishing = dependencyProject.getExtensions().findByType(PublishingExtension.class);

    if (publishing == null || publishing.getPublications().withType(PublicationInternal.class).isEmpty()) {
        // Project does not apply publishing (or has no publications): simply use the project name in place of the dependency name
        return new DefaultModuleVersionIdentifier(dependency.getGroup(), dependencyProject.getName(), dependency.getVersion());
    }

    // See if all publications have the same identifier
    Set<? extends PublicationInternal> publications = publishing.getPublications().withType(PublicationInternal.class);
    Iterator<? extends PublicationInternal> iterator = publications.iterator();
    ModuleVersionIdentifier candidate = iterator.next().getCoordinates();
    while (iterator.hasNext()) {
        ModuleVersionIdentifier alternative = iterator.next().getCoordinates();
        if (!candidate.equals(alternative)) {
            throw new UnsupportedOperationException("Publishing is not yet able to resolve a dependency on a project with multiple different publications.");
        }
    }
    return candidate;

}
项目:Pushjet-Android    文件:CachingModuleVersionRepository.java   
public void localListModuleVersions(DependencyMetaData dependency, BuildableModuleVersionSelectionResolveResult result) {
    ModuleVersionSelector requested = dependency.getRequested();
    final ModuleIdentifier moduleId = moduleExtractor.transform(requested);
    ModuleVersionsCache.CachedModuleVersionList cachedModuleVersionList = moduleVersionsCache.getCachedModuleResolution(delegate, moduleId);
    if (cachedModuleVersionList != null) {
        ModuleVersionListing versionList = cachedModuleVersionList.getModuleVersions();
        Set<ModuleVersionIdentifier> versions = CollectionUtils.collect(versionList.getVersions(), new Transformer<ModuleVersionIdentifier, Versioned>() {
            public ModuleVersionIdentifier transform(Versioned original) {
                return new DefaultModuleVersionIdentifier(moduleId, original.getVersion());
            }
        });
        if (cachePolicy.mustRefreshVersionList(moduleId, versions, cachedModuleVersionList.getAgeMillis())) {
            LOGGER.debug("Version listing in dynamic revision cache is expired: will perform fresh resolve of '{}' in '{}'", requested, delegate.getName());
        } else {
            if (cachedModuleVersionList.getAgeMillis() == 0) {
                // Verified since the start of this build, assume still missing
                result.listed(versionList);
            } else {
                // Was missing last time we checked
                result.probablyListed(versionList);
            }
        }
    }
}
项目:Pushjet-Android    文件:CachingModuleVersionRepository.java   
public void getDependency(DependencyMetaData dependency, BuildableModuleVersionMetaDataResolveResult result) {
    DependencyMetaData forced = dependency.withChanging();
    delegate.getDependency(forced, result);
    switch (result.getState()) {
        case Missing:
            ModuleRevisionId dependencyRevisionId = dependency.getDescriptor().getDependencyRevisionId();
            ModuleVersionIdentifier moduleVersionIdentifier = DefaultModuleVersionIdentifier.newId(dependencyRevisionId);
            moduleMetaDataCache.cacheMissing(delegate, moduleVersionIdentifier);
            break;
        case Resolved:
            MutableModuleVersionMetaData metaData = result.getMetaData();
            ModuleSource moduleSource = result.getModuleSource();
            ModuleMetaDataCache.CachedMetaData cachedMetaData = moduleMetaDataCache.cacheMetaData(delegate, metaData, moduleSource);
            metadataProcessor.process(metaData);
            result.setModuleSource(new CachingModuleSource(cachedMetaData.getDescriptorHash(), dependency.isChanging() || metaData.isChanging(), moduleSource));
            break;
        case Failed:
            break;
        default:
            throw new IllegalStateException("Unexpected resolve state: " + result.getState());
    }
}
项目:Pushjet-Android    文件:ExternalResourceResolver.java   
protected MutableModuleVersionMetaData findMetaDataArtifact(DependencyMetaData dependency, ArtifactResolver artifactResolver) {
    ModuleVersionArtifactMetaData artifact = getMetaDataArtifactFor(dependency);
    if (artifact == null) {
        return null;
    }
    ExternalResource metaDataResource = artifactResolver.resolveMetaDataArtifact(artifact);
    if (metaDataResource == null) {
        return null;
    }
    MutableModuleVersionMetaData moduleVersionMetaData = getArtifactMetadata(artifact, metaDataResource);

    if (isCheckconsistency()) {
        ModuleVersionSelector requested = dependency.getRequested();
        ModuleVersionIdentifier requestedId = DefaultModuleVersionIdentifier.newId(requested.getGroup(), requested.getName(), requested.getVersion());
        checkMetadataConsistency(requestedId, moduleVersionMetaData);
    }
    return moduleVersionMetaData;
}
项目:Pushjet-Android    文件:MavenResolver.java   
private TimestampedModuleSource findUniqueSnapshotVersion(ModuleRevisionId moduleRevisionId) {
    ModuleVersionIdentifier moduleVersionIdentifier = DefaultModuleVersionIdentifier.newId(moduleRevisionId);
    ModuleVersionArtifactIdentifier artifactId = new DefaultModuleVersionArtifactIdentifier(moduleVersionIdentifier, moduleVersionIdentifier.getName(), "pom", "pom");
    DefaultModuleVersionArtifactMetaData pomArtifact = new DefaultModuleVersionArtifactMetaData(artifactId);
    String metadataLocation = toResourcePattern(getWholePattern()).toModuleVersionPath(pomArtifact) + "/maven-metadata.xml";
    MavenMetadata mavenMetadata = parseMavenMetadata(metadataLocation);

    if (mavenMetadata.timestamp != null) {
        // we have found a timestamp, so this is a snapshot unique version
        String rev = moduleRevisionId.getRevision();
        rev = rev.substring(0, rev.length() - "SNAPSHOT".length());
        rev = rev + mavenMetadata.timestamp + "-" + mavenMetadata.buildNumber;
        return new TimestampedModuleSource(rev);
    }
    return null;
}
项目:Pushjet-Android    文件:DependencyResolverIvyPublisher.java   
public void publish(IvyNormalizedPublication publication, PublicationAwareRepository repository) {
    ModuleVersionPublisher publisher = repository.createPublisher();
    IvyPublicationIdentity projectIdentity = publication.getProjectIdentity();
    ModuleRevisionId moduleRevisionId = IvyUtil.createModuleRevisionId(projectIdentity.getOrganisation(), projectIdentity.getModule(), projectIdentity.getRevision());
    ModuleVersionIdentifier moduleVersionIdentifier = DefaultModuleVersionIdentifier.newId(moduleRevisionId);
    DefaultModuleVersionPublishMetaData publishMetaData = new DefaultModuleVersionPublishMetaData(moduleVersionIdentifier);

    try {
        for (IvyArtifact publishArtifact : publication.getArtifacts()) {
            Artifact ivyArtifact = createIvyArtifact(publishArtifact, moduleRevisionId);
            publishMetaData.addArtifact(ivyArtifact, publishArtifact.getFile());
        }

        Artifact artifact = DefaultArtifact.newIvyArtifact(moduleRevisionId, null);
        publishMetaData.addArtifact(artifact, publication.getDescriptorFile());

        publisher.publish(publishMetaData);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
项目:Pushjet-Android    文件:BasePlugin.java   
private void configureUploadArchivesTask() {
    configurationActionContainer.add(new Action<Project>() {
        public void execute(Project project) {
            Upload uploadArchives = project.getTasks().withType(Upload.class).findByName(UPLOAD_ARCHIVES_TASK_NAME);
            if (uploadArchives == null) { return; }

            boolean hasIvyRepo = !uploadArchives.getRepositories().withType(IvyArtifactRepository.class).isEmpty();
            if (!hasIvyRepo) { return; } // Maven repos are handled by MavenPlugin

            ConfigurationInternal configuration = (ConfigurationInternal) uploadArchives.getConfiguration();
            ModuleInternal module = configuration.getModule();
            ModuleVersionIdentifier publicationId =
                    new DefaultModuleVersionIdentifier(module.getGroup(), module.getName(), module.getVersion());
            publicationRegistry.registerPublication(module.getProjectPath(), new DefaultProjectPublication(publicationId));
        }
    });
}
项目:Reer    文件:ShortCircuitEmptyConfigurationResolver.java   
private void emptyGraph(ConfigurationInternal configuration, ResolverResults results) {
    Module module = configuration.getModule();
    ModuleVersionIdentifier id = DefaultModuleVersionIdentifier.newId(module);
    ComponentIdentifier componentIdentifier = componentIdentifierFactory.createComponentIdentifier(module);
    ResolutionResult emptyResult = DefaultResolutionResultBuilder.empty(id, componentIdentifier);
    ResolvedLocalComponentsResult emptyProjectResult = new ResolvedLocalComponentsResultGraphVisitor();
    results.graphResolved(emptyResult, emptyProjectResult, new EmptyResults());
}
项目:Reer    文件:DefaultProjectLocalComponentProvider.java   
private LocalComponentMetadata getLocalComponentMetaData(ProjectInternal project) {
    Module module = project.getModule();
    ModuleVersionIdentifier moduleVersionIdentifier = DefaultModuleVersionIdentifier.newId(module);
    ComponentIdentifier componentIdentifier = newProjectId(project);
    DefaultLocalComponentMetadata metaData = new DefaultLocalComponentMetadata(moduleVersionIdentifier, componentIdentifier, module.getStatus(), project.getAttributesSchema());
    metaDataBuilder.addConfigurations(metaData, project.getConfigurations().withType(ConfigurationInternal.class));
    return metaData;
}
项目:Reer    文件:PomReader.java   
public ModuleVersionIdentifier getRelocation() {
    Element distrMgt = getFirstChildElement(projectElement, DISTRIBUTION_MGT);
    Element relocation = getFirstChildElement(distrMgt , RELOCATION);
    if (relocation == null) {
        return null;
    } else {
        String relocGroupId = getFirstChildText(relocation, GROUP_ID);
        String relocArtId = getFirstChildText(relocation, ARTIFACT_ID);
        String relocVersion = getFirstChildText(relocation, VERSION);
        relocGroupId = relocGroupId == null ? getGroupId() : relocGroupId;
        relocArtId = relocArtId == null ? getArtifactId() : relocArtId;
        relocVersion = relocVersion == null ? getVersion() : relocVersion;
        return DefaultModuleVersionIdentifier.newId(relocGroupId, relocArtId, relocVersion);
    }
}
项目:Reer    文件:RepositoryChainDependencyToComponentIdResolver.java   
public void resolve(DependencyMetadata dependency, BuildableComponentIdResolveResult result) {
    ModuleVersionSelector requested = dependency.getRequested();
    if (versionSelectorScheme.parseSelector(requested.getVersion()).isDynamic()) {
        dynamicRevisionResolver.resolve(dependency, result);
    } else {
        DefaultModuleComponentIdentifier id = new DefaultModuleComponentIdentifier(requested.getGroup(), requested.getName(), requested.getVersion());
        DefaultModuleVersionIdentifier mvId = new DefaultModuleVersionIdentifier(requested.getGroup(), requested.getName(), requested.getVersion());
        result.resolved(id, mvId);
    }
}
项目:Reer    文件:DefaultConfiguration.java   
public ComponentResolveMetadata toRootComponentMetaData() {
    Module module = getModule();
    ComponentIdentifier componentIdentifier = componentIdentifierFactory.createComponentIdentifier(module);
    ModuleVersionIdentifier moduleVersionIdentifier = DefaultModuleVersionIdentifier.newId(module);
    ProjectInternal project = projectFinder.findProject(module.getProjectPath());
    AttributesSchema schema = project == null ? null : project.getAttributesSchema();
    DefaultLocalComponentMetadata metaData = new DefaultLocalComponentMetadata(moduleVersionIdentifier, componentIdentifier, module.getStatus(), schema);
    configurationComponentMetaDataBuilder.addConfigurations(metaData, configurationsProvider.getAll());
    return metaData;
}
项目:Reer    文件:AbstractMutableModuleComponentResolveMetadata.java   
protected AbstractMutableModuleComponentResolveMetadata(ModuleComponentIdentifier componentIdentifier, ModuleDescriptorState moduleDescriptor, Map<String, Configuration> configurations, List<? extends DependencyMetadata> dependencies) {
    this.descriptor = moduleDescriptor;
    this.componentId = componentIdentifier;
    this.id = DefaultModuleVersionIdentifier.newId(componentIdentifier);
    this.status = moduleDescriptor.getStatus();
    this.dependencies = dependencies;
    this.configurationDefinitions = configurations;
}
项目:Pushjet-Android    文件:RepositoryChainDependencyResolver.java   
public void resolve(DependencyMetaData dependency, BuildableComponentResolveResult result) {
    ModuleVersionSelector requested = dependency.getRequested();
    LOGGER.debug("Attempting to resolve {} using repositories {}", requested, repositoryNames);
    ModuleComponentIdentifier moduleComponentIdentifier = new DefaultModuleComponentIdentifier(requested.getGroup(), requested.getName(), requested.getVersion());
    ModuleVersionIdentifier moduleVersionIdentifier = new DefaultModuleVersionIdentifier(requested.getGroup(), requested.getName(), requested.getVersion());

    List<Throwable> errors = new ArrayList<Throwable>();

    List<ComponentMetaDataResolveState> resolveStates = new ArrayList<ComponentMetaDataResolveState>();
    for (ModuleComponentRepository repository : repositories) {
        resolveStates.add(new ComponentMetaDataResolveState(dependency, moduleComponentIdentifier, repository, componentChooser));
    }

    final RepositoryChainModuleResolution latestResolved = findBestMatch(resolveStates, errors);
    if (latestResolved != null) {
        LOGGER.debug("Using {} from {}", latestResolved.module.getId(), latestResolved.repository);
        for (Throwable error : errors) {
            LOGGER.debug("Discarding resolve failure.", error);
        }

        result.resolved(metaDataFactory.transform(latestResolved));
        return;
    }
    if (!errors.isEmpty()) {
        result.failed(new ModuleVersionResolveException(moduleComponentIdentifier, errors));
    } else {
        for (ComponentMetaDataResolveState resolveState : resolveStates) {
            resolveState.applyTo(result);
        }
        result.notFound(moduleVersionIdentifier);
    }
}
项目:Pushjet-Android    文件:RepositoryChainAdapter.java   
public void resolve(DependencyMetaData dependency, BuildableComponentIdResolveResult result) {
    ModuleVersionSelector requested = dependency.getRequested();
    if (versionMatcher.isDynamic(requested.getVersion())) {
        dynamicRevisionResolver.resolve(dependency, result);
    } else {
        DefaultModuleComponentIdentifier id = new DefaultModuleComponentIdentifier(requested.getGroup(), requested.getName(), requested.getVersion());
        DefaultModuleVersionIdentifier mvId = new DefaultModuleVersionIdentifier(requested.getGroup(), requested.getName(), requested.getVersion());
        result.resolved(id, mvId);
    }
}
项目:Pushjet-Android    文件:ShortcircuitEmptyConfigsArtifactDependencyResolver.java   
public void resolve(ConfigurationInternal configuration,
                    List<? extends ResolutionAwareRepository> repositories,
                    GlobalDependencyResolutionRules metadataHandler,
                    ResolverResults results) throws ResolveException {
    if (configuration.getAllDependencies().isEmpty()) {
        ModuleVersionIdentifier id = DefaultModuleVersionIdentifier.newId(configuration.getModule());
        ComponentIdentifier componentIdentifier = componentIdentifierFactory.createComponentIdentifier(configuration.getModule());
        ResolutionResult emptyResult = new DefaultResolutionResultBuilder().start(id, componentIdentifier).complete();
        results.resolved(new EmptyResolvedConfiguration(), emptyResult);
    } else {
        dependencyResolver.resolve(configuration, repositories, metadataHandler, results);
    }
}
项目:Pushjet-Android    文件:ShortcircuitEmptyConfigsArtifactDependencyResolver.java   
public void resolve(ConfigurationInternal configuration,
                    List<? extends ResolutionAwareRepository> repositories,
                    ModuleMetadataProcessor metadataProcessor,
                    ResolverResults results) throws ResolveException {
    if (configuration.getAllDependencies().isEmpty()) {
        ModuleVersionIdentifier id = DefaultModuleVersionIdentifier.newId(configuration.getModule());
        ComponentIdentifier componentIdentifier = componentIdentifierFactory.createComponentIdentifier(configuration.getModule());
        ResolutionResult emptyResult = new DefaultResolutionResultBuilder().start(id, componentIdentifier).complete();
        results.resolved(new EmptyResolvedConfiguration(), emptyResult);
    } else {
        dependencyResolver.resolve(configuration, repositories, metadataProcessor, results);
    }
}
项目:Reer    文件:DefaultLibraryLocalComponentMetadata.java   
private static DefaultModuleVersionIdentifier localModuleVersionIdentifierFor(LibraryBinaryIdentifier componentId) {
    return new DefaultModuleVersionIdentifier(componentId.getProjectPath(), componentId.getLibraryName(), VERSION);
}
项目:Reer    文件:DefaultMavenPublication.java   
public ModuleVersionIdentifier getCoordinates() {
    return new DefaultModuleVersionIdentifier(getGroupId(), getArtifactId(), getVersion());
}
项目:Reer    文件:DefaultCachePolicy.java   
private boolean mustRefreshModule(ModuleComponentIdentifier component, ResolvedModuleVersion version, long ageMillis, boolean changingModule) {
    return mustRefreshModule(DefaultModuleVersionIdentifier.newId(component), version, ageMillis, changingModule);
}
项目:Reer    文件:DefaultBuildableComponentResolveResult.java   
@Override
public void notFound(ModuleComponentIdentifier versionIdentifier) {
    failed(new ModuleVersionNotFoundException(DefaultModuleVersionIdentifier.newId(versionIdentifier), getAttempted()));
}
项目:Reer    文件:AbstractMutableModuleComponentResolveMetadata.java   
@Override
public void setComponentId(ModuleComponentIdentifier componentId) {
    this.componentId = componentId;
    this.id = DefaultModuleVersionIdentifier.newId(componentId);
}
项目:Reer    文件:DefaultIvyPublication.java   
public ModuleVersionIdentifier getCoordinates() {
    return new DefaultModuleVersionIdentifier(getOrganisation(), getModule(), getRevision());
}
项目:atlas    文件:ResolvedDependencyInfo.java   
public ModuleVersionIdentifier getModuleVersionIdentifier() {
    return new DefaultModuleVersionIdentifier(group, name, version);
}
项目:Pushjet-Android    文件:DefaultMavenPublication.java   
public ModuleVersionIdentifier getCoordinates() {
    return new DefaultModuleVersionIdentifier(getGroupId(), getArtifactId(), getVersion());
}
项目:Pushjet-Android    文件:DefaultCachePolicy.java   
private boolean mustRefreshModule(ModuleComponentIdentifier component, ResolvedModuleVersion version, long ageMillis, boolean changingModule) {
    return mustRefreshModule(DefaultModuleVersionIdentifier.newId(component), version, ageMillis, changingModule);
}
项目:Pushjet-Android    文件:IvyXmlModuleDescriptorParser.java   
protected ModuleDescriptor parseOtherIvyFile(String parentOrganisation, String parentModule, String parentRevision) throws IOException, ParseException, SAXException {
    ModuleVersionIdentifier importedId = new DefaultModuleVersionIdentifier(parentOrganisation, parentModule, parentRevision);
    LocallyAvailableExternalResource externalResource = parseContext.getMetaDataArtifact(importedId, ArtifactType.IVY_DESCRIPTOR);

    return parseModuleDescriptor(externalResource, externalResource.getLocalResource().getFile().toURI().toURL());
}
项目:Pushjet-Android    文件:GradlePomModuleDescriptorParser.java   
private void doParsePom(DescriptorParseContext parserSettings, GradlePomModuleDescriptorBuilder mdBuilder, PomReader pomReader) throws IOException, SAXException {
    if (pomReader.hasParent()) {
        //Is there any other parent properties?

        ModuleVersionIdentifier parentId = DefaultModuleVersionIdentifier.newId(
                pomReader.getParentGroupId(),
                pomReader.getParentArtifactId(),
                pomReader.getParentVersion());
        PomReader parentPomReader = parseOtherPom(parserSettings, parentId);
        pomReader.setPomParent(parentPomReader);
    }
    pomReader.resolveGAV();

    String groupId = pomReader.getGroupId();
    String artifactId = pomReader.getArtifactId();
    String version = pomReader.getVersion();
    mdBuilder.setModuleRevId(groupId, artifactId, version);

    mdBuilder.setHomePage(pomReader.getHomePage());
    mdBuilder.setDescription(pomReader.getDescription());
    mdBuilder.setLicenses(pomReader.getLicenses());

    ModuleRevisionId relocation = pomReader.getRelocation();

    if (relocation != null) {
        if (groupId != null && artifactId != null
                && artifactId.equals(relocation.getName())
                && groupId.equals(relocation.getOrganisation())) {
            LOGGER.error("POM relocation to an other version number is not fully supported in Gradle : {} relocated to {}.",
                    mdBuilder.getModuleDescriptor().getModuleRevisionId(), relocation);
            LOGGER.warn("Please update your dependency to directly use the correct version '{}'.", relocation);
            LOGGER.warn("Resolution will only pick dependencies of the relocated element.  Artifacts and other metadata will be ignored.");
            PomReader relocatedModule = parseOtherPom(parserSettings, DefaultModuleVersionIdentifier.newId(relocation));

            Collection<PomDependencyData> pomDependencyDataList = relocatedModule.getDependencies().values();
            for(PomDependencyData pomDependencyData : pomDependencyDataList) {
                mdBuilder.addDependency(pomDependencyData);
            }

        } else {
            LOGGER.info(mdBuilder.getModuleDescriptor().getModuleRevisionId()
                    + " is relocated to " + relocation
                    + ". Please update your dependencies.");
            LOGGER.debug("Relocated module will be considered as a dependency");
            DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(mdBuilder.getModuleDescriptor(), relocation, true, false, true);
            /* Map all public dependencies */
            Configuration[] m2Confs = GradlePomModuleDescriptorBuilder.MAVEN2_CONFIGURATIONS;
            for (Configuration m2Conf : m2Confs) {
                if (Visibility.PUBLIC.equals(m2Conf.getVisibility())) {
                    dd.addDependencyConfiguration(m2Conf.getName(), m2Conf.getName());
                }
            }
            mdBuilder.addDependency(dd);
        }
    } else {
        overrideDependencyMgtsWithImported(parserSettings, pomReader);

        for (PomDependencyData dependency : pomReader.getDependencies().values()) {
            mdBuilder.addDependency(dependency);
        }
    }
}
项目:Pushjet-Android    文件:DefaultLocalComponentMetaData.java   
public DefaultLocalComponentMetaData(DefaultModuleDescriptor moduleDescriptor, ComponentIdentifier componentIdentifier) {
    this.moduleDescriptor = moduleDescriptor;
    id = DefaultModuleVersionIdentifier.newId(moduleDescriptor.getModuleRevisionId());
    this.componentIdentifier = componentIdentifier;
}