use of org.eclipse.tycho.p2.repository.GAV in project tycho by eclipse.
the class FileBasedTychoRepositoryIndex method reconcile.
private synchronized void reconcile() throws IOException {
// processes which happened in the meantime are not discarded
if (indexFile.isFile()) {
gavs = read(new FileInputStream(indexFile));
for (GAV addedGav : addedGavs) {
addGav(addedGav);
}
for (GAV removedGav : removedGavs) {
removeGav(removedGav);
}
}
addedGavs.clear();
removedGavs.clear();
}
use of org.eclipse.tycho.p2.repository.GAV in project tycho by eclipse.
the class FileBasedTychoRepositoryIndex method write.
private void write(OutputStream outStream) throws IOException {
Writer out = new OutputStreamWriter(new BufferedOutputStream(outStream), ENCODING);
try {
for (GAV gav : getProjectGAVs()) {
out.write(gav.toExternalForm());
out.write(EOL);
}
out.flush();
} finally {
out.close();
}
}
use of org.eclipse.tycho.p2.repository.GAV 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);
}
use of org.eclipse.tycho.p2.repository.GAV in project tycho by eclipse.
the class AbstractMavenMetadataRepository method load.
protected void load() {
MetadataIO io = new MetadataIO();
for (GAV gav : metadataIndex.getProjectGAVs()) {
try {
File localArtifactFileLocation = contentLocator.getLocalArtifactLocation(gav, RepositoryLayoutHelper.CLASSIFIER_P2_METADATA, RepositoryLayoutHelper.EXTENSION_P2_METADATA);
if (!localArtifactFileLocation.exists()) {
// if files have been manually removed from the repository, simply remove them from the index (bug 351080)
metadataIndex.removeGav(gav);
} else {
InputStream is = new FileInputStream(localArtifactFileLocation);
try {
Set<IInstallableUnit> gavUnits = io.readXML(is);
unitsMap.put(gav, gavUnits);
units.addAll(gavUnits);
} finally {
is.close();
}
}
} catch (IOException e) {
// TODO throw properly typed exception if repository cannot be loaded
e.printStackTrace();
}
}
}
use of org.eclipse.tycho.p2.repository.GAV in project tycho by eclipse.
the class RepositoryLayoutHelperTest method testRelpath.
@Test
public void testRelpath() {
GAV gav = new GAV("a.b.c", "d.e.f", "1.0.0");
Assert.assertEquals("a/b/c/d.e.f/1.0.0/d.e.f-1.0.0-foo.bar", RepositoryLayoutHelper.getRelativePath(gav, "foo", "bar"));
Assert.assertEquals("a/b/c/d.e.f/1.0.0/d.e.f-1.0.0.jar", RepositoryLayoutHelper.getRelativePath(gav, null, null));
}
Aggregations