use of org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates in project tycho by eclipse.
the class GAVArtifactDescriptorTest method testSerializationRoundTrip.
@Test
public void testSerializationRoundTrip() {
MavenRepositoryCoordinates coordinates = new MavenRepositoryCoordinates(TEST_GAV, OTHER_CLASSIFIER, OTHER_EXTENSION);
GAVArtifactDescriptor original = new GAVArtifactDescriptor(createP2Descriptor(), coordinates);
subject = serializeAndDeSerialize(original);
assertThat(subject.getArtifactKey(), is(TEST_KEY));
assertThat(subject.getMavenCoordinates(), is(coordinates));
}
use of org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates in project tycho by eclipse.
the class GAVArtifactDescriptor method getP2DerivedCoordinates.
/**
* @return fake Maven coordinates derived from the given key; never <code>null</code>
*/
private static MavenRepositoryCoordinates getP2DerivedCoordinates(IArtifactKey key, Map<String, String> properties) {
GAV gav = RepositoryLayoutHelper.getP2Gav(key.getClassifier(), key.getId(), key.getVersion().toString());
String classifier = null;
String extension = RepositoryLayoutHelper.DEFAULT_EXTERNSION;
if (properties != null && IArtifactDescriptor.FORMAT_PACKED.equals(properties.get(IArtifactDescriptor.FORMAT))) {
classifier = RepositoryLayoutHelper.PACK200_CLASSIFIER;
extension = RepositoryLayoutHelper.PACK200_EXTENSION;
}
return new MavenRepositoryCoordinates(gav, classifier, extension);
}
use of org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates in project tycho by eclipse.
the class ModuleArtifactRepository method createArtifactDescriptor.
public IArtifactDescriptor createArtifactDescriptor(IArtifactKey key, WriteSessionContext writeSession) {
ClassifierAndExtension additionalProperties = writeSession.getClassifierAndExtensionForNewKey(key);
MavenRepositoryCoordinates mavenCoordinates = new MavenRepositoryCoordinates(moduleGAV, additionalProperties.classifier, additionalProperties.fileExtension);
return new ModuleArtifactDescriptor(key, mavenCoordinates);
}
use of org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates in project tycho by eclipse.
the class ModuleArtifactRepository method getInternalDescriptorForAdding.
@Override
protected ModuleArtifactDescriptor getInternalDescriptorForAdding(IArtifactDescriptor descriptor) throws IllegalArgumentException {
if (descriptor == null) {
throw new NullPointerException();
} else if (!(descriptor instanceof ModuleArtifactDescriptor) || descriptor.getRepository() != this) {
throw new IllegalArgumentException("Cannot add artifact descriptor which has not been created by this repository");
}
ModuleArtifactDescriptor internalDescriptor = (ModuleArtifactDescriptor) descriptor;
try {
MavenRepositoryCoordinates coordinates = internalDescriptor.getMavenCoordinates();
artifactsMap.addToAutomaticLocation(coordinates.getClassifier(), coordinates.getExtension());
} catch (ProvisionException e) {
// TODO 393004 Revise exception handling
throw new RuntimeException(e);
}
return internalDescriptor;
}
use of org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates in project tycho by eclipse.
the class GAVArtifactDescriptorBase method readMavenCoordinateProperties.
/**
* @return the Maven coordinates stored in the properties of the given descriptor, or
* <code>null</code>
*/
public static MavenRepositoryCoordinates readMavenCoordinateProperties(IArtifactDescriptor descriptor) {
GAV gav = RepositoryLayoutHelper.getGAV(descriptor.getProperties());
if (gav == null) {
return null;
}
String classifier = RepositoryLayoutHelper.getClassifier(descriptor.getProperties());
String extension = RepositoryLayoutHelper.getExtension(descriptor.getProperties());
return new MavenRepositoryCoordinates(gav, classifier, extension);
}
Aggregations