Java Code Examples for org.gradle.api.internal.artifacts.DefaultModuleVersionIdentifier#newId()
The following examples show how to use
org.gradle.api.internal.artifacts.DefaultModuleVersionIdentifier#newId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExternalResourceResolver.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
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; }
Example 2
Source File: DependencyResolverIvyPublisher.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
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); } }
Example 3
Source File: MavenResolver.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
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; }
Example 4
Source File: ExternalResourceResolver.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
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; }
Example 5
Source File: DependencyResolverIvyPublisher.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
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); } }
Example 6
Source File: CachingModuleVersionRepository.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
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()); } }
Example 7
Source File: ShortcircuitEmptyConfigsArtifactDependencyResolver.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
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); } }
Example 8
Source File: ShortcircuitEmptyConfigsArtifactDependencyResolver.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
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); } }
Example 9
Source File: GradlePomModuleDescriptorParser.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
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); } } }
Example 10
Source File: AbstractModuleComponentResolveMetaData.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
private static ModuleVersionIdentifier moduleVersionIdentifier(ModuleDescriptor descriptor) { return DefaultModuleVersionIdentifier.newId(descriptor.getModuleRevisionId()); }
Example 11
Source File: DefaultLocalComponentMetaData.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultLocalComponentMetaData(DefaultModuleDescriptor moduleDescriptor, ComponentIdentifier componentIdentifier) { this.moduleDescriptor = moduleDescriptor; id = DefaultModuleVersionIdentifier.newId(moduleDescriptor.getModuleRevisionId()); this.componentIdentifier = componentIdentifier; }
Example 12
Source File: DefaultLocalComponentMetaData.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultLocalComponentMetaData(DefaultModuleDescriptor moduleDescriptor, ComponentIdentifier componentIdentifier) { this.moduleDescriptor = moduleDescriptor; id = DefaultModuleVersionIdentifier.newId(moduleDescriptor.getModuleRevisionId()); this.componentIdentifier = componentIdentifier; }
Example 13
Source File: ModuleDescriptorAdapter.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public ModuleDescriptorAdapter(ModuleDescriptor moduleDescriptor) { this(DefaultModuleVersionIdentifier.newId(moduleDescriptor.getModuleRevisionId()), moduleDescriptor); }
Example 14
Source File: DefaultLocalComponentMetaData.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultLocalComponentMetaData(DefaultModuleDescriptor moduleDescriptor, ComponentIdentifier componentIdentifier) { this.moduleDescriptor = moduleDescriptor; id = DefaultModuleVersionIdentifier.newId(moduleDescriptor.getModuleRevisionId()); this.componentIdentifier = componentIdentifier; }
Example 15
Source File: WrappedNativeLibraryPlugin.java From native-samples with Apache License 2.0 | 4 votes |
@Override public ModuleVersionIdentifier getCoordinates() { return DefaultModuleVersionIdentifier.newId(group.toString(), projectName + "_" + variantName, version.toString()); }
Example 16
Source File: ModuleDescriptorAdapter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public ModuleDescriptorAdapter(ModuleDescriptor moduleDescriptor) { this(DefaultModuleVersionIdentifier.newId(moduleDescriptor.getModuleRevisionId()), moduleDescriptor); }
Example 17
Source File: WrappedNativeLibraryPlugin.java From native-samples with Apache License 2.0 | 4 votes |
@Override public ModuleVersionIdentifier getCoordinates() { return DefaultModuleVersionIdentifier.newId(group.toString(), projectName + "_" + variantName, version.toString()); }
Example 18
Source File: GradlePomModuleDescriptorParser.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
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); } } }
Example 19
Source File: GradlePomModuleDescriptorParser.java From pushfish-android with BSD 2-Clause "Simplified" License | 2 votes |
/** * Parses imported POM. * * @param parseContext Parse context * @param pomDependencyMgt Dependency management information * @return POM reader * @throws IOException * @throws SAXException */ private PomReader parseImportedPom(DescriptorParseContext parseContext, PomDependencyMgt pomDependencyMgt) throws IOException, SAXException { ModuleVersionIdentifier importedId = DefaultModuleVersionIdentifier.newId(pomDependencyMgt.getGroupId(), pomDependencyMgt.getArtifactId(), pomDependencyMgt.getVersion()); return parseOtherPom(parseContext, importedId); }
Example 20
Source File: GradlePomModuleDescriptorParser.java From pushfish-android with BSD 2-Clause "Simplified" License | 2 votes |
/** * Parses imported POM. * * @param parseContext Parse context * @param pomDependencyMgt Dependency management information * @return POM reader * @throws IOException * @throws SAXException */ private PomReader parseImportedPom(DescriptorParseContext parseContext, PomDependencyMgt pomDependencyMgt) throws IOException, SAXException { ModuleVersionIdentifier importedId = DefaultModuleVersionIdentifier.newId(pomDependencyMgt.getGroupId(), pomDependencyMgt.getArtifactId(), pomDependencyMgt.getVersion()); return parseOtherPom(parseContext, importedId); }