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;
}
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);
}
}
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());
}
Aggregations