Search in sources :

Example 1 with LocalMetadataRepository

use of org.eclipse.tycho.repository.local.LocalMetadataRepository 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 2 with LocalMetadataRepository

use of org.eclipse.tycho.repository.local.LocalMetadataRepository in project tycho by eclipse.

the class P2ResolverFactoryImpl method getTargetPlatformFactory.

@Override
public TargetPlatformFactoryImpl getTargetPlatformFactory() {
    try {
        // TODO don't synchronize twice
        LocalMetadataRepository localMetadataRepo = getLocalMetadataRepository(mavenContext, localRepoIndices);
        LocalArtifactRepository localArtifactRepo = getLocalArtifactRepository(mavenContext, localRepoIndices);
        return new TargetPlatformFactoryImpl(mavenContext, remoteAgentManager.getProvisioningAgent(), localArtifactRepo, localMetadataRepo, targetDefinitionResolverService);
    } catch (ProvisionException e) {
        throw new RuntimeException(e);
    }
}
Also used : LocalArtifactRepository(org.eclipse.tycho.repository.local.LocalArtifactRepository) ProvisionException(org.eclipse.equinox.p2.core.ProvisionException) LocalMetadataRepository(org.eclipse.tycho.repository.local.LocalMetadataRepository) TargetPlatformFactoryImpl(org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl)

Example 3 with LocalMetadataRepository

use of org.eclipse.tycho.repository.local.LocalMetadataRepository in project tycho by eclipse.

the class TargetPlatformFactoryTest method testIncludeLocalMavenRepo.

@Test
public void testIncludeLocalMavenRepo() throws Exception {
    TestResolverFactory factory = new TestResolverFactory(logVerifier.getLogger());
    LocalMetadataRepository localMetadataRepo = factory.getLocalMetadataRepository();
    // add one IU to local repo
    localMetadataRepo.addInstallableUnit(InstallableUnitUtil.createIU("locallyInstalledIU", "1.0.0"), new GAV("test", "foo", "1.0.0"));
    subject = factory.getTargetPlatformFactoryImpl();
    Collection<IInstallableUnit> iusIncludingLocalRepo = subject.createTargetPlatform(tpConfig, NOOP_EE_RESOLUTION_HANDLER, null, null).getInstallableUnits();
    tpConfig.setForceIgnoreLocalArtifacts(true);
    Collection<IInstallableUnit> iusWithoutLocalRepo = subject.createTargetPlatform(tpConfig, NOOP_EE_RESOLUTION_HANDLER, null, null).getInstallableUnits();
    Set<IInstallableUnit> retainedIUs = new HashSet<>(iusIncludingLocalRepo);
    retainedIUs.removeAll(iusWithoutLocalRepo);
    assertEquals(1, retainedIUs.size());
    assertEquals("locallyInstalledIU", retainedIUs.iterator().next().getId());
}
Also used : IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) LocalMetadataRepository(org.eclipse.tycho.repository.local.LocalMetadataRepository) GAV(org.eclipse.tycho.p2.repository.GAV) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

LocalMetadataRepository (org.eclipse.tycho.repository.local.LocalMetadataRepository)3 File (java.io.File)1 HashSet (java.util.HashSet)1 ProvisionException (org.eclipse.equinox.p2.core.ProvisionException)1 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)1 GAV (org.eclipse.tycho.p2.repository.GAV)1 LocalRepositoryReader (org.eclipse.tycho.p2.repository.LocalRepositoryReader)1 RepositoryReader (org.eclipse.tycho.p2.repository.RepositoryReader)1 TargetPlatformFactoryImpl (org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl)1 LocalArtifactRepository (org.eclipse.tycho.repository.local.LocalArtifactRepository)1 Test (org.junit.Test)1