use of org.eclipse.tycho.p2.resolver.TargetDefinitionFile.Repository in project tycho by eclipse.
the class TargetDefinitionResolver method resolveContentWithExceptions.
TargetDefinitionContent resolveContentWithExceptions(TargetDefinition definition) throws TargetDefinitionSyntaxException, TargetDefinitionResolutionException, ResolverException {
List<URI> artifactRepositories = new ArrayList<>();
ResolverRun resolverRun = new ResolverRun();
for (Location locationDefinition : definition.getLocations()) {
if (locationDefinition instanceof InstallableUnitLocation) {
resolverRun.addLocation((InstallableUnitLocation) locationDefinition);
for (Repository repository : ((InstallableUnitLocation) locationDefinition).getRepositories()) {
artifactRepositories.add(repository.getLocation());
}
} else {
logger.warn("Target location type '" + locationDefinition.getTypeDescription() + "' is not supported");
}
}
if (definition.hasIncludedBundles()) {
// the bundle selection list is currently not taken into account (see bug 373776)
logger.warn("De-selecting bundles in a target definition file is not supported. See http://wiki.eclipse.org/Tycho_Messages_Explained#Target_File_Include_Bundles for alternatives.");
}
return new TargetDefinitionContent(resolverRun.resolve(), artifactRepositories);
}
use of org.eclipse.tycho.p2.resolver.TargetDefinitionFile.Repository in project tycho by eclipse.
the class VerifierServiceImpl method verify.
@Override
public boolean verify(URI metadataRepositoryUri, URI artifactRepositoryUri, BuildOutputDirectory tempDirectory) throws FacadeException {
MavenLogger logger = mavenContext.getLogger();
logger.debug("Checking metadata from '" + metadataRepositoryUri + "' and artifacts from '" + artifactRepositoryUri + "'");
IProvisioningAgent agent = Activator.createProvisioningAgent(tempDirectory);
try {
try {
final IMetadataRepository metadata = loadMetadataRepository(metadataRepositoryUri, agent);
final IArtifactRepository artifactRepository = loadArtifactRepository(artifactRepositoryUri, agent);
boolean valid = true;
valid &= verifyReferencedArtifactsExist(metadata, artifactRepository, logger);
valid &= verifyAllArtifactContent(artifactRepository, logger);
if (valid) {
logger.info("The integrity of the metadata repository '" + metadataRepositoryUri + "' and artifact repository '" + artifactRepositoryUri + "' has been verified successfully");
}
return valid;
} catch (ProvisionException e) {
throw new FacadeException(e);
}
} finally {
agent.stop();
}
}
use of org.eclipse.tycho.p2.resolver.TargetDefinitionFile.Repository in project tycho by eclipse.
the class AssembleRepositoryMojo method execute.
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
try {
File destination = getAssemblyRepositoryLocation();
destination.mkdirs();
copyResources(destination);
Collection<DependencySeed> projectSeeds = TychoProjectUtils.getDependencySeeds(getProject());
if (projectSeeds.size() == 0) {
throw new MojoFailureException("No content specified for p2 repository");
}
RepositoryReferences sources = getVisibleRepositories();
TargetPlatformConfiguration configuration = TychoProjectUtils.getTargetPlatformConfiguration(getProject());
MirrorApplicationService mirrorApp = p2.getService(MirrorApplicationService.class);
DestinationRepositoryDescriptor destinationRepoDescriptor = new DestinationRepositoryDescriptor(destination, repositoryName, compress, xzCompress, keepNonXzIndexFiles, !createArtifactRepository, true);
mirrorApp.mirrorReactor(sources, destinationRepoDescriptor, projectSeeds, getBuildContext(), includeAllDependencies, configuration.isIncludePackedArtifacts(), profileProperties);
} catch (FacadeException e) {
throw new MojoExecutionException("Could not assemble p2 repository", e);
}
}
Aggregations