Search in sources :

Example 1 with LocalRepositoryP2Indices

use of org.eclipse.tycho.p2.repository.LocalRepositoryP2Indices in project tycho by eclipse.

the class P2ResolverFactoryImpl method getLocalArtifactRepository.

private static synchronized LocalArtifactRepository getLocalArtifactRepository(MavenContext mavenContext, LocalRepositoryP2Indices localRepoIndices) {
    if (localArtifactRepository == null) {
        RepositoryReader contentLocator = new LocalRepositoryReader(mavenContext.getLocalRepositoryRoot());
        localArtifactRepository = new LocalArtifactRepository(localRepoIndices, contentLocator);
    }
    return localArtifactRepository;
}
Also used : LocalArtifactRepository(org.eclipse.tycho.repository.local.LocalArtifactRepository) LocalRepositoryReader(org.eclipse.tycho.p2.repository.LocalRepositoryReader) LocalRepositoryReader(org.eclipse.tycho.p2.repository.LocalRepositoryReader) RepositoryReader(org.eclipse.tycho.p2.repository.RepositoryReader)

Example 2 with LocalRepositoryP2Indices

use of org.eclipse.tycho.p2.repository.LocalRepositoryP2Indices in project tycho by eclipse.

the class P2ResolverFactoryImpl method getLocalMetadataRepository.

private static synchronized LocalMetadataRepository getLocalMetadataRepository(MavenContext context, LocalRepositoryP2Indices localRepoIndices) {
    if (localMetadataRepository == null) {
        File localMavenRepoRoot = context.getLocalRepositoryRoot();
        RepositoryReader contentLocator = new LocalRepositoryReader(localMavenRepoRoot);
        localMetadataRepository = new LocalMetadataRepository(localMavenRepoRoot.toURI(), localRepoIndices.getMetadataIndex(), contentLocator);
    }
    return localMetadataRepository;
}
Also used : LocalRepositoryReader(org.eclipse.tycho.p2.repository.LocalRepositoryReader) LocalMetadataRepository(org.eclipse.tycho.repository.local.LocalMetadataRepository) File(java.io.File) LocalRepositoryReader(org.eclipse.tycho.p2.repository.LocalRepositoryReader) RepositoryReader(org.eclipse.tycho.p2.repository.RepositoryReader)

Example 3 with LocalRepositoryP2Indices

use of org.eclipse.tycho.p2.repository.LocalRepositoryP2Indices in project tycho by eclipse.

the class UpdateLocalIndexMojo method execute.

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    LocalRepositoryP2Indices localRepoIndices = serviceFactory.getService(LocalRepositoryP2Indices.class);
    GAV gav = new GAV(project.getGroupId(), project.getArtifactId(), project.getArtifact().getVersion());
    TychoRepositoryIndex artifactsIndex = localRepoIndices.getArtifactsIndex();
    TychoRepositoryIndex metadataIndex = localRepoIndices.getMetadataIndex();
    try {
        addGavAndSave(gav, artifactsIndex);
        addGavAndSave(gav, metadataIndex);
    } catch (IOException e) {
        throw new MojoExecutionException("Could not update local repository index", e);
    }
}
Also used : LocalRepositoryP2Indices(org.eclipse.tycho.p2.repository.LocalRepositoryP2Indices) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) TychoRepositoryIndex(org.eclipse.tycho.p2.repository.TychoRepositoryIndex) IOException(java.io.IOException) GAV(org.eclipse.tycho.p2.repository.GAV)

Example 4 with LocalRepositoryP2Indices

use of org.eclipse.tycho.p2.repository.LocalRepositoryP2Indices in project tycho by eclipse.

the class LocalArtifactRepositoryFactory method lookupLocalRepoIndices.

protected LocalRepositoryP2Indices lookupLocalRepoIndices() {
    final BundleContext context = Activator.getContext();
    ServiceReference<LocalRepositoryP2Indices> localRepoIndicesRef = context.getServiceReference(LocalRepositoryP2Indices.class);
    if (localRepoIndicesRef != null) {
        LocalRepositoryP2Indices localRepoIndices = context.getService(localRepoIndicesRef);
        if (localRepoIndices != null) {
            return localRepoIndices;
        }
    }
    throw new IllegalStateException("service not registered: " + LocalRepositoryP2Indices.class.getName());
}
Also used : LocalRepositoryP2Indices(org.eclipse.tycho.p2.repository.LocalRepositoryP2Indices) BundleContext(org.osgi.framework.BundleContext)

Aggregations

LocalRepositoryP2Indices (org.eclipse.tycho.p2.repository.LocalRepositoryP2Indices)2 LocalRepositoryReader (org.eclipse.tycho.p2.repository.LocalRepositoryReader)2 RepositoryReader (org.eclipse.tycho.p2.repository.RepositoryReader)2 File (java.io.File)1 IOException (java.io.IOException)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 GAV (org.eclipse.tycho.p2.repository.GAV)1 TychoRepositoryIndex (org.eclipse.tycho.p2.repository.TychoRepositoryIndex)1 LocalArtifactRepository (org.eclipse.tycho.repository.local.LocalArtifactRepository)1 LocalMetadataRepository (org.eclipse.tycho.repository.local.LocalMetadataRepository)1 BundleContext (org.osgi.framework.BundleContext)1